@@ -32,3 +32,68 @@ let Predicates = [HasStdExtZvfbfwma],
3232 DestEEW = EEWSEWx2 in {
3333defm VFWMACCBF16_V : VWMAC_FV_V_F<"vfwmaccbf16", 0b111011>;
3434}
35+
36+ //===----------------------------------------------------------------------===//
37+ // Pseudo instructions
38+ //===----------------------------------------------------------------------===//
39+ let Predicates = [HasStdExtZvfbfmin] in {
40+ defm PseudoVFWCVTBF16_F_F : VPseudoVWCVTD_V;
41+ defm PseudoVFNCVTBF16_F_F : VPseudoVNCVTD_W_RM;
42+ }
43+
44+ let mayRaiseFPException = true, Predicates = [HasStdExtZvfbfwma] in
45+ defm PseudoVFWMACCBF16 : VPseudoVWMAC_VV_VF_BF_RM;
46+
47+ //===----------------------------------------------------------------------===//
48+ // Patterns
49+ //===----------------------------------------------------------------------===//
50+ let Predicates = [HasStdExtZvfbfmin] in {
51+ defm : VPatConversionWF_VF_BF<"int_riscv_vfwcvtbf16_f_f_v",
52+ "PseudoVFWCVTBF16_F_F", isSEWAware=1>;
53+ defm : VPatConversionVF_WF_BF_RM<"int_riscv_vfncvtbf16_f_f_w",
54+ "PseudoVFNCVTBF16_F_F", isSEWAware=1>;
55+
56+ foreach fvtiToFWti = AllWidenableBFloatToFloatVectors in {
57+ defvar fvti = fvtiToFWti.Vti;
58+ defvar fwti = fvtiToFWti.Wti;
59+ let Predicates = [HasVInstructionsBF16Minimal] in
60+ def : Pat<(fwti.Vector (any_riscv_fpextend_vl
61+ (fvti.Vector fvti.RegClass:$rs1),
62+ (fvti.Mask VMV0:$vm),
63+ VLOpFrag)),
64+ (!cast<Instruction>("PseudoVFWCVTBF16_F_F_V_"#fvti.LMul.MX#"_E"#fvti.SEW#"_MASK")
65+ (fwti.Vector (IMPLICIT_DEF)), fvti.RegClass:$rs1,
66+ (fvti.Mask VMV0:$vm),
67+ GPR:$vl, fvti.Log2SEW, TA_MA)>;
68+
69+ let Predicates = [HasVInstructionsBF16Minimal] in
70+ def : Pat<(fvti.Vector (any_riscv_fpround_vl
71+ (fwti.Vector fwti.RegClass:$rs1),
72+ (fwti.Mask VMV0:$vm), VLOpFrag)),
73+ (!cast<Instruction>("PseudoVFNCVTBF16_F_F_W_"#fvti.LMul.MX#"_E"#fvti.SEW#"_MASK")
74+ (fvti.Vector (IMPLICIT_DEF)), fwti.RegClass:$rs1,
75+ (fwti.Mask VMV0:$vm),
76+ // Value to indicate no rounding mode change in
77+ // RISCVInsertReadWriteCSR
78+ FRM_DYN,
79+ GPR:$vl, fvti.Log2SEW, TA_MA)>;
80+ let Predicates = [HasVInstructionsBF16Minimal] in
81+ def : Pat<(fvti.Vector (fpround (fwti.Vector fwti.RegClass:$rs1))),
82+ (!cast<Instruction>("PseudoVFNCVTBF16_F_F_W_"#fvti.LMul.MX#"_E"#fvti.SEW)
83+ (fvti.Vector (IMPLICIT_DEF)),
84+ fwti.RegClass:$rs1,
85+ // Value to indicate no rounding mode change in
86+ // RISCVInsertReadWriteCSR
87+ FRM_DYN,
88+ fvti.AVL, fvti.Log2SEW, TA_MA)>;
89+ }
90+ }
91+
92+ let Predicates = [HasStdExtZvfbfwma] in {
93+ defm : VPatTernaryW_VV_VX_RM<"int_riscv_vfwmaccbf16", "PseudoVFWMACCBF16",
94+ AllWidenableBFloatToFloatVectors, isSEWAware=1>;
95+ defm : VPatWidenFPMulAccVL_VV_VF_RM<riscv_vfwmadd_vl, "PseudoVFWMACCBF16",
96+ AllWidenableBFloatToFloatVectors>;
97+ defm : VPatWidenFPMulAccSDNode_VV_VF_RM<"PseudoVFWMACCBF16",
98+ AllWidenableBFloatToFloatVectors>;
99+ }
0 commit comments