Skip to content

Commit 34be8af

Browse files
RKSimonyuxuanchen1997
authored andcommitted
[X86] getGFNICtrlMask - create a vXi8 mask instead of a bitcasted vXi64 mask.
Summary: Helps avoid some missed load-folds by stripping away bitcasts and make it easier to grok the GF2P8AFFINEQB masks. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250855
1 parent 666e230 commit 34be8af

File tree

6 files changed

+236
-301
lines changed

6 files changed

+236
-301
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29102,8 +29102,12 @@ SDValue getGFNICtrlMask(unsigned Opcode, SelectionDAG &DAG, const SDLoc &DL, MVT
2910229102
assert(VT.getVectorElementType() == MVT::i8 &&
2910329103
(VT.getSizeInBits() % 64) == 0 && "Illegal GFNI control type");
2910429104
uint64_t Imm = getGFNICtrlImm(Opcode, Amt);
29105-
MVT MaskVT = MVT::getVectorVT(MVT::i64, VT.getSizeInBits() / 64);
29106-
return DAG.getBitcast(VT, DAG.getConstant(Imm, DL, MaskVT));
29105+
SmallVector<SDValue> MaskBits;
29106+
for (unsigned I = 0, E = VT.getSizeInBits(); I != E; I += 8) {
29107+
uint64_t Bits = (Imm >> (I % 64)) & 255;
29108+
MaskBits.push_back(DAG.getConstant(Bits, DL, MVT::i8));
29109+
}
29110+
return DAG.getBuildVector(VT, DL, MaskBits);
2910729111
}
2910829112

2910929113
// Return true if the required (according to Opcode) shift-imm form is natively

llvm/test/CodeGen/X86/bitreverse.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ define i528 @large_promotion(i528 %A) nounwind {
13401340
; GFNI-NEXT: pushq %r14
13411341
; GFNI-NEXT: pushq %rbx
13421342
; GFNI-NEXT: movq %rdi, %rax
1343-
; GFNI-NEXT: vpbroadcastq {{.*#+}} xmm0 = [9241421688590303745,9241421688590303745]
1343+
; GFNI-NEXT: vpbroadcastq {{.*#+}} xmm0 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
13441344
; GFNI-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
13451345
; GFNI-NEXT: vgf2p8affineqb $0, %xmm0, %xmm1, %xmm1
13461346
; GFNI-NEXT: vmovq %xmm1, %r10

0 commit comments

Comments
 (0)