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
18psel    p0, p0, p0.b[w12, 0]
19// CHECK-INST: psel    p0, p0, p0.b[w12, 0]
20// CHECK-ENCODING: [0x00,0x40,0x24,0x25]
21// CHECK-ERROR: instruction requires: sme
22// CHECK-UNKNOWN: 00 40 24 25 <unknown>
23
24psel    p5, p5, p10.b[w13, 6]
25// CHECK-INST: psel    p5, p5, p10.b[w13, 6]
26// CHECK-ENCODING: [0x45,0x55,0x75,0x25]
27// CHECK-ERROR: instruction requires: sme
28// CHECK-UNKNOWN: 45 55 75 25 <unknown>
29
30psel    p7, p11, p13.b[w12, 5]
31// CHECK-INST: psel    p7, p11, p13.b[w12, 5]
32// CHECK-ENCODING: [0xa7,0x6d,0x6c,0x25]
33// CHECK-ERROR: instruction requires: sme
34// CHECK-UNKNOWN: a7 6d 6c 25 <unknown>
35
36psel    p15, p15, p15.b[w15, 15]
37// CHECK-INST: psel    p15, p15, p15.b[w15, 15]
38// CHECK-ENCODING: [0xef,0x7d,0xff,0x25]
39// CHECK-ERROR: instruction requires: sme
40// CHECK-UNKNOWN: ef 7d ff 25 <unknown>
41
42// --------------------------------------------------------------------------//
43// 16-bit
44
45psel    p0, p0, p0.h[w12, 0]
46// CHECK-INST: psel    p0, p0, p0.h[w12, 0]
47// CHECK-ENCODING: [0x00,0x40,0x28,0x25]
48// CHECK-ERROR: instruction requires: sme
49// CHECK-UNKNOWN: 00 40 28 25 <unknown>
50
51psel    p5, p5, p10.h[w13, 3]
52// CHECK-INST: psel    p5, p5, p10.h[w13, 3]
53// CHECK-ENCODING: [0x45,0x55,0x79,0x25]
54// CHECK-ERROR: instruction requires: sme
55// CHECK-UNKNOWN: 45 55 79 25 <unknown>
56
57psel    p7, p11, p13.h[w12, 2]
58// CHECK-INST: psel    p7, p11, p13.h[w12, 2]
59// CHECK-ENCODING: [0xa7,0x6d,0x68,0x25]
60// CHECK-ERROR: instruction requires: sme
61// CHECK-UNKNOWN: a7 6d 68 25 <unknown>
62
63psel    p15, p15, p15.h[w15, 7]
64// CHECK-INST: psel    p15, p15, p15.h[w15, 7]
65// CHECK-ENCODING: [0xef,0x7d,0xfb,0x25]
66// CHECK-ERROR: instruction requires: sme
67// CHECK-UNKNOWN: ef 7d fb 25 <unknown>
68
69// --------------------------------------------------------------------------//
70// 32-bit
71
72psel    p0, p0, p0.s[w12, 0]
73// CHECK-INST: psel    p0, p0, p0.s[w12, 0]
74// CHECK-ENCODING: [0x00,0x40,0x30,0x25]
75// CHECK-ERROR: instruction requires: sme
76// CHECK-UNKNOWN: 00 40 30 25 <unknown>
77
78psel    p5, p5, p10.s[w13, 1]
79// CHECK-INST: psel    p5, p5, p10.s[w13, 1]
80// CHECK-ENCODING: [0x45,0x55,0x71,0x25]
81// CHECK-ERROR: instruction requires: sme
82// CHECK-UNKNOWN: 45 55 71 25 <unknown>
83
84psel    p7, p11, p13.s[w12, 1]
85// CHECK-INST: psel    p7, p11, p13.s[w12, 1]
86// CHECK-ENCODING: [0xa7,0x6d,0x70,0x25]
87// CHECK-ERROR: instruction requires: sme
88// CHECK-UNKNOWN: a7 6d 70 25 <unknown>
89
90psel    p15, p15, p15.s[w15, 3]
91// CHECK-INST: psel    p15, p15, p15.s[w15, 3]
92// CHECK-ENCODING: [0xef,0x7d,0xf3,0x25]
93// CHECK-ERROR: instruction requires: sme
94// CHECK-UNKNOWN: ef 7d f3 25 <unknown>
95
96// --------------------------------------------------------------------------//
97// 64-bit
98
99psel    p0, p0, p0.d[w12, 0]
100// CHECK-INST: psel    p0, p0, p0.d[w12, 0]
101// CHECK-ENCODING: [0x00,0x40,0x60,0x25]
102// CHECK-ERROR: instruction requires: sme
103// CHECK-UNKNOWN: 00 40 60 25 <unknown>
104
105psel    p5, p5, p10.d[w13, 0]
106// CHECK-INST: psel    p5, p5, p10.d[w13, 0]
107// CHECK-ENCODING: [0x45,0x55,0x61,0x25]
108// CHECK-ERROR: instruction requires: sme
109// CHECK-UNKNOWN: 45 55 61 25 <unknown>
110
111psel    p7, p11, p13.d[w12, 0]
112// CHECK-INST: psel    p7, p11, p13.d[w12, 0]
113// CHECK-ENCODING: [0xa7,0x6d,0x60,0x25]
114// CHECK-ERROR: instruction requires: sme
115// CHECK-UNKNOWN: a7 6d 60 25 <unknown>
116
117psel    p15, p15, p15.d[w15, 1]
118// CHECK-INST: psel    p15, p15, p15.d[w15, 1]
119// CHECK-ENCODING: [0xef,0x7d,0xe3,0x25]
120// CHECK-ERROR: instruction requires: sme
121// CHECK-UNKNOWN: ef 7d e3 25 <unknown>
122