1# RUN: not llvm-mc -triple=thumbv8.1m.main-none-eabi -mattr=+mve -show-encoding  < %s 2>%t \
2# RUN:   | FileCheck --check-prefix=CHECK %s
3# RUN:     FileCheck --check-prefix=ERROR < %t %s
4# RUN: not llvm-mc -triple=thumbv8.1m.main-none-eabi -mattr=+mve.fp,+fp64 -show-encoding  < %s 2>%t \
5# RUN:   | FileCheck --check-prefix=CHECK %s
6# RUN:     FileCheck --check-prefix=ERROR < %t %s
7# RUN: not llvm-mc -triple=thumbv8.1m.main-none-eabi -show-encoding  < %s 2>%t \
8# RUN:   | FileCheck --check-prefix=CHECK-NOMVE %s
9# RUN:     FileCheck --check-prefix=ERROR-NOMVE < %t %s
10
11# CHECK: asrl    r0, r1, #23  @ encoding: [0x50,0xea,0xef,0x51]
12# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
13asrl    r0, r1, #23
14
15# CHECK: asrl    lr, r1, #27  @ encoding: [0x5e,0xea,0xef,0x61]
16# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
17asrl    lr, r1, #27
18
19# CHECK: it eq @ encoding: [0x08,0xbf]
20# CHECK-NEXT: asrleq    lr, r1, #27  @ encoding: [0x5e,0xea,0xef,0x61]
21it eq
22asrleq    lr, r1, #27
23
24# ERROR: [[@LINE+2]]:{{[0-9]+}}: {{error|note}}: invalid instruction
25# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: {{error|note}}: invalid instruction
26asrl    r3, r2, #33
27
28# ERROR: [[@LINE+3]]:{{[0-9]+}}: {{error|note}}: operand must be an immediate in the range [1,32]
29# ERROR: [[@LINE+2]]:{{[0-9]+}}: {{error|note}}: operand must be a register in range [r0, r12] or r14
30# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: invalid instruction
31asrl    r0, r1, #33
32
33# ERROR: [[@LINE+2]]:{{[0-9]+}}: {{error|note}}: operand must be an odd-numbered register in range [r1,r11]
34# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: invalid instruction
35asrl    r0, r0, #32
36
37# CHECK: asrl    r0, r1, r4  @ encoding: [0x50,0xea,0x2d,0x41]
38# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
39asrl    r0, r1, r4
40
41# ERROR: [[@LINE+2]]:{{[0-9]+}}: {{error|note}}: operand must be an odd-numbered register in range [r1,r11]
42# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: invalid instruction
43asrl    r0, r0, r4
44
45# The assembler will reject the above shifts when MVE is not supported,
46# so the previous valid instruction will be IT EQ, so we need to add
47# a NOPEQ:
48nopeq
49
50# CHECK: cinc    lr, r2, lo  @ encoding: [0x52,0xea,0x22,0x9e]
51# CHECK-NOMVE: cinc    lr, r2, lo  @ encoding: [0x52,0xea,0x22,0x9e]
52csinc   lr, r2, r2, hs
53
54# CHECK: cinc    lr, r7, pl  @ encoding: [0x57,0xea,0x47,0x9e]
55# CHECK-NOMVE: cinc    lr, r7, pl  @ encoding: [0x57,0xea,0x47,0x9e]
56cinc    lr, r7, pl
57
58# CHECK: cinv    lr, r12, hs  @ encoding: [0x5c,0xea,0x3c,0xae]
59# CHECK-NOMVE: cinv    lr, r12, hs  @ encoding: [0x5c,0xea,0x3c,0xae]
60cinv    lr, r12, hs
61
62# CHECK: cneg    lr, r10, hs  @ encoding: [0x5a,0xea,0x3a,0xbe]
63# CHECK-NOMVE: cneg    lr, r10, hs  @ encoding: [0x5a,0xea,0x3a,0xbe]
64csneg   lr, r10, r10, lo
65
66# CHECK: csel    r9, r9, r11, vc  @ encoding: [0x59,0xea,0x7b,0x89]
67# CHECK-NOMVE: csel    r9, r9, r11, vc  @ encoding: [0x59,0xea,0x7b,0x89]
68csel    r9, r9, r11, vc
69
70# CHECK: cset    lr, eq  @ encoding: [0x5f,0xea,0x1f,0x9e]
71# CHECK-NOMVE: cset    lr, eq  @ encoding: [0x5f,0xea,0x1f,0x9e]
72cset    lr, eq
73
74# CHECK: csetm   lr, hs  @ encoding: [0x5f,0xea,0x3f,0xae]
75# CHECK-NOMVE: csetm   lr, hs  @ encoding: [0x5f,0xea,0x3f,0xae]
76csetm   lr, hs
77
78# CHECK: csinc   lr, r10, r7, le  @ encoding: [0x5a,0xea,0xd7,0x9e]
79# CHECK-NOMVE: csinc   lr, r10, r7, le  @ encoding: [0x5a,0xea,0xd7,0x9e]
80csinc   lr, r10, r7, le
81
82# CHECK: csinv   lr, r5, zr, hs  @ encoding: [0x55,0xea,0x2f,0xae]
83# CHECK-NOMVE: csinv   lr, r5, zr, hs  @ encoding: [0x55,0xea,0x2f,0xae]
84csinv   lr, r5, zr, hs
85
86# CHECK: cinv    lr, r2, pl  @ encoding: [0x52,0xea,0x42,0xae]
87# CHECK-NOMVE: cinv    lr, r2, pl  @ encoding: [0x52,0xea,0x42,0xae]
88csinv   lr, r2, r2, mi
89
90# CHECK: csneg   lr, r1, r11, vc  @ encoding: [0x51,0xea,0x7b,0xbe]
91# CHECK-NOMVE: csneg   lr, r1, r11, vc  @ encoding: [0x51,0xea,0x7b,0xbe]
92csneg   lr, r1, r11, vc
93
94# CHECK: lsll    lr, r1, #11  @ encoding: [0x5e,0xea,0xcf,0x21]
95# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
96lsll    lr, r1, #11
97
98# CHECK: lsll    lr, r1, r4  @ encoding: [0x5e,0xea,0x0d,0x41]
99# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
100lsll    lr, r1, r4
101
102# CHECK: lsrl    lr, r1, #12  @ encoding: [0x5e,0xea,0x1f,0x31]
103# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
104lsrl    lr, r1, #12
105
106# CHECK: sqrshr  lr, r12  @ encoding: [0x5e,0xea,0x2d,0xcf]
107# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
108sqrshr  lr, r12
109
110# CHECK: sqrshr  r11, r12  @ encoding: [0x5b,0xea,0x2d,0xcf]
111# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
112sqrshr  r11, r12
113
114# CHECK: sqrshrl lr, r3, #64, r8  @ encoding: [0x5f,0xea,0x2d,0x83]
115# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
116sqrshrl lr, r3, #64, r8
117
118# ERROR: [[@LINE+2]]:{{[0-9]+}}: {{error|note}}: saturate operand must be 48 or 64
119# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: invalid instruction
120sqrshrl lr, r3, #32, r8
121
122# CHECK: sqshl   lr, #17  @ encoding: [0x5e,0xea,0x7f,0x4f]
123# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
124sqshl   lr, #17
125
126# CHECK: sqshll  lr, r11, #28  @ encoding: [0x5f,0xea,0x3f,0x7b]
127# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
128sqshll  lr, r11, #28
129
130# CHECK: srshr   lr, #11  @ encoding: [0x5e,0xea,0xef,0x2f]
131# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
132srshr   lr, #11
133
134# CHECK: srshrl  lr, r11, #23  @ encoding: [0x5f,0xea,0xef,0x5b]
135# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
136srshrl  lr, r11, #23
137
138# CHECK: uqrshl  lr, r1  @ encoding: [0x5e,0xea,0x0d,0x1f]
139# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
140uqrshl  lr, r1
141
142# CHECK: uqrshll lr, r1, #48, r4  @ encoding: [0x5f,0xea,0x8d,0x41]
143# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
144uqrshll lr, r1, #48, r4
145
146# ERROR: [[@LINE+2]]:{{[0-9]+}}: {{error|note}}: saturate operand must be 48 or 64
147# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: invalid instruction
148uqrshll lr, r1, #0, r4
149
150# CHECK: uqshl   r0, #1  @ encoding: [0x50,0xea,0x4f,0x0f]
151# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
152uqshl   r0, #1
153
154# CHECK: uqshll  lr, r7, #7  @ encoding: [0x5f,0xea,0xcf,0x17]
155# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
156uqshll  lr, r7, #7
157
158# CHECK: urshr   r0, #10  @ encoding: [0x50,0xea,0x9f,0x2f]
159# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
160urshr   r0, #10
161
162# CHECK: urshrl  r0, r9, #29  @ encoding: [0x51,0xea,0x5f,0x79]
163# ERROR-NOMVE: [[@LINE+1]]:{{[0-9]+}}: error: instruction requires: mve
164urshrl  r0, r9, #29
165