Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
156 | Add this assert from hasSameVTYPE assert(!SEWLMULRatioOnly && !Other.SEWLMULRatioOnly && "Can't compare when only LMUL/SEW ratio is valid."); | |
258 | This comment was not addressed | |
261 | Add !Strict to this. | |
264 | The LMUL does matter if the policy is tail agnostic. If the last vsetvli has a larger lmul than the vmv.s.x instruction, then by ignoring LMUL you gave hardware permission to replace every element except 0 of the larger lmul with all 1s. But the vmv.s.x was only allowed to replace the smaller lmul. I think there's also an issue if the register isn't aligned to a multiple of the LMUL setting in vtype. For example, if LMUL=8, the vmv.s.x can't use v2 as its register. Section 3.4.2 of the V spec says that is reserved. When LMUL=8, the vector register group contains eight vector registers, and instructions specifying an LMUL=8 vector register group using register numbers that are not multiples of eight are reserved. |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
264 | According to the spec: The instructions ignore LMUL and vector register groups. The other elements in the destination vector register ( 0 < index < VLEN/SEW) are treated as tail elements using the current tail agnostic/undisturbed policy. I think this means that these vector scalar move instructions only perform on a single vector register what ever the LMUL is. And cause of ignoring the LMUL and vector group, it also can accept any vector register with any LMUL. |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
264 | Thanks. I missed that. |
Thanks, could you also accept the pre-commit test https://reviews.llvm.org/D116306 , so I could push them both.
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
470 | I'm confused by the commit title. You mention vmv.s.x which seems OK with the cases above and you also mention vfmv.s.f. But IIUC the cases listed here are for vfmv.f.s, right? This is my understanding after this exceprt from RISCVInstrInfoVPseudos.td //===----------------------------------------------------------------------===// // 17.2. Floating-Point Scalar Move Instructions //===----------------------------------------------------------------------===// let Predicates = [HasVInstructionsAnyF] in { foreach fvti = AllFloatVectors in { defvar instr = !cast<Instruction>("PseudoVFMV_"#fvti.ScalarSuffix#"_S_" # fvti.LMul.MX); def : Pat<(fvti.Scalar (int_riscv_vfmv_f_s (fvti.Vector fvti.RegClass:$rs2))), (instr $rs2, fvti.Log2SEW)>; def : Pat<(fvti.Vector (int_riscv_vfmv_s_f (fvti.Vector fvti.RegClass:$rs1), (fvti.Scalar fvti.ScalarRegClass:$rs2), VLOpFrag)), (!cast<Instruction>("PseudoVFMV_S_"#fvti.ScalarSuffix#"_" # fvti.LMul.MX) (fvti.Vector $rs1), (fvti.Scalar fvti.ScalarRegClass:$rs2), GPR:$vl, fvti.Log2SEW)>; } } // Predicates = [HasVInstructionsAnyF] |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
470 | Yes, you are right. I used wrong cases here; I will create a new revision to fix this and add more test cases for floating point. Thank you very much. |
Do we need to init ScalarMovOp here?