This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Asm: Support for DUPM (masked immediate) instruction.
ClosedPublic

Authored by sdesmalen on May 24 2018, 7:33 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

sdesmalen created this revision.May 24 2018, 7:33 AM
SjoerdMeijer added inline comments.May 31 2018, 2:05 AM
lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
1495 ↗(On Diff #148407)

If was wondering if this could be simplified to:

if (std::is_same<T, int16_t>::value) 
  printImmSVE(PrintVal, O);
else 
  O << '#' << formatHex((uint64_t)PrintVal);
test/MC/AArch64/SVE/mov.s
185 ↗(On Diff #148407)

just checking: do we expect dupm here?

sdesmalen added inline comments.May 31 2018, 2:35 AM
lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
1495 ↗(On Diff #148407)

This code checks the actual (decoded) value. where std::is_same<T, int16_t>::value would just check the type passed to printSVELogicalImm.

test/MC/AArch64/SVE/mov.s
185 ↗(On Diff #148407)

Yes, I think so:

mov z0.h, #0x8000

and

dupm z0.h, #0x8000

are equivalent and according to the SVE specification MOV is the preferred alias iff SVEMoveMaskPreferred evaluates to true. Since the logical immediate for dupm z0.h, #0x8000 is 0x8000800080008000, the condition as shown below from the pseudo code evaluates to true, causing SVEMoveMaskPreferred to return false:

// Check for 'xy00xy00xy00xy00'
if imm<63:32> == imm<31:0> && imm<31:16> == imm<15:0> then
  return FALSE;
SjoerdMeijer accepted this revision.May 31 2018, 3:02 AM

Thanks, looks OK to me.

This revision is now accepted and ready to land.May 31 2018, 3:02 AM
sdesmalen added inline comments.May 31 2018, 7:30 AM
test/MC/AArch64/SVE/mov.s
185 ↗(On Diff #148407)

So I double checked this and GAS assembles this to the DUP instruction, which has mov-alias (mov z0.h, #-32768). I will follow this up with a separate patch to fix it.

This revision was automatically updated to reflect the committed changes.