[llvm] Adding support in llvm-exegesis for Aarch64 for handling FPR64/128, PPR16 and ZPR128 reg class. (PR #127564)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 03:19:23 PST 2025
================
@@ -28,13 +28,51 @@ static unsigned getLoadImmediateOpcode(unsigned RegBitWidth) {
// Generates instruction to load an immediate value into a register.
static MCInst loadImmediate(MCRegister Reg, unsigned RegBitWidth,
const APInt &Value) {
- if (Value.getBitWidth() > RegBitWidth)
- llvm_unreachable("Value must fit in the Register");
+ assert(Value.getBitWidth() <= RegBitWidth && "Value must fit in the Register");
return MCInstBuilder(getLoadImmediateOpcode(RegBitWidth))
.addReg(Reg)
.addImm(Value.getZExtValue());
}
+static MCInst loadZPRImmediate(MCRegister Reg, unsigned RegBitWidth,
+ const APInt &Value) {
+ assert(Value.getBitWidth() <= RegBitWidth && "Value must fit in the PPR Register");
+ // For ZPR, we typically use DUPM instruction to load immediate values
+ return MCInstBuilder(AArch64::DUPM_ZI)
+ .addReg(Reg)
+ .addImm(Value.getZExtValue());
+}
+
+static MCInst loadPPRImmediate(MCRegister Reg, unsigned RegBitWidth,
+ const APInt &Value) {
+ assert(Value.getBitWidth() <= RegBitWidth && "Value must fit in the PPR Register");
+ // For PPR, we typically use PTRUE instruction to set predicate registers
+ return MCInstBuilder(AArch64::PTRUE_B)
+ .addReg(Reg)
+ .addImm(0xFFFF); // All lanes true for 16 bits
+}
+
+// Generates instruction to load an FP immediate value into a register.
+static unsigned getLoadFPImmediateOpcode(unsigned RegBitWidth) {
+ switch (RegBitWidth) {
+ case 64:
----------------
davemgreen wrote:
Once you get there you might need to create a FMOVDi with a d reg and then subreg-copy to the smaller reg. I'm not sure the subreg copy is actually needed though, as it is really the same register and clearing the Dreg will clear all of the s/h/b.
https://github.com/llvm/llvm-project/pull/127564
More information about the llvm-commits
mailing list