Also combine zext/sext into selects for ARM.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 18 Aug 2012 21:25:22 +0000 (21:25 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 18 Aug 2012 21:25:22 +0000 (21:25 +0000)
commit864c8702ba0da2208212e84f146fbbe5c77866ed
treef9c883fd5936ad30038ff4d41ab64299fa1b8089
parentdcd2342d32e92912cc457fe6ce4cd8a72c93c06b
Also combine zext/sext into selects for ARM.

This turns common i1 patterns into predicated instructions:

  (add (zext cc), x) -> (select cc (add x, 1), x)
  (add (sext cc), x) -> (select cc (add x, -1), x)

For a function like:

  unsigned f(unsigned s, int x) {
    return s + (x>0);
  }

We now produce:

  cmp r1, #0
  it  gt
  addgt.w r0, r0, #1

Instead of:

  movs  r2, #0
  cmp r1, #0
  it  gt
  movgt r2, #1
  add r0, r2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162177 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/select_xform.ll