diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td @@ -341,33 +341,33 @@ multiclass VPatWidenBinarySDNode_VV_VX { - foreach vti = AllWidenableIntVectors in { - def : Pat<(op (vti.Wti.Vector (extop1 (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector (extop2 (vti.Vti.Vector vti.Vti.RegClass:$rs1)))), - (!cast(instruction_name#"_VV_"#vti.Vti.LMul.MX) - vti.Vti.RegClass:$rs2, vti.Vti.RegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; - def : Pat<(op (vti.Wti.Vector (extop1 (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector (extop2 (vti.Vti.Vector (SplatPat GPR:$rs1))))), - (!cast(instruction_name#"_VX_"#vti.Vti.LMul.MX) - vti.Vti.RegClass:$rs2, GPR:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; + foreach vtiToWti = AllWidenableIntVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; + def : Pat<(op (wti.Vector (extop1 (vti.Vector vti.RegClass:$rs2))), + (wti.Vector (extop2 (vti.Vector vti.RegClass:$rs1)))), + (!cast(instruction_name#"_VV_"#vti.LMul.MX) + vti.RegClass:$rs2, vti.RegClass:$rs1, vti.AVL, vti.Log2SEW)>; + def : Pat<(op (wti.Vector (extop1 (vti.Vector vti.RegClass:$rs2))), + (wti.Vector (extop2 (vti.Vector (SplatPat GPR:$rs1))))), + (!cast(instruction_name#"_VX_"#vti.LMul.MX) + vti.RegClass:$rs2, GPR:$rs1, vti.AVL, vti.Log2SEW)>; } } multiclass VPatWidenBinarySDNode_WV_WX { - foreach vti = AllWidenableIntVectors in { - def : Pat<(op (vti.Wti.Vector vti.Wti.RegClass:$rs2), - (vti.Wti.Vector (extop (vti.Vti.Vector vti.Vti.RegClass:$rs1)))), - (!cast(instruction_name#"_WV_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rs2, vti.Vti.RegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; - def : Pat<(op (vti.Wti.Vector vti.Wti.RegClass:$rs2), - (vti.Wti.Vector (extop (vti.Vti.Vector (SplatPat GPR:$rs1))))), - (!cast(instruction_name#"_WX_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rs2, GPR:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; + foreach vtiToWti = AllWidenableIntVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; + def : Pat<(op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (extop (vti.Vector vti.RegClass:$rs1)))), + (!cast(instruction_name#"_WV_"#vti.LMul.MX) + wti.RegClass:$rs2, vti.RegClass:$rs1, vti.AVL, vti.Log2SEW)>; + def : Pat<(op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (extop (vti.Vector (SplatPat GPR:$rs1))))), + (!cast(instruction_name#"_WX_"#vti.LMul.MX) + wti.RegClass:$rs2, GPR:$rs1, vti.AVL, vti.Log2SEW)>; } } @@ -378,67 +378,69 @@ } multiclass VPatWidenMulAddSDNode_VV { - foreach vti = AllWidenableIntVectors in { + foreach vtiToWti = AllWidenableIntVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; def : Pat< - (add (vti.Wti.Vector vti.Wti.RegClass:$rd), - (mul_oneuse (vti.Wti.Vector (extop1 (vti.Vti.Vector vti.Vti.RegClass:$rs1))), - (vti.Wti.Vector (extop2 (vti.Vti.Vector vti.Vti.RegClass:$rs2))))), - (!cast(instruction_name#"_VV_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rd, vti.Vti.RegClass:$rs1, vti.Vti.RegClass:$rs2, - vti.Vti.AVL, vti.Vti.Log2SEW, TAIL_AGNOSTIC + (add (wti.Vector wti.RegClass:$rd), + (mul_oneuse (wti.Vector (extop1 (vti.Vector vti.RegClass:$rs1))), + (wti.Vector (extop2 (vti.Vector vti.RegClass:$rs2))))), + (!cast(instruction_name#"_VV_"#vti.LMul.MX) + wti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + vti.AVL, vti.Log2SEW, TAIL_AGNOSTIC )>; } } multiclass VPatWidenMulAddSDNode_VX { - foreach vti = AllWidenableIntVectors in { + foreach vtiToWti = AllWidenableIntVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; def : Pat< - (add (vti.Wti.Vector vti.Wti.RegClass:$rd), - (mul_oneuse (vti.Wti.Vector (extop1 (vti.Vti.Vector (SplatPat GPR:$rs1)))), - (vti.Wti.Vector (extop2 (vti.Vti.Vector vti.Vti.RegClass:$rs2))))), - (!cast(instruction_name#"_VX_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rd, GPR:$rs1, vti.Vti.RegClass:$rs2, - vti.Vti.AVL, vti.Vti.Log2SEW, TAIL_AGNOSTIC + (add (wti.Vector wti.RegClass:$rd), + (mul_oneuse (wti.Vector (extop1 (vti.Vector (SplatPat GPR:$rs1)))), + (wti.Vector (extop2 (vti.Vector vti.RegClass:$rs2))))), + (!cast(instruction_name#"_VX_"#vti.LMul.MX) + wti.RegClass:$rd, GPR:$rs1, vti.RegClass:$rs2, + vti.AVL, vti.Log2SEW, TAIL_AGNOSTIC )>; } } multiclass VPatWidenBinaryFPSDNode_VV_VF { - foreach vti = AllWidenableFloatVectors in { - def : Pat<(op (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs1)))), - (!cast(instruction_name#"_VV_"#vti.Vti.LMul.MX) - vti.Vti.RegClass:$rs2, vti.Vti.RegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; - def : Pat<(op (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector (SplatFPOp vti.Vti.ScalarRegClass:$rs1))))), - (!cast(instruction_name#"_V"#vti.Vti.ScalarSuffix#"_"#vti.Vti.LMul.MX) - vti.Vti.RegClass:$rs2, vti.Vti.ScalarRegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; - def : Pat<(op (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector (SplatFPOp (fpext_oneuse vti.Vti.ScalarRegClass:$rs1)))), - (!cast(instruction_name#"_V"#vti.Vti.ScalarSuffix#"_"#vti.Vti.LMul.MX) - vti.Vti.RegClass:$rs2, vti.Vti.ScalarRegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; + foreach vtiToWti = AllWidenableFloatVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; + def : Pat<(op (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs2))), + (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs1)))), + (!cast(instruction_name#"_VV_"#vti.LMul.MX) + vti.RegClass:$rs2, vti.RegClass:$rs1, vti.AVL, vti.Log2SEW)>; + def : Pat<(op (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs2))), + (wti.Vector (fpext_oneuse (vti.Vector (SplatFPOp vti.ScalarRegClass:$rs1))))), + (!cast(instruction_name#"_V"#vti.ScalarSuffix#"_"#vti.LMul.MX) + vti.RegClass:$rs2, vti.ScalarRegClass:$rs1, vti.AVL, vti.Log2SEW)>; + def : Pat<(op (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs2))), + (wti.Vector (SplatFPOp (fpext_oneuse vti.ScalarRegClass:$rs1)))), + (!cast(instruction_name#"_V"#vti.ScalarSuffix#"_"#vti.LMul.MX) + vti.RegClass:$rs2, vti.ScalarRegClass:$rs1, vti.AVL, vti.Log2SEW)>; } } multiclass VPatWidenBinaryFPSDNode_WV_WF { - foreach vti = AllWidenableFloatVectors in { - def : Pat<(op (vti.Wti.Vector vti.Wti.RegClass:$rs2), - (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs1)))), - (!cast(instruction_name#"_WV_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rs2, vti.Vti.RegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; - def : Pat<(op (vti.Wti.Vector vti.Wti.RegClass:$rs2), - (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector (SplatFPOp vti.Vti.ScalarRegClass:$rs1))))), - (!cast(instruction_name#"_W"#vti.Vti.ScalarSuffix#"_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rs2, vti.Vti.ScalarRegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; - def : Pat<(op (vti.Wti.Vector vti.Wti.RegClass:$rs2), - (vti.Wti.Vector (SplatFPOp (fpext_oneuse vti.Vti.ScalarRegClass:$rs1)))), - (!cast(instruction_name#"_W"#vti.Vti.ScalarSuffix#"_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rs2, vti.Vti.ScalarRegClass:$rs1, - vti.Vti.AVL, vti.Vti.Log2SEW)>; + foreach vtiToWti = AllWidenableFloatVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; + def : Pat<(op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs1)))), + (!cast(instruction_name#"_WV_"#vti.LMul.MX) + wti.RegClass:$rs2, vti.RegClass:$rs1, vti.AVL, vti.Log2SEW)>; + def : Pat<(op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (fpext_oneuse (vti.Vector (SplatFPOp vti.ScalarRegClass:$rs1))))), + (!cast(instruction_name#"_W"#vti.ScalarSuffix#"_"#vti.LMul.MX) + wti.RegClass:$rs2, vti.ScalarRegClass:$rs1, vti.AVL, vti.Log2SEW)>; + def : Pat<(op (wti.Vector wti.RegClass:$rs2), + (wti.Vector (SplatFPOp (fpext_oneuse vti.ScalarRegClass:$rs1)))), + (!cast(instruction_name#"_W"#vti.ScalarSuffix#"_"#vti.LMul.MX) + wti.RegClass:$rs2, vti.ScalarRegClass:$rs1, vti.AVL, vti.Log2SEW)>; } } @@ -448,19 +450,21 @@ } multiclass VPatWidenFPMulAccSDNode_VV_VF { - foreach vti = AllWidenableFloatVectors in { - def : Pat<(fma (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs1))), - (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector vti.Wti.RegClass:$rd)), - (!cast(instruction_name#"_VV_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rd, vti.Vti.RegClass:$rs1, vti.Vti.RegClass:$rs2, - vti.Vti.AVL, vti.Vti.Log2SEW, TAIL_AGNOSTIC)>; - def : Pat<(fma (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector (SplatFPOp vti.Vti.ScalarRegClass:$rs1)))), - (vti.Wti.Vector (fpext_oneuse (vti.Vti.Vector vti.Vti.RegClass:$rs2))), - (vti.Wti.Vector vti.Wti.RegClass:$rd)), - (!cast(instruction_name#"_V"#vti.Vti.ScalarSuffix#"_"#vti.Vti.LMul.MX) - vti.Wti.RegClass:$rd, vti.Vti.ScalarRegClass:$rs1, vti.Vti.RegClass:$rs2, - vti.Vti.AVL, vti.Vti.Log2SEW, TAIL_AGNOSTIC)>; + foreach vtiToWti = AllWidenableFloatVectors in { + defvar vti = vtiToWti.Vti; + defvar wti = vtiToWti.Wti; + def : Pat<(fma (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs1))), + (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs2))), + (wti.Vector wti.RegClass:$rd)), + (!cast(instruction_name#"_VV_"#vti.LMul.MX) + wti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2, + vti.AVL, vti.Log2SEW, TAIL_AGNOSTIC)>; + def : Pat<(fma (wti.Vector (fpext_oneuse (vti.Vector (SplatFPOp vti.ScalarRegClass:$rs1)))), + (wti.Vector (fpext_oneuse (vti.Vector vti.RegClass:$rs2))), + (wti.Vector wti.RegClass:$rd)), + (!cast(instruction_name#"_V"#vti.ScalarSuffix#"_"#vti.LMul.MX) + wti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2, + vti.AVL, vti.Log2SEW, TAIL_AGNOSTIC)>; } }