Skip to content

[RISCV] Order the implicit defs/uses of vl/vtype on MC instructions the same as the pseudo version. #129104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Feb 27, 2025

CodeGen pseudos and the vsetvli insertion pass put VL before VTYPE. Make the MC layer instructions consistent.

…ame as the pseudo version.

This doesn't really matter, but its good to be consistent. There
is code that depends on the pseudo order so it was easier to change
the MC order.
@topperc topperc changed the title [RISCV] Order the implicit defs on MC vset(i)vl(i) instructions the s… [RISCV] Order the implicit defs on MC vset(i)vl(i) instructions the same as the pseudo version. Feb 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 27, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

This doesn't really matter, but its good to be consistent. There is code that depends on the pseudo order so it was easier to change the MC order.


Full diff: https://github.com/llvm/llvm-project/pull/129104.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrFormatsV.td (+3-3)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormatsV.td b/llvm/lib/Target/RISCV/RISCVInstrFormatsV.td
index 6f27c98dd6183..3235b601d4774 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrFormatsV.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrFormatsV.td
@@ -68,7 +68,7 @@ class RVInstSetiVLi<dag outs, dag ins, string opcodestr, string argstr>
   let Inst{11-7} = rd;
   let Inst{6-0} = OPC_OP_V.Value;
 
-  let Defs = [VTYPE, VL];
+  let Defs = [VL, VTYPE];
 }
 
 class RVInstSetVLi<dag outs, dag ins, string opcodestr, string argstr>
@@ -84,7 +84,7 @@ class RVInstSetVLi<dag outs, dag ins, string opcodestr, string argstr>
   let Inst{11-7} = rd;
   let Inst{6-0} = OPC_OP_V.Value;
 
-  let Defs = [VTYPE, VL];
+  let Defs = [VL, VTYPE];
 }
 
 class RVInstSetVL<dag outs, dag ins, string opcodestr, string argstr>
@@ -101,7 +101,7 @@ class RVInstSetVL<dag outs, dag ins, string opcodestr, string argstr>
   let Inst{11-7} = rd;
   let Inst{6-0} = OPC_OP_V.Value;
 
-  let Defs = [VTYPE, VL];
+  let Defs = [VL, VTYPE];
 }
 
 class RVInstVV<bits<6> funct6, RISCVVFormat opv, dag outs, dag ins,

@topperc topperc changed the title [RISCV] Order the implicit defs on MC vset(i)vl(i) instructions the same as the pseudo version. [RISCV] Order the implicit defs/uses of vl/vtype on MC instructions the same as the pseudo version. Feb 27, 2025
Copy link
Collaborator

@preames preames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Aside: In RISCVAsmPrinter::lowerOperand, we drop the implicit operands on the floor. Should we be asserting something about the MC instructions relations to the MI ones somewhere?

@topperc topperc merged commit 73ed27c into llvm:main Feb 27, 2025
11 checks passed
@topperc topperc deleted the pr/vsetvli-order branch February 27, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants