Skip to content

Commit 516f08b

Browse files
[LLVM][AArch64] Refactor sve-b16b16 instruction definitions. (#107265)
Update the predicate protecting bfloat instructions to only reference FEAT_SVE_B16B16, which matches the specification. Rename and move instruction classes to match the names of the encoding groups the bfloat arithmetic instructions belong.
1 parent 23595d1 commit 516f08b

File tree

16 files changed

+200
-201
lines changed

16 files changed

+200
-201
lines changed

llvm/lib/Target/AArch64/AArch64.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def SVE2p1Unsupported : AArch64Unsupported;
6363

6464
def SVE2Unsupported : AArch64Unsupported {
6565
let F = !listconcat([HasSVE2, HasSVE2orSME, HasSVE2orSME2, HasSSVE_FP8FMA, HasSMEF8F16,
66-
HasSMEF8F32, HasSVE2AES, HasSVE2SHA3, HasSVE2SM4, HasSVE2BitPerm],
66+
HasSMEF8F32, HasSVE2AES, HasSVE2SHA3, HasSVE2SM4, HasSVE2BitPerm,
67+
HasSVEB16B16],
6768
SVE2p1Unsupported.F);
6869
}
6970

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def HasFuseAES : Predicate<"Subtarget->hasFuseAES()">,
143143
"fuse-aes">;
144144
def HasSVE : Predicate<"Subtarget->isSVEAvailable()">,
145145
AssemblerPredicateWithAll<(all_of FeatureSVE), "sve">;
146-
def HasSVEB16B16 : Predicate<"Subtarget->hasSVEB16B16()">,
146+
def HasSVEB16B16 : Predicate<"Subtarget->isSVEorStreamingSVEAvailable() && Subtarget->hasSVEB16B16()">,
147147
AssemblerPredicateWithAll<(all_of FeatureSVEB16B16), "sve-b16b16">;
148148
def HasSVE2 : Predicate<"Subtarget->isSVEAvailable() && Subtarget->hasSVE2()">,
149149
AssemblerPredicateWithAll<(all_of FeatureSVE2), "sve2">;

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 45 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3897,7 +3897,7 @@ defm PSEL_PPPRI : sve2_int_perm_sel_p<"psel", int_aarch64_sve_psel>;
38973897
//===----------------------------------------------------------------------===//
38983898

38993899
let Predicates = [HasSVE2p1_or_HasSME2] in {
3900-
defm FCLAMP_ZZZ : sve2p1_fclamp<"fclamp", AArch64fclamp>;
3900+
defm FCLAMP_ZZZ : sve_fp_clamp<"fclamp", AArch64fclamp>;
39013901

39023902
defm FDOT_ZZZ_S : sve_float_dot<0b0, 0b0, ZPR32, ZPR16, "fdot", nxv8f16, int_aarch64_sve_fdot_x2>;
39033903
defm FDOT_ZZZI_S : sve_float_dot_indexed<0b0, 0b00, ZPR16, ZPR3b16, "fdot", nxv8f16, int_aarch64_sve_fdot_lane_x2>;
@@ -4080,57 +4080,50 @@ def : InstAlias<"pfalse\t$Pd", (PFALSE PPRorPNR8:$Pd), 0>;
40804080
// Non-widening BFloat16 to BFloat16 instructions
40814081
//===----------------------------------------------------------------------===//
40824082

4083-
let Predicates = [HasSVE2orSME2, HasSVEB16B16, UseExperimentalZeroingPseudos] in {
4084-
defm BFADD_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fadd>;
4085-
defm BFSUB_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fsub>;
4086-
defm BFMUL_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmul>;
4087-
defm BFMAXNM_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmaxnm>;
4088-
defm BFMINNM_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fminnm>;
4089-
defm BFMIN_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmin>;
4090-
defm BFMAX_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmax>;
4091-
} // HasSVE2orSME2, HasSVEB16B16, UseExperimentalZeroingPseudos
4092-
4093-
let Predicates = [HasSVE2orSME2, HasSVEB16B16] in {
4094-
4095-
defm BFMLA_ZPmZZ : sve_fp_3op_p_zds_a_bf<0b00, "bfmla", "BFMLA_ZPZZZ", AArch64fmla_m1>;
4096-
defm BFMLS_ZPmZZ : sve_fp_3op_p_zds_a_bf<0b01, "bfmls", "BFMLS_ZPZZZ", AArch64fmls_m1>;
4097-
4098-
defm BFMLA_ZPZZZ : sve_fp_3op_pred_bf<AArch64fmla_p>;
4099-
defm BFMLS_ZPZZZ : sve_fp_3op_pred_bf<AArch64fmls_p>;
4100-
4101-
defm BFMLA_ZZZI : sve2p1_fp_bfma_by_indexed_elem<"bfmla", 0b10, int_aarch64_sve_fmla_lane>;
4102-
defm BFMLS_ZZZI : sve2p1_fp_bfma_by_indexed_elem<"bfmls", 0b11, int_aarch64_sve_fmls_lane>;
4103-
4104-
defm BFADD_ZPmZZ : sve2p1_bf_2op_p_zds<0b0000, "bfadd", "BFADD_ZPZZ", AArch64fadd_m1, DestructiveBinaryComm>;
4105-
defm BFSUB_ZPmZZ : sve2p1_bf_2op_p_zds<0b0001, "bfsub", "BFSUB_ZPZZ", AArch64fsub_m1, DestructiveBinaryComm>;
4106-
defm BFMUL_ZPmZZ : sve2p1_bf_2op_p_zds<0b0010, "bfmul", "BFMUL_ZPZZ", AArch64fmul_m1, DestructiveBinaryComm>;
4107-
4108-
defm BFADD_ZZZ : sve2p1_bf_3op_u_zd<0b000, "bfadd", AArch64fadd>;
4109-
defm BFSUB_ZZZ : sve2p1_bf_3op_u_zd<0b001, "bfsub", AArch64fsub>;
4110-
defm BFMUL_ZZZ : sve2p1_bf_3op_u_zd<0b010, "bfmul", AArch64fmul>;
4111-
4112-
defm BFADD_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fadd_p>;
4113-
defm BFSUB_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fsub_p>;
4114-
defm BFMUL_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fmul_p>;
4115-
4116-
4117-
defm BFMAX_ZPmZZ : sve2p1_bf_2op_p_zds<0b0110, "bfmax", "BFMAX_ZPZZ", int_aarch64_sve_fmax, DestructiveBinaryComm>;
4118-
defm BFMIN_ZPmZZ : sve2p1_bf_2op_p_zds<0b0111, "bfmin", "BFMIN_ZPZZ", int_aarch64_sve_fmin, DestructiveBinaryComm>;
4119-
4120-
defm BFMAX_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fmax_p>;
4121-
defm BFMIN_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fmin_p>;
4122-
4123-
4124-
defm BFMAXNM_ZPmZZ : sve2p1_bf_2op_p_zds<0b0100, "bfmaxnm", "BFMAXNM_ZPZZ", int_aarch64_sve_fmaxnm, DestructiveBinaryComm>;
4125-
defm BFMINNM_ZPmZZ : sve2p1_bf_2op_p_zds<0b0101, "bfminnm", "BFMINNM_ZPZZ", int_aarch64_sve_fminnm, DestructiveBinaryComm>;
4126-
4127-
defm BFMAXNM_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fmaxnm_p>;
4128-
defm BFMINNM_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fminnm_p>;
4129-
4130-
defm BFMUL_ZZZI : sve2p1_fp_bfmul_by_indexed_elem<"bfmul", int_aarch64_sve_fmul_lane>;
4131-
4132-
defm BFCLAMP_ZZZ : sve2p1_bfclamp<"bfclamp", AArch64fclamp>;
4133-
} // End HasSVE2orSME2, HasSVEB16B16
4083+
let Predicates = [HasSVEB16B16] in {
4084+
defm BFADD_ZZZ : sve_fp_3op_u_zd_bfloat<0b000, "bfadd", AArch64fadd>;
4085+
defm BFSUB_ZZZ : sve_fp_3op_u_zd_bfloat<0b001, "bfsub", AArch64fsub>;
4086+
defm BFMUL_ZZZ : sve_fp_3op_u_zd_bfloat<0b010, "bfmul", AArch64fmul>;
4087+
4088+
defm BFADD_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0000, "bfadd", "BFADD_ZPZZ", AArch64fadd_m1, DestructiveBinaryComm>;
4089+
defm BFSUB_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0001, "bfsub", "BFSUB_ZPZZ", AArch64fsub_m1, DestructiveBinaryComm>;
4090+
defm BFMUL_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0010, "bfmul", "BFMUL_ZPZZ", AArch64fmul_m1, DestructiveBinaryComm>;
4091+
defm BFMAXNM_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0100, "bfmaxnm", "BFMAXNM_ZPZZ", int_aarch64_sve_fmaxnm, DestructiveBinaryComm>;
4092+
defm BFMINNM_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0101, "bfminnm", "BFMINNM_ZPZZ", int_aarch64_sve_fminnm, DestructiveBinaryComm>;
4093+
defm BFMAX_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0110, "bfmax", "BFMAX_ZPZZ", int_aarch64_sve_fmax, DestructiveBinaryComm>;
4094+
defm BFMIN_ZPmZZ : sve_fp_2op_p_zds_bfloat<0b0111, "bfmin", "BFMIN_ZPZZ", int_aarch64_sve_fmin, DestructiveBinaryComm>;
4095+
4096+
defm BFADD_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fadd_p>;
4097+
defm BFSUB_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fsub_p>;
4098+
defm BFMUL_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fmul_p>;
4099+
defm BFMAXNM_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fmaxnm_p>;
4100+
defm BFMINNM_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fminnm_p>;
4101+
defm BFMAX_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fmax_p>;
4102+
defm BFMIN_ZPZZ : sve_fp_bin_pred_bfloat<AArch64fmin_p>;
4103+
4104+
defm BFMLA_ZPmZZ : sve_fp_3op_p_zds_a_bfloat<0b00, "bfmla", "BFMLA_ZPZZZ", AArch64fmla_m1>;
4105+
defm BFMLS_ZPmZZ : sve_fp_3op_p_zds_a_bfloat<0b01, "bfmls", "BFMLS_ZPZZZ", AArch64fmls_m1>;
4106+
4107+
defm BFMLA_ZPZZZ : sve_fp_3op_pred_bfloat<AArch64fmla_p>;
4108+
defm BFMLS_ZPZZZ : sve_fp_3op_pred_bfloat<AArch64fmls_p>;
4109+
4110+
defm BFMLA_ZZZI : sve_fp_fma_by_indexed_elem_bfloat<"bfmla", 0b10, int_aarch64_sve_fmla_lane>;
4111+
defm BFMLS_ZZZI : sve_fp_fma_by_indexed_elem_bfloat<"bfmls", 0b11, int_aarch64_sve_fmls_lane>;
4112+
4113+
defm BFMUL_ZZZI : sve_fp_fmul_by_indexed_elem_bfloat<"bfmul", int_aarch64_sve_fmul_lane>;
4114+
4115+
defm BFCLAMP_ZZZ : sve_fp_clamp_bfloat<"bfclamp", AArch64fclamp>;
4116+
} // End HasSVEB16B16
4117+
4118+
let Predicates = [HasSVEB16B16, UseExperimentalZeroingPseudos] in {
4119+
defm BFADD_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fadd>;
4120+
defm BFSUB_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fsub>;
4121+
defm BFMUL_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fmul>;
4122+
defm BFMAXNM_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fmaxnm>;
4123+
defm BFMINNM_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fminnm>;
4124+
defm BFMIN_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fmin>;
4125+
defm BFMAX_ZPZZ : sve_fp_2op_p_zds_zeroing_bfloat<int_aarch64_sve_fmax>;
4126+
} // HasSVEB16B16, UseExperimentalZeroingPseudos
41344127

41354128

41364129
//===----------------------------------------------------------------------===//

llvm/lib/Target/AArch64/AArch64SchedNeoverseN2.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def NeoverseN2Model : SchedMachineModel {
1919
let CompleteModel = 1;
2020

2121
list<Predicate> UnsupportedFeatures = !listconcat(SMEUnsupported.F,
22-
[HasSVE2p1, HasPAuthLR, HasCPA, HasCSSC]);
22+
[HasSVE2p1, HasSVEB16B16, HasPAuthLR, HasCPA, HasCSSC]);
2323
}
2424

2525
//===----------------------------------------------------------------------===//

llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def NeoverseV2Model : SchedMachineModel {
2222
let CompleteModel = 1;
2323

2424
list<Predicate> UnsupportedFeatures = !listconcat(SMEUnsupported.F,
25-
[HasSVE2p1, HasCPA,
26-
HasCSSC]);
25+
[HasSVE2p1, HasSVEB16B16,
26+
HasCPA, HasCSSC]);
2727
}
2828

2929
//===----------------------------------------------------------------------===//

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 64 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,29 +2134,6 @@ class sve_fp_2op_p_zds<bits<2> sz, bits<4> opc, string asm,
21342134
let mayRaiseFPException = 1;
21352135
}
21362136

2137-
multiclass sve2p1_bf_2op_p_zds<bits<4> opc, string asm, string Ps,
2138-
SDPatternOperator op, DestructiveInstTypeEnum flags,
2139-
string revname="", bit isReverseInstr=0> {
2140-
let DestructiveInstType = flags in {
2141-
def NAME : sve_fp_2op_p_zds<0b00, opc, asm, ZPR16>,
2142-
SVEPseudo2Instr<Ps, 1>, SVEInstr2Rev<NAME , revname , isReverseInstr>;
2143-
}
2144-
2145-
def : SVE_3_Op_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, !cast<Instruction>(NAME)>;
2146-
}
2147-
2148-
multiclass sve2p1_bf_bin_pred_zds<SDPatternOperator op> {
2149-
def _UNDEF : PredTwoOpPseudo<NAME, ZPR16, FalseLanesUndef>;
2150-
2151-
def : SVE_3_Op_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, !cast<Pseudo>(NAME # _UNDEF)>;
2152-
}
2153-
2154-
multiclass sve2p1_bf_2op_p_zds_zeroing<SDPatternOperator op> {
2155-
def _ZERO : PredTwoOpPseudo<NAME, ZPR16, FalseLanesZero>;
2156-
2157-
def : SVE_3_Op_Pat_SelZero<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, !cast<Pseudo>(NAME # _ZERO)>;
2158-
}
2159-
21602137
multiclass sve_fp_2op_p_zds<bits<4> opc, string asm, string Ps,
21612138
SDPatternOperator op, DestructiveInstTypeEnum flags,
21622139
string revname="", bit isReverseInstr=0> {
@@ -2185,6 +2162,18 @@ multiclass sve_fp_2op_p_zds_fscale<bits<4> opc, string asm,
21852162
def : SVE_3_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2i64, !cast<Instruction>(NAME # _D)>;
21862163
}
21872164

2165+
multiclass sve_fp_2op_p_zds_bfloat<bits<4> opc, string asm, string Ps,
2166+
SDPatternOperator op,
2167+
DestructiveInstTypeEnum flags,
2168+
string revname="", bit isReverseInstr=0> {
2169+
let DestructiveInstType = flags in {
2170+
def NAME : sve_fp_2op_p_zds<0b00, opc, asm, ZPR16>,
2171+
SVEPseudo2Instr<Ps, 1>, SVEInstr2Rev<NAME , revname , isReverseInstr>;
2172+
}
2173+
2174+
def : SVE_3_Op_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, !cast<Instruction>(NAME)>;
2175+
}
2176+
21882177
multiclass sve_fp_2op_p_zds_zeroing_hsd<SDPatternOperator op> {
21892178
def _H_ZERO : PredTwoOpPseudo<NAME # _H, ZPR16, FalseLanesZero>;
21902179
def _S_ZERO : PredTwoOpPseudo<NAME # _S, ZPR32, FalseLanesZero>;
@@ -2195,6 +2184,12 @@ multiclass sve_fp_2op_p_zds_zeroing_hsd<SDPatternOperator op> {
21952184
def : SVE_3_Op_Pat_SelZero<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, !cast<Pseudo>(NAME # _D_ZERO)>;
21962185
}
21972186

2187+
multiclass sve_fp_2op_p_zds_zeroing_bfloat<SDPatternOperator op> {
2188+
def _ZERO : PredTwoOpPseudo<NAME, ZPR16, FalseLanesZero>;
2189+
2190+
def : SVE_3_Op_Pat_SelZero<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, !cast<Pseudo>(NAME # _ZERO)>;
2191+
}
2192+
21982193
class sve_fp_ftmad<bits<2> sz, string asm, ZPRRegOp zprty>
21992194
: I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, timm32_0_7:$imm3),
22002195
asm, "\t$Zdn, $_Zdn, $Zm, $imm3",
@@ -2300,7 +2295,7 @@ multiclass sve_fp_3op_u_zd<bits<3> opc, string asm, SDPatternOperator op> {
23002295
def : SVE_2_Op_Pat<nxv2f64, op, nxv2f64, nxv2f64, !cast<Instruction>(NAME # _D)>;
23012296
}
23022297

2303-
multiclass sve2p1_bf_3op_u_zd<bits<3> opc, string asm, SDPatternOperator op> {
2298+
multiclass sve_fp_3op_u_zd_bfloat<bits<3> opc, string asm, SDPatternOperator op> {
23042299
def NAME : sve_fp_3op_u_zd<0b00, opc, asm, ZPR16>;
23052300

23062301
def : SVE_2_Op_Pat<nxv8bf16, op, nxv8bf16, nxv8bf16, !cast<Instruction>(NAME)>;
@@ -2364,8 +2359,8 @@ multiclass sve_fp_3op_p_zds_a<bits<2> opc, string asm, string Ps,
23642359
def : SVE_4_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, nxv2f64, !cast<Instruction>(NAME # _D)>;
23652360
}
23662361

2367-
multiclass sve_fp_3op_p_zds_a_bf<bits<2> opc, string asm, string Ps,
2368-
SDPatternOperator op> {
2362+
multiclass sve_fp_3op_p_zds_a_bfloat<bits<2> opc, string asm, string Ps,
2363+
SDPatternOperator op> {
23692364
def NAME : sve_fp_3op_p_zds_a<0b00, opc, asm, ZPR16>,
23702365
SVEPseudo2Instr<Ps, 1>, SVEInstr2Rev<NAME, "", 0>;
23712366

@@ -2439,19 +2434,6 @@ class sve_fp_fma_by_indexed_elem<bits<2> sz, bits<2> opc, string asm,
24392434
let mayRaiseFPException = 1;
24402435
}
24412436

2442-
multiclass sve2p1_fp_bfma_by_indexed_elem<string asm, bits<2> opc, SDPatternOperator op> {
2443-
def NAME : sve_fp_fma_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR3b16,
2444-
VectorIndexH32b> {
2445-
bits<3> Zm;
2446-
bits<3> iop;
2447-
let Inst{22} = iop{2};
2448-
let Inst{20-19} = iop{1-0};
2449-
let Inst{18-16} = Zm;
2450-
}
2451-
def : Pat<(nxv8bf16 (op nxv8bf16:$op1, nxv8bf16:$op2, nxv8bf16:$op3, (i32 VectorIndexH32b_timm:$idx))),
2452-
(!cast<Instruction>(NAME) $op1, $op2, $op3, VectorIndexH32b_timm:$idx)>;
2453-
}
2454-
24552437
multiclass sve_fp_fma_by_indexed_elem<bits<2> opc, string asm,
24562438
SDPatternOperator op> {
24572439
def _H : sve_fp_fma_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR3b16, VectorIndexH32b> {
@@ -2482,6 +2464,19 @@ multiclass sve_fp_fma_by_indexed_elem<bits<2> opc, string asm,
24822464
(!cast<Instruction>(NAME # _D) $Op1, $Op2, $Op3, VectorIndexD32b_timm:$idx)>;
24832465
}
24842466

2467+
multiclass sve_fp_fma_by_indexed_elem_bfloat<string asm, bits<2> opc,
2468+
SDPatternOperator op> {
2469+
def NAME : sve_fp_fma_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR3b16, VectorIndexH32b> {
2470+
bits<3> Zm;
2471+
bits<3> iop;
2472+
let Inst{22} = iop{2};
2473+
let Inst{20-19} = iop{1-0};
2474+
let Inst{18-16} = Zm;
2475+
}
2476+
2477+
def : Pat<(nxv8bf16 (op nxv8bf16:$op1, nxv8bf16:$op2, nxv8bf16:$op3, (i32 VectorIndexH32b_timm:$idx))),
2478+
(!cast<Instruction>(NAME) $op1, $op2, $op3, VectorIndexH32b_timm:$idx)>;
2479+
}
24852480

24862481
//===----------------------------------------------------------------------===//
24872482
// SVE Floating Point Multiply - Indexed Group
@@ -2506,18 +2501,6 @@ class sve_fp_fmul_by_indexed_elem<bits<2> sz, bit o2, string asm, ZPRRegOp zprty
25062501
let mayRaiseFPException = 1;
25072502
}
25082503

2509-
multiclass sve2p1_fp_bfmul_by_indexed_elem<string asm, SDPatternOperator ir_intrinsic> {
2510-
def NAME : sve_fp_fmul_by_indexed_elem<{0, ?}, 0b1, asm, ZPR16, ZPR3b16, VectorIndexH32b> {
2511-
bits<3> Zm;
2512-
bits<3> iop;
2513-
let Inst{22} = iop{2};
2514-
let Inst{20-19} = iop{1-0};
2515-
let Inst{18-16} = Zm;
2516-
}
2517-
def : Pat <(nxv8bf16 (ir_intrinsic nxv8bf16:$Op1, nxv8bf16:$Op2, (i32 VectorIndexH32b_timm:$idx))),
2518-
(!cast<Instruction>(NAME) $Op1, $Op2, VectorIndexH32b_timm:$idx)>;
2519-
}
2520-
25212504
multiclass sve_fp_fmul_by_indexed_elem<string asm, SDPatternOperator op> {
25222505
def _H : sve_fp_fmul_by_indexed_elem<{0, ?}, 0b0, asm, ZPR16, ZPR3b16, VectorIndexH32b> {
25232506
bits<3> Zm;
@@ -2547,6 +2530,19 @@ multiclass sve_fp_fmul_by_indexed_elem<string asm, SDPatternOperator op> {
25472530
(!cast<Instruction>(NAME # _D) $Op1, $Op2, VectorIndexD32b_timm:$idx)>;
25482531
}
25492532

2533+
multiclass sve_fp_fmul_by_indexed_elem_bfloat<string asm,
2534+
SDPatternOperator op> {
2535+
def NAME : sve_fp_fmul_by_indexed_elem<{0, ?}, 0b1, asm, ZPR16, ZPR3b16, VectorIndexH32b> {
2536+
bits<3> Zm;
2537+
bits<3> iop;
2538+
let Inst{22} = iop{2};
2539+
let Inst{20-19} = iop{1-0};
2540+
let Inst{18-16} = Zm;
2541+
}
2542+
def : Pat <(nxv8bf16 (op nxv8bf16:$Op1, nxv8bf16:$Op2, (i32 VectorIndexH32b_timm:$idx))),
2543+
(!cast<Instruction>(NAME) $Op1, $Op2, VectorIndexH32b_timm:$idx)>;
2544+
}
2545+
25502546
//===----------------------------------------------------------------------===//
25512547
// SVE Floating Point Complex Multiply-Add Group
25522548
//===----------------------------------------------------------------------===//
@@ -9073,6 +9069,13 @@ multiclass sve_fp_bin_pred_hfd<SDPatternOperator op> {
90739069
def : SVE_3_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, !cast<Pseudo>(NAME # _D_UNDEF)>;
90749070
}
90759071

9072+
// Predicated pseudo floating point (BFloat) two operand instructions.
9073+
multiclass sve_fp_bin_pred_bfloat<SDPatternOperator op> {
9074+
def _UNDEF : PredTwoOpPseudo<NAME, ZPR16, FalseLanesUndef>;
9075+
9076+
def : SVE_3_Op_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, !cast<Pseudo>(NAME # _UNDEF)>;
9077+
}
9078+
90769079
// Predicated pseudo floating point three operand instructions.
90779080
multiclass sve_fp_3op_pred_hfd<SDPatternOperator op> {
90789081
def _H_UNDEF : PredThreeOpPseudo<NAME # _H, ZPR16, FalseLanesUndef>;
@@ -9087,7 +9090,8 @@ multiclass sve_fp_3op_pred_hfd<SDPatternOperator op> {
90879090
def : SVE_4_Op_Pat<nxv2f64, op, nxv2i1, nxv2f64, nxv2f64, nxv2f64, !cast<Instruction>(NAME # _D_UNDEF)>;
90889091
}
90899092

9090-
multiclass sve_fp_3op_pred_bf<SDPatternOperator op> {
9093+
// Predicated pseudo floating point (BFloat) three operand instructions.
9094+
multiclass sve_fp_3op_pred_bfloat<SDPatternOperator op> {
90919095
def _UNDEF : PredThreeOpPseudo<NAME, ZPR16, FalseLanesUndef>;
90929096

90939097
def : SVE_4_Op_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, nxv8bf16, nxv8bf16, !cast<Instruction>(NAME # _UNDEF)>;
@@ -9147,7 +9151,7 @@ multiclass sve_int_bin_pred_all_active_bhsd<SDPatternOperator op> {
91479151
// SME2 or SVE2.1 Instructions
91489152
//===----------------------------------------------------------------------===//
91499153

9150-
class sve2p1_fclamp<string asm, bits<2> sz, ZPRRegOp zpr_ty>
9154+
class sve_fp_clamp<string asm, bits<2> sz, ZPRRegOp zpr_ty>
91519155
: I<(outs zpr_ty:$Zd), (ins zpr_ty:$_Zd, zpr_ty:$Zn, zpr_ty:$Zm),
91529156
asm, "\t$Zd, $Zn, $Zm", "", []>,
91539157
Sched<[]> {
@@ -9168,18 +9172,19 @@ class sve2p1_fclamp<string asm, bits<2> sz, ZPRRegOp zpr_ty>
91689172
let hasSideEffects = 0;
91699173
}
91709174

9171-
multiclass sve2p1_fclamp<string asm, SDPatternOperator op> {
9172-
def _H : sve2p1_fclamp<asm, 0b01, ZPR16>;
9173-
def _S : sve2p1_fclamp<asm, 0b10, ZPR32>;
9174-
def _D : sve2p1_fclamp<asm, 0b11, ZPR64>;
9175+
multiclass sve_fp_clamp<string asm, SDPatternOperator op> {
9176+
def _H : sve_fp_clamp<asm, 0b01, ZPR16>;
9177+
def _S : sve_fp_clamp<asm, 0b10, ZPR32>;
9178+
def _D : sve_fp_clamp<asm, 0b11, ZPR64>;
91759179

91769180
def : SVE_3_Op_Pat<nxv8f16, op, nxv8f16, nxv8f16, nxv8f16, !cast<Instruction>(NAME # _H)>;
91779181
def : SVE_3_Op_Pat<nxv4f32, op, nxv4f32, nxv4f32, nxv4f32, !cast<Instruction>(NAME # _S)>;
91789182
def : SVE_3_Op_Pat<nxv2f64, op, nxv2f64, nxv2f64, nxv2f64, !cast<Instruction>(NAME # _D)>;
91799183
}
91809184

9181-
multiclass sve2p1_bfclamp<string asm, SDPatternOperator op> {
9182-
def NAME : sve2p1_fclamp<asm, 0b00, ZPR16>;
9185+
multiclass sve_fp_clamp_bfloat<string asm, SDPatternOperator op> {
9186+
def NAME : sve_fp_clamp<asm, 0b00, ZPR16>;
9187+
91839188
def : SVE_3_Op_Pat<nxv8bf16, op, nxv8bf16, nxv8bf16, nxv8bf16, !cast<Instruction>(NAME)>;
91849189
}
91859190

0 commit comments

Comments
 (0)