[PATCH] D22354: AVX-512: Fixed BT instruction selection on AVX-512

Elena Demikhovsky via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 06:57:51 PDT 2016


delena created this revision.
delena added reviewers: spatel, RKSimon.
delena added a subscriber: llvm-commits.
delena set the repository for this revision to rL LLVM.

The following condition expression ( a >> n) & 1 is converted to "bt a, n" instruction. It works on all intel targets.
But on AVX-512 it was broken because the expression is modified to (truncate (a >>n) to i1).

I added the new sequence (truncate (a >>n) to i1) to the BT pattern.

One more thing that required changes in TargetLowering.cpp is bad simplification of (truncate (a >>n) to i1) when we compare it to i1:
        %tmp29 = lshr i32 %x, %n               
        %tmp3 = and i32 1, %tmp29
        %tmp4 = icmp ne i32 %tmp3, 1
is transferred to
         %tmp29 = lshr i32 %x, %n               
        %tmp3 = trunc i32 %tmp29 to i1
        %tmp4 = icmp eq i32 %tmp3, 0
and then the 'bt' instruction should be selected:
        %tmp4 = bt %x, %n



Repository:
  rL LLVM

https://reviews.llvm.org/D22354

Files:
  ../lib/CodeGen/SelectionDAG/TargetLowering.cpp
  ../lib/Target/X86/X86ISelLowering.cpp
  ../test/CodeGen/X86/bt.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22354.63963.patch
Type: text/x-patch
Size: 4886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160714/3670ab6e/attachment.bin>


More information about the llvm-commits mailing list