[llvm] [WIP][X86] Use GFNI for vXi8 per-element shifts (PR #89644)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 10:02:50 PDT 2024
https://github.com/RKSimon updated https://github.com/llvm/llvm-project/pull/89644
>From c9038213eed9d80554f384c42f380e5dee0a8ae7 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Mon, 22 Apr 2024 19:09:52 +0100
Subject: [PATCH] [X86] Use GFNI for vXi8 per-element shifts
As detailed here: https://github.com/InstLatx64/InstLatX64_Demo/blob/master/GFNI_Demo.h
These are a bit more complicated than gf2p8affine look ups, requiring us to convert a SHL shift value / amount into a GF so we can perform a multiplication. SRL/SRA need to be converted to SHL via bitreverse/variable-sign-extension.
Followup to #89115
---
llvm/lib/Target/X86/X86ISelLowering.cpp | 65 +
llvm/test/CodeGen/X86/gfni-funnel-shifts.ll | 1074 +++-----
llvm/test/CodeGen/X86/gfni-shifts.ll | 2501 +++++++------------
3 files changed, 1431 insertions(+), 2209 deletions(-)
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index ecc5b3b3bf840..c2ccd9eb0397d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -29628,6 +29628,62 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
DAG.getNode(Opc, dl, ExtVT, R, Amt));
}
+ // GFNI - we can perform SHL with a GF multiplication, and can convert
+ // SRL/SRA to a SHL.
+ if (VT == MVT::v16i8 ||
+ (VT == MVT::v32i8 && Subtarget.hasInt256() && !Subtarget.hasXOP()) ||
+ (VT == MVT::v64i8 && Subtarget.hasBWI())) {
+ if (Subtarget.hasGFNI() && Subtarget.hasSSSE3()) {
+ auto GFShiftLeft = [&](SDValue Val) {
+ // Use PSHUFB as a LUT from the shift amount to create a per-element
+ // byte mask for the shift value and an index. For shift amounts greater
+ // than 7, the result will be zero.
+ SmallVector<APInt, 8> MaskBits, IdxBits;
+ for (unsigned I = 0, E = VT.getSizeInBits() / 128; I != E; ++I) {
+ MaskBits.push_back(APInt(64, 0x0103070F1F3F7FFFULL));
+ IdxBits.push_back(APInt(64, 0x8040201008040201ULL));
+ MaskBits.push_back(APInt::getZero(64));
+ IdxBits.push_back(APInt::getZero(64));
+ }
+
+ MVT CVT = MVT::getVectorVT(MVT::i64, VT.getSizeInBits() / 64);
+ SDValue Mask =
+ DAG.getBitcast(VT, getConstVector(MaskBits, CVT, DAG, dl));
+ SDValue Idx = DAG.getBitcast(VT, getConstVector(IdxBits, CVT, DAG, dl));
+ Mask = DAG.getNode(X86ISD::PSHUFB, dl, VT, Mask, Amt);
+ Idx = DAG.getNode(X86ISD::PSHUFB, dl, VT, Idx, Amt);
+ Mask = DAG.getNode(ISD::AND, dl, VT, Val, Mask);
+ return DAG.getNode(X86ISD::GF2P8MULB, dl, VT, Mask, Idx);
+ };
+
+ if (Opc == ISD::SHL)
+ return GFShiftLeft(R);
+
+ // srl(x,y)
+ // --> bitreverse(shl(bitreverse(x),y))
+ if (Opc == ISD::SRL) {
+ R = DAG.getNode(ISD::BITREVERSE, dl, VT, R);
+ R = GFShiftLeft(R);
+ return DAG.getNode(ISD::BITREVERSE, dl, VT, R);
+ }
+
+ // sra(x,y)
+ // --> sub(xor(srl(x,y), m),m)
+ // --> sub(xor(bitreverse(shl(bitreverse(x),y)), m),m)
+ // where m = srl(signbit, amt) --> bitreverse(shl(lsb, amt))
+ if (Opc == ISD::SRA) {
+ SDValue LSB = DAG.getConstant(APInt::getOneBitSet(8, 0), dl, VT);
+ SDValue M = DAG.getNode(ISD::BITREVERSE, dl, VT, GFShiftLeft(LSB));
+ R = DAG.getNode(ISD::BITREVERSE, dl, VT, R);
+ R = GFShiftLeft(R);
+ R = DAG.getNode(ISD::BITREVERSE, dl, VT, R);
+ R = DAG.getNode(ISD::XOR, dl, VT, R, M);
+ R = DAG.getNode(ISD::SUB, dl, VT, R, M);
+ return R;
+ }
+ }
+ }
+
// Constant ISD::SRA/SRL can be performed efficiently on vXi8 vectors as we
// extend to vXi16 to perform a MUL scale effectively as a MUL_LOHI.
if (ConstantAmt && (Opc == ISD::SRA || Opc == ISD::SRL) &&
@@ -55807,6 +55863,15 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
ConcatSubOperand(VT, Ops, 0));
}
break;
+ case X86ISD::GF2P8MULB:
+ if (!IsSplat &&
+ (VT.is256BitVector() ||
+ (VT.is512BitVector() && Subtarget.useAVX512Regs()))) {
+ return DAG.getNode(Op0.getOpcode(), DL, VT,
+ ConcatSubOperand(VT, Ops, 0),
+ ConcatSubOperand(VT, Ops, 1));
+ }
+ break;
case X86ISD::GF2P8AFFINEQB:
if (!IsSplat &&
(VT.is256BitVector() ||
diff --git a/llvm/test/CodeGen/X86/gfni-funnel-shifts.ll b/llvm/test/CodeGen/X86/gfni-funnel-shifts.ll
index b3ca9fb04aeb7..72b5fb3ac4af4 100644
--- a/llvm/test/CodeGen/X86/gfni-funnel-shifts.ll
+++ b/llvm/test/CodeGen/X86/gfni-funnel-shifts.ll
@@ -141,99 +141,71 @@ define <16 x i8> @var_fshl_v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> %amt) nou
define <16 x i8> @var_fshr_v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> %amt) nounwind {
; GFNISSE-LABEL: var_fshr_v16i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pand %xmm5, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: movdqa %xmm0, %xmm4
-; GFNISSE-NEXT: paddb %xmm0, %xmm4
-; GFNISSE-NEXT: movdqa %xmm1, %xmm6
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm6
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm6
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm6
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm6
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm6
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm1
-; GFNISSE-NEXT: pandn %xmm5, %xmm3
-; GFNISSE-NEXT: psllw $5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm4
-; GFNISSE-NEXT: paddb %xmm3, %xmm4
-; GFNISSE-NEXT: paddb %xmm2, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm5
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: paddb %xmm2, %xmm3
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: por %xmm1, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNISSE-NEXT: movdqa %xmm2, %xmm4
+; GFNISSE-NEXT: pandn %xmm3, %xmm4
+; GFNISSE-NEXT: movq {{.*#+}} xmm5 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm5, %xmm6
+; GFNISSE-NEXT: pshufb %xmm4, %xmm6
+; GFNISSE-NEXT: movq {{.*#+}} xmm7 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm7, %xmm8
+; GFNISSE-NEXT: pshufb %xmm4, %xmm8
+; GFNISSE-NEXT: paddb %xmm0, %xmm0
+; GFNISSE-NEXT: pand %xmm8, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm6, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1
+; GFNISSE-NEXT: pand %xmm3, %xmm2
+; GFNISSE-NEXT: pshufb %xmm2, %xmm7
+; GFNISSE-NEXT: pand %xmm1, %xmm7
+; GFNISSE-NEXT: pshufb %xmm2, %xmm5
+; GFNISSE-NEXT: gf2p8mulb %xmm7, %xmm5
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm5
+; GFNISSE-NEXT: por %xmm5, %xmm0
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_fshr_v16i8:
; GFNIAVX1: # %bb.0:
; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} xmm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX1-NEXT: vpand %xmm3, %xmm2, %xmm4
-; GFNIAVX1-NEXT: vpsllw $5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm4, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm6, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpandn %xmm3, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm3
+; GFNIAVX1-NEXT: vpandn %xmm3, %xmm2, %xmm4
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm5 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm4, %xmm5, %xmm6
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm7 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm4, %xmm7, %xmm4
; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm4, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm2, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm2
-; GFNIAVX1-NEXT: vpaddb %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm6, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm3
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm5, %xmm2
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
; GFNIAVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_fshr_v16i8:
; GFNIAVX2: # %bb.0:
; GFNIAVX2-NEXT: vpbroadcastb {{.*#+}} xmm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX2-NEXT: vpand %xmm3, %xmm2, %xmm4
-; GFNIAVX2-NEXT: vpsllw $5, %xmm4, %xmm4
-; GFNIAVX2-NEXT: vpaddb %xmm4, %xmm4, %xmm5
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm6
-; GFNIAVX2-NEXT: vpblendvb %xmm4, %xmm6, %xmm1, %xmm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm4
-; GFNIAVX2-NEXT: vpblendvb %xmm5, %xmm4, %xmm1, %xmm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm4
-; GFNIAVX2-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX2-NEXT: vpblendvb %xmm5, %xmm4, %xmm1, %xmm1
-; GFNIAVX2-NEXT: vpandn %xmm3, %xmm2, %xmm2
-; GFNIAVX2-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX2-NEXT: vpaddb %xmm2, %xmm2, %xmm3
+; GFNIAVX2-NEXT: vpandn %xmm3, %xmm2, %xmm4
+; GFNIAVX2-NEXT: vmovq {{.*#+}} xmm5 = [9241421688590303745,0]
+; GFNIAVX2-NEXT: vpshufb %xmm4, %xmm5, %xmm6
+; GFNIAVX2-NEXT: vmovq {{.*#+}} xmm7 = [72909780498219007,0]
+; GFNIAVX2-NEXT: vpshufb %xmm4, %xmm7, %xmm4
; GFNIAVX2-NEXT: vpaddb %xmm0, %xmm0, %xmm0
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm4
-; GFNIAVX2-NEXT: vpblendvb %xmm2, %xmm4, %xmm0, %xmm0
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX2-NEXT: vpblendvb %xmm3, %xmm2, %xmm0, %xmm0
-; GFNIAVX2-NEXT: vpaddb %xmm0, %xmm0, %xmm2
-; GFNIAVX2-NEXT: vpaddb %xmm3, %xmm3, %xmm3
-; GFNIAVX2-NEXT: vpblendvb %xmm3, %xmm2, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpand %xmm4, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8mulb %xmm6, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX2-NEXT: vpand %xmm3, %xmm2, %xmm2
+; GFNIAVX2-NEXT: vpshufb %xmm2, %xmm7, %xmm3
+; GFNIAVX2-NEXT: vpand %xmm3, %xmm1, %xmm1
+; GFNIAVX2-NEXT: vpshufb %xmm2, %xmm5, %xmm2
+; GFNIAVX2-NEXT: vgf2p8mulb %xmm2, %xmm1, %xmm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
; GFNIAVX2-NEXT: vpor %xmm1, %xmm0, %xmm0
; GFNIAVX2-NEXT: retq
;
@@ -697,28 +669,24 @@ define <32 x i8> @var_fshl_v32i8(<32 x i8> %a, <32 x i8> %b, <32 x i8> %amt) nou
; GFNIAVX512VL-LABEL: var_fshl_v32i8:
; GFNIAVX512VL: # %bb.0:
; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} ymm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX512VL-NEXT: vpandn %ymm3, %ymm2, %ymm4
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm5 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm1, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm4, %ymm6, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm1, %ymm6
-; GFNIAVX512VL-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm4, %ymm6, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm1, %ymm5
-; GFNIAVX512VL-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm4, %ymm5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpand %ymm3, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm3
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand %ymm3, %ymm2, %ymm4
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm7 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm7 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm7, %ymm4
+; GFNIAVX512VL-NEXT: vpand %ymm4, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm6, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpandn %ymm3, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm7, %ymm3
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vpand %ymm3, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm2
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
; GFNIAVX512VL-NEXT: vpor %ymm1, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
@@ -741,199 +709,133 @@ define <32 x i8> @var_fshl_v32i8(<32 x i8> %a, <32 x i8> %b, <32 x i8> %amt) nou
define <32 x i8> @var_fshr_v32i8(<32 x i8> %a, <32 x i8> %b, <32 x i8> %amt) nounwind {
; GFNISSE-LABEL: var_fshr_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm4, %xmm6
-; GFNISSE-NEXT: movdqa %xmm0, %xmm4
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm8 = [1161999622361579520,1161999622361579520]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm9
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm9
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm7 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pand %xmm7, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm9, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm9 = [290499906672525312,290499906672525312]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm10
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm10
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm10, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm10 = [145249953336295424,145249953336295424]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm11
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm11
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm8 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNISSE-NEXT: movdqa %xmm4, %xmm9
+; GFNISSE-NEXT: pandn %xmm8, %xmm9
+; GFNISSE-NEXT: movq {{.*#+}} xmm6 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm6, %xmm10
+; GFNISSE-NEXT: pshufb %xmm9, %xmm10
+; GFNISSE-NEXT: movq {{.*#+}} xmm7 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm7, %xmm11
+; GFNISSE-NEXT: pshufb %xmm9, %xmm11
; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm11, %xmm2
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: pmovsxdq {{.*#+}} xmm11 = [16909320,16909320]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm12
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm12
-; GFNISSE-NEXT: pandn %xmm7, %xmm6
-; GFNISSE-NEXT: psllw $5, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm12, %xmm4
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm12 = [1108169199648,1108169199648]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm13
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm12, %xmm13
-; GFNISSE-NEXT: paddb %xmm6, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm13, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm13
-; GFNISSE-NEXT: paddb %xmm4, %xmm13
-; GFNISSE-NEXT: paddb %xmm6, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm13, %xmm4
-; GFNISSE-NEXT: por %xmm2, %xmm4
-; GFNISSE-NEXT: movdqa %xmm3, %xmm2
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm2
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pand %xmm7, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm2
+; GFNISSE-NEXT: pand %xmm11, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm10, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm9 = [9241421688590303745,9241421688590303745]
; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm2
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm2
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm2
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm3
+; GFNISSE-NEXT: pand %xmm8, %xmm4
+; GFNISSE-NEXT: movdqa %xmm7, %xmm10
+; GFNISSE-NEXT: pshufb %xmm4, %xmm10
+; GFNISSE-NEXT: pand %xmm2, %xmm10
+; GFNISSE-NEXT: movdqa %xmm6, %xmm2
+; GFNISSE-NEXT: pshufb %xmm4, %xmm2
+; GFNISSE-NEXT: gf2p8mulb %xmm10, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm2
+; GFNISSE-NEXT: por %xmm2, %xmm0
+; GFNISSE-NEXT: movdqa %xmm5, %xmm2
+; GFNISSE-NEXT: pandn %xmm8, %xmm2
+; GFNISSE-NEXT: movdqa %xmm6, %xmm4
+; GFNISSE-NEXT: pshufb %xmm2, %xmm4
+; GFNISSE-NEXT: movdqa %xmm7, %xmm10
+; GFNISSE-NEXT: pshufb %xmm2, %xmm10
; GFNISSE-NEXT: paddb %xmm1, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm2
-; GFNISSE-NEXT: pandn %xmm7, %xmm5
-; GFNISSE-NEXT: psllw $5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm12, %xmm2
-; GFNISSE-NEXT: paddb %xmm5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: paddb %xmm1, %xmm2
-; GFNISSE-NEXT: paddb %xmm5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm1
-; GFNISSE-NEXT: por %xmm3, %xmm1
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
+; GFNISSE-NEXT: pand %xmm10, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm3
+; GFNISSE-NEXT: pand %xmm8, %xmm5
+; GFNISSE-NEXT: pshufb %xmm5, %xmm7
+; GFNISSE-NEXT: pand %xmm3, %xmm7
+; GFNISSE-NEXT: pshufb %xmm5, %xmm6
+; GFNISSE-NEXT: gf2p8mulb %xmm7, %xmm6
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm6
+; GFNISSE-NEXT: por %xmm6, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_fshr_v32i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm4
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm5 = [1161999622361579520,1161999622361579520]
-; GFNIAVX1-NEXT: # xmm5 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm4, %xmm6
-; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} ymm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX1-NEXT: vandps %ymm3, %ymm2, %ymm2
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm7, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm8, %xmm6, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm6 = [290499906672525312,290499906672525312]
-; GFNIAVX1-NEXT: # xmm6 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm4, %xmm9
-; GFNIAVX1-NEXT: vpaddb %xmm8, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm8, %xmm9, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm9 = [145249953336295424,145249953336295424]
-; GFNIAVX1-NEXT: # xmm9 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm9, %xmm4, %xmm10
-; GFNIAVX1-NEXT: vpaddb %xmm8, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm8, %xmm10, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm8, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm10 = [16909320,16909320]
-; GFNIAVX1-NEXT: # xmm10 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm10, %xmm8, %xmm11
-; GFNIAVX1-NEXT: vpxor %xmm3, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm11, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm11 = [1108169199648,1108169199648]
-; GFNIAVX1-NEXT: # xmm11 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm11, %xmm8, %xmm12
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm12, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm8, %xmm8, %xmm12
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm12, %xmm8, %xmm7
-; GFNIAVX1-NEXT: vpor %xmm4, %xmm7, %xmm4
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm1, %xmm5
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm1, %xmm5
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm6, %xmm5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm9, %xmm1, %xmm5
-; GFNIAVX1-NEXT: vpaddb %xmm6, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm6, %xmm5, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} ymm5 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNIAVX1-NEXT: vandps %ymm5, %ymm2, %ymm2
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm6
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm7 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm6, %xmm7, %xmm8
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm8, %xmm3
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm8 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm6, %xmm8, %xmm9
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm9, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vpxor %xmm5, %xmm6, %xmm6
+; GFNIAVX1-NEXT: vpshufb %xmm6, %xmm8, %xmm9
+; GFNIAVX1-NEXT: vpshufb %xmm6, %xmm7, %xmm6
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm10
+; GFNIAVX1-NEXT: vpaddb %xmm10, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm10, %xmm6
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm9, %xmm6, %xmm6
+; GFNIAVX1-NEXT: vpor %xmm3, %xmm6, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm6
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm8, %xmm6
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm6, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpxor %xmm5, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm8, %xmm4
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm2
; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm10, %xmm0, %xmm5
-; GFNIAVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm5, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm11, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm4, %xmm0, %xmm0
; GFNIAVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm3, %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_fshr_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm1, %ymm3
-; GFNIAVX2-NEXT: vpbroadcastb {{.*#+}} ymm4 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX2-NEXT: vpand %ymm4, %ymm2, %ymm5
-; GFNIAVX2-NEXT: vpsllw $5, %ymm5, %ymm5
-; GFNIAVX2-NEXT: vpblendvb %ymm5, %ymm3, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm1, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX2-NEXT: vpblendvb %ymm5, %ymm3, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm1, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX2-NEXT: vpblendvb %ymm5, %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpbroadcastb {{.*#+}} ymm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNIAVX2-NEXT: vpandn %ymm3, %ymm2, %ymm4
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm7 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm7 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm4, %ymm7, %ymm4
; GFNIAVX2-NEXT: vpaddb %ymm0, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [16909320,16909320,16909320,16909320]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm3
-; GFNIAVX2-NEXT: vpandn %ymm4, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm3, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm3, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpaddb %ymm0, %ymm0, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand %ymm4, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm6, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm3, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm7, %ymm3
+; GFNIAVX2-NEXT: vpand %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm5, %ymm2
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
; GFNIAVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_fshr_v32i8:
; GFNIAVX512VL: # %bb.0:
; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} ymm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX512VL-NEXT: vpand %ymm3, %ymm2, %ymm4
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm4, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm1, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm4, %ymm6, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm1, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm1, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpandn %ymm3, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm3
+; GFNIAVX512VL-NEXT: vpandn %ymm3, %ymm2, %ymm4
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm7 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm7 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm7, %ymm4
; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand %ymm4, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm6, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vpand %ymm3, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm7, %ymm3
+; GFNIAVX512VL-NEXT: vpand %ymm3, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm2
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
; GFNIAVX512VL-NEXT: vpor %ymm1, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
@@ -1685,58 +1587,35 @@ define <64 x i8> @var_fshl_v64i8(<64 x i8> %a, <64 x i8> %b, <64 x i8> %amt) nou
;
; GFNIAVX512VL-LABEL: var_fshl_v64i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm5 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm3, %ymm6
-; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} zmm7 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX512VL-NEXT: vpandq %zmm7, %zmm2, %zmm2
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm2, %ymm8
-; GFNIAVX512VL-NEXT: vpxor %ymm7, %ymm8, %ymm9
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm9, %ymm9
-; GFNIAVX512VL-NEXT: vpblendvb %ymm9, %ymm6, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm6 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm6, %ymm3, %ymm10
-; GFNIAVX512VL-NEXT: vpaddb %ymm9, %ymm9, %ymm9
-; GFNIAVX512VL-NEXT: vpblendvb %ymm9, %ymm10, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm10
-; GFNIAVX512VL-NEXT: vpaddb %ymm9, %ymm9, %ymm9
-; GFNIAVX512VL-NEXT: vpblendvb %ymm9, %ymm10, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm1, %ymm5
-; GFNIAVX512VL-NEXT: vpxor %ymm7, %ymm2, %ymm7
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm7, %ymm7
-; GFNIAVX512VL-NEXT: vpblendvb %ymm7, %ymm5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm6, %ymm1, %ymm5
-; GFNIAVX512VL-NEXT: vpaddb %ymm7, %ymm7, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm6, %ymm5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm6, %ymm6, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm3, %zmm1, %zmm1
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [16909320,16909320,16909320,16909320]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm5
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm8, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm6, %ymm5, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm5 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm3, %ymm7
-; GFNIAVX512VL-NEXT: vpaddb %ymm6, %ymm6, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm6, %ymm7, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm3, %ymm3, %ymm7
-; GFNIAVX512VL-NEXT: vpaddb %ymm6, %ymm6, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm6, %ymm7, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm3, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} zmm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNIAVX512VL-NEXT: vpandq %zmm3, %zmm2, %zmm2
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm2, %ymm4
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm7
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm6, %zmm7, %zmm6
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm7 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm7 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm7, %ymm8
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm7, %ymm9
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm8, %zmm9, %zmm8
+; GFNIAVX512VL-NEXT: vpandq %zmm8, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %zmm6, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vpxor %ymm3, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX512VL-NEXT: vpxor %ymm3, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm3
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm6, %zmm3, %zmm3
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm7, %ymm4
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm7, %ymm2
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm4, %zmm2, %zmm2
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} zmm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %zmm4, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vpandq %zmm2, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vgf2p8mulb %zmm3, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %zmm4, %zmm1, %zmm1
; GFNIAVX512VL-NEXT: vporq %zmm1, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: retq
;
@@ -1761,376 +1640,233 @@ define <64 x i8> @var_fshl_v64i8(<64 x i8> %a, <64 x i8> %b, <64 x i8> %amt) nou
define <64 x i8> @var_fshr_v64i8(<64 x i8> %a, <64 x i8> %b, <64 x i8> %amt) nounwind {
; GFNISSE-LABEL: var_fshr_v64i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm7, %xmm10
-; GFNISSE-NEXT: movdqa %xmm6, %xmm7
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: movdqa %xmm4, %xmm5
-; GFNISSE-NEXT: movdqa %xmm3, %xmm4
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: movdqa %xmm0, %xmm1
-; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
-; GFNISSE-NEXT: movdqa %xmm5, %xmm12
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm12
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm11 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pand %xmm11, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm12, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm13
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm13
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm13, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm14
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm14
+; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm13
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm10 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNISSE-NEXT: movdqa %xmm13, %xmm11
+; GFNISSE-NEXT: pandn %xmm10, %xmm11
+; GFNISSE-NEXT: movq {{.*#+}} xmm8 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm8, %xmm14
+; GFNISSE-NEXT: pshufb %xmm11, %xmm14
+; GFNISSE-NEXT: movq {{.*#+}} xmm9 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm9, %xmm15
+; GFNISSE-NEXT: pshufb %xmm11, %xmm15
+; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm12
; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm14, %xmm5
+; GFNISSE-NEXT: pand %xmm15, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm14, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm11 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm4
+; GFNISSE-NEXT: pand %xmm10, %xmm13
+; GFNISSE-NEXT: movdqa %xmm9, %xmm14
+; GFNISSE-NEXT: pshufb %xmm13, %xmm14
+; GFNISSE-NEXT: pand %xmm4, %xmm14
+; GFNISSE-NEXT: movdqa %xmm8, %xmm4
+; GFNISSE-NEXT: pshufb %xmm13, %xmm4
+; GFNISSE-NEXT: gf2p8mulb %xmm14, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm4
+; GFNISSE-NEXT: por %xmm4, %xmm0
+; GFNISSE-NEXT: movdqa %xmm12, %xmm4
+; GFNISSE-NEXT: pandn %xmm10, %xmm4
+; GFNISSE-NEXT: movdqa %xmm8, %xmm13
+; GFNISSE-NEXT: pshufb %xmm4, %xmm13
+; GFNISSE-NEXT: movdqa %xmm9, %xmm14
+; GFNISSE-NEXT: pshufb %xmm4, %xmm14
; GFNISSE-NEXT: paddb %xmm1, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm15
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm15
-; GFNISSE-NEXT: movdqa %xmm11, %xmm12
-; GFNISSE-NEXT: pandn %xmm11, %xmm9
-; GFNISSE-NEXT: psllw $5, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm15, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: paddb %xmm1, %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
-; GFNISSE-NEXT: movdqa %xmm6, %xmm8
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm11 = [1161999622361579520,1161999622361579520]
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm8
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pand %xmm12, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm8
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm13 = [290499906672525312,290499906672525312]
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm13, %xmm8
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm8
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm14 = [145249953336295424,145249953336295424]
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm14, %xmm8
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm6
+; GFNISSE-NEXT: pand %xmm14, %xmm1
+; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm4
+; GFNISSE-NEXT: gf2p8mulb %xmm13, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm5
+; GFNISSE-NEXT: pand %xmm10, %xmm12
+; GFNISSE-NEXT: movdqa %xmm9, %xmm13
+; GFNISSE-NEXT: pshufb %xmm12, %xmm13
+; GFNISSE-NEXT: pand %xmm5, %xmm13
+; GFNISSE-NEXT: movdqa %xmm8, %xmm5
+; GFNISSE-NEXT: pshufb %xmm12, %xmm5
+; GFNISSE-NEXT: gf2p8mulb %xmm13, %xmm5
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm5
+; GFNISSE-NEXT: por %xmm5, %xmm1
+; GFNISSE-NEXT: movdqa %xmm4, %xmm5
+; GFNISSE-NEXT: pandn %xmm10, %xmm5
+; GFNISSE-NEXT: movdqa %xmm8, %xmm12
+; GFNISSE-NEXT: pshufb %xmm5, %xmm12
+; GFNISSE-NEXT: movdqa %xmm9, %xmm13
+; GFNISSE-NEXT: pshufb %xmm5, %xmm13
; GFNISSE-NEXT: paddb %xmm2, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm8
-; GFNISSE-NEXT: pmovsxdq {{.*#+}} xmm15 = [16909320,16909320]
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm15, %xmm8
-; GFNISSE-NEXT: pandn %xmm12, %xmm9
-; GFNISSE-NEXT: psllw $5, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm8
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm0 = [1108169199648,1108169199648]
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm0, %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm8
-; GFNISSE-NEXT: paddb %xmm2, %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm2
-; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
-; GFNISSE-NEXT: movdqa %xmm7, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm8
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pand %xmm12, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm13, %xmm8
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm14, %xmm8
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm7
+; GFNISSE-NEXT: pand %xmm13, %xmm2
+; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm5
+; GFNISSE-NEXT: gf2p8mulb %xmm12, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm6
+; GFNISSE-NEXT: pand %xmm10, %xmm4
+; GFNISSE-NEXT: movdqa %xmm9, %xmm12
+; GFNISSE-NEXT: pshufb %xmm4, %xmm12
+; GFNISSE-NEXT: pand %xmm6, %xmm12
+; GFNISSE-NEXT: movdqa %xmm8, %xmm6
+; GFNISSE-NEXT: pshufb %xmm4, %xmm6
+; GFNISSE-NEXT: gf2p8mulb %xmm12, %xmm6
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm6
+; GFNISSE-NEXT: por %xmm6, %xmm2
+; GFNISSE-NEXT: movdqa %xmm5, %xmm4
+; GFNISSE-NEXT: pandn %xmm10, %xmm4
+; GFNISSE-NEXT: movdqa %xmm8, %xmm6
+; GFNISSE-NEXT: pshufb %xmm4, %xmm6
+; GFNISSE-NEXT: movdqa %xmm9, %xmm12
+; GFNISSE-NEXT: pshufb %xmm4, %xmm12
; GFNISSE-NEXT: paddb %xmm3, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm15, %xmm8
-; GFNISSE-NEXT: pandn %xmm12, %xmm9
-; GFNISSE-NEXT: psllw $5, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm8
-; GFNISSE-NEXT: paddb %xmm3, %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm3
-; GFNISSE-NEXT: movdqa {{[0-9]+}}(%rsp), %xmm9
-; GFNISSE-NEXT: movdqa %xmm10, %xmm8
+; GFNISSE-NEXT: pand %xmm12, %xmm3
+; GFNISSE-NEXT: gf2p8mulb %xmm6, %xmm3
+; GFNISSE-NEXT: pand %xmm10, %xmm5
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm7
+; GFNISSE-NEXT: pshufb %xmm5, %xmm9
+; GFNISSE-NEXT: pand %xmm7, %xmm9
+; GFNISSE-NEXT: pshufb %xmm5, %xmm8
+; GFNISSE-NEXT: gf2p8mulb %xmm9, %xmm8
; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm8
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pand %xmm12, %xmm0
-; GFNISSE-NEXT: psllw $5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm10
-; GFNISSE-NEXT: movdqa %xmm10, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm13, %xmm8
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm10
-; GFNISSE-NEXT: movdqa %xmm10, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm14, %xmm8
-; GFNISSE-NEXT: paddb %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm10
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm15, %xmm8
-; GFNISSE-NEXT: pandn %xmm12, %xmm9
-; GFNISSE-NEXT: psllw $5, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: paddb %xmm4, %xmm8
-; GFNISSE-NEXT: paddb %xmm9, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm4
-; GFNISSE-NEXT: por %xmm5, %xmm1
-; GFNISSE-NEXT: por %xmm6, %xmm2
-; GFNISSE-NEXT: por %xmm7, %xmm3
-; GFNISSE-NEXT: por %xmm10, %xmm4
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: movdqa %xmm2, %xmm1
-; GFNISSE-NEXT: movdqa %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm4, %xmm3
+; GFNISSE-NEXT: por %xmm8, %xmm3
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_fshr_v64i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm8
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm7 = [1161999622361579520,1161999622361579520]
-; GFNIAVX1-NEXT: # xmm7 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm7, %xmm8, %xmm9
-; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} ymm6 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX1-NEXT: vandps %ymm6, %ymm4, %ymm11
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm11, %xmm10
-; GFNIAVX1-NEXT: vpsllw $5, %xmm10, %xmm12
-; GFNIAVX1-NEXT: vpblendvb %xmm12, %xmm9, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [290499906672525312,290499906672525312]
-; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm8, %xmm9
-; GFNIAVX1-NEXT: vpaddb %xmm12, %xmm12, %xmm12
-; GFNIAVX1-NEXT: vpblendvb %xmm12, %xmm9, %xmm8, %xmm9
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm8 = [145249953336295424,145249953336295424]
-; GFNIAVX1-NEXT: # xmm8 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm9, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm12, %xmm12, %xmm12
-; GFNIAVX1-NEXT: vpblendvb %xmm12, %xmm13, %xmm9, %xmm12
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm9
-; GFNIAVX1-NEXT: vpaddb %xmm9, %xmm9, %xmm13
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm9 = [16909320,16909320]
-; GFNIAVX1-NEXT: # xmm9 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm9, %xmm13, %xmm14
-; GFNIAVX1-NEXT: vpxor %xmm6, %xmm10, %xmm10
-; GFNIAVX1-NEXT: vpsllw $5, %xmm10, %xmm15
-; GFNIAVX1-NEXT: vpblendvb %xmm15, %xmm14, %xmm13, %xmm13
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm10 = [1108169199648,1108169199648]
-; GFNIAVX1-NEXT: # xmm10 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm10, %xmm13, %xmm14
-; GFNIAVX1-NEXT: vpaddb %xmm15, %xmm15, %xmm15
-; GFNIAVX1-NEXT: vpblendvb %xmm15, %xmm14, %xmm13, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm13, %xmm13, %xmm14
-; GFNIAVX1-NEXT: vpaddb %xmm15, %xmm15, %xmm15
-; GFNIAVX1-NEXT: vpblendvb %xmm15, %xmm14, %xmm13, %xmm13
-; GFNIAVX1-NEXT: vpor %xmm12, %xmm13, %xmm12
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm7, %xmm2, %xmm13
-; GFNIAVX1-NEXT: vpsllw $5, %xmm11, %xmm14
-; GFNIAVX1-NEXT: vpblendvb %xmm14, %xmm13, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm2, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm14, %xmm14, %xmm14
-; GFNIAVX1-NEXT: vpblendvb %xmm14, %xmm13, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm2, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm14, %xmm14, %xmm14
-; GFNIAVX1-NEXT: vpblendvb %xmm14, %xmm13, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm7
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm6 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm6 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm7, %xmm8
+; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} ymm7 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNIAVX1-NEXT: vandps %ymm7, %ymm4, %ymm9
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm9, %xmm10
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm4 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm10, %xmm4, %xmm11
+; GFNIAVX1-NEXT: vpand %xmm11, %xmm8, %xmm11
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm8 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm10, %xmm8, %xmm12
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm12, %xmm11, %xmm11
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm11, %xmm11
+; GFNIAVX1-NEXT: vpxor %xmm7, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vpshufb %xmm10, %xmm8, %xmm12
+; GFNIAVX1-NEXT: vpshufb %xmm10, %xmm4, %xmm10
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm13
+; GFNIAVX1-NEXT: vpaddb %xmm13, %xmm13, %xmm13
+; GFNIAVX1-NEXT: vpand %xmm10, %xmm13, %xmm10
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm12, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vpor %xmm11, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm4, %xmm11
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm11, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm8, %xmm11
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm11, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpxor %xmm7, %xmm9, %xmm9
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm8, %xmm11
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm4, %xmm9
; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm9, %xmm0, %xmm13
-; GFNIAVX1-NEXT: vpxor %xmm6, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vpsllw $5, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vpblendvb %xmm11, %xmm13, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm10, %xmm0, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm11, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vpblendvb %xmm11, %xmm13, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm11, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vpblendvb %xmm11, %xmm13, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm0, %xmm9, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm11, %xmm0, %xmm0
; GFNIAVX1-NEXT: vpor %xmm2, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm12, %ymm0, %ymm0
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm11
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm7, %xmm11, %xmm12
-; GFNIAVX1-NEXT: vandps %ymm6, %ymm5, %ymm2
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm5
-; GFNIAVX1-NEXT: vpsllw $5, %xmm5, %xmm13
-; GFNIAVX1-NEXT: vpblendvb %xmm13, %xmm12, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm11, %xmm12
-; GFNIAVX1-NEXT: vpaddb %xmm13, %xmm13, %xmm13
-; GFNIAVX1-NEXT: vpblendvb %xmm13, %xmm12, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm11, %xmm12
-; GFNIAVX1-NEXT: vpaddb %xmm13, %xmm13, %xmm13
-; GFNIAVX1-NEXT: vpblendvb %xmm13, %xmm12, %xmm11, %xmm11
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm12
-; GFNIAVX1-NEXT: vpaddb %xmm12, %xmm12, %xmm12
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm9, %xmm12, %xmm13
-; GFNIAVX1-NEXT: vpxor %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsllw $5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm13, %xmm12, %xmm12
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm10, %xmm12, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm13, %xmm12, %xmm12
-; GFNIAVX1-NEXT: vpaddb %xmm12, %xmm12, %xmm13
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm13, %xmm12, %xmm5
-; GFNIAVX1-NEXT: vpor %xmm5, %xmm11, %xmm5
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm7, %xmm3, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm11
-; GFNIAVX1-NEXT: vpblendvb %xmm11, %xmm7, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm3, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm11, %xmm11, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm4, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm3, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm4, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm10, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vandps %ymm7, %ymm5, %ymm5
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm5, %xmm9
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm4, %xmm10
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm10, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm8, %xmm10
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm10, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpxor %xmm7, %xmm9, %xmm9
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm8, %xmm10
+; GFNIAVX1-NEXT: vpshufb %xmm9, %xmm4, %xmm9
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm11
+; GFNIAVX1-NEXT: vpaddb %xmm11, %xmm11, %xmm11
+; GFNIAVX1-NEXT: vpand %xmm9, %xmm11, %xmm9
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm10, %xmm9, %xmm9
+; GFNIAVX1-NEXT: vpor %xmm2, %xmm9, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vpshufb %xmm5, %xmm4, %xmm9
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm9, %xmm3
+; GFNIAVX1-NEXT: vpshufb %xmm5, %xmm8, %xmm9
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm9, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vpxor %xmm7, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpshufb %xmm5, %xmm8, %xmm6
+; GFNIAVX1-NEXT: vpshufb %xmm5, %xmm4, %xmm4
; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm9, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpxor %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm10, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm6, %xmm1, %xmm1
; GFNIAVX1-NEXT: vpor %xmm3, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm5, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_fshr_v64i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm7 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm7, %ymm2, %ymm8
; GFNIAVX2-NEXT: vpbroadcastb {{.*#+}} ymm6 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX2-NEXT: vpand %ymm6, %ymm4, %ymm9
-; GFNIAVX2-NEXT: vpsllw $5, %ymm9, %ymm9
-; GFNIAVX2-NEXT: vpblendvb %ymm9, %ymm8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm8 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm8, %ymm2, %ymm10
-; GFNIAVX2-NEXT: vpaddb %ymm9, %ymm9, %ymm9
-; GFNIAVX2-NEXT: vpblendvb %ymm9, %ymm10, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm10 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm10, %ymm2, %ymm11
-; GFNIAVX2-NEXT: vpaddb %ymm9, %ymm9, %ymm9
-; GFNIAVX2-NEXT: vpblendvb %ymm9, %ymm11, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vpandn %ymm6, %ymm4, %ymm7
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm8 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm8 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm7, %ymm8, %ymm9
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm10 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm10 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm7, %ymm10, %ymm7
; GFNIAVX2-NEXT: vpaddb %ymm0, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm9 = [16909320,16909320,16909320,16909320]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm0, %ymm11
-; GFNIAVX2-NEXT: vpandn %ymm6, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpsllw $5, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm11, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm11 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm11, %ymm0, %ymm12
-; GFNIAVX2-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm12, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpaddb %ymm0, %ymm0, %ymm12
-; GFNIAVX2-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm12, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand %ymm7, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm9, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm7 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm7, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vpand %ymm6, %ymm4, %ymm4
+; GFNIAVX2-NEXT: vpshufb %ymm4, %ymm10, %ymm9
+; GFNIAVX2-NEXT: vpand %ymm2, %ymm9, %ymm2
+; GFNIAVX2-NEXT: vpshufb %ymm4, %ymm8, %ymm4
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm4, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm7, %ymm2, %ymm2
; GFNIAVX2-NEXT: vpor %ymm2, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm7, %ymm3, %ymm2
-; GFNIAVX2-NEXT: vpand %ymm6, %ymm5, %ymm4
-; GFNIAVX2-NEXT: vpsllw $5, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm2, %ymm3, %ymm2
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm8, %ymm2, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm3, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm10, %ymm2, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm3, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vpandn %ymm6, %ymm5, %ymm2
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm8, %ymm4
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm10, %ymm2
; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm1, %ymm3
-; GFNIAVX2-NEXT: vpandn %ymm6, %ymm5, %ymm4
-; GFNIAVX2-NEXT: vpsllw $5, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm3, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm11, %ymm1, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm3, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm3
-; GFNIAVX2-NEXT: vpaddb %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm4, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm7, %ymm3, %ymm2
+; GFNIAVX2-NEXT: vpand %ymm6, %ymm5, %ymm3
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm10, %ymm4
+; GFNIAVX2-NEXT: vpand %ymm4, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm8, %ymm3
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm3, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm7, %ymm2, %ymm2
; GFNIAVX2-NEXT: vpor %ymm2, %ymm1, %ymm1
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_fshr_v64i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm5
-; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} zmm6 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
-; GFNIAVX512VL-NEXT: vpandq %zmm6, %zmm2, %zmm2
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm2, %ymm7
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm7, %ymm8
-; GFNIAVX512VL-NEXT: vpblendvb %ymm8, %ymm5, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm5 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm3, %ymm9
-; GFNIAVX512VL-NEXT: vpaddb %ymm8, %ymm8, %ymm8
-; GFNIAVX512VL-NEXT: vpblendvb %ymm8, %ymm9, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm9 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm9, %ymm3, %ymm10
-; GFNIAVX512VL-NEXT: vpaddb %ymm8, %ymm8, %ymm8
-; GFNIAVX512VL-NEXT: vpblendvb %ymm8, %ymm10, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm4
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm2, %ymm8
-; GFNIAVX512VL-NEXT: vpblendvb %ymm8, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm1, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm8, %ymm8, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm9, %ymm1, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm3, %zmm1, %zmm1
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [16909320,16909320,16909320,16909320]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm5
-; GFNIAVX512VL-NEXT: vpxor %ymm6, %ymm7, %ymm7
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm7, %ymm7
-; GFNIAVX512VL-NEXT: vpblendvb %ymm7, %ymm5, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm5 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm3, %ymm8
-; GFNIAVX512VL-NEXT: vpaddb %ymm7, %ymm7, %ymm7
-; GFNIAVX512VL-NEXT: vpblendvb %ymm7, %ymm8, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm3, %ymm3, %ymm8
-; GFNIAVX512VL-NEXT: vpaddb %ymm7, %ymm7, %ymm7
-; GFNIAVX512VL-NEXT: vpblendvb %ymm7, %ymm8, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpxor %ymm6, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm5, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} zmm3 = [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]
+; GFNIAVX512VL-NEXT: vpandq %zmm3, %zmm2, %zmm2
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm2, %ymm4
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm7
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm6, %zmm7, %zmm6
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm7 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm7 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm7, %ymm8
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm7, %ymm9
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm8, %zmm9, %zmm8
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} zmm9 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %zmm9, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vpandq %zmm8, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vgf2p8mulb %zmm6, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %zmm9, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vpxor %ymm3, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm5, %ymm6
+; GFNIAVX512VL-NEXT: vpxor %ymm3, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm3
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm6, %zmm3, %zmm3
+; GFNIAVX512VL-NEXT: vpshufb %ymm4, %ymm7, %ymm4
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm7, %ymm2
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm4, %zmm2, %zmm2
; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm3, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm0
+; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm0, %zmm4, %zmm0
+; GFNIAVX512VL-NEXT: vpandq %zmm2, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %zmm3, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: vporq %zmm1, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: retq
;
diff --git a/llvm/test/CodeGen/X86/gfni-shifts.ll b/llvm/test/CodeGen/X86/gfni-shifts.ll
index 6232488bea71b..55228ca6a5677 100644
--- a/llvm/test/CodeGen/X86/gfni-shifts.ll
+++ b/llvm/test/CodeGen/X86/gfni-shifts.ll
@@ -12,36 +12,22 @@
define <16 x i8> @var_shl_v16i8(<16 x i8> %a, <16 x i8> %b) nounwind {
; GFNISSE-LABEL: var_shl_v16i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: psllw $5, %xmm1
-; GFNISSE-NEXT: movdqa %xmm0, %xmm3
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3
-; GFNISSE-NEXT: paddb %xmm1, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: paddb %xmm2, %xmm3
-; GFNISSE-NEXT: paddb %xmm1, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNISSE-NEXT: pshufb %xmm1, %xmm2
+; GFNISSE-NEXT: movq {{.*#+}} xmm3 = [72909780498219007,0]
+; GFNISSE-NEXT: pshufb %xmm1, %xmm3
+; GFNISSE-NEXT: pand %xmm3, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm0
; GFNISSE-NEXT: retq
;
; GFNIAVX1OR2-LABEL: var_shl_v16i8:
; GFNIAVX1OR2: # %bb.0:
-; GFNIAVX1OR2-NEXT: vpsllw $5, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm2, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX1OR2-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm2, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vpaddb %xmm0, %xmm0, %xmm2
-; GFNIAVX1OR2-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm2, %xmm0, %xmm0
+; GFNIAVX1OR2-NEXT: vmovq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNIAVX1OR2-NEXT: vpshufb %xmm1, %xmm2, %xmm2
+; GFNIAVX1OR2-NEXT: vmovq {{.*#+}} xmm3 = [72909780498219007,0]
+; GFNIAVX1OR2-NEXT: vpshufb %xmm1, %xmm3, %xmm1
+; GFNIAVX1OR2-NEXT: vpand %xmm1, %xmm0, %xmm0
+; GFNIAVX1OR2-NEXT: vgf2p8mulb %xmm2, %xmm0, %xmm0
; GFNIAVX1OR2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_shl_v16i8:
@@ -68,37 +54,43 @@ define <16 x i8> @var_shl_v16i8(<16 x i8> %a, <16 x i8> %b) nounwind {
define <16 x i8> @var_lshr_v16i8(<16 x i8> %a, <16 x i8> %b) nounwind {
; GFNISSE-LABEL: var_lshr_v16i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: psllw $5, %xmm1
-; GFNISSE-NEXT: movdqa %xmm0, %xmm3
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3
-; GFNISSE-NEXT: paddb %xmm1, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm3
-; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm3
-; GFNISSE-NEXT: paddb %xmm1, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm2 = [72909780498219007,0]
+; GFNISSE-NEXT: pshufb %xmm1, %xmm2
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm3, %xmm0
+; GFNISSE-NEXT: pand %xmm2, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNISSE-NEXT: pshufb %xmm1, %xmm2
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm3, %xmm0
; GFNISSE-NEXT: retq
;
-; GFNIAVX1OR2-LABEL: var_lshr_v16i8:
-; GFNIAVX1OR2: # %bb.0:
-; GFNIAVX1OR2-NEXT: vpsllw $5, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm2, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX1OR2-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm2, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm2
-; GFNIAVX1OR2-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm2, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: retq
+; GFNIAVX1-LABEL: var_lshr_v16i8:
+; GFNIAVX1: # %bb.0:
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm2 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm3 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm2, %xmm1
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: retq
+;
+; GFNIAVX2-LABEL: var_lshr_v16i8:
+; GFNIAVX2: # %bb.0:
+; GFNIAVX2-NEXT: vmovq {{.*#+}} xmm2 = [72909780498219007,0]
+; GFNIAVX2-NEXT: vpshufb %xmm1, %xmm2, %xmm2
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vmovq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNIAVX2-NEXT: vpshufb %xmm1, %xmm2, %xmm1
+; GFNIAVX2-NEXT: vgf2p8mulb %xmm1, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_lshr_v16i8:
; GFNIAVX512VL: # %bb.0:
@@ -124,67 +116,59 @@ define <16 x i8> @var_lshr_v16i8(<16 x i8> %a, <16 x i8> %b) nounwind {
define <16 x i8> @var_ashr_v16i8(<16 x i8> %a, <16 x i8> %b) nounwind {
; GFNISSE-LABEL: var_ashr_v16i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: psllw $5, %xmm1
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm3 = xmm3[8],xmm2[8],xmm3[9],xmm2[9],xmm3[10],xmm2[10],xmm3[11],xmm2[11],xmm3[12],xmm2[12],xmm3[13],xmm2[13],xmm3[14],xmm2[14],xmm3[15],xmm2[15]
-; GFNISSE-NEXT: movdqa %xmm3, %xmm4
-; GFNISSE-NEXT: psraw $4, %xmm4
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm4
-; GFNISSE-NEXT: psraw $2, %xmm4
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm4
-; GFNISSE-NEXT: psraw $1, %xmm4
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm3
-; GFNISSE-NEXT: psrlw $8, %xmm3
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: psraw $4, %xmm2
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: psraw $2, %xmm2
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: psraw $1, %xmm2
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm2, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm3, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNISSE-NEXT: pshufb %xmm1, %xmm2
+; GFNISSE-NEXT: movq {{.*#+}} xmm3 = [72909780498219007,0]
+; GFNISSE-NEXT: pshufb %xmm1, %xmm3
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm1 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNISSE-NEXT: pand %xmm3, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm1
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0
+; GFNISSE-NEXT: pand %xmm3, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0
+; GFNISSE-NEXT: pxor %xmm1, %xmm0
+; GFNISSE-NEXT: psubb %xmm1, %xmm0
; GFNISSE-NEXT: retq
;
-; GFNIAVX1OR2-LABEL: var_ashr_v16i8:
-; GFNIAVX1OR2: # %bb.0:
-; GFNIAVX1OR2-NEXT: vpsllw $5, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1OR2-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1OR2-NEXT: vpsraw $4, %xmm3, %xmm4
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
-; GFNIAVX1OR2-NEXT: vpsraw $2, %xmm3, %xmm4
-; GFNIAVX1OR2-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
-; GFNIAVX1OR2-NEXT: vpsraw $1, %xmm3, %xmm4
-; GFNIAVX1OR2-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm2
-; GFNIAVX1OR2-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1OR2-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1OR2-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1OR2-NEXT: vpsraw $4, %xmm0, %xmm3
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vpsraw $2, %xmm0, %xmm3
-; GFNIAVX1OR2-NEXT: vpaddw %xmm1, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vpsraw $1, %xmm0, %xmm3
-; GFNIAVX1OR2-NEXT: vpaddw %xmm1, %xmm1, %xmm1
-; GFNIAVX1OR2-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
-; GFNIAVX1OR2-NEXT: retq
+; GFNIAVX1-LABEL: var_ashr_v16i8:
+; GFNIAVX1: # %bb.0:
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm3 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm3, %xmm1
+; GFNIAVX1-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm3
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpxor %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpsubb %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: retq
+;
+; GFNIAVX2-LABEL: var_ashr_v16i8:
+; GFNIAVX2: # %bb.0:
+; GFNIAVX2-NEXT: vmovq {{.*#+}} xmm2 = [9241421688590303745,0]
+; GFNIAVX2-NEXT: vpshufb %xmm1, %xmm2, %xmm2
+; GFNIAVX2-NEXT: vmovq {{.*#+}} xmm3 = [72909780498219007,0]
+; GFNIAVX2-NEXT: vpshufb %xmm1, %xmm3, %xmm1
+; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm3
+; GFNIAVX2-NEXT: vgf2p8mulb %xmm2, %xmm3, %xmm3
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm4, %xmm3, %xmm3
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8mulb %xmm2, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpxor %xmm3, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpsubb %xmm3, %xmm0, %xmm0
+; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_ashr_v16i8:
; GFNIAVX512VL: # %bb.0:
@@ -440,37 +424,30 @@ define <16 x i8> @constant_shl_v16i8(<16 x i8> %a) nounwind {
define <16 x i8> @constant_lshr_v16i8(<16 x i8> %a) nounwind {
; GFNISSE-LABEL: constant_lshr_v16i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: pxor %xmm2, %xmm2
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm1 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm2[8],xmm0[9],xmm2[9],xmm0[10],xmm2[10],xmm0[11],xmm2[11],xmm0[12],xmm2[12],xmm0[13],xmm2[13],xmm0[14],xmm2[14],xmm0[15],xmm2[15]
-; GFNISSE-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; GFNISSE-NEXT: psrlw $8, %xmm0
-; GFNISSE-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm0, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm1 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm1, %xmm0
+; GFNISSE-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
+; GFNISSE-NEXT: gf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm1, %xmm0
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: constant_lshr_v16i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
-; GFNIAVX1-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
-; GFNIAVX1-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm1 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm1 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm1, %xmm0, %xmm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: constant_lshr_v16i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
-; GFNIAVX2-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; GFNIAVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
-; GFNIAVX2-NEXT: vzeroupper
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm1, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm1, %xmm0, %xmm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: constant_lshr_v16i8:
@@ -495,39 +472,46 @@ define <16 x i8> @constant_lshr_v16i8(<16 x i8> %a) nounwind {
define <16 x i8> @constant_ashr_v16i8(<16 x i8> %a) nounwind {
; GFNISSE-LABEL: constant_ashr_v16i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm1
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm0[8],xmm1[9],xmm0[9],xmm1[10],xmm0[10],xmm1[11],xmm0[11],xmm1[12],xmm0[12],xmm1[13],xmm0[13],xmm1[14],xmm0[14],xmm1[15],xmm0[15]
-; GFNISSE-NEXT: psraw $8, %xmm1
-; GFNISSE-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm0
-; GFNISSE-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
-; GFNISSE-NEXT: psrlw $8, %xmm0
-; GFNISSE-NEXT: packuswb %xmm1, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm2 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNISSE-NEXT: gf2p8mulb %xmm1, %xmm2
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm3, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm3, %xmm0
+; GFNISSE-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm1, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm3, %xmm0
+; GFNISSE-NEXT: pxor %xmm2, %xmm0
+; GFNISSE-NEXT: psubb %xmm2, %xmm0
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: constant_ashr_v16i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX1-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm2
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm3 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpxor %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpsubb %xmm2, %xmm0, %xmm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: constant_ashr_v16i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpmovsxbw %xmm0, %ymm0
-; GFNIAVX2-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; GFNIAVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
-; GFNIAVX2-NEXT: vzeroupper
+; GFNIAVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX2-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm2
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm3, %xmm2, %xmm2
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8mulb %xmm1, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpxor %xmm2, %xmm0, %xmm0
+; GFNIAVX2-NEXT: vpsubb %xmm2, %xmm0, %xmm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: constant_ashr_v16i8:
@@ -613,98 +597,59 @@ define <16 x i8> @splatconstant_ashr_v16i8(<16 x i8> %a) nounwind {
define <32 x i8> @var_shl_v32i8(<32 x i8> %a, <32 x i8> %b) nounwind {
; GFNISSE-LABEL: var_shl_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm2, %xmm4
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: pmovsxdq {{.*#+}} xmm5 = [16909320,16909320]
-; GFNISSE-NEXT: movdqa %xmm0, %xmm6
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm5, %xmm6
-; GFNISSE-NEXT: psllw $5, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [1108169199648,1108169199648]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm7
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm7
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm7, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm7
-; GFNISSE-NEXT: paddb %xmm2, %xmm7
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm7, %xmm2
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm5, %xmm4
-; GFNISSE-NEXT: psllw $5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm4
-; GFNISSE-NEXT: paddb %xmm3, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: paddb %xmm1, %xmm4
-; GFNISSE-NEXT: paddb %xmm3, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm4 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm4, %xmm5
+; GFNISSE-NEXT: pshufb %xmm2, %xmm5
+; GFNISSE-NEXT: movq {{.*#+}} xmm6 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm6, %xmm7
+; GFNISSE-NEXT: pshufb %xmm2, %xmm7
+; GFNISSE-NEXT: pand %xmm7, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm0
+; GFNISSE-NEXT: pshufb %xmm3, %xmm4
+; GFNISSE-NEXT: pshufb %xmm3, %xmm6
+; GFNISSE-NEXT: pand %xmm6, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_shl_v32i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm3 = [16909320,16909320]
-; GFNIAVX1-NEXT: # xmm3 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm2, %xmm4
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
-; GFNIAVX1-NEXT: vpsllw $5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm4, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [1108169199648,1108169199648]
-; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm2, %xmm6
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm6
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpsllw $5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm3 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm4
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm3, %ymm3
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm4 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm4, %xmm2
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm5, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm4, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm3, %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_shl_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [16909320,16909320,16909320,16909320]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm2
-; GFNIAVX2-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpaddb %ymm0, %ymm0, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm1, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm1, %ymm3, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_shl_v32i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm3, %ymm1
+; GFNIAVX512VL-NEXT: vpand %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: var_shl_v32i8:
@@ -721,102 +666,74 @@ define <32 x i8> @var_shl_v32i8(<32 x i8> %a, <32 x i8> %b) nounwind {
define <32 x i8> @var_lshr_v32i8(<32 x i8> %a, <32 x i8> %b) nounwind {
; GFNISSE-LABEL: var_lshr_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm2, %xmm4
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [1161999622361579520,1161999622361579520]
-; GFNISSE-NEXT: movdqa %xmm0, %xmm6
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm5, %xmm6
-; GFNISSE-NEXT: psllw $5, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [290499906672525312,290499906672525312]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm7
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm7
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm7, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm7 = [145249953336295424,145249953336295424]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm7, %xmm8
-; GFNISSE-NEXT: paddb %xmm4, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm2
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm5, %xmm4
-; GFNISSE-NEXT: psllw $5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm4
-; GFNISSE-NEXT: paddb %xmm3, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm7, %xmm4
-; GFNISSE-NEXT: paddb %xmm3, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm4 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm4, %xmm5
+; GFNISSE-NEXT: pshufb %xmm2, %xmm5
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm0
+; GFNISSE-NEXT: pand %xmm5, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm5 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm5, %xmm7
+; GFNISSE-NEXT: pshufb %xmm2, %xmm7
+; GFNISSE-NEXT: gf2p8mulb %xmm7, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm0
+; GFNISSE-NEXT: pshufb %xmm3, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm1
+; GFNISSE-NEXT: pand %xmm4, %xmm1
+; GFNISSE-NEXT: pshufb %xmm3, %xmm5
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_lshr_v32i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm3 = [1161999622361579520,1161999622361579520]
-; GFNIAVX1-NEXT: # xmm3 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm2, %xmm4
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
-; GFNIAVX1-NEXT: vpsllw $5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm4, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [290499906672525312,290499906672525312]
-; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm2, %xmm6
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm6 = [145249953336295424,145249953336295424]
-; GFNIAVX1-NEXT: # xmm6 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm2, %xmm7
-; GFNIAVX1-NEXT: vpaddb %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm7, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpsllw $5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm0, %xmm3
-; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm3 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm4
+; GFNIAVX1-NEXT: vbroadcastsd {{.*#+}} ymm5 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm6
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm6, %xmm6
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm6, %xmm4
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm3 = [1,2,4,8,16,32,64,128,0,0,0,0,0,0,0,0]
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm3, %xmm1
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm1, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %ymm5, %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_lshr_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm2
-; GFNIAVX2-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm1, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm1, %ymm2, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm1, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_lshr_v32i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %ymm0, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm2, %ymm1
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: var_lshr_v32i8:
@@ -833,179 +750,108 @@ define <32 x i8> @var_lshr_v32i8(<32 x i8> %a, <32 x i8> %b) nounwind {
define <32 x i8> @var_ashr_v32i8(<32 x i8> %a, <32 x i8> %b) nounwind {
; GFNISSE-LABEL: var_ashr_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm4
-; GFNISSE-NEXT: psllw $5, %xmm2
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm2[8],xmm0[9],xmm2[9],xmm0[10],xmm2[10],xmm0[11],xmm2[11],xmm0[12],xmm2[12],xmm0[13],xmm2[13],xmm0[14],xmm2[14],xmm0[15],xmm2[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm5 = xmm5[8],xmm4[8],xmm5[9],xmm4[9],xmm5[10],xmm4[10],xmm5[11],xmm4[11],xmm5[12],xmm4[12],xmm5[13],xmm4[13],xmm5[14],xmm4[14],xmm5[15],xmm4[15]
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: psraw $4, %xmm6
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: psraw $2, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: psraw $1, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm5
-; GFNISSE-NEXT: psrlw $8, %xmm5
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1],xmm2[2],xmm4[2],xmm2[3],xmm4[3],xmm2[4],xmm4[4],xmm2[5],xmm4[5],xmm2[6],xmm4[6],xmm2[7],xmm4[7]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm4
-; GFNISSE-NEXT: psraw $4, %xmm4
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm4
-; GFNISSE-NEXT: psraw $2, %xmm4
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm4
-; GFNISSE-NEXT: psraw $1, %xmm4
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm4, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: packuswb %xmm5, %xmm2
-; GFNISSE-NEXT: psllw $5, %xmm3
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm3[8],xmm0[9],xmm3[9],xmm0[10],xmm3[10],xmm0[11],xmm3[11],xmm0[12],xmm3[12],xmm0[13],xmm3[13],xmm0[14],xmm3[14],xmm0[15],xmm3[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm5
-; GFNISSE-NEXT: psraw $4, %xmm5
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm5
-; GFNISSE-NEXT: psraw $2, %xmm5
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm5
-; GFNISSE-NEXT: psraw $1, %xmm5
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm4
-; GFNISSE-NEXT: psrlw $8, %xmm4
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: movdqa %xmm1, %xmm3
-; GFNISSE-NEXT: psraw $4, %xmm3
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm3
-; GFNISSE-NEXT: psraw $2, %xmm3
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm3
-; GFNISSE-NEXT: psraw $1, %xmm3
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm3, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm4, %xmm1
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm4 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm4, %xmm7
+; GFNISSE-NEXT: pshufb %xmm2, %xmm7
+; GFNISSE-NEXT: movq {{.*#+}} xmm5 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm5, %xmm8
+; GFNISSE-NEXT: pshufb %xmm2, %xmm8
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm2 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm0
+; GFNISSE-NEXT: pand %xmm8, %xmm0
+; GFNISSE-NEXT: pand %xmm2, %xmm8
+; GFNISSE-NEXT: gf2p8mulb %xmm7, %xmm8
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm8
+; GFNISSE-NEXT: gf2p8mulb %xmm7, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm0
+; GFNISSE-NEXT: pxor %xmm8, %xmm0
+; GFNISSE-NEXT: psubb %xmm8, %xmm0
+; GFNISSE-NEXT: pshufb %xmm3, %xmm4
+; GFNISSE-NEXT: pshufb %xmm3, %xmm5
+; GFNISSE-NEXT: pand %xmm5, %xmm2
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm1
+; GFNISSE-NEXT: pand %xmm5, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm1
+; GFNISSE-NEXT: pxor %xmm2, %xmm1
+; GFNISSE-NEXT: psubb %xmm2, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_ashr_v32i8:
; GFNIAVX1: # %bb.0:
; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm2[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm4[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsraw $2, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsraw $1, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm6, %xmm5, %xmm3
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm4 = xmm4[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsraw $2, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsraw $1, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm5, %xmm4, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpackuswb %xmm3, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm4 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsraw $2, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vpaddw %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsraw $1, %xmm4, %xmm5
-; GFNIAVX1-NEXT: vpaddw %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm5, %xmm4, %xmm3
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm0, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm4, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsraw $2, %xmm0, %xmm4
-; GFNIAVX1-NEXT: vpaddw %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm4, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsraw $1, %xmm0, %xmm4
-; GFNIAVX1-NEXT: vpaddw %xmm1, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpblendvb %xmm1, %xmm4, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm3 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm4
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm5 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm5, %xmm2
+; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} xmm6 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm2, %xmm7
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm4, %xmm7, %xmm7
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm8 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm8 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm7, %xmm7
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm9
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm9, %xmm9
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm9, %xmm2
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm4, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpxor %xmm7, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpsubb %xmm7, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vpshufb %xmm1, %xmm5, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm1, %xmm4
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm3, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm8, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpxor %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpsubb %xmm4, %xmm0, %xmm0
; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_ashr_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpsraw $4, %ymm3, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm4, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpsraw $2, %ymm3, %ymm4
-; GFNIAVX2-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm4, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpsraw $1, %ymm3, %ymm4
-; GFNIAVX2-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm4, %ymm3, %ymm2
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpsraw $4, %ymm0, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsraw $2, %ymm0, %ymm3
-; GFNIAVX2-NEXT: vpaddw %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsraw $1, %ymm0, %ymm3
-; GFNIAVX2-NEXT: vpaddw %ymm1, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpackuswb %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm1, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm1, %ymm3, %ymm1
+; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm3
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm3, %ymm3
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm3
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpxor %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpsubb %ymm3, %ymm0, %ymm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_ashr_v32i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpsraw $4, %ymm3, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpsraw $2, %ymm3, %ymm4
-; GFNIAVX512VL-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpsraw $1, %ymm3, %ymm4
-; GFNIAVX512VL-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm4, %ymm3, %ymm2
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpsraw $4, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsraw $2, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddw %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsraw $1, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddw %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpackuswb %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm3, %ymm1
+; GFNIAVX512VL-NEXT: vpandd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %ymm1, %ymm3
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm2, %ymm3, %ymm3
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm3
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpxor %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpsubb %ymm3, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: var_ashr_v32i8:
@@ -1305,72 +1151,49 @@ define <32 x i8> @constant_shl_v32i8(<32 x i8> %a) nounwind {
define <32 x i8> @constant_lshr_v32i8(<32 x i8> %a) nounwind {
; GFNISSE-LABEL: constant_lshr_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: pxor %xmm4, %xmm4
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm2 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm4[8],xmm0[9],xmm4[9],xmm0[10],xmm4[10],xmm0[11],xmm4[11],xmm0[12],xmm4[12],xmm0[13],xmm4[13],xmm0[14],xmm4[14],xmm0[15],xmm4[15]
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [2,4,8,16,32,64,128,256]
-; GFNISSE-NEXT: pmullw %xmm5, %xmm0
-; GFNISSE-NEXT: psrlw $8, %xmm0
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [256,128,64,32,16,8,4,2]
-; GFNISSE-NEXT: pmullw %xmm6, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: packuswb %xmm0, %xmm2
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm3 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm4[8],xmm1[9],xmm4[9],xmm1[10],xmm4[10],xmm1[11],xmm4[11],xmm1[12],xmm4[12],xmm1[13],xmm4[13],xmm1[14],xmm4[14],xmm1[15],xmm4[15]
-; GFNISSE-NEXT: pmullw %xmm5, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: pmullw %xmm6, %xmm3
-; GFNISSE-NEXT: psrlw $8, %xmm3
-; GFNISSE-NEXT: packuswb %xmm1, %xmm3
-; GFNISSE-NEXT: movdqa %xmm2, %xmm0
-; GFNISSE-NEXT: movdqa %xmm3, %xmm1
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm2 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm3 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNISSE-NEXT: pand %xmm3, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm1
+; GFNISSE-NEXT: pand %xmm3, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: constant_lshr_v32i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; GFNIAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm1[8],xmm2[8],xmm1[9],xmm2[9],xmm1[10],xmm2[10],xmm1[11],xmm2[11],xmm1[12],xmm2[12],xmm1[13],xmm2[13],xmm1[14],xmm2[14],xmm1[15],xmm2[15]
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm4 = [2,4,8,16,32,64,128,256]
-; GFNIAVX1-NEXT: vpmullw %xmm4, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm5 = [256,128,64,32,16,8,4,2]
-; GFNIAVX1-NEXT: vpmullw %xmm5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpackuswb %xmm3, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm0[8],xmm2[8],xmm0[9],xmm2[9],xmm0[10],xmm2[10],xmm0[11],xmm2[11],xmm0[12],xmm2[12],xmm0[13],xmm2[13],xmm0[14],xmm2[14],xmm0[15],xmm2[15]
-; GFNIAVX1-NEXT: vpmullw %xmm4, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
-; GFNIAVX1-NEXT: vpmullw %xmm5, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vbroadcastsd {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm1, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %ymm1, %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: constant_lshr_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
-; GFNIAVX2-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
-; GFNIAVX2-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpackuswb %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm1, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm1, %ymm0, %ymm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: constant_lshr_v32i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm0[8],ymm1[8],ymm0[9],ymm1[9],ymm0[10],ymm1[10],ymm0[11],ymm1[11],ymm0[12],ymm1[12],ymm0[13],ymm1[13],ymm0[14],ymm1[14],ymm0[15],ymm1[15],ymm0[24],ymm1[24],ymm0[25],ymm1[25],ymm0[26],ymm1[26],ymm0[27],ymm1[27],ymm0[28],ymm1[28],ymm0[29],ymm1[29],ymm0[30],ymm1[30],ymm0[31],ymm1[31]
-; GFNIAVX512VL-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[4],ymm1[4],ymm0[5],ymm1[5],ymm0[6],ymm1[6],ymm0[7],ymm1[7],ymm0[16],ymm1[16],ymm0[17],ymm1[17],ymm0[18],ymm1[18],ymm0[19],ymm1[19],ymm0[20],ymm1[20],ymm0[21],ymm1[21],ymm0[22],ymm1[22],ymm0[23],ymm1[23]
-; GFNIAVX512VL-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpackuswb %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm1 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm1, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: constant_lshr_v32i8:
@@ -1386,80 +1209,78 @@ define <32 x i8> @constant_lshr_v32i8(<32 x i8> %a) nounwind {
define <32 x i8> @constant_ashr_v32i8(<32 x i8> %a) nounwind {
; GFNISSE-LABEL: constant_ashr_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm2
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
-; GFNISSE-NEXT: psraw $8, %xmm2
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm3 = [2,4,8,16,32,64,128,256]
-; GFNISSE-NEXT: pmullw %xmm3, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm0
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [256,128,64,32,16,8,4,2]
-; GFNISSE-NEXT: pmullw %xmm4, %xmm0
-; GFNISSE-NEXT: psrlw $8, %xmm0
-; GFNISSE-NEXT: packuswb %xmm2, %xmm0
-; GFNISSE-NEXT: movdqa %xmm1, %xmm2
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
-; GFNISSE-NEXT: psraw $8, %xmm2
-; GFNISSE-NEXT: pmullw %xmm3, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm1
-; GFNISSE-NEXT: pmullw %xmm4, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm2, %xmm1
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm2 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm3 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm3
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm3
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNISSE-NEXT: pand %xmm5, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0
+; GFNISSE-NEXT: pxor %xmm3, %xmm0
+; GFNISSE-NEXT: psubb %xmm3, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1
+; GFNISSE-NEXT: pand %xmm5, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm2, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1
+; GFNISSE-NEXT: pxor %xmm3, %xmm1
+; GFNISSE-NEXT: psubb %xmm3, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: constant_ashr_v32i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [2,4,8,16,32,64,128,256]
-; GFNIAVX1-NEXT: vpmullw %xmm3, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm4 = [256,128,64,32,16,8,4,2]
-; GFNIAVX1-NEXT: vpmullw %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpackuswb %xmm2, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpmullw %xmm3, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpmullw %xmm4, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX1-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm2
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm3 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm3 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm5 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX1-NEXT: vpand %xmm5, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm1, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vpxor %xmm2, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vpsubb %xmm2, %xmm4, %xmm4
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm5, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm1, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpxor %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpsubb %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: constant_ashr_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm1 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpsraw $8, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpsraw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpackuswb %ymm1, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX2-NEXT: # ymm1 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm2
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm2, %ymm2
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm1, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpxor %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpsubb %ymm2, %ymm0, %ymm0
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: constant_ashr_v32i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm1 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpsraw $8, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpsraw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpackuswb %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX512VL-NEXT: # ymm1 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm2
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpxor %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpsubb %ymm2, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: constant_ashr_v32i8:
@@ -1560,185 +1381,103 @@ define <32 x i8> @splatconstant_ashr_v32i8(<32 x i8> %a) nounwind {
define <64 x i8> @var_shl_v64i8(<64 x i8> %a, <64 x i8> %b) nounwind {
; GFNISSE-LABEL: var_shl_v64i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: movdqa %xmm0, %xmm4
-; GFNISSE-NEXT: pmovsxdq {{.*#+}} xmm9 = [16909320,16909320]
-; GFNISSE-NEXT: movdqa %xmm0, %xmm10
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm10
-; GFNISSE-NEXT: psllw $5, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm10, %xmm4
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm10 = [1108169199648,1108169199648]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm11
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm11
-; GFNISSE-NEXT: paddb %xmm8, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm11, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm11
-; GFNISSE-NEXT: paddb %xmm4, %xmm11
-; GFNISSE-NEXT: paddb %xmm8, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm11, %xmm4
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm8
-; GFNISSE-NEXT: psllw $5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm8
-; GFNISSE-NEXT: paddb %xmm5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: paddb %xmm1, %xmm8
-; GFNISSE-NEXT: paddb %xmm5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm5
-; GFNISSE-NEXT: psllw $5, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm5
-; GFNISSE-NEXT: paddb %xmm6, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: paddb %xmm2, %xmm5
-; GFNISSE-NEXT: paddb %xmm6, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm3, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm5
-; GFNISSE-NEXT: psllw $5, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm5
-; GFNISSE-NEXT: paddb %xmm7, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm5
-; GFNISSE-NEXT: paddb %xmm3, %xmm5
-; GFNISSE-NEXT: paddb %xmm7, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm8 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm8, %xmm9
+; GFNISSE-NEXT: pshufb %xmm4, %xmm9
+; GFNISSE-NEXT: movq {{.*#+}} xmm10 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm10, %xmm11
+; GFNISSE-NEXT: pshufb %xmm4, %xmm11
+; GFNISSE-NEXT: pand %xmm11, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm9, %xmm0
+; GFNISSE-NEXT: movdqa %xmm8, %xmm4
+; GFNISSE-NEXT: pshufb %xmm5, %xmm4
+; GFNISSE-NEXT: movdqa %xmm10, %xmm9
+; GFNISSE-NEXT: pshufb %xmm5, %xmm9
+; GFNISSE-NEXT: pand %xmm9, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm1
+; GFNISSE-NEXT: movdqa %xmm8, %xmm4
+; GFNISSE-NEXT: pshufb %xmm6, %xmm4
+; GFNISSE-NEXT: movdqa %xmm10, %xmm5
+; GFNISSE-NEXT: pshufb %xmm6, %xmm5
+; GFNISSE-NEXT: pand %xmm5, %xmm2
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm2
+; GFNISSE-NEXT: pshufb %xmm7, %xmm8
+; GFNISSE-NEXT: pshufb %xmm7, %xmm10
+; GFNISSE-NEXT: pand %xmm10, %xmm3
+; GFNISSE-NEXT: gf2p8mulb %xmm8, %xmm3
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_shl_v64i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [16909320,16909320]
-; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm6, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm5 = [1108169199648,1108169199648]
-; GFNIAVX1-NEXT: # xmm5 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm6, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm8, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpaddb %xmm6, %xmm6, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm8, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm7, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm0, %xmm7
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm7, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpaddb %xmm0, %xmm0, %xmm7
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm7, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm6, %ymm0, %ymm0
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm2, %xmm6
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm2, %xmm6
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm6
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpsllw $5, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpaddb %xmm1, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm4
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm5 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm4, %xmm5, %xmm6
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm5, %xmm7
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm6, %ymm7, %ymm6
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm7 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm4, %xmm7, %xmm4
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm8
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm8, %xmm4
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm2
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm6, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm5, %xmm4
+; GFNIAVX1-NEXT: vpshufb %xmm3, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm5, %ymm4
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm2
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm5, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm3, %xmm7, %xmm3
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm1, %xmm1
; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm4, %ymm1, %ymm1
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_shl_v64i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm4 = [16909320,16909320,16909320,16909320]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm5
-; GFNIAVX2-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm5, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm5 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm5, %ymm0, %ymm6
-; GFNIAVX2-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm6, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpaddb %ymm0, %ymm0, %ymm6
-; GFNIAVX2-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm6, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm2
-; GFNIAVX2-NEXT: vpsllw $5, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm5, %ymm1, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpaddb %ymm1, %ymm1, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm4 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm4, %ymm5
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm6 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm6 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm6, %ymm2
+; GFNIAVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm5, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm4, %ymm2
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm6, %ymm3
+; GFNIAVX2-NEXT: vpand %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_shl_v64i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm2
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm3 = [16909320,16909320,16909320,16909320]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm2, %ymm4
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm5
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [1108169199648,1108169199648,1108169199648,1108169199648]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm2, %ymm6
-; GFNIAVX512VL-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm6, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpaddb %ymm2, %ymm2, %ymm6
-; GFNIAVX512VL-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm6, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpaddb %ymm0, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm2, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm2
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm3, %ymm4
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm3, %ymm3
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm4, %zmm3, %zmm3
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm4 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm4, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm4, %ymm1
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm2, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %zmm3, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: var_shl_v64i8:
; GFNIAVX512BW: # %bb.0:
-; GFNIAVX512BW-NEXT: vpsllw $5, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpaddb %zmm1, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpaddb %zmm1, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vpaddb %zmm0, %zmm0, %zmm0 {%k1}
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm2 = [9241421688590303745,0,9241421688590303745,0,9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512BW-NEXT: # zmm2 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vpshufb %zmm1, %zmm2, %zmm2
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm3 = [72909780498219007,0,72909780498219007,0,72909780498219007,0,72909780498219007,0]
+; GFNIAVX512BW-NEXT: # zmm3 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vpshufb %zmm1, %zmm3, %zmm1
+; GFNIAVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vgf2p8mulb %zmm2, %zmm0, %zmm0
; GFNIAVX512BW-NEXT: retq
%shift = shl <64 x i8> %a, %b
ret <64 x i8> %shift
@@ -1747,190 +1486,130 @@ define <64 x i8> @var_shl_v64i8(<64 x i8> %a, <64 x i8> %b) nounwind {
define <64 x i8> @var_lshr_v64i8(<64 x i8> %a, <64 x i8> %b) nounwind {
; GFNISSE-LABEL: var_lshr_v64i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: movdqa %xmm0, %xmm4
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm9 = [1161999622361579520,1161999622361579520]
-; GFNISSE-NEXT: movdqa %xmm0, %xmm10
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm10
-; GFNISSE-NEXT: psllw $5, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm10, %xmm4
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm10 = [290499906672525312,290499906672525312]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm11
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm11
-; GFNISSE-NEXT: paddb %xmm8, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm11, %xmm4
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm11 = [145249953336295424,145249953336295424]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm12
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm12
-; GFNISSE-NEXT: paddb %xmm8, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm12, %xmm4
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm8
-; GFNISSE-NEXT: psllw $5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm8
-; GFNISSE-NEXT: paddb %xmm5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm8
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm8
-; GFNISSE-NEXT: paddb %xmm5, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm1
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm5
-; GFNISSE-NEXT: psllw $5, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm5
-; GFNISSE-NEXT: paddb %xmm6, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm5
-; GFNISSE-NEXT: paddb %xmm6, %xmm6
-; GFNISSE-NEXT: movdqa %xmm6, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm2
-; GFNISSE-NEXT: movdqa %xmm3, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm9, %xmm5
-; GFNISSE-NEXT: psllw $5, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm5
-; GFNISSE-NEXT: paddb %xmm7, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm5
-; GFNISSE-NEXT: gf2p8affineqb $0, %xmm11, %xmm5
-; GFNISSE-NEXT: paddb %xmm7, %xmm7
-; GFNISSE-NEXT: movdqa %xmm7, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm9 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm9, %xmm10
+; GFNISSE-NEXT: pshufb %xmm4, %xmm10
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm8 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm0
+; GFNISSE-NEXT: pand %xmm10, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm10 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm10, %xmm11
+; GFNISSE-NEXT: pshufb %xmm4, %xmm11
+; GFNISSE-NEXT: gf2p8mulb %xmm11, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm0
+; GFNISSE-NEXT: movdqa %xmm9, %xmm4
+; GFNISSE-NEXT: pshufb %xmm5, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm1
+; GFNISSE-NEXT: pand %xmm4, %xmm1
+; GFNISSE-NEXT: movdqa %xmm10, %xmm4
+; GFNISSE-NEXT: pshufb %xmm5, %xmm4
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm1
+; GFNISSE-NEXT: movdqa %xmm9, %xmm4
+; GFNISSE-NEXT: pshufb %xmm6, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm2
+; GFNISSE-NEXT: pand %xmm4, %xmm2
+; GFNISSE-NEXT: movdqa %xmm10, %xmm4
+; GFNISSE-NEXT: pshufb %xmm6, %xmm4
+; GFNISSE-NEXT: gf2p8mulb %xmm4, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm2
+; GFNISSE-NEXT: pshufb %xmm7, %xmm9
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm3
+; GFNISSE-NEXT: pand %xmm9, %xmm3
+; GFNISSE-NEXT: pshufb %xmm7, %xmm10
+; GFNISSE-NEXT: gf2p8mulb %xmm10, %xmm3
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm8, %xmm3
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_lshr_v64i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [1161999622361579520,1161999622361579520]
-; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm7
-; GFNIAVX1-NEXT: vpsllw $5, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm6, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm5 = [290499906672525312,290499906672525312]
-; GFNIAVX1-NEXT: # xmm5 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm6, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm8, %xmm6, %xmm8
-; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm6 = [145249953336295424,145249953336295424]
-; GFNIAVX1-NEXT: # xmm6 = mem[0,0]
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm8, %xmm9
-; GFNIAVX1-NEXT: vpaddb %xmm7, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm7, %xmm9, %xmm8, %xmm7
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm8
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm0, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm0, %xmm8
-; GFNIAVX1-NEXT: vpaddb %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm8, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm5
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm6 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm5, %xmm6, %xmm7
+; GFNIAVX1-NEXT: vbroadcastsd {{.*#+}} ymm4 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm8
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm8, %xmm8
+; GFNIAVX1-NEXT: vpand %xmm7, %xmm8, %xmm7
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm6, %xmm8
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm0, %xmm8, %xmm0
; GFNIAVX1-NEXT: vinsertf128 $1, %xmm7, %ymm0, %ymm0
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm2, %xmm7
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm8
-; GFNIAVX1-NEXT: vpsllw $5, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm8, %xmm7, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm2, %xmm7
-; GFNIAVX1-NEXT: vpaddb %xmm8, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm8, %xmm7, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm2, %xmm7
-; GFNIAVX1-NEXT: vpaddb %xmm8, %xmm8, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm8, %xmm7, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpsllw $5, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm5, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm6, %xmm1, %xmm4
-; GFNIAVX1-NEXT: vpaddb %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm4, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm7 = [1,2,4,8,16,32,64,128,0,0,0,0,0,0,0,0]
+; GFNIAVX1-NEXT: vpshufb %xmm5, %xmm7, %xmm5
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm2
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm5, %ymm2, %ymm2
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm6, %xmm5
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm8
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm8, %xmm8
+; GFNIAVX1-NEXT: vpand %xmm5, %xmm8, %xmm5
+; GFNIAVX1-NEXT: vpshufb %xmm3, %xmm6, %xmm6
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm5, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm7, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm3, %xmm7, %xmm3
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm3, %ymm2
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_lshr_v64i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm4 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm5
-; GFNIAVX2-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm5, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm5 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm5, %ymm0, %ymm6
-; GFNIAVX2-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm6, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm6 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm6, %ymm0, %ymm7
-; GFNIAVX2-NEXT: vpaddb %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm7, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm2
-; GFNIAVX2-NEXT: vpsllw $5, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm5, %ymm1, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm6, %ymm1, %ymm2
-; GFNIAVX2-NEXT: vpaddb %ymm3, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm4 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm4, %ymm5
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm6 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm6, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand %ymm5, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm5, %ymm2
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm6, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm4, %ymm2
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm6, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm5, %ymm2
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm6, %ymm1, %ymm1
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_lshr_v64i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm2
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm3 = [1161999622361579520,1161999622361579520,1161999622361579520,1161999622361579520]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm2, %ymm4
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm5
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm4, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm4 = [290499906672525312,290499906672525312,290499906672525312,290499906672525312]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm2, %ymm6
-; GFNIAVX512VL-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm6, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm6 = [145249953336295424,145249953336295424,145249953336295424,145249953336295424]
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm6, %ymm2, %ymm7
-; GFNIAVX512VL-NEXT: vpaddb %ymm5, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm5, %ymm7, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm6, %ymm0, %ymm3
-; GFNIAVX512VL-NEXT: vpaddb %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm2, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm2
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm3, %ymm4
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm3, %ymm3
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm4, %zmm3, %zmm3
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm4 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm4, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm4, %ymm1
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm2, %zmm1, %zmm1
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} zmm2 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %zmm2, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %zmm3, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %zmm2, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: var_lshr_v64i8:
; GFNIAVX512BW: # %bb.0:
-; GFNIAVX512BW-NEXT: vpsllw $5, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpaddb %zmm1, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpaddb %zmm1, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0 {%k1}
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm2 = [72909780498219007,0,72909780498219007,0,72909780498219007,0,72909780498219007,0]
+; GFNIAVX512BW-NEXT: # zmm2 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vpshufb %zmm1, %zmm2, %zmm2
+; GFNIAVX512BW-NEXT: vpbroadcastq {{.*#+}} zmm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm3, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpandq %zmm2, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm2 = [9241421688590303745,0,9241421688590303745,0,9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512BW-NEXT: # zmm2 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vpshufb %zmm1, %zmm2, %zmm1
+; GFNIAVX512BW-NEXT: vgf2p8mulb %zmm1, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm3, %zmm0, %zmm0
; GFNIAVX512BW-NEXT: retq
%shift = lshr <64 x i8> %a, %b
ret <64 x i8> %shift
@@ -1939,375 +1618,206 @@ define <64 x i8> @var_lshr_v64i8(<64 x i8> %a, <64 x i8> %b) nounwind {
define <64 x i8> @var_ashr_v64i8(<64 x i8> %a, <64 x i8> %b) nounwind {
; GFNISSE-LABEL: var_ashr_v64i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm8
-; GFNISSE-NEXT: psllw $5, %xmm4
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm4[8],xmm0[9],xmm4[9],xmm0[10],xmm4[10],xmm0[11],xmm4[11],xmm0[12],xmm4[12],xmm0[13],xmm4[13],xmm0[14],xmm4[14],xmm0[15],xmm4[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm9 = xmm9[8],xmm8[8],xmm9[9],xmm8[9],xmm9[10],xmm8[10],xmm9[11],xmm8[11],xmm9[12],xmm8[12],xmm9[13],xmm8[13],xmm9[14],xmm8[14],xmm9[15],xmm8[15]
-; GFNISSE-NEXT: movdqa %xmm9, %xmm10
-; GFNISSE-NEXT: psraw $4, %xmm10
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm10, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm10
-; GFNISSE-NEXT: psraw $2, %xmm10
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm10, %xmm9
-; GFNISSE-NEXT: movdqa %xmm9, %xmm10
-; GFNISSE-NEXT: psraw $1, %xmm10
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm10, %xmm9
-; GFNISSE-NEXT: psrlw $8, %xmm9
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm8[0],xmm4[1],xmm8[1],xmm4[2],xmm8[2],xmm4[3],xmm8[3],xmm4[4],xmm8[4],xmm4[5],xmm8[5],xmm4[6],xmm8[6],xmm4[7],xmm8[7]
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: psraw $4, %xmm8
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: psraw $2, %xmm8
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm4
-; GFNISSE-NEXT: movdqa %xmm4, %xmm8
-; GFNISSE-NEXT: psraw $1, %xmm8
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm4
-; GFNISSE-NEXT: psrlw $8, %xmm4
-; GFNISSE-NEXT: packuswb %xmm9, %xmm4
-; GFNISSE-NEXT: psllw $5, %xmm5
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm5[8],xmm0[9],xmm5[9],xmm0[10],xmm5[10],xmm0[11],xmm5[11],xmm0[12],xmm5[12],xmm0[13],xmm5[13],xmm0[14],xmm5[14],xmm0[15],xmm5[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm8 = xmm8[8],xmm1[8],xmm8[9],xmm1[9],xmm8[10],xmm1[10],xmm8[11],xmm1[11],xmm8[12],xmm1[12],xmm8[13],xmm1[13],xmm8[14],xmm1[14],xmm8[15],xmm1[15]
-; GFNISSE-NEXT: movdqa %xmm8, %xmm9
-; GFNISSE-NEXT: psraw $4, %xmm9
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm9, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm9
-; GFNISSE-NEXT: psraw $2, %xmm9
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm9, %xmm8
-; GFNISSE-NEXT: movdqa %xmm8, %xmm9
-; GFNISSE-NEXT: psraw $1, %xmm9
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm9, %xmm8
-; GFNISSE-NEXT: psrlw $8, %xmm8
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1],xmm0[2],xmm5[2],xmm0[3],xmm5[3],xmm0[4],xmm5[4],xmm0[5],xmm5[5],xmm0[6],xmm5[6],xmm0[7],xmm5[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: movdqa %xmm1, %xmm5
-; GFNISSE-NEXT: psraw $4, %xmm5
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm5
-; GFNISSE-NEXT: psraw $2, %xmm5
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm1
-; GFNISSE-NEXT: movdqa %xmm1, %xmm5
-; GFNISSE-NEXT: psraw $1, %xmm5
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm5, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm8, %xmm1
-; GFNISSE-NEXT: psllw $5, %xmm6
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm6[8],xmm0[9],xmm6[9],xmm0[10],xmm6[10],xmm0[11],xmm6[11],xmm0[12],xmm6[12],xmm0[13],xmm6[13],xmm0[14],xmm6[14],xmm0[15],xmm6[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm5 = xmm5[8],xmm2[8],xmm5[9],xmm2[9],xmm5[10],xmm2[10],xmm5[11],xmm2[11],xmm5[12],xmm2[12],xmm5[13],xmm2[13],xmm5[14],xmm2[14],xmm5[15],xmm2[15]
-; GFNISSE-NEXT: movdqa %xmm5, %xmm8
-; GFNISSE-NEXT: psraw $4, %xmm8
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm8
-; GFNISSE-NEXT: psraw $2, %xmm8
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm8
-; GFNISSE-NEXT: psraw $1, %xmm8
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm8, %xmm5
-; GFNISSE-NEXT: psrlw $8, %xmm5
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1],xmm0[2],xmm6[2],xmm0[3],xmm6[3],xmm0[4],xmm6[4],xmm0[5],xmm6[5],xmm0[6],xmm6[6],xmm0[7],xmm6[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: movdqa %xmm2, %xmm6
-; GFNISSE-NEXT: psraw $4, %xmm6
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm6
-; GFNISSE-NEXT: psraw $2, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm2
-; GFNISSE-NEXT: movdqa %xmm2, %xmm6
-; GFNISSE-NEXT: psraw $1, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: packuswb %xmm5, %xmm2
-; GFNISSE-NEXT: psllw $5, %xmm7
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm7[8],xmm0[9],xmm7[9],xmm0[10],xmm7[10],xmm0[11],xmm7[11],xmm0[12],xmm7[12],xmm0[13],xmm7[13],xmm0[14],xmm7[14],xmm0[15],xmm7[15]
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm5 = xmm5[8],xmm3[8],xmm5[9],xmm3[9],xmm5[10],xmm3[10],xmm5[11],xmm3[11],xmm5[12],xmm3[12],xmm5[13],xmm3[13],xmm5[14],xmm3[14],xmm5[15],xmm3[15]
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: psraw $4, %xmm6
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: psraw $2, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm5
-; GFNISSE-NEXT: movdqa %xmm5, %xmm6
-; GFNISSE-NEXT: psraw $1, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm5
-; GFNISSE-NEXT: psrlw $8, %xmm5
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1],xmm0[2],xmm7[2],xmm0[3],xmm7[3],xmm0[4],xmm7[4],xmm0[5],xmm7[5],xmm0[6],xmm7[6],xmm0[7],xmm7[7]
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: movdqa %xmm3, %xmm6
-; GFNISSE-NEXT: psraw $4, %xmm6
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm6
-; GFNISSE-NEXT: psraw $2, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm3
-; GFNISSE-NEXT: movdqa %xmm3, %xmm6
-; GFNISSE-NEXT: psraw $1, %xmm6
-; GFNISSE-NEXT: paddw %xmm0, %xmm0
-; GFNISSE-NEXT: pblendvb %xmm0, %xmm6, %xmm3
-; GFNISSE-NEXT: psrlw $8, %xmm3
-; GFNISSE-NEXT: packuswb %xmm5, %xmm3
-; GFNISSE-NEXT: movdqa %xmm4, %xmm0
+; GFNISSE-NEXT: movq {{.*#+}} xmm8 = [9241421688590303745,0]
+; GFNISSE-NEXT: movdqa %xmm8, %xmm11
+; GFNISSE-NEXT: pshufb %xmm4, %xmm11
+; GFNISSE-NEXT: movq {{.*#+}} xmm9 = [72909780498219007,0]
+; GFNISSE-NEXT: movdqa %xmm9, %xmm12
+; GFNISSE-NEXT: pshufb %xmm4, %xmm12
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm10 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm0
+; GFNISSE-NEXT: pand %xmm12, %xmm0
+; GFNISSE-NEXT: pand %xmm4, %xmm12
+; GFNISSE-NEXT: gf2p8mulb %xmm11, %xmm12
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm12
+; GFNISSE-NEXT: gf2p8mulb %xmm11, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm0
+; GFNISSE-NEXT: pxor %xmm12, %xmm0
+; GFNISSE-NEXT: psubb %xmm12, %xmm0
+; GFNISSE-NEXT: movdqa %xmm8, %xmm11
+; GFNISSE-NEXT: pshufb %xmm5, %xmm11
+; GFNISSE-NEXT: movdqa %xmm9, %xmm12
+; GFNISSE-NEXT: pshufb %xmm5, %xmm12
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm1
+; GFNISSE-NEXT: pand %xmm12, %xmm1
+; GFNISSE-NEXT: pand %xmm4, %xmm12
+; GFNISSE-NEXT: gf2p8mulb %xmm11, %xmm12
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm12
+; GFNISSE-NEXT: gf2p8mulb %xmm11, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm1
+; GFNISSE-NEXT: pxor %xmm12, %xmm1
+; GFNISSE-NEXT: psubb %xmm12, %xmm1
+; GFNISSE-NEXT: movdqa %xmm8, %xmm5
+; GFNISSE-NEXT: pshufb %xmm6, %xmm5
+; GFNISSE-NEXT: movdqa %xmm9, %xmm11
+; GFNISSE-NEXT: pshufb %xmm6, %xmm11
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm2
+; GFNISSE-NEXT: pand %xmm11, %xmm2
+; GFNISSE-NEXT: pand %xmm4, %xmm11
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm11
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm11
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm2
+; GFNISSE-NEXT: pxor %xmm11, %xmm2
+; GFNISSE-NEXT: psubb %xmm11, %xmm2
+; GFNISSE-NEXT: pshufb %xmm7, %xmm8
+; GFNISSE-NEXT: pshufb %xmm7, %xmm9
+; GFNISSE-NEXT: pand %xmm9, %xmm4
+; GFNISSE-NEXT: gf2p8mulb %xmm8, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm3
+; GFNISSE-NEXT: pand %xmm9, %xmm3
+; GFNISSE-NEXT: gf2p8mulb %xmm8, %xmm3
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm10, %xmm3
+; GFNISSE-NEXT: pxor %xmm4, %xmm3
+; GFNISSE-NEXT: psubb %xmm4, %xmm3
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: var_ashr_v64i8:
; GFNIAVX1: # %bb.0:
; GFNIAVX1-NEXT: vextractf128 $1, %ymm2, %xmm4
-; GFNIAVX1-NEXT: vpsllw $5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm4[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm6
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm7 = xmm6[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm7, %xmm8
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm8, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpsraw $2, %xmm7, %xmm8
-; GFNIAVX1-NEXT: vpaddw %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm8, %xmm7, %xmm7
-; GFNIAVX1-NEXT: vpsraw $1, %xmm7, %xmm8
-; GFNIAVX1-NEXT: vpaddw %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm8, %xmm7, %xmm5
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm4 = xmm4[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm6 = xmm6[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm7, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpsraw $2, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpaddw %xmm4, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm7, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpsraw $1, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpaddw %xmm4, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm7, %xmm6, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpackuswb %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm2[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm6 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm7, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpsraw $2, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpaddw %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm7, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpsraw $1, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpaddw %xmm5, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm5, %xmm7, %xmm6, %xmm5
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm0, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm6, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsraw $2, %xmm0, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm6, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsraw $1, %xmm0, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm6, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm5, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm5 = [9241421688590303745,0]
+; GFNIAVX1-NEXT: vpshufb %xmm4, %xmm5, %xmm8
+; GFNIAVX1-NEXT: vmovq {{.*#+}} xmm6 = [72909780498219007,0]
+; GFNIAVX1-NEXT: vpshufb %xmm4, %xmm6, %xmm9
+; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} xmm7 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNIAVX1-NEXT: vpand %xmm7, %xmm9, %xmm4
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm8, %xmm4, %xmm10
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm11
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm11, %xmm11
+; GFNIAVX1-NEXT: vpand %xmm9, %xmm11, %xmm9
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm8, %xmm9, %xmm8
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm8, %xmm8
+; GFNIAVX1-NEXT: vpxor %xmm10, %xmm8, %xmm8
+; GFNIAVX1-NEXT: vpsubb %xmm10, %xmm8, %xmm8
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm5, %xmm9
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm6, %xmm2
+; GFNIAVX1-NEXT: vpand %xmm7, %xmm2, %xmm10
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm9, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm9, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpxor %xmm0, %xmm10, %xmm0
+; GFNIAVX1-NEXT: vpsubb %xmm10, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm8, %ymm0, %ymm0
; GFNIAVX1-NEXT: vextractf128 $1, %ymm3, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm4 = xmm2[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm6 = xmm5[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm7, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpsraw $2, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpaddw %xmm4, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm7, %xmm6, %xmm6
-; GFNIAVX1-NEXT: vpsraw $1, %xmm6, %xmm7
-; GFNIAVX1-NEXT: vpaddw %xmm4, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm7, %xmm6, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm5 = xmm5[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsraw $2, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsraw $1, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpblendvb %xmm2, %xmm6, %xmm5, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpackuswb %xmm4, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsllw $5, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm4 = xmm3[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsraw $2, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm4, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm6, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsraw $1, %xmm5, %xmm6
-; GFNIAVX1-NEXT: vpaddw %xmm4, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpblendvb %xmm4, %xmm6, %xmm5, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $4, %xmm1, %xmm5
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsraw $2, %xmm1, %xmm5
-; GFNIAVX1-NEXT: vpaddw %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsraw $1, %xmm1, %xmm5
-; GFNIAVX1-NEXT: vpaddw %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpblendvb %xmm3, %xmm5, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpackuswb %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm5, %xmm8
+; GFNIAVX1-NEXT: vpshufb %xmm2, %xmm6, %xmm2
+; GFNIAVX1-NEXT: vpand %xmm7, %xmm2, %xmm9
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm8, %xmm9, %xmm9
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm9, %xmm9
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm10
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm10, %xmm10
+; GFNIAVX1-NEXT: vpand %xmm2, %xmm10, %xmm2
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm8, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpxor %xmm2, %xmm9, %xmm2
+; GFNIAVX1-NEXT: vpsubb %xmm9, %xmm2, %xmm2
+; GFNIAVX1-NEXT: vpshufb %xmm3, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpshufb %xmm3, %xmm6, %xmm3
+; GFNIAVX1-NEXT: vpand %xmm7, %xmm3, %xmm6
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm5, %xmm6, %xmm6
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm6, %xmm6
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm3, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm5, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpxor %xmm6, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpsubb %xmm6, %xmm1, %xmm1
; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: var_ashr_v64i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm4 = ymm2[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm5 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpsraw $4, %ymm5, %ymm6
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm6, %ymm5, %ymm5
-; GFNIAVX2-NEXT: vpsraw $2, %ymm5, %ymm6
-; GFNIAVX2-NEXT: vpaddw %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm6, %ymm5, %ymm5
-; GFNIAVX2-NEXT: vpsraw $1, %ymm5, %ymm6
-; GFNIAVX2-NEXT: vpaddw %ymm4, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm4, %ymm6, %ymm5, %ymm4
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpsraw $4, %ymm0, %ymm5
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm5, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsraw $2, %ymm0, %ymm5
-; GFNIAVX2-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm5, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsraw $1, %ymm0, %ymm5
-; GFNIAVX2-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm5, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpackuswb %ymm4, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsllw $5, %ymm3, %ymm2
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm2[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm4 = ymm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpsraw $4, %ymm4, %ymm5
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm5, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpsraw $2, %ymm4, %ymm5
-; GFNIAVX2-NEXT: vpaddw %ymm3, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm5, %ymm4, %ymm4
-; GFNIAVX2-NEXT: vpsraw $1, %ymm4, %ymm5
-; GFNIAVX2-NEXT: vpaddw %ymm3, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpblendvb %ymm3, %ymm5, %ymm4, %ymm3
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpsraw $4, %ymm1, %ymm4
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm4, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpsraw $2, %ymm1, %ymm4
-; GFNIAVX2-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm4, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpsraw $1, %ymm1, %ymm4
-; GFNIAVX2-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpblendvb %ymm2, %ymm4, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpackuswb %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX2-NEXT: # ymm4 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm4, %ymm5
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm6 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX2-NEXT: # ymm6 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpshufb %ymm2, %ymm6, %ymm2
+; GFNIAVX2-NEXT: vpbroadcastb {{.*#+}} ymm7 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNIAVX2-NEXT: vpand %ymm7, %ymm2, %ymm8
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm5, %ymm8, %ymm8
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm9 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm8, %ymm8
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm5, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpxor %ymm0, %ymm8, %ymm0
+; GFNIAVX2-NEXT: vpsubb %ymm8, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm4, %ymm2
+; GFNIAVX2-NEXT: vpshufb %ymm3, %ymm6, %ymm3
+; GFNIAVX2-NEXT: vpand %ymm7, %ymm3, %ymm4
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm4, %ymm4
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm4, %ymm4
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm9, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpxor %ymm4, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpsubb %ymm4, %ymm1, %ymm1
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: var_ashr_v64i8:
; GFNIAVX512VL: # %bb.0:
; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm1, %ymm2
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm2[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm4
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm5 = ymm4[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpsraw $4, %ymm5, %ymm6
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm6, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpsraw $2, %ymm5, %ymm6
-; GFNIAVX512VL-NEXT: vpaddw %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm6, %ymm5, %ymm5
-; GFNIAVX512VL-NEXT: vpsraw $1, %ymm5, %ymm6
-; GFNIAVX512VL-NEXT: vpaddw %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm6, %ymm5, %ymm3
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm2 = ymm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm4 = ymm4[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpsraw $4, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm5, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpsraw $2, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm5, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpsraw $1, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vpaddw %ymm2, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpblendvb %ymm2, %ymm5, %ymm4, %ymm2
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpackuswb %ymm3, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsllw $5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm4 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpsraw $4, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm5, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpsraw $2, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vpaddw %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm5, %ymm4, %ymm4
-; GFNIAVX512VL-NEXT: vpsraw $1, %ymm4, %ymm5
-; GFNIAVX512VL-NEXT: vpaddw %ymm3, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpblendvb %ymm3, %ymm5, %ymm4, %ymm3
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpsraw $4, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsraw $2, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpaddw %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsraw $1, %ymm0, %ymm4
-; GFNIAVX512VL-NEXT: vpaddw %ymm1, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpblendvb %ymm1, %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpackuswb %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512VL-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm3, %ymm4
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [72909780498219007,0,72909780498219007,0]
+; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpshufb %ymm2, %ymm5, %ymm2
+; GFNIAVX512VL-NEXT: vpbroadcastd {{.*#+}} ymm6 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNIAVX512VL-NEXT: vpand %ymm6, %ymm2, %ymm7
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm4, %ymm7, %ymm7
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm8 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm8, %ymm7, %ymm7
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm9
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm8, %ymm9, %ymm9
+; GFNIAVX512VL-NEXT: vpand %ymm2, %ymm9, %ymm2
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm4, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm8, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpxor %ymm7, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpsubb %ymm7, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm3, %ymm3
+; GFNIAVX512VL-NEXT: vpshufb %ymm1, %ymm5, %ymm1
+; GFNIAVX512VL-NEXT: vpand %ymm6, %ymm1, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm3, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm8, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm8, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm8, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpxor %ymm4, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpsubb %ymm4, %ymm0, %ymm0
; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm2, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: var_ashr_v64i8:
; GFNIAVX512BW: # %bb.0:
-; GFNIAVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm2 = zmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
-; GFNIAVX512BW-NEXT: vpsraw $4, %zmm2, %zmm3
-; GFNIAVX512BW-NEXT: vpsllw $5, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm4 = zmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm4, %k1
-; GFNIAVX512BW-NEXT: vmovdqu8 %zmm3, %zmm2 {%k1}
-; GFNIAVX512BW-NEXT: vpsraw $2, %zmm2, %zmm3
-; GFNIAVX512BW-NEXT: vpaddw %zmm4, %zmm4, %zmm4
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm4, %k1
-; GFNIAVX512BW-NEXT: vmovdqu8 %zmm3, %zmm2 {%k1}
-; GFNIAVX512BW-NEXT: vpsraw $1, %zmm2, %zmm3
-; GFNIAVX512BW-NEXT: vpaddw %zmm4, %zmm4, %zmm4
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm4, %k1
-; GFNIAVX512BW-NEXT: vmovdqu8 %zmm3, %zmm2 {%k1}
-; GFNIAVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
-; GFNIAVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm0 = zmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
-; GFNIAVX512BW-NEXT: vpsraw $4, %zmm0, %zmm3
-; GFNIAVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm1 = zmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vmovdqu8 %zmm3, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpsraw $2, %zmm0, %zmm3
-; GFNIAVX512BW-NEXT: vpaddw %zmm1, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vmovdqu8 %zmm3, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpsraw $1, %zmm0, %zmm3
-; GFNIAVX512BW-NEXT: vpaddw %zmm1, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpmovb2m %zmm1, %k1
-; GFNIAVX512BW-NEXT: vmovdqu8 %zmm3, %zmm0 {%k1}
-; GFNIAVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: vpackuswb %zmm2, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm2 = [9241421688590303745,0,9241421688590303745,0,9241421688590303745,0,9241421688590303745,0]
+; GFNIAVX512BW-NEXT: # zmm2 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vpshufb %zmm1, %zmm2, %zmm2
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm3 = [72909780498219007,0,72909780498219007,0,72909780498219007,0,72909780498219007,0]
+; GFNIAVX512BW-NEXT: # zmm3 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vpshufb %zmm1, %zmm3, %zmm1
+; GFNIAVX512BW-NEXT: vpandd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm1, %zmm3
+; GFNIAVX512BW-NEXT: vgf2p8mulb %zmm2, %zmm3, %zmm3
+; GFNIAVX512BW-NEXT: vpbroadcastq {{.*#+}} zmm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm4, %zmm3, %zmm3
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm4, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vgf2p8mulb %zmm2, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm4, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpxorq %zmm3, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpsubb %zmm3, %zmm0, %zmm0
; GFNIAVX512BW-NEXT: retq
%shift = ashr <64 x i8> %a, %b
ret <64 x i8> %shift
@@ -2730,141 +2240,76 @@ define <64 x i8> @constant_shl_v64i8(<64 x i8> %a) nounwind {
define <64 x i8> @constant_lshr_v64i8(<64 x i8> %a) nounwind {
; GFNISSE-LABEL: constant_lshr_v64i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm1, %xmm4
-; GFNISSE-NEXT: movdqa %xmm0, %xmm1
-; GFNISSE-NEXT: pxor %xmm6, %xmm6
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm6[8],xmm1[9],xmm6[9],xmm1[10],xmm6[10],xmm1[11],xmm6[11],xmm1[12],xmm6[12],xmm1[13],xmm6[13],xmm1[14],xmm6[14],xmm1[15],xmm6[15]
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm7 = [2,4,8,16,32,64,128,256]
-; GFNISSE-NEXT: pmullw %xmm7, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm8 = [256,128,64,32,16,8,4,2]
-; GFNISSE-NEXT: pmullw %xmm8, %xmm0
-; GFNISSE-NEXT: psrlw $8, %xmm0
-; GFNISSE-NEXT: packuswb %xmm1, %xmm0
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm1 = xmm4[0],zero,xmm4[1],zero,xmm4[2],zero,xmm4[3],zero,xmm4[4],zero,xmm4[5],zero,xmm4[6],zero,xmm4[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm6[8],xmm4[9],xmm6[9],xmm4[10],xmm6[10],xmm4[11],xmm6[11],xmm4[12],xmm6[12],xmm4[13],xmm6[13],xmm4[14],xmm6[14],xmm4[15],xmm6[15]
-; GFNISSE-NEXT: pmullw %xmm7, %xmm4
-; GFNISSE-NEXT: psrlw $8, %xmm4
-; GFNISSE-NEXT: pmullw %xmm8, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm4, %xmm1
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm4 = xmm2[0],zero,xmm2[1],zero,xmm2[2],zero,xmm2[3],zero,xmm2[4],zero,xmm2[5],zero,xmm2[6],zero,xmm2[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm6[8],xmm2[9],xmm6[9],xmm2[10],xmm6[10],xmm2[11],xmm6[11],xmm2[12],xmm6[12],xmm2[13],xmm6[13],xmm2[14],xmm6[14],xmm2[15],xmm6[15]
-; GFNISSE-NEXT: pmullw %xmm7, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: pmullw %xmm8, %xmm4
-; GFNISSE-NEXT: psrlw $8, %xmm4
-; GFNISSE-NEXT: packuswb %xmm2, %xmm4
-; GFNISSE-NEXT: pmovzxbw {{.*#+}} xmm5 = xmm3[0],zero,xmm3[1],zero,xmm3[2],zero,xmm3[3],zero,xmm3[4],zero,xmm3[5],zero,xmm3[6],zero,xmm3[7],zero
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm3 = xmm3[8],xmm6[8],xmm3[9],xmm6[9],xmm3[10],xmm6[10],xmm3[11],xmm6[11],xmm3[12],xmm6[12],xmm3[13],xmm6[13],xmm3[14],xmm6[14],xmm3[15],xmm6[15]
-; GFNISSE-NEXT: pmullw %xmm7, %xmm3
-; GFNISSE-NEXT: psrlw $8, %xmm3
-; GFNISSE-NEXT: pmullw %xmm8, %xmm5
-; GFNISSE-NEXT: psrlw $8, %xmm5
-; GFNISSE-NEXT: packuswb %xmm3, %xmm5
-; GFNISSE-NEXT: movdqa %xmm4, %xmm2
-; GFNISSE-NEXT: movdqa %xmm5, %xmm3
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNISSE-NEXT: pand %xmm5, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNISSE-NEXT: gf2p8mulb %xmm6, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1
+; GFNISSE-NEXT: pand %xmm5, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm6, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm2
+; GFNISSE-NEXT: pand %xmm5, %xmm2
+; GFNISSE-NEXT: gf2p8mulb %xmm6, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm3
+; GFNISSE-NEXT: pand %xmm5, %xmm3
+; GFNISSE-NEXT: gf2p8mulb %xmm6, %xmm3
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm3
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: constant_lshr_v64i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
-; GFNIAVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm4 = xmm2[8],xmm3[8],xmm2[9],xmm3[9],xmm2[10],xmm3[10],xmm2[11],xmm3[11],xmm2[12],xmm3[12],xmm2[13],xmm3[13],xmm2[14],xmm3[14],xmm2[15],xmm3[15]
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm5 = [2,4,8,16,32,64,128,256]
-; GFNIAVX1-NEXT: vpmullw %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm2 = xmm2[0],zero,xmm2[1],zero,xmm2[2],zero,xmm2[3],zero,xmm2[4],zero,xmm2[5],zero,xmm2[6],zero,xmm2[7],zero
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm6 = [256,128,64,32,16,8,4,2]
-; GFNIAVX1-NEXT: vpmullw %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpackuswb %xmm4, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm4 = xmm0[8],xmm3[8],xmm0[9],xmm3[9],xmm0[10],xmm3[10],xmm0[11],xmm3[11],xmm0[12],xmm3[12],xmm0[13],xmm3[13],xmm0[14],xmm3[14],xmm0[15],xmm3[15]
-; GFNIAVX1-NEXT: vpmullw %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
-; GFNIAVX1-NEXT: vpmullw %xmm6, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm4, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm4 = xmm2[8],xmm3[8],xmm2[9],xmm3[9],xmm2[10],xmm3[10],xmm2[11],xmm3[11],xmm2[12],xmm3[12],xmm2[13],xmm3[13],xmm2[14],xmm3[14],xmm2[15],xmm3[15]
-; GFNIAVX1-NEXT: vpmullw %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm2 = xmm2[0],zero,xmm2[1],zero,xmm2[2],zero,xmm2[3],zero,xmm2[4],zero,xmm2[5],zero,xmm2[6],zero,xmm2[7],zero
-; GFNIAVX1-NEXT: vpmullw %xmm6, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpackuswb %xmm4, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm1[8],xmm3[8],xmm1[9],xmm3[9],xmm1[10],xmm3[10],xmm1[11],xmm3[11],xmm1[12],xmm3[12],xmm1[13],xmm3[13],xmm1[14],xmm3[14],xmm1[15],xmm3[15]
-; GFNIAVX1-NEXT: vpmullw %xmm5, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm3, %xmm3
-; GFNIAVX1-NEXT: vpmovzxbw {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
-; GFNIAVX1-NEXT: vpmullw %xmm6, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpackuswb %xmm3, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vbroadcastsd {{.*#+}} ymm2 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm2, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm4 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm3, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vbroadcastf128 {{.*#+}} ymm3 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX1-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm3, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm2, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm2, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm5, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vgf2p8mulb %ymm3, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %ymm2, %ymm1, %ymm1
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: constant_lshr_v64i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8],ymm2[8],ymm0[9],ymm2[9],ymm0[10],ymm2[10],ymm0[11],ymm2[11],ymm0[12],ymm2[12],ymm0[13],ymm2[13],ymm0[14],ymm2[14],ymm0[15],ymm2[15],ymm0[24],ymm2[24],ymm0[25],ymm2[25],ymm0[26],ymm2[26],ymm0[27],ymm2[27],ymm0[28],ymm2[28],ymm0[29],ymm2[29],ymm0[30],ymm2[30],ymm0[31],ymm2[31]
-; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [2,4,8,16,32,64,128,256,2,4,8,16,32,64,128,256]
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255,255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX2-NEXT: # ymm3 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpand %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
; GFNIAVX2-NEXT: # ymm4 = mem[0,1,0,1]
-; GFNIAVX2-NEXT: vpmullw %ymm4, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0],ymm2[0],ymm0[1],ymm2[1],ymm0[2],ymm2[2],ymm0[3],ymm2[3],ymm0[4],ymm2[4],ymm0[5],ymm2[5],ymm0[6],ymm2[6],ymm0[7],ymm2[7],ymm0[16],ymm2[16],ymm0[17],ymm2[17],ymm0[18],ymm2[18],ymm0[19],ymm2[19],ymm0[20],ymm2[20],ymm0[21],ymm2[21],ymm0[22],ymm2[22],ymm0[23],ymm2[23]
-; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [256,128,64,32,16,8,4,2,256,128,64,32,16,8,4,2]
-; GFNIAVX2-NEXT: # ymm5 = mem[0,1,0,1]
-; GFNIAVX2-NEXT: vpmullw %ymm5, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpackuswb %ymm3, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm1[8],ymm2[8],ymm1[9],ymm2[9],ymm1[10],ymm2[10],ymm1[11],ymm2[11],ymm1[12],ymm2[12],ymm1[13],ymm2[13],ymm1[14],ymm2[14],ymm1[15],ymm2[15],ymm1[24],ymm2[24],ymm1[25],ymm2[25],ymm1[26],ymm2[26],ymm1[27],ymm2[27],ymm1[28],ymm2[28],ymm1[29],ymm2[29],ymm1[30],ymm2[30],ymm1[31],ymm2[31]
-; GFNIAVX2-NEXT: vpmullw %ymm4, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0],ymm2[0],ymm1[1],ymm2[1],ymm1[2],ymm2[2],ymm1[3],ymm2[3],ymm1[4],ymm2[4],ymm1[5],ymm2[5],ymm1[6],ymm2[6],ymm1[7],ymm2[7],ymm1[16],ymm2[16],ymm1[17],ymm2[17],ymm1[18],ymm2[18],ymm1[19],ymm2[19],ymm1[20],ymm2[20],ymm1[21],ymm2[21],ymm1[22],ymm2[22],ymm1[23],ymm2[23]
-; GFNIAVX2-NEXT: vpmullw %ymm5, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpackuswb %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm4, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm4, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm2, %ymm1, %ymm1
; GFNIAVX2-NEXT: retq
;
-; GFNIAVX512VL-LABEL: constant_lshr_v64i8:
-; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; GFNIAVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm1[8],ymm2[8],ymm1[9],ymm2[9],ymm1[10],ymm2[10],ymm1[11],ymm2[11],ymm1[12],ymm2[12],ymm1[13],ymm2[13],ymm1[14],ymm2[14],ymm1[15],ymm2[15],ymm1[24],ymm2[24],ymm1[25],ymm2[25],ymm1[26],ymm2[26],ymm1[27],ymm2[27],ymm1[28],ymm2[28],ymm1[29],ymm2[29],ymm1[30],ymm2[30],ymm1[31],ymm2[31]
-; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [2,4,8,16,32,64,128,256,2,4,8,16,32,64,128,256]
-; GFNIAVX512VL-NEXT: # ymm4 = mem[0,1,0,1]
-; GFNIAVX512VL-NEXT: vpmullw %ymm4, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0],ymm2[0],ymm1[1],ymm2[1],ymm1[2],ymm2[2],ymm1[3],ymm2[3],ymm1[4],ymm2[4],ymm1[5],ymm2[5],ymm1[6],ymm2[6],ymm1[7],ymm2[7],ymm1[16],ymm2[16],ymm1[17],ymm2[17],ymm1[18],ymm2[18],ymm1[19],ymm2[19],ymm1[20],ymm2[20],ymm1[21],ymm2[21],ymm1[22],ymm2[22],ymm1[23],ymm2[23]
-; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [256,128,64,32,16,8,4,2,256,128,64,32,16,8,4,2]
-; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
-; GFNIAVX512VL-NEXT: vpmullw %ymm5, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpackuswb %ymm3, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm3 = ymm0[8],ymm2[8],ymm0[9],ymm2[9],ymm0[10],ymm2[10],ymm0[11],ymm2[11],ymm0[12],ymm2[12],ymm0[13],ymm2[13],ymm0[14],ymm2[14],ymm0[15],ymm2[15],ymm0[24],ymm2[24],ymm0[25],ymm2[25],ymm0[26],ymm2[26],ymm0[27],ymm2[27],ymm0[28],ymm2[28],ymm0[29],ymm2[29],ymm0[30],ymm2[30],ymm0[31],ymm2[31]
-; GFNIAVX512VL-NEXT: vpmullw %ymm4, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm3, %ymm3
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0],ymm2[0],ymm0[1],ymm2[1],ymm0[2],ymm2[2],ymm0[3],ymm2[3],ymm0[4],ymm2[4],ymm0[5],ymm2[5],ymm0[6],ymm2[6],ymm0[7],ymm2[7],ymm0[16],ymm2[16],ymm0[17],ymm2[17],ymm0[18],ymm2[18],ymm0[19],ymm2[19],ymm0[20],ymm2[20],ymm0[21],ymm2[21],ymm0[22],ymm2[22],ymm0[23],ymm2[23]
-; GFNIAVX512VL-NEXT: vpmullw %ymm5, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpackuswb %ymm3, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
-; GFNIAVX512VL-NEXT: retq
-;
-; GFNIAVX512BW-LABEL: constant_lshr_v64i8:
-; GFNIAVX512BW: # %bb.0:
-; GFNIAVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; GFNIAVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm2 = zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[12],zmm1[12],zmm0[13],zmm1[13],zmm0[14],zmm1[14],zmm0[15],zmm1[15],zmm0[24],zmm1[24],zmm0[25],zmm1[25],zmm0[26],zmm1[26],zmm0[27],zmm1[27],zmm0[28],zmm1[28],zmm0[29],zmm1[29],zmm0[30],zmm1[30],zmm0[31],zmm1[31],zmm0[40],zmm1[40],zmm0[41],zmm1[41],zmm0[42],zmm1[42],zmm0[43],zmm1[43],zmm0[44],zmm1[44],zmm0[45],zmm1[45],zmm0[46],zmm1[46],zmm0[47],zmm1[47],zmm0[56],zmm1[56],zmm0[57],zmm1[57],zmm0[58],zmm1[58],zmm0[59],zmm1[59],zmm0[60],zmm1[60],zmm0[61],zmm1[61],zmm0[62],zmm1[62],zmm0[63],zmm1[63]
-; GFNIAVX512BW-NEXT: vpsllvw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm2, %zmm2
-; GFNIAVX512BW-NEXT: vpsrlw $8, %zmm2, %zmm2
-; GFNIAVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm0 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[16],zmm1[16],zmm0[17],zmm1[17],zmm0[18],zmm1[18],zmm0[19],zmm1[19],zmm0[20],zmm1[20],zmm0[21],zmm1[21],zmm0[22],zmm1[22],zmm0[23],zmm1[23],zmm0[32],zmm1[32],zmm0[33],zmm1[33],zmm0[34],zmm1[34],zmm0[35],zmm1[35],zmm0[36],zmm1[36],zmm0[37],zmm1[37],zmm0[38],zmm1[38],zmm0[39],zmm1[39],zmm0[48],zmm1[48],zmm0[49],zmm1[49],zmm0[50],zmm1[50],zmm0[51],zmm1[51],zmm0[52],zmm1[52],zmm0[53],zmm1[53],zmm0[54],zmm1[54],zmm0[55],zmm1[55]
-; GFNIAVX512BW-NEXT: vpsllvw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: vpackuswb %zmm2, %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: retq
+; GFNIAVX512-LABEL: constant_lshr_v64i8:
+; GFNIAVX512: # %bb.0:
+; GFNIAVX512-NEXT: vpbroadcastq {{.*#+}} zmm1 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512-NEXT: vgf2p8affineqb $0, %zmm1, %zmm0, %zmm0
+; GFNIAVX512-NEXT: vpandq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %zmm0
+; GFNIAVX512-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %zmm0
+; GFNIAVX512-NEXT: vgf2p8affineqb $0, %zmm1, %zmm0, %zmm0
+; GFNIAVX512-NEXT: retq
%shift = lshr <64 x i8> %a, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>
ret <64 x i8> %shift
}
@@ -2872,161 +2317,137 @@ define <64 x i8> @constant_lshr_v64i8(<64 x i8> %a) nounwind {
define <64 x i8> @constant_ashr_v64i8(<64 x i8> %a) nounwind {
; GFNISSE-LABEL: constant_ashr_v64i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: movdqa %xmm0, %xmm6
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm6 = xmm6[8],xmm0[8],xmm6[9],xmm0[9],xmm6[10],xmm0[10],xmm6[11],xmm0[11],xmm6[12],xmm0[12],xmm6[13],xmm0[13],xmm6[14],xmm0[14],xmm6[15],xmm0[15]
-; GFNISSE-NEXT: psraw $8, %xmm6
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [2,4,8,16,32,64,128,256]
-; GFNISSE-NEXT: pmullw %xmm4, %xmm6
-; GFNISSE-NEXT: psrlw $8, %xmm6
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm0
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [256,128,64,32,16,8,4,2]
-; GFNISSE-NEXT: pmullw %xmm5, %xmm0
-; GFNISSE-NEXT: psrlw $8, %xmm0
-; GFNISSE-NEXT: packuswb %xmm6, %xmm0
-; GFNISSE-NEXT: movdqa %xmm1, %xmm6
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm6 = xmm6[8],xmm1[8],xmm6[9],xmm1[9],xmm6[10],xmm1[10],xmm6[11],xmm1[11],xmm6[12],xmm1[12],xmm6[13],xmm1[13],xmm6[14],xmm1[14],xmm6[15],xmm1[15]
-; GFNISSE-NEXT: psraw $8, %xmm6
-; GFNISSE-NEXT: pmullw %xmm4, %xmm6
-; GFNISSE-NEXT: psrlw $8, %xmm6
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm1
-; GFNISSE-NEXT: pmullw %xmm5, %xmm1
-; GFNISSE-NEXT: psrlw $8, %xmm1
-; GFNISSE-NEXT: packuswb %xmm6, %xmm1
-; GFNISSE-NEXT: movdqa %xmm2, %xmm6
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm6 = xmm6[8],xmm2[8],xmm6[9],xmm2[9],xmm6[10],xmm2[10],xmm6[11],xmm2[11],xmm6[12],xmm2[12],xmm6[13],xmm2[13],xmm6[14],xmm2[14],xmm6[15],xmm2[15]
-; GFNISSE-NEXT: psraw $8, %xmm6
-; GFNISSE-NEXT: pmullw %xmm4, %xmm6
-; GFNISSE-NEXT: psrlw $8, %xmm6
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm2
-; GFNISSE-NEXT: pmullw %xmm5, %xmm2
-; GFNISSE-NEXT: psrlw $8, %xmm2
-; GFNISSE-NEXT: packuswb %xmm6, %xmm2
-; GFNISSE-NEXT: movdqa %xmm3, %xmm6
-; GFNISSE-NEXT: punpckhbw {{.*#+}} xmm6 = xmm6[8],xmm3[8],xmm6[9],xmm3[9],xmm6[10],xmm3[10],xmm6[11],xmm3[11],xmm6[12],xmm3[12],xmm6[13],xmm3[13],xmm6[14],xmm3[14],xmm6[15],xmm3[15]
-; GFNISSE-NEXT: psraw $8, %xmm6
-; GFNISSE-NEXT: pmullw %xmm4, %xmm6
-; GFNISSE-NEXT: psrlw $8, %xmm6
-; GFNISSE-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNISSE-NEXT: psraw $8, %xmm3
-; GFNISSE-NEXT: pmullw %xmm5, %xmm3
-; GFNISSE-NEXT: psrlw $8, %xmm3
-; GFNISSE-NEXT: packuswb %xmm6, %xmm3
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm5 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm4
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm6 = [9241421688590303745,9241421688590303745]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm4
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm0
+; GFNISSE-NEXT: movdqa {{.*#+}} xmm7 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNISSE-NEXT: pand %xmm7, %xmm0
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm0
+; GFNISSE-NEXT: pxor %xmm4, %xmm0
+; GFNISSE-NEXT: psubb %xmm4, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm1
+; GFNISSE-NEXT: pand %xmm7, %xmm1
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm1
+; GFNISSE-NEXT: pxor %xmm4, %xmm1
+; GFNISSE-NEXT: psubb %xmm4, %xmm1
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm2
+; GFNISSE-NEXT: pand %xmm7, %xmm2
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm2
+; GFNISSE-NEXT: pxor %xmm4, %xmm2
+; GFNISSE-NEXT: psubb %xmm4, %xmm2
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm3
+; GFNISSE-NEXT: pand %xmm7, %xmm3
+; GFNISSE-NEXT: gf2p8mulb %xmm5, %xmm3
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm6, %xmm3
+; GFNISSE-NEXT: pxor %xmm4, %xmm3
+; GFNISSE-NEXT: psubb %xmm4, %xmm3
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: constant_ashr_v64i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm3[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm2, %xmm4
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [2,4,8,16,32,64,128,256]
-; GFNIAVX1-NEXT: vpmullw %xmm2, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm3, %xmm5
-; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [256,128,64,32,16,8,4,2]
-; GFNIAVX1-NEXT: vpmullw %xmm3, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpackuswb %xmm4, %xmm5, %xmm4
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpmullw %xmm2, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpmullw %xmm3, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpackuswb %xmm5, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm4
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm4[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpmullw %xmm2, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm4 = xmm4[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpmullw %xmm3, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpackuswb %xmm5, %xmm4, %xmm4
-; GFNIAVX1-NEXT: vpunpckhbw {{.*#+}} xmm5 = xmm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm5, %xmm5
-; GFNIAVX1-NEXT: vpmullw %xmm2, %xmm5, %xmm2
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm2, %xmm2
-; GFNIAVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
-; GFNIAVX1-NEXT: vpsraw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpmullw %xmm3, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsrlw $8, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpackuswb %xmm2, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm4, %ymm1, %ymm1
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX1-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm2, %xmm3
+; GFNIAVX1-NEXT: vmovddup {{.*#+}} xmm4 = [9241421688590303745,9241421688590303745]
+; GFNIAVX1-NEXT: # xmm4 = mem[0,0]
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm3, %xmm3
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vmovdqa {{.*#+}} xmm6 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpxor %xmm3, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpsubb %xmm3, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpxor %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vpsubb %xmm3, %xmm0, %xmm0
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm5, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpxor %xmm3, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vpsubb %xmm3, %xmm5, %xmm5
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpand %xmm6, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8mulb %xmm2, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, %xmm4, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpxor %xmm3, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vpsubb %xmm3, %xmm1, %xmm1
+; GFNIAVX1-NEXT: vinsertf128 $1, %xmm5, %ymm1, %ymm1
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: constant_ashr_v64i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpsraw $8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [2,4,8,16,32,64,128,256,2,4,8,16,32,64,128,256]
-; GFNIAVX2-NEXT: # ymm3 = mem[0,1,0,1]
-; GFNIAVX2-NEXT: vpmullw %ymm3, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpsraw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [256,128,64,32,16,8,4,2,256,128,64,32,16,8,4,2]
-; GFNIAVX2-NEXT: # ymm4 = mem[0,1,0,1]
-; GFNIAVX2-NEXT: vpmullw %ymm4, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpackuswb %ymm2, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX2-NEXT: vpsraw $8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpmullw %ymm3, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX2-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX2-NEXT: vpsraw $8, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpmullw %ymm4, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX2-NEXT: vpackuswb %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm2 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX2-NEXT: # ymm2 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm2, %ymm3
+; GFNIAVX2-NEXT: vpbroadcastq {{.*#+}} ymm4 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm3, %ymm3
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255,255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX2-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX2-NEXT: vpand %ymm5, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpxor %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vpsubb %ymm3, %ymm0, %ymm0
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpand %ymm5, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8mulb %ymm2, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vgf2p8affineqb $0, %ymm4, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpxor %ymm3, %ymm1, %ymm1
+; GFNIAVX2-NEXT: vpsubb %ymm3, %ymm1, %ymm1
; GFNIAVX2-NEXT: retq
;
; GFNIAVX512VL-LABEL: constant_ashr_v64i8:
; GFNIAVX512VL: # %bb.0:
-; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm1
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm1[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpsraw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm3 = [2,4,8,16,32,64,128,256,2,4,8,16,32,64,128,256]
-; GFNIAVX512VL-NEXT: # ymm3 = mem[0,1,0,1]
-; GFNIAVX512VL-NEXT: vpmullw %ymm3, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm1 = ymm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpsraw $8, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm4 = [256,128,64,32,16,8,4,2,256,128,64,32,16,8,4,2]
-; GFNIAVX512VL-NEXT: # ymm4 = mem[0,1,0,1]
-; GFNIAVX512VL-NEXT: vpmullw %ymm4, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpackuswb %ymm2, %ymm1, %ymm1
-; GFNIAVX512VL-NEXT: vpunpckhbw {{.*#+}} ymm2 = ymm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31]
-; GFNIAVX512VL-NEXT: vpsraw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpmullw %ymm3, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm2, %ymm2
-; GFNIAVX512VL-NEXT: vpunpcklbw {{.*#+}} ymm0 = ymm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23]
-; GFNIAVX512VL-NEXT: vpsraw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpmullw %ymm4, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpsrlw $8, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vpackuswb %ymm2, %ymm0, %ymm0
-; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX512VL-NEXT: # ymm1 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm1, %ymm2
+; GFNIAVX512VL-NEXT: vpbroadcastq {{.*#+}} ymm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm2, %ymm2
+; GFNIAVX512VL-NEXT: vextracti64x4 $1, %zmm0, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm5 = [255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255,255,127,63,31,15,7,3,1,1,3,7,15,31,63,127,255]
+; GFNIAVX512VL-NEXT: # ymm5 = mem[0,1,0,1]
+; GFNIAVX512VL-NEXT: vpand %ymm5, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm1, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vpxor %ymm2, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vpsubb %ymm2, %ymm4, %ymm4
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpand %ymm5, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8mulb %ymm1, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vgf2p8affineqb $0, %ymm3, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpxor %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vpsubb %ymm2, %ymm0, %ymm0
+; GFNIAVX512VL-NEXT: vinserti64x4 $1, %ymm4, %zmm0, %zmm0
; GFNIAVX512VL-NEXT: retq
;
; GFNIAVX512BW-LABEL: constant_ashr_v64i8:
; GFNIAVX512BW: # %bb.0:
-; GFNIAVX512BW-NEXT: vpunpckhbw {{.*#+}} zmm1 = zmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63]
-; GFNIAVX512BW-NEXT: vpsraw $8, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpsllvw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpsrlw $8, %zmm1, %zmm1
-; GFNIAVX512BW-NEXT: vpunpcklbw {{.*#+}} zmm0 = zmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55]
-; GFNIAVX512BW-NEXT: vpsraw $8, %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: vpsllvw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
-; GFNIAVX512BW-NEXT: vpackuswb %zmm1, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vbroadcasti32x4 {{.*#+}} zmm1 = [1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1]
+; GFNIAVX512BW-NEXT: # zmm1 = mem[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
+; GFNIAVX512BW-NEXT: vgf2p8mulb {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm1, %zmm2
+; GFNIAVX512BW-NEXT: vpbroadcastq {{.*#+}} zmm3 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm3, %zmm2, %zmm2
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm3, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpandq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vgf2p8mulb %zmm1, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vgf2p8affineqb $0, %zmm3, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpxorq %zmm2, %zmm0, %zmm0
+; GFNIAVX512BW-NEXT: vpsubb %zmm2, %zmm0, %zmm0
; GFNIAVX512BW-NEXT: retq
%shift = ashr <64 x i8> %a, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>
ret <64 x i8> %shift
More information about the llvm-commits
mailing list