]> granicus.if.org Git - llvm/commitdiff
[X86][XOP] Use default AVX2 lowering for v4i64 ashr by splat constants
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 19 Jul 2017 10:29:31 +0000 (10:29 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 19 Jul 2017 10:29:31 +0000 (10:29 +0000)
XOP shifts only support 128-bit vectors, so we were ending up with less optimal codegen requiring constants

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308430 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/vector-shift-ashr-256.ll

index 44eecd664714afe9fd82bd72450a52a16c861cc2..4485fa277161493a1dfe900f68a162b72ab56fc7 100644 (file)
@@ -22022,8 +22022,9 @@ static SDValue LowerScalarImmediateShift(SDValue Op, SelectionDAG &DAG,
         return getTargetVShiftByConstNode(X86Opc, dl, VT, R, ShiftAmt, DAG);
 
       // i64 SRA needs to be performed as partial shifts.
-      if ((VT == MVT::v2i64 || (Subtarget.hasInt256() && VT == MVT::v4i64)) &&
-          Op.getOpcode() == ISD::SRA && !Subtarget.hasXOP())
+      if (((!Subtarget.hasXOP() && VT == MVT::v2i64) ||
+           (Subtarget.hasInt256() && VT == MVT::v4i64)) &&
+          Op.getOpcode() == ISD::SRA)
         return ArithmeticShiftRight64(ShiftAmt);
 
       if (VT == MVT::v16i8 ||
index 5f2b18fc9c03acfa8558d579ebb8cbe963a89631..6bb57d8f5f7120d8631692a21c9c73760f453047 100644 (file)
@@ -1699,10 +1699,9 @@ define <4 x i64> @splatconstant_shift_v4i64(<4 x i64> %a) nounwind {
 ;
 ; XOPAVX2-LABEL: splatconstant_shift_v4i64:
 ; XOPAVX2:       # BB#0:
+; XOPAVX2-NEXT:    vpsrad $7, %ymm0, %ymm1
 ; XOPAVX2-NEXT:    vpsrlq $7, %ymm0, %ymm0
-; XOPAVX2-NEXT:    vpbroadcastq {{.*#+}} ymm1 = [72057594037927936,72057594037927936,72057594037927936,72057594037927936]
-; XOPAVX2-NEXT:    vpxor %ymm1, %ymm0, %ymm0
-; XOPAVX2-NEXT:    vpsubq %ymm1, %ymm0, %ymm0
+; XOPAVX2-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3],ymm0[4],ymm1[5],ymm0[6],ymm1[7]
 ; XOPAVX2-NEXT:    retq
 ;
 ; AVX512-LABEL: splatconstant_shift_v4i64: