1// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %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=+sme < %s \
6// RUN:        | llvm-objdump -d --mattr=+sme - | FileCheck %s --check-prefix=CHECK-INST
7// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme < %s \
8// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
9// Disassemble encoding and check the re-encoding (-show-encoding) matches.
10// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s \
11// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
12// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme -disassemble -show-encoding \
13// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
14
15// --------------------------------------------------------------------------//
16// 8-bit
17
18sclamp  z0.b, z0.b, z0.b
19// CHECK-INST: sclamp  z0.b, z0.b, z0.b
20// CHECK-ENCODING: [0x00,0xc0,0x00,0x44]
21// CHECK-ERROR: instruction requires: sme
22// CHECK-UNKNOWN: 00 c0 00 44 <unknown>
23
24sclamp  z21.b, z10.b, z21.b
25// CHECK-INST: sclamp  z21.b, z10.b, z21.b
26// CHECK-ENCODING: [0x55,0xc1,0x15,0x44]
27// CHECK-ERROR: instruction requires: sme
28// CHECK-UNKNOWN: 55 c1 15 44 <unknown>
29
30sclamp  z23.b, z13.b, z8.b
31// CHECK-INST: sclamp  z23.b, z13.b, z8.b
32// CHECK-ENCODING: [0xb7,0xc1,0x08,0x44]
33// CHECK-ERROR: instruction requires: sme
34// CHECK-UNKNOWN: b7 c1 08 44 <unknown>
35
36sclamp  z31.b, z31.b, z31.b
37// CHECK-INST: sclamp  z31.b, z31.b, z31.b
38// CHECK-ENCODING: [0xff,0xc3,0x1f,0x44]
39// CHECK-ERROR: instruction requires: sme
40// CHECK-UNKNOWN: ff c3 1f 44 <unknown>
41
42// --------------------------------------------------------------------------//
43// 16-bit
44
45sclamp  z0.h, z0.h, z0.h
46// CHECK-INST: sclamp  z0.h, z0.h, z0.h
47// CHECK-ENCODING: [0x00,0xc0,0x40,0x44]
48// CHECK-ERROR: instruction requires: sme
49// CHECK-UNKNOWN: 00 c0 40 44 <unknown>
50
51sclamp  z21.h, z10.h, z21.h
52// CHECK-INST: sclamp  z21.h, z10.h, z21.h
53// CHECK-ENCODING: [0x55,0xc1,0x55,0x44]
54// CHECK-ERROR: instruction requires: sme
55// CHECK-UNKNOWN: 55 c1 55 44 <unknown>
56
57sclamp  z23.h, z13.h, z8.h
58// CHECK-INST: sclamp  z23.h, z13.h, z8.h
59// CHECK-ENCODING: [0xb7,0xc1,0x48,0x44]
60// CHECK-ERROR: instruction requires: sme
61// CHECK-UNKNOWN: b7 c1 48 44 <unknown>
62
63sclamp  z31.h, z31.h, z31.h
64// CHECK-INST: sclamp  z31.h, z31.h, z31.h
65// CHECK-ENCODING: [0xff,0xc3,0x5f,0x44]
66// CHECK-ERROR: instruction requires: sme
67// CHECK-UNKNOWN: ff c3 5f 44 <unknown>
68
69// --------------------------------------------------------------------------//
70// 32-bit
71
72sclamp  z0.s, z0.s, z0.s
73// CHECK-INST: sclamp  z0.s, z0.s, z0.s
74// CHECK-ENCODING: [0x00,0xc0,0x80,0x44]
75// CHECK-ERROR: instruction requires: sme
76// CHECK-UNKNOWN: 00 c0 80 44 <unknown>
77
78sclamp  z21.s, z10.s, z21.s
79// CHECK-INST: sclamp  z21.s, z10.s, z21.s
80// CHECK-ENCODING: [0x55,0xc1,0x95,0x44]
81// CHECK-ERROR: instruction requires: sme
82// CHECK-UNKNOWN: 55 c1 95 44 <unknown>
83
84sclamp  z23.s, z13.s, z8.s
85// CHECK-INST: sclamp  z23.s, z13.s, z8.s
86// CHECK-ENCODING: [0xb7,0xc1,0x88,0x44]
87// CHECK-ERROR: instruction requires: sme
88// CHECK-UNKNOWN: b7 c1 88 44 <unknown>
89
90sclamp  z31.s, z31.s, z31.s
91// CHECK-INST: sclamp  z31.s, z31.s, z31.s
92// CHECK-ENCODING: [0xff,0xc3,0x9f,0x44]
93// CHECK-ERROR: instruction requires: sme
94// CHECK-UNKNOWN: ff c3 9f 44 <unknown>
95
96// --------------------------------------------------------------------------//
97// 64-bit
98
99sclamp  z0.d, z0.d, z0.d
100// CHECK-INST: sclamp  z0.d, z0.d, z0.d
101// CHECK-ENCODING: [0x00,0xc0,0xc0,0x44]
102// CHECK-ERROR: instruction requires: sme
103// CHECK-UNKNOWN: 00 c0 c0 44 <unknown>
104
105sclamp  z21.d, z10.d, z21.d
106// CHECK-INST: sclamp  z21.d, z10.d, z21.d
107// CHECK-ENCODING: [0x55,0xc1,0xd5,0x44]
108// CHECK-ERROR: instruction requires: sme
109// CHECK-UNKNOWN: 55 c1 d5 44 <unknown>
110
111sclamp  z23.d, z13.d, z8.d
112// CHECK-INST: sclamp  z23.d, z13.d, z8.d
113// CHECK-ENCODING: [0xb7,0xc1,0xc8,0x44]
114// CHECK-ERROR: instruction requires: sme
115// CHECK-UNKNOWN: b7 c1 c8 44 <unknown>
116
117sclamp  z31.d, z31.d, z31.d
118// CHECK-INST: sclamp  z31.d, z31.d, z31.d
119// CHECK-ENCODING: [0xff,0xc3,0xdf,0x44]
120// CHECK-ERROR: instruction requires: sme
121// CHECK-UNKNOWN: ff c3 df 44 <unknown>
122
123// --------------------------------------------------------------------------//
124// Test compatibility with MOVPRFX instruction.
125
126movprfx z23, z27
127// CHECK-INST: movprfx  z23, z27
128// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
129// CHECK-ERROR: instruction requires: streaming-sve or sve
130// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
131
132sclamp  z23.b, z13.b, z8.b
133// CHECK-INST: sclamp  z23.b, z13.b, z8.b
134// CHECK-ENCODING: [0xb7,0xc1,0x08,0x44]
135// CHECK-ERROR: instruction requires: sme
136// CHECK-UNKNOWN: b7 c1 08 44 <unknown>
137
138movprfx z23, z27
139// CHECK-INST: movprfx  z23, z27
140// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
141// CHECK-ERROR: instruction requires: streaming-sve or sve
142// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
143
144sclamp  z23.h, z13.h, z8.h
145// CHECK-INST: sclamp  z23.h, z13.h, z8.h
146// CHECK-ENCODING: [0xb7,0xc1,0x48,0x44]
147// CHECK-ERROR: instruction requires: sme
148// CHECK-UNKNOWN: b7 c1 48 44 <unknown>
149
150movprfx z23, z27
151// CHECK-INST: movprfx  z23, z27
152// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
153// CHECK-ERROR: instruction requires: streaming-sve or sve
154// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
155
156sclamp  z23.s, z13.s, z8.s
157// CHECK-INST: sclamp  z23.s, z13.s, z8.s
158// CHECK-ENCODING: [0xb7,0xc1,0x88,0x44]
159// CHECK-ERROR: instruction requires: sme
160// CHECK-UNKNOWN: b7 c1 88 44 <unknown>
161
162movprfx z23, z27
163// CHECK-INST: movprfx  z23, z27
164// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
165// CHECK-ERROR: instruction requires: streaming-sve or sve
166// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
167
168sclamp  z23.d, z13.d, z8.d
169// CHECK-INST: sclamp  z23.d, z13.d, z8.d
170// CHECK-ENCODING: [0xb7,0xc1,0xc8,0x44]
171// CHECK-ERROR: instruction requires: sme
172// CHECK-UNKNOWN: b7 c1 c8 44 <unknown>
173