diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -164,10 +164,6 @@ true: [2, 3, 4, 5, 6, 7, 8]); } -class log2 { - int val = !if(!eq(num, 1), 0, !add(1, log2.val)); -} - class octuple_to_str { string ret = !cond(!eq(octuple, 1): "MF8", !eq(octuple, 2): "MF4", @@ -205,7 +201,7 @@ ValueType Vector = Vec; ValueType Mask = Mas; int SEW = Sew; - int Log2SEW = log2.val; + int Log2SEW = !logtwo(Sew); VReg RegClass = Reg; LMULInfo LMul = M; ValueType Scalar = Scal; @@ -693,7 +689,7 @@ Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -706,7 +702,7 @@ Pseudo<(outs RetClass:$rd), (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -723,7 +719,7 @@ GPRMem:$rs1, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -739,7 +735,7 @@ Pseudo<(outs RetClass:$rd, GPR:$vl), (ins GPRMem:$rs1, AVL:$avl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -752,7 +748,7 @@ Pseudo<(outs RetClass:$rd, GPR:$vl), (ins RetClass:$dest, GPRMem:$rs1, AVL:$avl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -769,7 +765,7 @@ GPRMem:$rs1, VMaskOp:$vm, AVL:$avl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -785,7 +781,7 @@ Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, GPR:$rs2, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -798,7 +794,7 @@ Pseudo<(outs RetClass:$rd), (ins RetClass:$dest, GPRMem:$rs1, GPR:$rs2, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -815,7 +811,7 @@ GPRMem:$rs1, GPR:$rs2, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLE.val, VLMul> { + RISCVVLE { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -833,7 +829,7 @@ (ins GPRMem:$rs1, IdxClass:$rs2, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLX.val, VLMul, LMUL> { + RISCVVLX { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -849,7 +845,7 @@ (ins RetClass:$dest, GPRMem:$rs1, IdxClass:$rs2, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLX.val, VLMul, LMUL> { + RISCVVLX { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -867,7 +863,7 @@ GPRMem:$rs1, IdxClass:$rs2, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLX.val, VLMul, LMUL> { + RISCVVLX { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -883,7 +879,7 @@ Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSE.val, VLMul> { + RISCVVSE { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -896,7 +892,7 @@ Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSE.val, VLMul> { + RISCVVSE { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -908,7 +904,7 @@ Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, GPR:$rs2, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSE.val, VLMul> { + RISCVVSE { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -921,7 +917,7 @@ Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, GPR:$rs2, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSE.val, VLMul> { + RISCVVSE { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1194,7 +1190,7 @@ Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, IdxClass:$rs2, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSX.val, VLMul, LMUL> { + RISCVVSX { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1208,7 +1204,7 @@ Pseudo<(outs), (ins StClass:$rd, GPRMem:$rs1, IdxClass:$rs2, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSX.val, VLMul, LMUL> { + RISCVVSX { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1403,7 +1399,7 @@ Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1416,7 +1412,7 @@ Pseudo<(outs RetClass:$rd), (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1432,7 +1428,7 @@ (ins GetVRegNoV0.R:$merge, GPRMem:$rs1, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1448,7 +1444,7 @@ Pseudo<(outs RetClass:$rd, GPR:$vl), (ins GPRMem:$rs1, AVL:$avl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1461,7 +1457,7 @@ Pseudo<(outs RetClass:$rd, GPR:$vl), (ins RetClass:$dest, GPRMem:$rs1, AVL:$avl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1477,7 +1473,7 @@ (ins GetVRegNoV0.R:$merge, GPRMem:$rs1, VMaskOp:$vm, AVL:$avl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1493,7 +1489,7 @@ Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, GPR:$offset, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1506,7 +1502,7 @@ Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, GPRMem:$rs1, GPR:$offset, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1523,7 +1519,7 @@ GPR:$offset, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLSEG.val, VLMul> { + RISCVVLSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1540,7 +1536,7 @@ Pseudo<(outs RetClass:$rd), (ins GPRMem:$rs1, IdxClass:$offset, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLXSEG.val, VLMul, LMUL> { + RISCVVLXSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1557,7 +1553,7 @@ Pseudo<(outs RetClass:$rd), (ins RetClass:$merge, GPRMem:$rs1, IdxClass:$offset, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVLXSEG.val, VLMul, LMUL> { + RISCVVLXSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1577,7 +1573,7 @@ IdxClass:$offset, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy),[]>, RISCVVPseudo, - RISCVVLXSEG.val, VLMul, LMUL> { + RISCVVLXSEG { let mayLoad = 1; let mayStore = 0; let hasSideEffects = 0; @@ -1595,7 +1591,7 @@ Pseudo<(outs), (ins ValClass:$rd, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSSEG.val, VLMul> { + RISCVVSSEG { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1609,7 +1605,7 @@ (ins ValClass:$rd, GPRMem:$rs1, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSSEG.val, VLMul> { + RISCVVSSEG { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1621,7 +1617,7 @@ Pseudo<(outs), (ins ValClass:$rd, GPRMem:$rs1, GPR: $offset, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSSEG.val, VLMul> { + RISCVVSSEG { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1635,7 +1631,7 @@ (ins ValClass:$rd, GPRMem:$rs1, GPR: $offset, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSSEG.val, VLMul> { + RISCVVSSEG { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1649,7 +1645,7 @@ (ins ValClass:$rd, GPRMem:$rs1, IdxClass: $index, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSXSEG.val, VLMul, LMUL> { + RISCVVSXSEG { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1664,7 +1660,7 @@ (ins ValClass:$rd, GPRMem:$rs1, IdxClass: $index, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, RISCVVPseudo, - RISCVVSXSEG.val, VLMul, LMUL> { + RISCVVSXSEG { let mayLoad = 0; let mayStore = 1; let hasSideEffects = 0; @@ -1751,7 +1747,7 @@ defvar dataEMULOctuple = dataEMUL.octuple; // Calculate emul = eew * lmul / sew defvar idxEMULOctuple = - !srl(!mul(idxEEW, dataEMULOctuple), log2.val); + !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { defvar DataLInfo = dataEMUL.MX; defvar IdxLInfo = octuple_to_str.ret; @@ -1826,7 +1822,7 @@ defvar dataEMULOctuple = dataEMUL.octuple; // Calculate emul = eew * lmul / sew defvar idxEMULOctuple = - !srl(!mul(idxEEW, dataEMULOctuple), log2.val); + !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { defvar DataLInfo = dataEMUL.MX; defvar IdxLInfo = octuple_to_str.ret; @@ -2079,7 +2075,7 @@ foreach sew = EEWList in { defvar dataEMULOctuple = m.octuple; // emul = lmul * eew / sew - defvar idxEMULOctuple = !srl(!mul(dataEMULOctuple, eew), log2.val); + defvar idxEMULOctuple = !srl(!mul(dataEMULOctuple, eew), !logtwo(sew)); if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { defvar emulMX = octuple_to_str.ret; defvar emul = !cast("V_" # emulMX); @@ -3796,7 +3792,7 @@ foreach dataEMUL = MxSet.m in { defvar dataEMULOctuple = dataEMUL.octuple; // Calculate emul = eew * lmul / sew - defvar idxEMULOctuple = !srl(!mul(idxEEW, dataEMULOctuple), log2.val); + defvar idxEMULOctuple = !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { defvar DataLInfo = dataEMUL.MX; defvar IdxLInfo = octuple_to_str.ret; @@ -3867,7 +3863,7 @@ foreach dataEMUL = MxSet.m in { defvar dataEMULOctuple = dataEMUL.octuple; // Calculate emul = eew * lmul / sew - defvar idxEMULOctuple = !srl(!mul(idxEEW, dataEMULOctuple), log2.val); + defvar idxEMULOctuple = !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { defvar DataLInfo = dataEMUL.MX; defvar IdxLInfo = octuple_to_str.ret;