OSDN Git Service

[NVPTX] Implement min/max in tablegen, rather than with custom DAGComine logic.
authorJustin Lebar <jlebar@google.com>
Wed, 18 Jan 2017 00:09:01 +0000 (00:09 +0000)
committerJustin Lebar <jlebar@google.com>
Wed, 18 Jan 2017 00:09:01 +0000 (00:09 +0000)
commitdb8ecafe570b3365a6342cd474f6045754a6dff9
treeedca71152b9696ef88de67a532973349b2a01773
parentf78819e87fb5e210d95eb89a751ab3335138020f
[NVPTX] Implement min/max in tablegen, rather than with custom DAGComine logic.

Summary:
This change also lets us use max.{s,u}16.  There's a vague warning in a
test about this maybe being less efficient, but I could not come up with
a case where the resulting SASS (sm_35 or sm_60) was different with or
without max.{s,u}16.  It's true that nvcc seems to emit only
max.{s,u}32, but even ptxas 7.0 seems to have no problem generating
efficient SASS from max.{s,u}16 (the casts up to i32 and back down to
i16 seem to be implicit and nops, happening via register aliasing).

In the absence of evidence, better to have fewer special cases, emit
more straightforward code, etc.  In particular, if a new GPU has 16-bit
min/max instructions, we want to be able to use them.

Reviewers: tra

Subscribers: jholewinski, llvm-commits

Differential Revision: https://reviews.llvm.org/D28732

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292304 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXISelLowering.cpp
lib/Target/NVPTX/NVPTXInstrInfo.td
test/CodeGen/NVPTX/combine-min-max.ll