From 80e005e5b5f8d49ca69469ee4f3808a9128abcec Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 3 Apr 2018 18:23:46 -0400 Subject: [PATCH] A64/translate: Amend I() to also handle u8 and u16 immediates This is necessary for instructions like SRSHR, and other related instructions. --- src/frontend/A64/translate/impl/impl.cpp | 6 +++++- src/frontend/A64/translate/impl/impl.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontend/A64/translate/impl/impl.cpp b/src/frontend/A64/translate/impl/impl.cpp index 86ae2833..3f056fc9 100644 --- a/src/frontend/A64/translate/impl/impl.cpp +++ b/src/frontend/A64/translate/impl/impl.cpp @@ -116,8 +116,12 @@ u64 TranslatorVisitor::AdvSIMDExpandImm(bool op, Imm<4> cmode, Imm<8> imm8) { return 0; } -IR::U32U64 TranslatorVisitor::I(size_t bitsize, u64 value) { +IR::UAny TranslatorVisitor::I(size_t bitsize, u64 value) { switch (bitsize) { + case 8: + return ir.Imm8(static_cast(value)); + case 16: + return ir.Imm16(static_cast(value)); case 32: return ir.Imm32(static_cast(value)); case 64: diff --git a/src/frontend/A64/translate/impl/impl.h b/src/frontend/A64/translate/impl/impl.h index 2a6295a6..7ed461aa 100644 --- a/src/frontend/A64/translate/impl/impl.h +++ b/src/frontend/A64/translate/impl/impl.h @@ -44,7 +44,7 @@ struct TranslatorVisitor final { boost::optional DecodeBitMasks(bool N, Imm<6> immr, Imm<6> imms, bool immediate); u64 AdvSIMDExpandImm(bool op, Imm<4> cmode, Imm<8> imm8); - IR::U32U64 I(size_t bitsize, u64 value); + IR::UAny I(size_t bitsize, u64 value); IR::UAny X(size_t bitsize, Reg reg); void X(size_t bitsize, Reg reg, IR::U32U64 value); IR::U32U64 SP(size_t bitsize);