[llvm] [NFC][RISCV] Unify all zvfbfa vl patterns and sd node patterns (PR #171072)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 11:24:11 PST 2025
================
@@ -1446,13 +1473,28 @@ defm : VPatNConvertFP2ISDNode_W<any_fp_to_sint, "PseudoVFNCVT_RTZ_X_F_W">;
defm : VPatNConvertFP2ISDNode_W<any_fp_to_uint, "PseudoVFNCVT_RTZ_XU_F_W">;
defm : VPatNConvertI2FPSDNode_W_RM<any_sint_to_fp, "PseudoVFNCVT_F_X_W">;
defm : VPatNConvertI2FPSDNode_W_RM<any_uint_to_fp, "PseudoVFNCVT_F_XU_W">;
-foreach fvtiToFWti = AllWidenableFloatVectors in {
+foreach fvtiToFWti = AllWidenableFloatAndBF16Vectors in {
defvar fvti = fvtiToFWti.Vti;
defvar fwti = fvtiToFWti.Wti;
- let Predicates = !listconcat(GetVTypeMinimalPredicates<fvti>.Predicates,
- GetVTypeMinimalPredicates<fwti>.Predicates) in
+ let Predicates = !listconcat(GetVTypeMinimalPredicates<fwti>.Predicates,
+ !if(!eq(fvti.Scalar, bf16),
+ [HasStdExtZvfbfmin],
+ GetVTypeMinimalPredicates<fvti>.Predicates)) in
+ def : Pat<(fvti.Vector (fpround (fwti.Vector fwti.RegClass:$rs1))),
+ (!cast<Instruction>("PseudoVFNCVT"#
+ !if(!eq(fvti.Scalar, bf16), "BF16", "")#
+ "_F_F_W_"#fvti.LMul.MX#"_E"#fvti.SEW)
+ (fvti.Vector (IMPLICIT_DEF)),
+ fwti.RegClass:$rs1,
+ // Value to indicate no rounding mode change in
+ // RISCVInsertReadWriteCSR
+ FRM_DYN,
+ fvti.AVL, fvti.Log2SEW, TA_MA)>;
+ // Define vfncvt.f.f.w for bf16 when Zvfbfa is enabled.
+ if !eq(fvti.Scalar, bf16) then
+ let Predicates = [HasStdExtZvfbfa] in
----------------
topperc wrote:
Should this be `HasVInstructionsBF16` for consistency with `GetVTypePredicates`
https://github.com/llvm/llvm-project/pull/171072
More information about the llvm-commits
mailing list