2017-11-11 00:25:16 +08:00
|
|
|
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s
|
|
|
|
|
|
|
|
// Register z32 does not exist.
|
|
|
|
add z22.h, z10.h, z32.h
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
|
|
|
|
// CHECK-NEXT: add z22.h, z10.h, z32.h
|
[AArch64][SVE] Asm: Report SVE parsing diagnostics only once
Summary:
Prevent an issue where a diagnostic is reported multiple times by bailing out with a ParseFail if an invalid SVE register element qualifier/suffix is specified, for example:
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
^
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
...
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
^
Reviewers: fhahn, rengolin
Reviewed By: rengolin
Subscribers: aemerson, javed.absar, tschuett, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D39894
llvm-svn: 318297
2017-11-15 23:44:43 +08:00
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
2017-11-11 00:25:16 +08:00
|
|
|
|
|
|
|
// Invalid element kind.
|
|
|
|
add z20.h, z2.h, z31.x
|
[AArch64][AsmParser] Unify code for parsing Neon/SVE vectors.
Summary:
Merged 'tryMatchVectorRegister' (specific to Neon) and
'tryParseSVERegister' into a single 'tryParseVectorRegister' function, and
created a generic 'parseVectorKind()' function that returns the #Elements
and ElementWidth of a vector suffix. This reduces the duplication of
this functionality between two the vector implementations.
This is patch [1/6] in a series to add assembler/disassembler support for
SVE's contiguous ST1 (scalar+imm) instructions.
Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro
Reviewed By: fhahn
Subscribers: tschuett, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D45427
llvm-svn: 329782
2018-04-11 15:36:10 +08:00
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid vector kind qualifier
|
2017-11-11 00:25:16 +08:00
|
|
|
// CHECK-NEXT: add z20.h, z2.h, z31.x
|
[AArch64][SVE] Asm: Report SVE parsing diagnostics only once
Summary:
Prevent an issue where a diagnostic is reported multiple times by bailing out with a ParseFail if an invalid SVE register element qualifier/suffix is specified, for example:
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
^
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
...
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
^
Reviewers: fhahn, rengolin
Reviewed By: rengolin
Subscribers: aemerson, javed.absar, tschuett, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D39894
llvm-svn: 318297
2017-11-15 23:44:43 +08:00
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
2017-11-11 00:25:16 +08:00
|
|
|
|
|
|
|
// Element size specifiers should match.
|
|
|
|
add z27.h, z11.h, z27.b
|
[AArch64][SVE] Improve diagnostics for vectors with incorrect element-size.
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'
Reviewers: SjoerdMeijer, aemerson, fhahn, samparker, javed.absar
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D46688
llvm-svn: 332483
2018-05-16 23:45:17 +08:00
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
|
2017-11-11 00:25:16 +08:00
|
|
|
// CHECK-NEXT: add z27.h, z11.h, z27.b
|
[AArch64][SVE] Asm: Report SVE parsing diagnostics only once
Summary:
Prevent an issue where a diagnostic is reported multiple times by bailing out with a ParseFail if an invalid SVE register element qualifier/suffix is specified, for example:
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
^
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
...
<stdin>:10:18: error: invalid sve vector kind qualifier
add z20.h, z2.h, z31.x
^
Reviewers: fhahn, rengolin
Reviewed By: rengolin
Subscribers: aemerson, javed.absar, tschuett, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D39894
llvm-svn: 318297
2017-11-15 23:44:43 +08:00
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
2018-01-10 01:01:27 +08:00
|
|
|
|
|
|
|
// Invalid predicate suffix '/a'
|
|
|
|
add z29.d, p7/a, z29.d, z8.d
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: expecting 'm' or 'z' predication
|
|
|
|
// CHECK-NEXT: add z29.d, p7/a, z29.d, z8.d
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
// Missing predicate suffix
|
|
|
|
add z29.d, p7, z29.d, z8.d
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
|
|
|
|
// CHECK-NEXT: add z29.d, p7, z29.d, z8.d
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------//
|
2019-06-07 16:37:00 +08:00
|
|
|
// error: invalid restricted predicate register, expected p0..p7 (without element suffix)
|
2018-01-10 01:01:27 +08:00
|
|
|
|
|
|
|
add z22.b, p8/m, z22.b, z11.b
|
2019-06-07 16:37:00 +08:00
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
|
2018-01-10 01:01:27 +08:00
|
|
|
// CHECK-NEXT: add z22.b, p8/m, z22.b, z11.b
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z22.h, p8/m, z22.h, z6.h
|
2019-06-07 16:37:00 +08:00
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
|
2018-01-10 01:01:27 +08:00
|
|
|
// CHECK-NEXT: add z22.h, p8/m, z22.h, z6.h
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z30.s, p8/m, z30.s, z13.s
|
2019-06-07 16:37:00 +08:00
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
|
2018-01-10 01:01:27 +08:00
|
|
|
// CHECK-NEXT: add z30.s, p8/m, z30.s, z13.s
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z29.d, p8/m, z29.d, z8.d
|
2019-06-07 16:37:00 +08:00
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
|
2018-01-10 01:01:27 +08:00
|
|
|
// CHECK-NEXT: add z29.d, p8/m, z29.d, z8.d
|
2018-01-11 18:02:27 +08:00
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------//
|
|
|
|
// Source and Destination Registers must match
|
|
|
|
|
|
|
|
add z19.b, p4/m, z20.b, z13.b
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: operand must match destination register
|
|
|
|
// CHECK-NEXT: add z19.b, p4/m, z20.b, z13.b
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z9.h, p3/m, z10.h, z28.h
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: operand must match destination register
|
|
|
|
// CHECK-NEXT: add z9.h, p3/m, z10.h, z28.h
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z5.s, p3/m, z6.s, z18.s
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: operand must match destination register
|
|
|
|
// CHECK-NEXT: add z5.s, p3/m, z6.s, z18.s
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z9.d, p4/m, z10.d, z7.d
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: operand must match destination register
|
|
|
|
// CHECK-NEXT: add z9.d, p4/m, z10.d, z7.d
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
2018-05-29 18:39:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------//
|
|
|
|
// Invalid immediates
|
|
|
|
|
|
|
|
add z0.b, z0.b, #0, lsl #8 // #0, lsl #8 is not valid for .b
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
|
|
|
|
// CHECK-NEXT: add z0.b, z0.b, #0, lsl #8
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.b, z0.b, #-1
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
|
|
|
|
// CHECK-NEXT: add z0.b, z0.b, #-1
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.b, z0.b, #1, lsl #8
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
|
|
|
|
// CHECK-NEXT: add z0.b, z0.b, #1, lsl #8
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.b, z0.b, #256
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
|
|
|
|
// CHECK-NEXT: add z0.b, z0.b, #256
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.h, z0.h, #-1
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.h, z0.h, #-1
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.h, z0.h, #256, lsl #8
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.h, z0.h, #256, lsl #8
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.h, z0.h, #65536
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.h, z0.h, #65536
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.s, z0.s, #-1
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.s, z0.s, #-1
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.s, z0.s, #256, lsl #8
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.s, z0.s, #256, lsl #8
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.s, z0.s, #65536
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.s, z0.s, #65536
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.d, z0.d, #-1
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.d, z0.d, #-1
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.d, z0.d, #256, lsl #8
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.d, z0.d, #256, lsl #8
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
add z0.d, z0.d, #65536
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
|
|
|
|
// CHECK-NEXT: add z0.d, z0.d, #65536
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
2018-07-31 00:05:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------//
|
|
|
|
// Negative tests for instructions that are incompatible with movprfx
|
|
|
|
|
|
|
|
movprfx z31.d, p0/z, z6.d
|
|
|
|
add z31.d, z31.d, #65280
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx, suggest using unpredicated movprfx
|
|
|
|
// CHECK-NEXT: add z31.d, z31.d, #65280
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
movprfx z23.s, p0/z, z30.s
|
|
|
|
add z23.s, z13.s, z8.s
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov
|
|
|
|
// CHECK-NEXT: add z23.s, z13.s, z8.s
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|
|
|
|
|
|
|
|
movprfx z23, z30
|
|
|
|
add z23.s, z13.s, z8.s
|
|
|
|
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov
|
|
|
|
// CHECK-NEXT: add z23.s, z13.s, z8.s
|
|
|
|
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
|