[PATCH] D46688: [AArch64][SVE] Improve diagnostics for vectors with incorrect element-size.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 03:57:11 PDT 2018


sdesmalen created this revision.
sdesmalen added reviewers: SjoerdMeijer, aemerson, fhahn, samparker.
Herald added subscribers: kristof.beyls, tschuett, rengolin.
Herald added a reviewer: javed.absar.

For regular SVE vector operands, this patch introduces a more
sensible diagnostic when the vector has a wrong suffix (e.g. z0.s vs z0.b).

For example:

  add z0.s, z1.s, z2.b      -> invalid element width
               ^_____^
               mismatch

For the vector-with-shift/extend (e.g. z0.s, uxtw #2) this patch takes
a slightly different approach and instead returns a 'invalid operand'
if the element size is not as expected. This is because the diagnostics
are more specificied to suggest using the right shift/extend suffix. This
is a trade-off not to introduce more operand classes and still provide
useful diagnostics for LD1 and PRF instructions.

For example:

  ld1w z1.s, p0/z, [x0, z0.s] -> invalid shift/extend specified, expected 'z[0..31].s, (uxtw|sxtw)'
  ld1w z1.d, p0/z, [x0, z0.s] -> invalid operand
          ^________________^
               mismatch

For gather prefetches, both 'z0.s' and 'z0.d' would be allowed:

  prfw #0, p0, [x0, z0.s]   -> invalid shift/extend specified, expected 'z[0..31].s, (uxtw|sxtw) #2'
  prfw #0, p0, [x0, z0.d]   -> invalid shift/extend specified, expected 'z[0..31].d, (lsl|uxtw|sxtw) #2'

Without this change, the diagnostic would unnecessarily suggest a
different element size:

  prfw #0, p0, [x0, z0.s]   -> invalid shift/extend specified, expected 'z[0..31].d, (lsl|uxtw|sxtw) #2'


https://reviews.llvm.org/D46688

Files:
  lib/Target/AArch64/AArch64RegisterInfo.td
  lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  test/MC/AArch64/SVE/add-diagnostics.s
  test/MC/AArch64/SVE/ld1b-diagnostics.s
  test/MC/AArch64/SVE/ld1d-diagnostics.s
  test/MC/AArch64/SVE/ld1h-diagnostics.s
  test/MC/AArch64/SVE/ld1rd-diagnostics.s
  test/MC/AArch64/SVE/ld1rh-diagnostics.s
  test/MC/AArch64/SVE/ld1rqb-diagnostics.s
  test/MC/AArch64/SVE/ld1rqd-diagnostics.s
  test/MC/AArch64/SVE/ld1rqh-diagnostics.s
  test/MC/AArch64/SVE/ld1rqw-diagnostics.s
  test/MC/AArch64/SVE/ld1rsb-diagnostics.s
  test/MC/AArch64/SVE/ld1rsh-diagnostics.s
  test/MC/AArch64/SVE/ld1rsw-diagnostics.s
  test/MC/AArch64/SVE/ld1rw-diagnostics.s
  test/MC/AArch64/SVE/ld1sb-diagnostics.s
  test/MC/AArch64/SVE/ld1sh-diagnostics.s
  test/MC/AArch64/SVE/ld1sw-diagnostics.s
  test/MC/AArch64/SVE/ld1w-diagnostics.s
  test/MC/AArch64/SVE/ldff1b-diagnostics.s
  test/MC/AArch64/SVE/ldff1d-diagnostics.s
  test/MC/AArch64/SVE/ldff1h-diagnostics.s
  test/MC/AArch64/SVE/ldff1sb-diagnostics.s
  test/MC/AArch64/SVE/ldff1sh-diagnostics.s
  test/MC/AArch64/SVE/ldff1sw-diagnostics.s
  test/MC/AArch64/SVE/ldff1w-diagnostics.s
  test/MC/AArch64/SVE/ldnf1sb-diagnostics.s
  test/MC/AArch64/SVE/ldnf1sh-diagnostics.s
  test/MC/AArch64/SVE/ldnf1sw-diagnostics.s
  test/MC/AArch64/SVE/ldnt1b-diagnostics.s
  test/MC/AArch64/SVE/ldnt1d-diagnostics.s
  test/MC/AArch64/SVE/ldnt1h-diagnostics.s
  test/MC/AArch64/SVE/ldnt1w-diagnostics.s
  test/MC/AArch64/SVE/prfb-diagnostics.s
  test/MC/AArch64/SVE/prfd-diagnostics.s
  test/MC/AArch64/SVE/prfh-diagnostics.s
  test/MC/AArch64/SVE/prfw-diagnostics.s
  test/MC/AArch64/SVE/st1b-diagnostics.s
  test/MC/AArch64/SVE/st1d-diagnostics.s
  test/MC/AArch64/SVE/st1h-diagnostics.s
  test/MC/AArch64/SVE/st1w-diagnostics.s
  test/MC/AArch64/SVE/stnt1b-diagnostics.s
  test/MC/AArch64/SVE/stnt1d-diagnostics.s
  test/MC/AArch64/SVE/stnt1h-diagnostics.s
  test/MC/AArch64/SVE/stnt1w-diagnostics.s
  test/MC/AArch64/SVE/sub-diagnostics.s
  test/MC/AArch64/SVE/zip1-diagnostics.s
  test/MC/AArch64/SVE/zip2-diagnostics.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46688.146107.patch
Type: text/x-patch
Size: 56209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180510/f81e37d9/attachment.bin>


More information about the llvm-commits mailing list