[PATCH] D28354: [X86][MCU] replace select with bit manipulation instead of branches

Asaf Badouh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 07:26:27 PST 2017


AsafBadouh created this revision.
AsafBadouh added reviewers: aaboud, igorb, zvi.
AsafBadouh added a subscriber: llvm-commits.
AsafBadouh set the repository for this revision to rL LLVM.

In case of the following select pattern, where :

1. the condition is a result of "x & 0x1"
2. the select operand are (z ^ y) , y or (z | y) , y

we can eliminate the branch (there is no "cmov" in MCU)  by generate bitwise sequence.

  select (and (x & 0x1) == 0), (z ^ y) , y )

to:

  (-(and (x & 0x1)) & z ) ^ y


Repository:
  rL LLVM

https://reviews.llvm.org/D28354

Files:
  ../tunkClang/lib/Target/X86/X86ISelLowering.cpp
  ../tunkClang/test/CodeGen/X86/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28354.83233.patch
Type: text/x-patch
Size: 5541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/c959d506/attachment-0001.bin>


More information about the llvm-commits mailing list