OSDN Git Service

Remove extra truncs/exts around i32 bit operations on PPC64
authorHal Finkel <hfinkel@anl.gov>
Sat, 1 Mar 2014 21:36:57 +0000 (21:36 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sat, 1 Mar 2014 21:36:57 +0000 (21:36 +0000)
commit92b38a9d1c2c8dcd1055de5dc1458ec24baee4da
tree523ad5f4b6346ea1dbd9166bc341b8f4b13b8f8e
parente4c88dd9095a566f934b826b7b94a0a8943959bc
Remove extra truncs/exts around i32 bit operations on PPC64

This generalizes the code to eliminate extra truncs/exts around i1 bit
operations to also do the same on PPC64 for i32 bit operations. This eliminates
a fairly prevalent code wart:

int foo(int a) {
  return a == 5 ? 7 : 8;
}

On PPC64, because of the extension implied by the ABI, this would generate:

cmplwi 0, 3, 5
li 12, 8
li 4, 7
isel 3, 4, 12, 2
rldicl 3, 3, 0, 32
blr

where the 'rldicl 3, 3, 0, 32', the extension, is completely unnecessary. At
least for the single-BB case (which is all that the DAG combine mechanism can
handle), this unnecessary extension is no longer generated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202600 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/crbits.ll