Skip to content

Commit 199c97b

Browse files
committed
rewrite bmi_pdep_pext
1 parent 9bc8ee2 commit 199c97b

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

llvm/lib/Target/X86/X86InstrMisc.td

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,38 +1375,40 @@ let Predicates = [HasBMI2, NoTBM, HasEGPR] in {
13751375
(MOV8ri (CountTrailingOnes imm:$mask)), sub_8bit))>;
13761376
}
13771377

1378-
multiclass bmi_pdep_pext<string mnemonic, RegisterClass RC,
1378+
multiclass bmi_pdep_pext<string mnemonic, X86TypeInfo t,
13791379
X86MemOperand x86memop, SDPatternOperator OpNode,
1380-
PatFrag ld_frag, string Suffix = ""> {
1381-
def rr#Suffix : I<0xF5, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, RC:$src2),
1382-
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
1383-
[(set RC:$dst, (OpNode RC:$src1, RC:$src2))]>,
1384-
NoCD8, VVVV, Sched<[WriteALU]>;
1385-
def rm#Suffix : I<0xF5, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
1386-
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
1387-
[(set RC:$dst, (OpNode RC:$src1, (ld_frag addr:$src2)))]>,
1388-
NoCD8, VVVV, Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]>;
1380+
PatFrag ld_frag, string suffix = ""> {
1381+
def rr#suffix : ITy<0xF5, MRMSrcReg, t, (outs t.RegClass:$dst),
1382+
(ins t.RegClass:$src1, t.RegClass:$src2),
1383+
mnemonic, binop_ndd_args,
1384+
[(set t.RegClass:$dst, (OpNode t.RegClass:$src1, t.RegClass:$src2))]>,
1385+
VVVV, Sched<[WriteALU]>;
1386+
def rm#suffix : ITy<0xF5, MRMSrcMem, t, (outs t.RegClass:$dst),
1387+
(ins t.RegClass:$src1, x86memop:$src2),
1388+
mnemonic, binop_ndd_args,
1389+
[(set t.RegClass:$dst, (OpNode t.RegClass:$src1, (ld_frag addr:$src2)))]>,
1390+
VVVV, Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]>;
13891391
}
13901392

13911393
let Predicates = [HasBMI2, NoEGPR] in {
1392-
defm PDEP32 : bmi_pdep_pext<"pdep{l}", GR32, i32mem,
1394+
defm PDEP32 : bmi_pdep_pext<"pdep", Xi32, i32mem,
13931395
X86pdep, loadi32>, T8, XD, VEX;
1394-
defm PDEP64 : bmi_pdep_pext<"pdep{q}", GR64, i64mem,
1396+
defm PDEP64 : bmi_pdep_pext<"pdep", Xi64, i64mem,
13951397
X86pdep, loadi64>, T8, XD, REX_W, VEX;
1396-
defm PEXT32 : bmi_pdep_pext<"pext{l}", GR32, i32mem,
1398+
defm PEXT32 : bmi_pdep_pext<"pext", Xi32, i32mem,
13971399
X86pext, loadi32>, T8, XS, VEX;
1398-
defm PEXT64 : bmi_pdep_pext<"pext{q}", GR64, i64mem,
1400+
defm PEXT64 : bmi_pdep_pext<"pext", Xi64, i64mem,
13991401
X86pext, loadi64>, T8, XS, REX_W, VEX;
14001402
}
14011403

14021404
let Predicates = [HasBMI2, HasEGPR] in {
1403-
defm PDEP32 : bmi_pdep_pext<"pdep{l}", GR32, i32mem,
1405+
defm PDEP32 : bmi_pdep_pext<"pdep", Xi32, i32mem,
14041406
X86pdep, loadi32, "_EVEX">, T8, XD, EVEX;
1405-
defm PDEP64 : bmi_pdep_pext<"pdep{q}", GR64, i64mem,
1407+
defm PDEP64 : bmi_pdep_pext<"pdep", Xi64, i64mem,
14061408
X86pdep, loadi64, "_EVEX">, T8, XD, REX_W, EVEX;
1407-
defm PEXT32 : bmi_pdep_pext<"pext{l}", GR32, i32mem,
1409+
defm PEXT32 : bmi_pdep_pext<"pext", Xi32, i32mem,
14081410
X86pext, loadi32, "_EVEX">, T8, XS, EVEX;
1409-
defm PEXT64 : bmi_pdep_pext<"pext{q}", GR64, i64mem,
1411+
defm PEXT64 : bmi_pdep_pext<"pext", Xi64, i64mem,
14101412
X86pext, loadi64, "_EVEX">, T8, XS, REX_W, EVEX;
14111413
}
14121414

0 commit comments

Comments
 (0)