Skip to content

Commit b684c97

Browse files
committed
[llvm-exegesis] Simplifying the FPR8 setReg implementation and corresponding test cases.
1 parent 62e8e36 commit b684c97

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

llvm/test/tools/llvm-exegesis/AArch64/setReg_init_check.s

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ RUN: llvm-exegesis -mcpu=neoverse-v2 -mode=latency --dump-object-to-disk=%d --op
6060
RUN: llvm-objdump -d %d > %t.s
6161
RUN: FileCheck %s --check-prefix=FPR8-ASM < %t.s
6262
FPR8-ASM: <foo>:
63-
FPR8-ASM: mov w{{[0-9]+}}, #0x0
64-
FPR8-ASM-NEXT: fmov h{{[0-9]+}}, w{{[0-9]+}}
63+
FPR8-ASM: movi d{{[0-9]+}}, #0000000000000000
6564
FPR8-ASM-NEXT: sqabs b{{[0-9]+}}, b{{[0-9]+}}
6665

6766

@@ -71,6 +70,6 @@ RUN: llvm-objdump -d %d > %t.s
7170
RUN: FileCheck %s --check-prefix=FPCR-ASM < %t.s
7271
FPCR-ASM: <foo>:
7372
FPCR-ASM: movi d{{[0-9]+}}, #0000000000000000
74-
FPCR-ASM-NEXT: mov x{{[0-9]+}}, #0x0
75-
FPCR-ASM-NEXT: msr FPCR, x{{[0-9]+}}
73+
FPCR-ASM-NEXT: mov x8, #0x0
74+
FPCR-ASM-NEXT: msr FPCR, x8
7675
FPCR-ASM-NEXT: bfcvt h{{[0-9]+}}, s{{[0-9]+}}

llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,6 @@ loadFPCRImmediate(MCRegister Reg, unsigned RegBitWidth, const APInt &Value) {
6363
return {LoadImm, MoveToFPCR};
6464
}
6565

66-
// Generates instructions to load an immediate value into an FPR8 register.
67-
static std::vector<MCInst>
68-
loadFP8Immediate(MCRegister Reg, unsigned RegBitWidth, const APInt &Value) {
69-
assert(Value.getBitWidth() <= 8 && "Value must fit in 8 bits");
70-
71-
// Use a temporary general-purpose register (W8) to hold the 8-bit value
72-
MCRegister TempReg = AArch64::W8;
73-
74-
// Load the 8-bit value into a general-purpose register (W8)
75-
MCInst LoadImm = MCInstBuilder(AArch64::MOVi32imm)
76-
.addReg(TempReg)
77-
.addImm(Value.getZExtValue());
78-
79-
// Move the value from the general-purpose register to the FPR16 register
80-
// Convert the FPR8 register to an FPR16 register
81-
MCRegister FPR16Reg = Reg + (AArch64::H0 - AArch64::B0);
82-
MCInst MoveToFPR =
83-
MCInstBuilder(AArch64::FMOVWHr).addReg(FPR16Reg).addReg(TempReg);
84-
return {LoadImm, MoveToFPR};
85-
}
86-
8766
// Fetch base-instruction to load an FP immediate value into a register.
8867
static unsigned getLoadFPImmediateOpcode(unsigned RegBitWidth) {
8968
switch (RegBitWidth) {
@@ -129,7 +108,7 @@ class ExegesisAArch64Target : public ExegesisTarget {
129108
if (AArch64::PPRRegClass.contains(Reg))
130109
return {loadPPRImmediate(Reg, 16, Value)};
131110
if (AArch64::FPR8RegClass.contains(Reg))
132-
return loadFP8Immediate(Reg, 8, Value);
111+
return {loadFPImmediate(Reg - AArch64::B0 + AArch64::D0, 64, Value)};
133112
if (AArch64::FPR16RegClass.contains(Reg))
134113
return {loadFPImmediate(Reg, 16, Value)};
135114
if (AArch64::FPR32RegClass.contains(Reg))

0 commit comments

Comments
 (0)