1// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
2// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
4// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
5// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
6// RUN:        | llvm-objdump -d --mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
7// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
8// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
9
10and     z5.b, z5.b, #0xf9
11// CHECK-INST: and     z5.b, z5.b, #0xf9
12// CHECK-ENCODING: [0xa5,0x2e,0x80,0x05]
13// CHECK-ERROR: instruction requires: sve
14// CHECK-UNKNOWN: a5 2e 80 05 <unknown>
15
16and     z23.h, z23.h, #0xfff9
17// CHECK-INST: and     z23.h, z23.h, #0xfff9
18// CHECK-ENCODING: [0xb7,0x6d,0x80,0x05]
19// CHECK-ERROR: instruction requires: sve
20// CHECK-UNKNOWN: b7 6d 80 05 <unknown>
21
22and     z0.s, z0.s, #0xfffffff9
23// CHECK-INST: and     z0.s, z0.s, #0xfffffff9
24// CHECK-ENCODING: [0xa0,0xeb,0x80,0x05]
25// CHECK-ERROR: instruction requires: sve
26// CHECK-UNKNOWN: a0 eb 80 05 <unknown>
27
28and     z0.d, z0.d, #0xfffffffffffffff9
29// CHECK-INST: and     z0.d, z0.d, #0xfffffffffffffff9
30// CHECK-ENCODING: [0xa0,0xef,0x83,0x05]
31// CHECK-ERROR: instruction requires: sve
32// CHECK-UNKNOWN: a0 ef 83 05 <unknown>
33
34and     z5.b, z5.b, #0x6
35// CHECK-INST: and     z5.b, z5.b, #0x6
36// CHECK-ENCODING: [0x25,0x3e,0x80,0x05]
37// CHECK-ERROR: instruction requires: sve
38// CHECK-UNKNOWN: 25 3e 80 05 <unknown>
39
40and     z23.h, z23.h, #0x6
41// CHECK-INST: and     z23.h, z23.h, #0x6
42// CHECK-ENCODING: [0x37,0x7c,0x80,0x05]
43// CHECK-ERROR: instruction requires: sve
44// CHECK-UNKNOWN: 37 7c 80 05 <unknown>
45
46and     z0.s, z0.s, #0x6
47// CHECK-INST: and     z0.s, z0.s, #0x6
48// CHECK-ENCODING: [0x20,0xf8,0x80,0x05]
49// CHECK-ERROR: instruction requires: sve
50// CHECK-UNKNOWN: 20 f8 80 05 <unknown>
51
52and     z0.d, z0.d, #0x6
53// CHECK-INST: and     z0.d, z0.d, #0x6
54// CHECK-ENCODING: [0x20,0xf8,0x83,0x05]
55// CHECK-ERROR: instruction requires: sve
56// CHECK-UNKNOWN: 20 f8 83 05 <unknown>
57
58and     z0.d, z0.d, z0.d
59// CHECK-INST: and     z0.d, z0.d, z0.d
60// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
61// CHECK-ERROR: instruction requires: sve
62// CHECK-UNKNOWN: 00 30 20 04 <unknown>
63
64and     z23.d, z13.d, z8.d
65// CHECK-INST: and     z23.d, z13.d, z8.d
66// CHECK-ENCODING: [0xb7,0x31,0x28,0x04]
67// CHECK-ERROR: instruction requires: sve
68// CHECK-UNKNOWN: b7 31 28 04 <unknown>
69
70and     z31.b, p7/m, z31.b, z31.b
71// CHECK-INST: and     z31.b, p7/m, z31.b, z31.b
72// CHECK-ENCODING: [0xff,0x1f,0x1a,0x04]
73// CHECK-ERROR: instruction requires: sve
74// CHECK-UNKNOWN: ff 1f 1a 04 <unknown>
75
76and     z31.h, p7/m, z31.h, z31.h
77// CHECK-INST: and     z31.h, p7/m, z31.h, z31.h
78// CHECK-ENCODING: [0xff,0x1f,0x5a,0x04]
79// CHECK-ERROR: instruction requires: sve
80// CHECK-UNKNOWN: ff 1f 5a 04 <unknown>
81
82and     z31.s, p7/m, z31.s, z31.s
83// CHECK-INST: and     z31.s, p7/m, z31.s, z31.s
84// CHECK-ENCODING: [0xff,0x1f,0x9a,0x04]
85// CHECK-ERROR: instruction requires: sve
86// CHECK-UNKNOWN: ff 1f 9a 04 <unknown>
87
88and     z31.d, p7/m, z31.d, z31.d
89// CHECK-INST: and     z31.d, p7/m, z31.d, z31.d
90// CHECK-ENCODING: [0xff,0x1f,0xda,0x04]
91// CHECK-ERROR: instruction requires: sve
92// CHECK-UNKNOWN: ff 1f da 04 <unknown>
93
94and     p0.b, p0/z, p0.b, p1.b
95// CHECK-INST: and     p0.b, p0/z, p0.b, p1.b
96// CHECK-ENCODING: [0x00,0x40,0x01,0x25]
97// CHECK-ERROR: instruction requires: sve
98// CHECK-UNKNOWN: 00 40 01 25 <unknown>
99
100and     p0.b, p0/z, p0.b, p0.b
101// CHECK-INST: mov     p0.b, p0/z, p0.b
102// CHECK-ENCODING: [0x00,0x40,0x00,0x25]
103// CHECK-ERROR: instruction requires: sve
104// CHECK-UNKNOWN: 00 40 00 25 <unknown>
105
106and     p15.b, p15/z, p15.b, p15.b
107// CHECK-INST: mov     p15.b, p15/z, p15.b
108// CHECK-ENCODING: [0xef,0x7d,0x0f,0x25]
109// CHECK-ERROR: instruction requires: sve
110// CHECK-UNKNOWN: ef 7d 0f 25 <unknown>
111
112
113// --------------------------------------------------------------------------//
114// Test aliases.
115
116and     z0.s, z0.s, z0.s
117// CHECK-INST: and     z0.d, z0.d, z0.d
118// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
119// CHECK-ERROR: instruction requires: sve
120// CHECK-UNKNOWN: 00 30 20 04 <unknown>
121
122and     z0.h, z0.h, z0.h
123// CHECK-INST: and     z0.d, z0.d, z0.d
124// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
125// CHECK-ERROR: instruction requires: sve
126// CHECK-UNKNOWN: 00 30 20 04 <unknown>
127
128and     z0.b, z0.b, z0.b
129// CHECK-INST: and     z0.d, z0.d, z0.d
130// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
131// CHECK-ERROR: instruction requires: sve
132// CHECK-UNKNOWN: 00 30 20 04 <unknown>
133
134
135// --------------------------------------------------------------------------//
136// Test compatibility with MOVPRFX instruction.
137
138movprfx z4.d, p7/z, z6.d
139// CHECK-INST: movprfx	z4.d, p7/z, z6.d
140// CHECK-ENCODING: [0xc4,0x3c,0xd0,0x04]
141// CHECK-ERROR: instruction requires: sve
142// CHECK-UNKNOWN: c4 3c d0 04 <unknown>
143
144and     z4.d, p7/m, z4.d, z31.d
145// CHECK-INST: and	z4.d, p7/m, z4.d, z31.d
146// CHECK-ENCODING: [0xe4,0x1f,0xda,0x04]
147// CHECK-ERROR: instruction requires: sve
148// CHECK-UNKNOWN: e4 1f da 04 <unknown>
149
150movprfx z4, z6
151// CHECK-INST: movprfx	z4, z6
152// CHECK-ENCODING: [0xc4,0xbc,0x20,0x04]
153// CHECK-ERROR: instruction requires: sve
154// CHECK-UNKNOWN: c4 bc 20 04 <unknown>
155
156and     z4.d, p7/m, z4.d, z31.d
157// CHECK-INST: and	z4.d, p7/m, z4.d, z31.d
158// CHECK-ENCODING: [0xe4,0x1f,0xda,0x04]
159// CHECK-ERROR: instruction requires: sve
160// CHECK-UNKNOWN: e4 1f da 04 <unknown>
161
162movprfx z0, z7
163// CHECK-INST: movprfx	z0, z7
164// CHECK-ENCODING: [0xe0,0xbc,0x20,0x04]
165// CHECK-ERROR: instruction requires: sve
166// CHECK-UNKNOWN: e0 bc 20 04 <unknown>
167
168and     z0.d, z0.d, #0x6
169// CHECK-INST: and	z0.d, z0.d, #0x6
170// CHECK-ENCODING: [0x20,0xf8,0x83,0x05]
171// CHECK-ERROR: instruction requires: sve
172// CHECK-UNKNOWN: 20 f8 83 05 <unknown>
173