Skip to content

Commit 9787b4d

Browse files
committed
[[lvm-exegesis] [AArch64] Updated PCREL imm value to 8 and Updated comments.
1 parent 93ec649 commit 9787b4d

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

llvm/test/tools/llvm-exegesis/AArch64/error-resolution.s

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44

5-
// Test for omitting OperandType::OPERAND_MSL_SHIFT_4S
5+
// Test for omitting OperandType::OPERAND_SHIFT_MSL
66

77
// MOVIv2s_msl: MOVI vd, #imm{, shift}
88
# RUN: llvm-exegesis --mtriple=aarch64 --mcpu=neoverse-v2 --mode=latency --benchmark-phase=prepare-and-assemble-snippet --opcode-name=MOVIv4s_msl 2>&1 | FileCheck %s --check-prefix=MOVIv4s_msl_latency
@@ -20,10 +20,6 @@
2020
# MOVIv4s_msl_throughput-NEXT: MOVIv4s_msl [[REG1:Q[0-9]+|LR]] i_0x1 i_0x108
2121
# MOVIv4s_msl_throughput: ...
2222

23-
24-
25-
// Test for omitting OperandType::OPERAND_MSL_SHIFT_2S
26-
2723
// MOVIv2s_msl: MOVI vd, #imm{, shift}
2824
# RUN: llvm-exegesis --mtriple=aarch64 --mcpu=neoverse-v2 --mode=latency --benchmark-phase=prepare-and-assemble-snippet --opcode-name=MOVIv2s_msl 2>&1 | FileCheck %s --check-prefix=MOVIv2s_msl_latency
2925
# RUN: llvm-exegesis --mtriple=aarch64 --mcpu=neoverse-v2 --mode=inverse_throughput --benchmark-phase=prepare-and-assemble-snippet --opcode-name=MOVIv2s_msl 2>&1 | FileCheck %s --check-prefix=MOVIv2s_msl_throughput
@@ -54,12 +50,12 @@
5450
# LDRDl_throughput-NEXT: mode: inverse_throughput
5551
# LDRDl_throughput-NEXT: key:
5652
# LDRDl_throughput-NEXT: instructions:
57-
# LDRDl_throughput-NEXT: LDRDl [[REG1:D[0-9]+|LR]] i_0x0
53+
# LDRDl_throughput-NEXT: LDRDl [[REG1:D[0-9]+|LR]] i_0x8
5854
# LDRDl_throughput: ...
5955

6056

6157

62-
// Test for omitting OperandType::OPERAND_FIRST_TARGET
58+
// Test for omitting OperandType::OPERAND_IMPLICIT_IMM_0
6359

6460
// UMOVvi16_idx0: UMOV wd, vn.h[index]
6561
# RUN: llvm-exegesis --mtriple=aarch64 --mcpu=neoverse-v2 --mode=latency --benchmark-phase=prepare-and-assemble-snippet --opcode-name=UMOVvi16_idx0 2>&1 | FileCheck %s --check-prefix=UMOVvi16_idx0_latency

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,23 @@ Error ExegesisAArch64Target::randomizeTargetMCOperand(
161161
const BitVector &ForbiddenRegs) const {
162162
const Operand &Op = Instr.getPrimaryOperand(Var);
163163
const auto OperandType = Op.getExplicitOperandInfo().OperandType;
164-
// FIXME: Implement opcode-specific immediate value handling for system
165-
// instructions:
164+
// NOTE: To resolve "Not all operands were initialized by snippet generator"
165+
// Requires OperandType to be defined for such opcode's operands in AArch64
166+
// tablegen files. And omit introduced OperandType(s).
167+
168+
// Hacky temporary fix works by defaulting all OPERAND_UNKNOWN to
169+
// immediate value 0, but this introduce illegal instruction error for below
170+
// system instructions will need to be omitted with OperandType or opcode
171+
// specific values to avoid generating invalid encodings or unreliable
172+
// benchmark results for these system-level instructions.
173+
// Implement opcode-specific immediate value handling for system instrs:
166174
// - MRS/MSR: Use valid system register encodings (e.g., NZCV, FPCR, FPSR)
167175
// - MSRpstatesvcrImm1: Use valid PSTATE field encodings (e.g., SPSel,
168176
// DAIFSet)
169177
// - SYSLxt/SYSxt: Use valid system instruction encodings with proper
170178
// CRn/CRm/op values
171179
// - UDF: Use valid undefined instruction immediate ranges (0-65535)
172-
// Currently defaulting to immediate value 0, which may cause invalid
173-
// encodings or unreliable benchmark results for these system-level
174-
// instructions.
180+
175181
switch (OperandType) {
176182
// MSL (Masking Shift Left) imm operand for 32-bit splatted SIMD constants
177183
// Correspond to AArch64InstructionSelector::tryAdvSIMDModImm321s()
@@ -186,9 +192,11 @@ Error ExegesisAArch64Target::randomizeTargetMCOperand(
186192
return Error::success();
187193
}
188194
case llvm::AArch64::OPERAND_IMPLICIT_IMM_0:
189-
case MCOI::OperandType::OPERAND_PCREL:
190195
AssignedValue = MCOperand::createImm(0);
191196
return Error::success();
197+
case MCOI::OperandType::OPERAND_PCREL:
198+
AssignedValue = MCOperand::createImm(8);
199+
return Error::success();
192200
default:
193201
break;
194202
}

0 commit comments

Comments
 (0)