[llvm-dev] Help handling opaque AArch64 immediates

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 14 18:26:52 PST 2016


On 14 January 2016 at 17:39, Steve King via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> // Opaque values become mov immediate to register
> def : Pat<(i64 (opaque imm:$src)), (MOV64ri imm:$src)>;
> def : Pat<(i32 (opaque imm:$src)), (MOV32ri imm:$src)>;

These two are pseudo-instructions: MOVi32imm and MOVi64imm work in
basically the same way as the x86 instructions I think. They get
expanded into real sequences in AArch64ExpandPseudos.cpp.

> def : Pat<(i16 (opaque imm:$src)), (MOV16ri imm:$src)>;

This is slightly different, the instruction is most likely MOVZWi,
with two wrinkles: i16 isn't a legal type and there's an extra "shift
amount" immediate. For your purposes something along the lines of

  def : Pat<(i64 (opaque (imm0_65535 imm:$src))), (MOVZWi imm:$src, 0)>;

is probably right (untested, I'm afraid, but it should contain the
essential ingredients).

Cheers.

Tim.


More information about the llvm-dev mailing list