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

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 02:35:05 PDT 2018


sdesmalen added inline comments.


================
Comment at: lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp:1495
+  // Prefer the default format for 16bit values, hex otherwise.
+  if ((int16_t)PrintVal == (SignedT)PrintVal)
+    printImmSVE((T)PrintVal, O);
----------------
SjoerdMeijer wrote:
> 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);
This code checks the actual (decoded) value. where std::is_same<T, int16_t>::value would just check the type passed to printSVELogicalImm.


================
Comment at: test/MC/AArch64/SVE/mov.s:185
+mov     z0.h, #32768
+// CHECK-INST: dupm    z0.h, #0x8000
+// CHECK-ENCODING: [0x00,0x0c,0xc0,0x05]
----------------
SjoerdMeijer wrote:
> just checking: do we expect dupm here?
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;


https://reviews.llvm.org/D47328





More information about the llvm-commits mailing list