1// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve  2>&1 < %s| FileCheck %s
2
3// Register z32 does not exist.
4uqsub z22.h, z10.h, z32.h
5// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
6// CHECK-NEXT: uqsub z22.h, z10.h, z32.h
7// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
8
9// Invalid element kind.
10uqsub z20.h, z2.h, z31.x
11// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid vector kind qualifier
12// CHECK-NEXT: uqsub z20.h, z2.h, z31.x
13// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
14
15// Element size specifiers should match.
16uqsub z27.h, z11.h, z27.b
17// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
18// CHECK-NEXT: uqsub z27.h, z11.h, z27.b
19// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
20
21
22// --------------------------------------------------------------------------//
23// Invalid immediates
24
25uqsub     z0.b, z0.b, #0, lsl #8      // #0, lsl #8 is not valid for .b
26// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
27// CHECK-NEXT: uqsub     z0.b, z0.b, #0, lsl #8
28// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
29
30uqsub     z0.b, z0.b, #-1
31// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
32// CHECK-NEXT: uqsub     z0.b, z0.b, #-1
33// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
34
35uqsub     z0.b, z0.b, #1, lsl #8
36// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
37// CHECK-NEXT: uqsub     z0.b, z0.b, #1, lsl #8
38// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
39
40uqsub     z0.b, z0.b, #256
41// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] with a shift amount of 0
42// CHECK-NEXT: uqsub     z0.b, z0.b, #256
43// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
44
45uqsub     z0.h, z0.h, #-1
46// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
47// CHECK-NEXT: uqsub     z0.h, z0.h, #-1
48// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
49
50uqsub     z0.h, z0.h, #256, lsl #8
51// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
52// CHECK-NEXT: uqsub     z0.h, z0.h, #256, lsl #8
53// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
54
55uqsub     z0.h, z0.h, #65536
56// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
57// CHECK-NEXT: uqsub     z0.h, z0.h, #65536
58// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
59
60uqsub     z0.s, z0.s, #-1
61// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
62// CHECK-NEXT: uqsub     z0.s, z0.s, #-1
63// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
64
65uqsub     z0.s, z0.s, #256, lsl #8
66// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
67// CHECK-NEXT: uqsub     z0.s, z0.s, #256, lsl #8
68// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
69
70uqsub     z0.s, z0.s, #65536
71// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
72// CHECK-NEXT: uqsub     z0.s, z0.s, #65536
73// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
74
75uqsub     z0.d, z0.d, #-1
76// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
77// CHECK-NEXT: uqsub     z0.d, z0.d, #-1
78// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
79
80uqsub     z0.d, z0.d, #256, lsl #8
81// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
82// CHECK-NEXT: uqsub     z0.d, z0.d, #256, lsl #8
83// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
84
85uqsub     z0.d, z0.d, #65536
86// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [0, 255] or a multiple of 256 in range [256, 65280]
87// CHECK-NEXT: uqsub     z0.d, z0.d, #65536
88// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
89
90
91// --------------------------------------------------------------------------//
92// Negative tests for instructions that are incompatible with movprfx
93
94movprfx z31.d, p0/z, z6.d
95uqsub     z31.d, z31.d, #65280
96// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx, suggest using unpredicated movprfx
97// CHECK-NEXT: uqsub     z31.d, z31.d, #65280
98// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
99
100movprfx z0.d, p0/z, z7.d
101uqsub     z0.d, z0.d, z0.d
102// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov
103// CHECK-NEXT: uqsub     z0.d, z0.d, z0.d
104// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
105
106movprfx z0, z7
107uqsub     z0.d, z0.d, z0.d
108// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov
109// CHECK-NEXT: uqsub     z0.d, z0.d, z0.d
110// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
111