[PATCH] D97008: [RISCV] Prune unneeded indexed load/store pseudo instructions.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 18 15:49:03 PST 2021
craig.topper created this revision.
craig.topper added reviewers: frasercrmck, evandro, HsiangKai, khchen, arcbbb, rogfer01.
Herald added subscribers: StephenFan, vkmr, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, arphaman, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.
We were creating more combinations of value and index lmul than
we needed.
I've copied the loop structure used here from VPseudoAMOEI with
all data lmul values instead of just 32/64.
Similar can be done for segment loads/store, but we're testing
illegal combinations today that need to be cleaned up first.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97008
Files:
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
Index: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -1253,15 +1253,22 @@
multiclass VPseudoILoad {
foreach eew = EEWList in {
- foreach lmul = MxList.m in
- foreach idx_lmul = MxSet<eew>.m in {
- defvar LInfo = lmul.MX;
- defvar Vreg = lmul.vrclass;
- defvar IdxLInfo = idx_lmul.MX;
- defvar IdxVreg = idx_lmul.vrclass;
- let VLMul = lmul.value in {
- def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo : VPseudoILoadNoMask<Vreg, IdxVreg>;
- def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo # "_MASK" : VPseudoILoadMask<Vreg, IdxVreg>;
+ foreach sew = EEWList in {
+ foreach lmul = MxSet<sew>.m in {
+ defvar octuple_lmul = octuple_from_str<lmul.MX>.ret;
+ // Calculate emul = eew * lmul / sew
+ defvar octuple_emul = !srl(!mul(eew, octuple_lmul), shift_amount<sew>.val);
+ if !and(!ge(octuple_emul, 1), !le(octuple_emul, 64)) then {
+ defvar LInfo = lmul.MX;
+ defvar IdxLInfo = octuple_to_str<octuple_emul>.ret;
+ defvar idx_lmul = !cast<LMULInfo>("V_" # IdxLInfo);
+ defvar Vreg = lmul.vrclass;
+ defvar IdxVreg = idx_lmul.vrclass;
+ let VLMul = lmul.value in {
+ def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo : VPseudoILoadNoMask<Vreg, IdxVreg>;
+ def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo # "_MASK" : VPseudoILoadMask<Vreg, IdxVreg>;
+ }
+ }
}
}
}
@@ -1303,17 +1310,24 @@
multiclass VPseudoIStore {
foreach eew = EEWList in {
- foreach lmul = MxList.m in
- foreach idx_lmul = MxSet<eew>.m in {
- defvar LInfo = lmul.MX;
- defvar Vreg = lmul.vrclass;
- defvar IdxLInfo = idx_lmul.MX;
- defvar IdxVreg = idx_lmul.vrclass;
- let VLMul = lmul.value in {
- def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo :
- VPseudoIStoreNoMask<Vreg, IdxVreg>;
- def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo # "_MASK" :
- VPseudoIStoreMask<Vreg, IdxVreg>;
+ foreach sew = EEWList in {
+ foreach lmul = MxSet<sew>.m in {
+ defvar octuple_lmul = octuple_from_str<lmul.MX>.ret;
+ // Calculate emul = eew * lmul / sew
+ defvar octuple_emul = !srl(!mul(eew, octuple_lmul), shift_amount<sew>.val);
+ if !and(!ge(octuple_emul, 1), !le(octuple_emul, 64)) then {
+ defvar LInfo = lmul.MX;
+ defvar IdxLInfo = octuple_to_str<octuple_emul>.ret;
+ defvar idx_lmul = !cast<LMULInfo>("V_" # IdxLInfo);
+ defvar Vreg = lmul.vrclass;
+ defvar IdxVreg = idx_lmul.vrclass;
+ let VLMul = lmul.value in {
+ def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo :
+ VPseudoIStoreNoMask<Vreg, IdxVreg>;
+ def "EI" # eew # "_V_" # IdxLInfo # "_" # LInfo # "_MASK" :
+ VPseudoIStoreMask<Vreg, IdxVreg>;
+ }
+ }
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97008.324801.patch
Type: text/x-patch
Size: 3088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/9c7ce9bc/attachment.bin>
More information about the llvm-commits
mailing list