[llvm] r292130 - [SelectionDAG] Add knownbits support for BITREVERSE
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 16 06:49:27 PST 2017
Author: rksimon
Date: Mon Jan 16 08:49:26 2017
New Revision: 292130
URL: http://llvm.org/viewvc/llvm-project?rev=292130&view=rev
Log:
[SelectionDAG] Add knownbits support for BITREVERSE
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/test/CodeGen/X86/known-bits-vector.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=292130&r1=292129&r2=292130&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jan 16 08:49:26 2017
@@ -2673,6 +2673,13 @@ void SelectionDAG::computeKnownBits(SDVa
}
break;
}
+ case ISD::BITREVERSE: {
+ computeKnownBits(Op.getOperand(0), KnownZero2, KnownOne2, DemandedElts,
+ Depth + 1);
+ KnownZero = KnownZero2.reverseBits();
+ KnownOne = KnownOne2.reverseBits();
+ break;
+ }
case ISD::BSWAP: {
computeKnownBits(Op.getOperand(0), KnownZero2, KnownOne2, DemandedElts,
Depth + 1);
Modified: llvm/trunk/test/CodeGen/X86/known-bits-vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/known-bits-vector.ll?rev=292130&r1=292129&r2=292130&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/known-bits-vector.ll (original)
+++ llvm/trunk/test/CodeGen/X86/known-bits-vector.ll Mon Jan 16 08:49:26 2017
@@ -535,34 +535,12 @@ define <4 x float> @knownbits_mask_umax_
define <4 x i32> @knownbits_mask_bitreverse_ashr(<4 x i32> %a0) {
; X32-LABEL: knownbits_mask_bitreverse_ashr:
; X32: # BB#0:
-; X32-NEXT: vpand {{\.LCPI.*}}, %xmm0, %xmm0
-; X32-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12]
-; X32-NEXT: vmovdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
-; X32-NEXT: vpand %xmm1, %xmm0, %xmm2
-; X32-NEXT: vmovdqa {{.*#+}} xmm3 = [0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240]
-; X32-NEXT: vpshufb %xmm2, %xmm3, %xmm2
-; X32-NEXT: vpsrlw $4, %xmm0, %xmm0
-; X32-NEXT: vpand %xmm1, %xmm0, %xmm0
-; X32-NEXT: vmovdqa {{.*#+}} xmm1 = [0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15]
-; X32-NEXT: vpshufb %xmm0, %xmm1, %xmm0
-; X32-NEXT: vpor %xmm0, %xmm2, %xmm0
-; X32-NEXT: vpsrad $31, %xmm0, %xmm0
+; X32-NEXT: vxorps %xmm0, %xmm0, %xmm0
; X32-NEXT: retl
;
; X64-LABEL: knownbits_mask_bitreverse_ashr:
; X64: # BB#0:
-; X64-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
-; X64-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12]
-; X64-NEXT: vmovdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
-; X64-NEXT: vpand %xmm1, %xmm0, %xmm2
-; X64-NEXT: vmovdqa {{.*#+}} xmm3 = [0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240]
-; X64-NEXT: vpshufb %xmm2, %xmm3, %xmm2
-; X64-NEXT: vpsrlw $4, %xmm0, %xmm0
-; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
-; X64-NEXT: vmovdqa {{.*#+}} xmm1 = [0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15]
-; X64-NEXT: vpshufb %xmm0, %xmm1, %xmm0
-; X64-NEXT: vpor %xmm0, %xmm2, %xmm0
-; X64-NEXT: vpsrad $31, %xmm0, %xmm0
+; X64-NEXT: vxorps %xmm0, %xmm0, %xmm0
; X64-NEXT: retq
%1 = and <4 x i32> %a0, <i32 -2, i32 -2, i32 -2, i32 -2>
%2 = call <4 x i32> @llvm.bitreverse.v4i32(<4 x i32> %1)
More information about the llvm-commits
mailing list