[SystemZ] Optimize selects between 0 and -1
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>
Fri, 6 Dec 2013 09:53:09 +0000 (09:53 +0000)
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>
Fri, 6 Dec 2013 09:53:09 +0000 (09:53 +0000)
commite3a804ba21634f835a4bbfba0ca44dbb1c21ea9d
tree16c0f77c9a6a07c9cf7f48d4350829b6251e6752
parent5aafde2d5a5d7db384ecada0dc22af47eb8d03f0
[SystemZ] Optimize selects between 0 and -1

Since z has no setcc instruction as such, the choice of setBooleanContents
is a bit arbitrary.  Currently it's set to ZeroOrOneBooleanContent,
so we produced a branch-free form when selecting between 0 and 1,
but not when selecting between 0 and -1.  This patch handles the latter
case too.

At some point I'd like to measure whether it's better to use conditional
moves for constant selects on z196, but that's future work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196578 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/SystemZ/SystemZISelLowering.cpp
test/CodeGen/SystemZ/selectcc-01.ll [new file with mode: 0644]
test/CodeGen/SystemZ/selectcc-02.ll [new file with mode: 0644]
test/CodeGen/SystemZ/selectcc-03.ll [new file with mode: 0644]