OSDN Git Service

R600/SI: Allow commuting compares
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 23 Mar 2015 18:45:30 +0000 (18:45 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 23 Mar 2015 18:45:30 +0000 (18:45 +0000)
commit59a5e979b5233c4c0aa94eb3bb49324435b6ad76
tree4abe197d340be8317612a3737f2503215901f01f
parentb53594d1cb63b1962b2edbb19473df4726f85ee4
R600/SI: Allow commuting compares

This enables very common cases to switch to the
smaller encoding.

All of the standard LLVM canonicalizations of comparisons
are the opposite of what we want. Compares with constants
are moved to the RHS, but the first operand can be an inline
immediate, literal constant, or SGPR using the 32-bit VOPC
encoding.

There are additional bad canonicalizations that should
also be fixed, such as canonicalizing ge x, k to gt x, (k + 1)
if this makes k no longer an inline immediate value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232988 91177308-0d34-0410-b5e6-96231b3b80d8
19 files changed:
lib/Target/R600/SIInstrInfo.cpp
lib/Target/R600/SIInstrInfo.h
lib/Target/R600/SIInstrInfo.td
lib/Target/R600/SIInstructions.td
test/CodeGen/R600/commute-compares.ll [new file with mode: 0644]
test/CodeGen/R600/fceil64.ll
test/CodeGen/R600/ffloor.f64.ll
test/CodeGen/R600/ftrunc.f64.ll
test/CodeGen/R600/i1-copy-phi.ll
test/CodeGen/R600/llvm.AMDGPU.div_fmas.ll
test/CodeGen/R600/llvm.round.f64.ll
test/CodeGen/R600/llvm.round.ll
test/CodeGen/R600/or.ll
test/CodeGen/R600/setcc-opt.ll
test/CodeGen/R600/sgpr-control-flow.ll
test/CodeGen/R600/trunc-cmp-constant.ll
test/CodeGen/R600/trunc.ll
test/CodeGen/R600/valu-i1.ll
test/CodeGen/R600/xor.ll