Skip to content

Commit 797d519

Browse files
authored
[RISCV] Check whether plain type is supported for permutation intrinsics instead of its float type (#146657)
For permutation intrinsics, the float data type is not used during processing. We only need to check whether its plain type is supported, rather than the float type. This is like what we did in https://github.com/llvm/llvm-project/blob/651c5208f8597f1f80349f6208e69bf9ea1c2862/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td#L2958
1 parent cc801b6 commit 797d519

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4567,7 +4567,8 @@ multiclass VPatUnaryS_M<string intrinsic_name,
45674567
multiclass VPatUnaryV_V_AnyMask<string intrinsic, string instruction,
45684568
list<VTypeInfo> vtilist> {
45694569
foreach vti = vtilist in {
4570-
let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
4570+
defvar ivti = GetIntVTypeInfo<vti>.Vti;
4571+
let Predicates = GetVTypePredicates<ivti>.Predicates in
45714572
def : VPatUnaryAnyMask<intrinsic, instruction, "VM",
45724573
vti.Vector, vti.Vector, vti.Mask,
45734574
vti.Log2SEW, vti.LMul, vti.RegClass, vti.RegClass>;
@@ -4886,7 +4887,7 @@ multiclass VPatBinaryV_VV_INT<string intrinsic, string instruction,
48864887
list<VTypeInfo> vtilist> {
48874888
foreach vti = vtilist in {
48884889
defvar ivti = GetIntVTypeInfo<vti>.Vti;
4889-
let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
4890+
let Predicates = GetVTypePredicates<ivti>.Predicates in
48904891
defm : VPatBinary<intrinsic,
48914892
instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW,
48924893
vti.Vector, vti.Vector, ivti.Vector, vti.Mask,
@@ -4903,15 +4904,16 @@ multiclass VPatBinaryV_VV_INT_EEW<string intrinsic, string instruction,
49034904
defvar octuple_lmul = vlmul.octuple;
49044905
defvar octuple_emul = !srl(!mul(octuple_lmul, eew), vti.Log2SEW);
49054906
if !and(!ge(octuple_emul, 1), !le(octuple_emul, 64)) then {
4907+
defvar ivti = GetIntVTypeInfo<vti>.Vti;
49064908
defvar emul_str = octuple_to_str<octuple_emul>.ret;
4907-
defvar ivti = !cast<VTypeInfo>("VI" # eew # emul_str);
49084909
defvar inst = instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW # "_" # emul_str;
4909-
let Predicates = !listconcat(GetVTypeMinimalPredicates<vti>.Predicates,
4910-
GetVTypeMinimalPredicates<ivti>.Predicates) in
4910+
defvar eivti = !cast<VTypeInfo>("VI" # eew # emul_str);
4911+
let Predicates = !listconcat(GetVTypePredicates<ivti>.Predicates,
4912+
GetVTypePredicates<eivti>.Predicates) in
49114913
defm : VPatBinary<intrinsic, inst,
4912-
vti.Vector, vti.Vector, ivti.Vector, vti.Mask,
4914+
vti.Vector, vti.Vector, eivti.Vector, vti.Mask,
49134915
vti.Log2SEW, vti.RegClass,
4914-
vti.RegClass, ivti.RegClass>;
4916+
vti.RegClass, eivti.RegClass>;
49154917
}
49164918
}
49174919
}
@@ -4948,12 +4950,14 @@ multiclass VPatBinaryV_VX_RM<string intrinsic, string instruction,
49484950

49494951
multiclass VPatBinaryV_VX_INT<string intrinsic, string instruction,
49504952
list<VTypeInfo> vtilist> {
4951-
foreach vti = vtilist in
4952-
let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
4953+
foreach vti = vtilist in {
4954+
defvar ivti = GetIntVTypeInfo<vti>.Vti;
4955+
let Predicates = GetVTypePredicates<ivti>.Predicates in
49534956
defm : VPatBinary<intrinsic, instruction # "_VX_" # vti.LMul.MX,
49544957
vti.Vector, vti.Vector, XLenVT, vti.Mask,
49554958
vti.Log2SEW, vti.RegClass,
49564959
vti.RegClass, GPR>;
4960+
}
49574961
}
49584962

49594963
multiclass VPatBinaryV_VI<string intrinsic, string instruction,
@@ -4980,12 +4984,14 @@ multiclass VPatBinaryV_VI_RM<string intrinsic, string instruction,
49804984

49814985
multiclass VPatBinaryV_VI_INT<string intrinsic, string instruction,
49824986
list<VTypeInfo> vtilist, Operand imm_type> {
4983-
foreach vti = vtilist in
4984-
let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
4987+
foreach vti = vtilist in {
4988+
defvar ivti = GetIntVTypeInfo<vti>.Vti;
4989+
let Predicates = GetVTypePredicates<ivti>.Predicates in
49854990
defm : VPatBinary<intrinsic, instruction # "_VI_" # vti.LMul.MX,
49864991
vti.Vector, vti.Vector, XLenVT, vti.Mask,
49874992
vti.Log2SEW, vti.RegClass,
49884993
vti.RegClass, imm_type>;
4994+
}
49894995
}
49904996

49914997
multiclass VPatBinaryM_MM<string intrinsic, string instruction> {
@@ -5573,12 +5579,14 @@ multiclass VPatTernaryV_VV_AAXA_RM<string intrinsic, string instruction,
55735579

55745580
multiclass VPatTernaryV_VX<string intrinsic, string instruction,
55755581
list<VTypeInfo> vtilist> {
5576-
foreach vti = vtilist in
5577-
let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
5582+
foreach vti = vtilist in {
5583+
defvar ivti = GetIntVTypeInfo<vti>.Vti;
5584+
let Predicates = GetVTypePredicates<ivti>.Predicates in
55785585
defm : VPatTernaryWithPolicy<intrinsic, instruction, "VX",
55795586
vti.Vector, vti.Vector, XLenVT, vti.Mask,
55805587
vti.Log2SEW, vti.LMul, vti.RegClass,
55815588
vti.RegClass, GPR>;
5589+
}
55825590
}
55835591

55845592
multiclass VPatTernaryV_VX_AAXA<string intrinsic, string instruction,
@@ -5605,12 +5613,14 @@ multiclass VPatTernaryV_VX_AAXA_RM<string intrinsic, string instruction,
56055613

56065614
multiclass VPatTernaryV_VI<string intrinsic, string instruction,
56075615
list<VTypeInfo> vtilist, Operand Imm_type> {
5608-
foreach vti = vtilist in
5609-
let Predicates = GetVTypeMinimalPredicates<vti>.Predicates in
5616+
foreach vti = vtilist in {
5617+
defvar ivti = GetIntVTypeInfo<vti>.Vti;
5618+
let Predicates = GetVTypePredicates<ivti>.Predicates in
56105619
defm : VPatTernaryWithPolicy<intrinsic, instruction, "VI",
56115620
vti.Vector, vti.Vector, XLenVT, vti.Mask,
56125621
vti.Log2SEW, vti.LMul, vti.RegClass,
56135622
vti.RegClass, Imm_type>;
5623+
}
56145624
}
56155625

56165626
multiclass VPatTernaryW_VV<string intrinsic, string instruction,

0 commit comments

Comments
 (0)