Skip to content

Commit dbbed99

Browse files
committed
[llvm-exegesis] [AArch64] Simplifies shift value for all move_vec_shift to be msl #8
1 parent ab92f0f commit dbbed99

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# MOVIv4s_msl_throughput-NEXT: mode: inverse_throughput
4141
# MOVIv4s_msl_throughput-NEXT: key:
4242
# MOVIv4s_msl_throughput-NEXT: instructions:
43-
# MOVIv4s_msl_throughput-NEXT: MOVIv4s_msl [[REG1:Q[0-9]+|LR]] i_0x1 i_0x110
43+
# MOVIv4s_msl_throughput-NEXT: MOVIv4s_msl [[REG1:Q[0-9]+|LR]] i_0x1 i_0x108
4444
# MOVIv4s_msl_throughput: ...
4545

4646

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

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,28 +180,14 @@ Error ExegesisAArch64Target::randomizeTargetMCOperand(
180180
// MSL (Masking Shift Left) imm operand for 32-bit splatted SIMD constants
181181
// Correspond to AArch64InstructionSelector::tryAdvSIMDModImm321s()
182182
case llvm::AArch64::OPERAND_MSL_SHIFT: {
183-
unsigned Opcode = Instr.getOpcode();
184-
switch (Opcode) {
185-
case AArch64::MOVIv2s_msl:
186-
case AArch64::MVNIv2s_msl:
187-
// Type 7: Pattern 0x00 0x00 abcdefgh 0xFF 0x00 0x00 abcdefgh 0xFF
188-
// Creates 2-element 32-bit vector with 8-bit imm at positions [15:8] &
189-
// [47:40] Shift value 264 (0x108) for Type 7 pattern encoding Corresponds
190-
// to AArch64_AM::encodeAdvSIMDModImmType7()
183+
// There are two valid encodings:
184+
// - Type 7: imm at [15:8], [47:40], shift = 264 (0x108) → msl #8
185+
// - Type 8: imm at [23:16], [55:48], shift = 272 (0x110) → msl #16
186+
// Corresponds AArch64_AM::encodeAdvSIMDModImmType7()
187+
// But, v2s_msl and v4s_msl instructions accept either form,
188+
// Thus, Arbitrarily chosing 264 (msl #8) for simplicity.
191189
AssignedValue = MCOperand::createImm(264);
192190
return Error::success();
193-
case AArch64::MOVIv4s_msl:
194-
case AArch64::MVNIv4s_msl:
195-
// Type 8: Pattern 0x00 abcdefgh 0xFF 0xFF 0x00 abcdefgh 0xFF 0xFF
196-
// Creates 4-element 32-bit vector with 8-bit imm at positions [23:16] &
197-
// [55:48] Shift value 272 (0x110) for Type 8 pattern encoding Corresponds
198-
// to AArch64_AM::encodeAdvSIMDModImmType8()
199-
AssignedValue = MCOperand::createImm(272);
200-
return Error::success();
201-
default:
202-
return make_error<Failure>(
203-
Twine("Unsupported MSL shift opcode: ").concat(Twine(Opcode)));
204-
}
205191
}
206192
case MCOI::OperandType::OPERAND_PCREL:
207193
case MCOI::OperandType::OPERAND_FIRST_TARGET:

0 commit comments

Comments
 (0)