1 ; RUN: llvm-mc -triple arm64-apple-darwin -mattr=neon -show-encoding < %s | FileCheck %s 2 3 foo: 4 ;==---------------------------------------------------------------------------== 5 ; Add/Subtract with carry/borrow 6 ;==---------------------------------------------------------------------------== 7 8 adc w1, w2, w3 9 adc x1, x2, x3 10 adcs w5, w4, w3 11 adcs x5, x4, x3 12 13 ; CHECK: adc w1, w2, w3 ; encoding: [0x41,0x00,0x03,0x1a] 14 ; CHECK: adc x1, x2, x3 ; encoding: [0x41,0x00,0x03,0x9a] 15 ; CHECK: adcs w5, w4, w3 ; encoding: [0x85,0x00,0x03,0x3a] 16 ; CHECK: adcs x5, x4, x3 ; encoding: [0x85,0x00,0x03,0xba] 17 18 sbc w1, w2, w3 19 sbc x1, x2, x3 20 sbcs w1, w2, w3 21 sbcs x1, x2, x3 22 23 ; CHECK: sbc w1, w2, w3 ; encoding: [0x41,0x00,0x03,0x5a] 24 ; CHECK: sbc x1, x2, x3 ; encoding: [0x41,0x00,0x03,0xda] 25 ; CHECK: sbcs w1, w2, w3 ; encoding: [0x41,0x00,0x03,0x7a] 26 ; CHECK: sbcs x1, x2, x3 ; encoding: [0x41,0x00,0x03,0xfa] 27 28 ;==---------------------------------------------------------------------------== 29 ; Add/Subtract with (optionally shifted) immediate 30 ;==---------------------------------------------------------------------------== 31 32 add w3, w4, #1024 33 add w3, w4, #1024, lsl #0 34 add x3, x4, #1024 35 add x3, x4, #1024, lsl #0 36 37 ; CHECK: add w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x11] 38 ; CHECK: add w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x11] 39 ; CHECK: add x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0x91] 40 ; CHECK: add x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0x91] 41 42 add w3, w4, #1024, lsl #12 43 add w3, w4, #4194304 44 add w3, w4, #0, lsl #12 45 add x3, x4, #1024, lsl #12 46 add x3, x4, #4194304 47 add x3, x4, #0, lsl #12 48 add sp, sp, #32 49 50 ; CHECK: add w3, w4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x11] 51 ; CHECK: add w3, w4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x11] 52 ; CHECK: add w3, w4, #0, lsl #12 ; encoding: [0x83,0x00,0x40,0x11] 53 ; CHECK: add x3, x4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x91] 54 ; CHECK: add x3, x4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x91] 55 ; CHECK: add x3, x4, #0, lsl #12 ; encoding: [0x83,0x00,0x40,0x91] 56 ; CHECK: add sp, sp, #32 ; encoding: [0xff,0x83,0x00,0x91] 57 58 adds w3, w4, #1024 59 adds w3, w4, #1024, lsl #0 60 adds w3, w4, #1024, lsl #12 61 adds x3, x4, #1024 62 adds x3, x4, #1024, lsl #0 63 adds x3, x4, #1024, lsl #12 64 65 ; CHECK: adds w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x31] 66 ; CHECK: adds w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x31] 67 ; CHECK: adds w3, w4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x31] 68 ; CHECK: adds x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0xb1] 69 ; CHECK: adds x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0xb1] 70 ; CHECK: adds x3, x4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0xb1] 71 72 sub w3, w4, #1024 73 sub w3, w4, #1024, lsl #0 74 sub w3, w4, #1024, lsl #12 75 sub x3, x4, #1024 76 sub x3, x4, #1024, lsl #0 77 sub x3, x4, #1024, lsl #12 78 sub sp, sp, #32 79 80 ; CHECK: sub w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x51] 81 ; CHECK: sub w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x51] 82 ; CHECK: sub w3, w4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x51] 83 ; CHECK: sub x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0xd1] 84 ; CHECK: sub x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0xd1] 85 ; CHECK: sub x3, x4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0xd1] 86 ; CHECK: sub sp, sp, #32 ; encoding: [0xff,0x83,0x00,0xd1] 87 88 subs w3, w4, #1024 89 subs w3, w4, #1024, lsl #0 90 subs w3, w4, #1024, lsl #12 91 subs x3, x4, #1024 92 subs x3, x4, #1024, lsl #0 93 subs x3, x4, #1024, lsl #12 94 95 ; CHECK: subs w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x71] 96 ; CHECK: subs w3, w4, #1024 ; encoding: [0x83,0x00,0x10,0x71] 97 ; CHECK: subs w3, w4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0x71] 98 ; CHECK: subs x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0xf1] 99 ; CHECK: subs x3, x4, #1024 ; encoding: [0x83,0x00,0x10,0xf1] 100 ; CHECK: subs x3, x4, #1024, lsl #12 ; encoding: [0x83,0x00,0x50,0xf1] 101 102 ;==---------------------------------------------------------------------------== 103 ; Add/Subtract register with (optional) shift 104 ;==---------------------------------------------------------------------------== 105 106 add w12, w13, w14 107 add x12, x13, x14 108 add w12, w13, w14, lsl #12 109 add x12, x13, x14, lsl #12 110 add x12, x13, x14, lsr #42 111 add x12, x13, x14, asr #39 112 113 ; CHECK: add w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x0b] 114 ; CHECK: add x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0x8b] 115 ; CHECK: add w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x0b] 116 ; CHECK: add x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x8b] 117 ; CHECK: add x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0x8b] 118 ; CHECK: add x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0x8b] 119 120 sub w12, w13, w14 121 sub x12, x13, x14 122 sub w12, w13, w14, lsl #12 123 sub x12, x13, x14, lsl #12 124 sub x12, x13, x14, lsr #42 125 sub x12, x13, x14, asr #39 126 127 ; CHECK: sub w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x4b] 128 ; CHECK: sub x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0xcb] 129 ; CHECK: sub w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x4b] 130 ; CHECK: sub x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0xcb] 131 ; CHECK: sub x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0xcb] 132 ; CHECK: sub x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0xcb] 133 134 adds w12, w13, w14 135 adds x12, x13, x14 136 adds w12, w13, w14, lsl #12 137 adds x12, x13, x14, lsl #12 138 adds x12, x13, x14, lsr #42 139 adds x12, x13, x14, asr #39 140 141 ; CHECK: adds w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x2b] 142 ; CHECK: adds x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0xab] 143 ; CHECK: adds w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x2b] 144 ; CHECK: adds x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0xab] 145 ; CHECK: adds x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0xab] 146 ; CHECK: adds x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0xab] 147 148 subs w12, w13, w14 149 subs x12, x13, x14 150 subs w12, w13, w14, lsl #12 151 subs x12, x13, x14, lsl #12 152 subs x12, x13, x14, lsr #42 153 subs x12, x13, x14, asr #39 154 155 ; CHECK: subs w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x6b] 156 ; CHECK: subs x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0xeb] 157 ; CHECK: subs w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x6b] 158 ; CHECK: subs x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0xeb] 159 ; CHECK: subs x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0xeb] 160 ; CHECK: subs x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0xeb] 161 162 ; Check use of upper case register names rdar://14354073 163 add X2, X2, X2 164 ; CHECK: add x2, x2, x2 ; encoding: [0x42,0x00,0x02,0x8b] 165 166 ;==---------------------------------------------------------------------------== 167 ; Add/Subtract with (optional) extend 168 ;==---------------------------------------------------------------------------== 169 170 add w1, w2, w3, uxtb 171 add w1, w2, w3, uxth 172 add w1, w2, w3, uxtw 173 add w1, w2, w3, uxtx 174 add w1, w2, w3, sxtb 175 add w1, w2, w3, sxth 176 add w1, w2, w3, sxtw 177 add w1, w2, w3, sxtx 178 179 ; CHECK: add w1, w2, w3, uxtb ; encoding: [0x41,0x00,0x23,0x0b] 180 ; CHECK: add w1, w2, w3, uxth ; encoding: [0x41,0x20,0x23,0x0b] 181 ; CHECK: add w1, w2, w3, uxtw ; encoding: [0x41,0x40,0x23,0x0b] 182 ; CHECK: add w1, w2, w3, uxtx ; encoding: [0x41,0x60,0x23,0x0b] 183 ; CHECK: add w1, w2, w3, sxtb ; encoding: [0x41,0x80,0x23,0x0b] 184 ; CHECK: add w1, w2, w3, sxth ; encoding: [0x41,0xa0,0x23,0x0b] 185 ; CHECK: add w1, w2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0x0b] 186 ; CHECK: add w1, w2, w3, sxtx ; encoding: [0x41,0xe0,0x23,0x0b] 187 188 add x1, x2, w3, uxtb 189 add x1, x2, w3, uxth 190 add x1, x2, w3, uxtw 191 add x1, x2, w3, sxtb 192 add x1, x2, w3, sxth 193 add x1, x2, w3, sxtw 194 195 ; CHECK: add x1, x2, w3, uxtb ; encoding: [0x41,0x00,0x23,0x8b] 196 ; CHECK: add x1, x2, w3, uxth ; encoding: [0x41,0x20,0x23,0x8b] 197 ; CHECK: add x1, x2, w3, uxtw ; encoding: [0x41,0x40,0x23,0x8b] 198 ; CHECK: add x1, x2, w3, sxtb ; encoding: [0x41,0x80,0x23,0x8b] 199 ; CHECK: add x1, x2, w3, sxth ; encoding: [0x41,0xa0,0x23,0x8b] 200 ; CHECK: add x1, x2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0x8b] 201 202 add w1, wsp, w3 203 add w1, wsp, w3, uxtw #0 204 add w2, wsp, w3, lsl #1 205 add sp, x2, x3 206 add sp, x2, x3, uxtx #0 207 208 ; CHECK: add w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x0b] 209 ; CHECK: add w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x0b] 210 ; CHECK: add w2, wsp, w3, lsl #1 ; encoding: [0xe2,0x47,0x23,0x0b] 211 ; CHECK: add sp, x2, x3 ; encoding: [0x5f,0x60,0x23,0x8b] 212 ; CHECK: add sp, x2, x3 ; encoding: [0x5f,0x60,0x23,0x8b] 213 214 sub w1, w2, w3, uxtb 215 sub w1, w2, w3, uxth 216 sub w1, w2, w3, uxtw 217 sub w1, w2, w3, uxtx 218 sub w1, w2, w3, sxtb 219 sub w1, w2, w3, sxth 220 sub w1, w2, w3, sxtw 221 sub w1, w2, w3, sxtx 222 223 ; CHECK: sub w1, w2, w3, uxtb ; encoding: [0x41,0x00,0x23,0x4b] 224 ; CHECK: sub w1, w2, w3, uxth ; encoding: [0x41,0x20,0x23,0x4b] 225 ; CHECK: sub w1, w2, w3, uxtw ; encoding: [0x41,0x40,0x23,0x4b] 226 ; CHECK: sub w1, w2, w3, uxtx ; encoding: [0x41,0x60,0x23,0x4b] 227 ; CHECK: sub w1, w2, w3, sxtb ; encoding: [0x41,0x80,0x23,0x4b] 228 ; CHECK: sub w1, w2, w3, sxth ; encoding: [0x41,0xa0,0x23,0x4b] 229 ; CHECK: sub w1, w2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0x4b] 230 ; CHECK: sub w1, w2, w3, sxtx ; encoding: [0x41,0xe0,0x23,0x4b] 231 232 sub x1, x2, w3, uxtb 233 sub x1, x2, w3, uxth 234 sub x1, x2, w3, uxtw 235 sub x1, x2, w3, sxtb 236 sub x1, x2, w3, sxth 237 sub x1, x2, w3, sxtw 238 239 ; CHECK: sub x1, x2, w3, uxtb ; encoding: [0x41,0x00,0x23,0xcb] 240 ; CHECK: sub x1, x2, w3, uxth ; encoding: [0x41,0x20,0x23,0xcb] 241 ; CHECK: sub x1, x2, w3, uxtw ; encoding: [0x41,0x40,0x23,0xcb] 242 ; CHECK: sub x1, x2, w3, sxtb ; encoding: [0x41,0x80,0x23,0xcb] 243 ; CHECK: sub x1, x2, w3, sxth ; encoding: [0x41,0xa0,0x23,0xcb] 244 ; CHECK: sub x1, x2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0xcb] 245 246 sub w1, wsp, w3 247 sub w1, wsp, w3, uxtw #0 248 sub sp, x2, x3 249 sub sp, x2, x3, uxtx #0 250 sub sp, x3, x7, lsl #4 251 252 ; CHECK: sub w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x4b] 253 ; CHECK: sub w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x4b] 254 ; CHECK: sub sp, x2, x3 ; encoding: [0x5f,0x60,0x23,0xcb] 255 ; CHECK: sub sp, x2, x3 ; encoding: [0x5f,0x60,0x23,0xcb] 256 ; CHECK: sp, x3, x7, lsl #4 ; encoding: [0x7f,0x70,0x27,0xcb] 257 258 adds w1, w2, w3, uxtb 259 adds w1, w2, w3, uxth 260 adds w1, w2, w3, uxtw 261 adds w1, w2, w3, uxtx 262 adds w1, w2, w3, sxtb 263 adds w1, w2, w3, sxth 264 adds w1, w2, w3, sxtw 265 adds w1, w2, w3, sxtx 266 267 ; CHECK: adds w1, w2, w3, uxtb ; encoding: [0x41,0x00,0x23,0x2b] 268 ; CHECK: adds w1, w2, w3, uxth ; encoding: [0x41,0x20,0x23,0x2b] 269 ; CHECK: adds w1, w2, w3, uxtw ; encoding: [0x41,0x40,0x23,0x2b] 270 ; CHECK: adds w1, w2, w3, uxtx ; encoding: [0x41,0x60,0x23,0x2b] 271 ; CHECK: adds w1, w2, w3, sxtb ; encoding: [0x41,0x80,0x23,0x2b] 272 ; CHECK: adds w1, w2, w3, sxth ; encoding: [0x41,0xa0,0x23,0x2b] 273 ; CHECK: adds w1, w2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0x2b] 274 ; CHECK: adds w1, w2, w3, sxtx ; encoding: [0x41,0xe0,0x23,0x2b] 275 276 adds x1, x2, w3, uxtb 277 adds x1, x2, w3, uxth 278 adds x1, x2, w3, uxtw 279 adds x1, x2, w3, uxtx 280 adds x1, x2, w3, sxtb 281 adds x1, x2, w3, sxth 282 adds x1, x2, w3, sxtw 283 adds x1, x2, w3, sxtx 284 285 ; CHECK: adds x1, x2, w3, uxtb ; encoding: [0x41,0x00,0x23,0xab] 286 ; CHECK: adds x1, x2, w3, uxth ; encoding: [0x41,0x20,0x23,0xab] 287 ; CHECK: adds x1, x2, w3, uxtw ; encoding: [0x41,0x40,0x23,0xab] 288 ; CHECK: adds x1, x2, w3, uxtx ; encoding: [0x41,0x60,0x23,0xab] 289 ; CHECK: adds x1, x2, w3, sxtb ; encoding: [0x41,0x80,0x23,0xab] 290 ; CHECK: adds x1, x2, w3, sxth ; encoding: [0x41,0xa0,0x23,0xab] 291 ; CHECK: adds x1, x2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0xab] 292 ; CHECK: adds x1, x2, w3, sxtx ; encoding: [0x41,0xe0,0x23,0xab] 293 294 adds w1, wsp, w3 295 adds w1, wsp, w3, uxtw #0 296 adds wzr, wsp, w3, lsl #4 297 298 ; CHECK: adds w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x2b] 299 ; CHECK: adds w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x2b] 300 ; CHECK: cmn wsp, w3, lsl #4 ; encoding: [0xff,0x53,0x23,0x2b] 301 302 subs w1, w2, w3, uxtb 303 subs w1, w2, w3, uxth 304 subs w1, w2, w3, uxtw 305 subs w1, w2, w3, uxtx 306 subs w1, w2, w3, sxtb 307 subs w1, w2, w3, sxth 308 subs w1, w2, w3, sxtw 309 subs w1, w2, w3, sxtx 310 311 ; CHECK: subs w1, w2, w3, uxtb ; encoding: [0x41,0x00,0x23,0x6b] 312 ; CHECK: subs w1, w2, w3, uxth ; encoding: [0x41,0x20,0x23,0x6b] 313 ; CHECK: subs w1, w2, w3, uxtw ; encoding: [0x41,0x40,0x23,0x6b] 314 ; CHECK: subs w1, w2, w3, uxtx ; encoding: [0x41,0x60,0x23,0x6b] 315 ; CHECK: subs w1, w2, w3, sxtb ; encoding: [0x41,0x80,0x23,0x6b] 316 ; CHECK: subs w1, w2, w3, sxth ; encoding: [0x41,0xa0,0x23,0x6b] 317 ; CHECK: subs w1, w2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0x6b] 318 ; CHECK: subs w1, w2, w3, sxtx ; encoding: [0x41,0xe0,0x23,0x6b] 319 320 subs x1, x2, w3, uxtb 321 subs x1, x2, w3, uxth 322 subs x1, x2, w3, uxtw 323 subs x1, x2, w3, uxtx 324 subs x1, x2, w3, sxtb 325 subs x1, x2, w3, sxth 326 subs x1, x2, w3, sxtw 327 subs x1, x2, w3, sxtx 328 329 ; CHECK: subs x1, x2, w3, uxtb ; encoding: [0x41,0x00,0x23,0xeb] 330 ; CHECK: subs x1, x2, w3, uxth ; encoding: [0x41,0x20,0x23,0xeb] 331 ; CHECK: subs x1, x2, w3, uxtw ; encoding: [0x41,0x40,0x23,0xeb] 332 ; CHECK: subs x1, x2, w3, uxtx ; encoding: [0x41,0x60,0x23,0xeb] 333 ; CHECK: subs x1, x2, w3, sxtb ; encoding: [0x41,0x80,0x23,0xeb] 334 ; CHECK: subs x1, x2, w3, sxth ; encoding: [0x41,0xa0,0x23,0xeb] 335 ; CHECK: subs x1, x2, w3, sxtw ; encoding: [0x41,0xc0,0x23,0xeb] 336 ; CHECK: subs x1, x2, w3, sxtx ; encoding: [0x41,0xe0,0x23,0xeb] 337 338 subs w1, wsp, w3 339 subs w1, wsp, w3, uxtw #0 340 341 ; CHECK: subs w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x6b] 342 ; CHECK: subs w1, wsp, w3 ; encoding: [0xe1,0x43,0x23,0x6b] 343 344 cmp wsp, w9, lsl #0 345 subs x3, sp, x9, lsl #2 346 cmp wsp, w8, uxtw 347 subs wzr, wsp, w8, uxtw 348 cmp sp, w8, uxtw 349 subs xzr, sp, w8, uxtw 350 351 ; CHECK: cmp wsp, w9 ; encoding: [0xff,0x43,0x29,0x6b] 352 ; CHECK: subs x3, sp, x9, lsl #2 ; encoding: [0xe3,0x6b,0x29,0xeb] 353 ; CHECK: cmp wsp, w8 ; encoding: [0xff,0x43,0x28,0x6b] 354 ; CHECK: cmp wsp, w8 ; encoding: [0xff,0x43,0x28,0x6b] 355 ; CHECK: cmp sp, w8, uxtw ; encoding: [0xff,0x43,0x28,0xeb] 356 ; CHECK: cmp sp, w8, uxtw ; encoding: [0xff,0x43,0x28,0xeb] 357 358 sub wsp, w9, w8, uxtw 359 sub w1, wsp, w8, uxtw 360 sub wsp, wsp, w8, uxtw 361 sub sp, x9, w8, uxtw 362 sub x1, sp, w8, uxtw 363 sub sp, sp, w8, uxtw 364 subs w1, wsp, w8, uxtw 365 subs x1, sp, w8, uxtw 366 367 ; CHECK: sub wsp, w9, w8 ; encoding: [0x3f,0x41,0x28,0x4b] 368 ; CHECK: sub w1, wsp, w8 ; encoding: [0xe1,0x43,0x28,0x4b] 369 ; CHECK: sub wsp, wsp, w8 ; encoding: [0xff,0x43,0x28,0x4b] 370 ; CHECK: sub sp, x9, w8, uxtw ; encoding: [0x3f,0x41,0x28,0xcb] 371 ; CHECK: sub x1, sp, w8, uxtw ; encoding: [0xe1,0x43,0x28,0xcb] 372 ; CHECK: sub sp, sp, w8, uxtw ; encoding: [0xff,0x43,0x28,0xcb] 373 ; CHECK: subs w1, wsp, w8 ; encoding: [0xe1,0x43,0x28,0x6b] 374 ; CHECK: subs x1, sp, w8, uxtw ; encoding: [0xe1,0x43,0x28,0xeb] 375 376 ;==---------------------------------------------------------------------------== 377 ; Signed/Unsigned divide 378 ;==---------------------------------------------------------------------------== 379 380 sdiv w1, w2, w3 381 sdiv x1, x2, x3 382 udiv w1, w2, w3 383 udiv x1, x2, x3 384 385 ; CHECK: sdiv w1, w2, w3 ; encoding: [0x41,0x0c,0xc3,0x1a] 386 ; CHECK: sdiv x1, x2, x3 ; encoding: [0x41,0x0c,0xc3,0x9a] 387 ; CHECK: udiv w1, w2, w3 ; encoding: [0x41,0x08,0xc3,0x1a] 388 ; CHECK: udiv x1, x2, x3 ; encoding: [0x41,0x08,0xc3,0x9a] 389 390 ;==---------------------------------------------------------------------------== 391 ; Variable shifts 392 ;==---------------------------------------------------------------------------== 393 394 asrv w1, w2, w3 395 asrv x1, x2, x3 396 asr w1, w2, w3 397 asr x1, x2, x3 398 lslv w1, w2, w3 399 lslv x1, x2, x3 400 lsl w1, w2, w3 401 lsl x1, x2, x3 402 lsrv w1, w2, w3 403 lsrv x1, x2, x3 404 lsr w1, w2, w3 405 lsr x1, x2, x3 406 rorv w1, w2, w3 407 rorv x1, x2, x3 408 ror w1, w2, w3 409 ror x1, x2, x3 410 411 ; CHECK: encoding: [0x41,0x28,0xc3,0x1a] 412 ; CHECK: encoding: [0x41,0x28,0xc3,0x9a] 413 ; CHECK: encoding: [0x41,0x28,0xc3,0x1a] 414 ; CHECK: encoding: [0x41,0x28,0xc3,0x9a] 415 ; CHECK: encoding: [0x41,0x20,0xc3,0x1a] 416 ; CHECK: encoding: [0x41,0x20,0xc3,0x9a] 417 ; CHECK: encoding: [0x41,0x20,0xc3,0x1a] 418 ; CHECK: encoding: [0x41,0x20,0xc3,0x9a] 419 ; CHECK: encoding: [0x41,0x24,0xc3,0x1a] 420 ; CHECK: encoding: [0x41,0x24,0xc3,0x9a] 421 ; CHECK: encoding: [0x41,0x24,0xc3,0x1a] 422 ; CHECK: encoding: [0x41,0x24,0xc3,0x9a] 423 ; CHECK: encoding: [0x41,0x2c,0xc3,0x1a] 424 ; CHECK: encoding: [0x41,0x2c,0xc3,0x9a] 425 ; CHECK: encoding: [0x41,0x2c,0xc3,0x1a] 426 ; CHECK: encoding: [0x41,0x2c,0xc3,0x9a] 427 428 ;==---------------------------------------------------------------------------== 429 ; One operand instructions 430 ;==---------------------------------------------------------------------------== 431 432 cls w1, w2 433 cls x1, x2 434 clz w1, w2 435 clz x1, x2 436 rbit w1, w2 437 rbit x1, x2 438 rev w1, w2 439 rev x1, x2 440 rev16 w1, w2 441 rev16 x1, x2 442 rev32 x1, x2 443 444 ; CHECK: encoding: [0x41,0x14,0xc0,0x5a] 445 ; CHECK: encoding: [0x41,0x14,0xc0,0xda] 446 ; CHECK: encoding: [0x41,0x10,0xc0,0x5a] 447 ; CHECK: encoding: [0x41,0x10,0xc0,0xda] 448 ; CHECK: encoding: [0x41,0x00,0xc0,0x5a] 449 ; CHECK: encoding: [0x41,0x00,0xc0,0xda] 450 ; CHECK: encoding: [0x41,0x08,0xc0,0x5a] 451 ; CHECK: encoding: [0x41,0x0c,0xc0,0xda] 452 ; CHECK: encoding: [0x41,0x04,0xc0,0x5a] 453 ; CHECK: encoding: [0x41,0x04,0xc0,0xda] 454 ; CHECK: encoding: [0x41,0x08,0xc0,0xda] 455 456 ;==---------------------------------------------------------------------------== 457 ; 6.6.1 Multiply-add instructions 458 ;==---------------------------------------------------------------------------== 459 460 madd w1, w2, w3, w4 461 madd x1, x2, x3, x4 462 msub w1, w2, w3, w4 463 msub x1, x2, x3, x4 464 smaddl x1, w2, w3, x4 465 smsubl x1, w2, w3, x4 466 umaddl x1, w2, w3, x4 467 umsubl x1, w2, w3, x4 468 469 ; CHECK: madd w1, w2, w3, w4 ; encoding: [0x41,0x10,0x03,0x1b] 470 ; CHECK: madd x1, x2, x3, x4 ; encoding: [0x41,0x10,0x03,0x9b] 471 ; CHECK: msub w1, w2, w3, w4 ; encoding: [0x41,0x90,0x03,0x1b] 472 ; CHECK: msub x1, x2, x3, x4 ; encoding: [0x41,0x90,0x03,0x9b] 473 ; CHECK: smaddl x1, w2, w3, x4 ; encoding: [0x41,0x10,0x23,0x9b] 474 ; CHECK: smsubl x1, w2, w3, x4 ; encoding: [0x41,0x90,0x23,0x9b] 475 ; CHECK: umaddl x1, w2, w3, x4 ; encoding: [0x41,0x10,0xa3,0x9b] 476 ; CHECK: umsubl x1, w2, w3, x4 ; encoding: [0x41,0x90,0xa3,0x9b] 477 478 ;==---------------------------------------------------------------------------== 479 ; Multiply-high instructions 480 ;==---------------------------------------------------------------------------== 481 482 smulh x1, x2, x3 483 umulh x1, x2, x3 484 485 ; CHECK: smulh x1, x2, x3 ; encoding: [0x41,0x7c,0x43,0x9b] 486 ; CHECK: umulh x1, x2, x3 ; encoding: [0x41,0x7c,0xc3,0x9b] 487 488 ;==---------------------------------------------------------------------------== 489 ; Move immediate instructions 490 ;==---------------------------------------------------------------------------== 491 492 movz w0, #1 493 movz x0, #1 494 movz w0, #1, lsl #16 495 movz x0, #1, lsl #16 496 497 ; CHECK: mov w0, #1 ; encoding: [0x20,0x00,0x80,0x52] 498 ; CHECK: mov x0, #1 ; encoding: [0x20,0x00,0x80,0xd2] 499 ; CHECK: mov w0, #65536 ; encoding: [0x20,0x00,0xa0,0x52] 500 ; CHECK: mov x0, #65536 ; encoding: [0x20,0x00,0xa0,0xd2] 501 502 movn w0, #2 503 movn x0, #2 504 movn w0, #2, lsl #16 505 movn x0, #2, lsl #16 506 507 ; CHECK: mov w0, #-3 ; encoding: [0x40,0x00,0x80,0x12] 508 ; CHECK: mov x0, #-3 ; encoding: [0x40,0x00,0x80,0x92] 509 ; CHECK: mov w0, #-131073 ; encoding: [0x40,0x00,0xa0,0x12] 510 ; CHECK: mov x0, #-131073 ; encoding: [0x40,0x00,0xa0,0x92] 511 512 movk w0, #1 513 movk x0, #1 514 movk w0, #1, lsl #16 515 movk x0, #1, lsl #16 516 517 ; CHECK: movk w0, #1 ; encoding: [0x20,0x00,0x80,0x72] 518 ; CHECK: movk x0, #1 ; encoding: [0x20,0x00,0x80,0xf2] 519 ; CHECK: movk w0, #1, lsl #16 ; encoding: [0x20,0x00,0xa0,0x72] 520 ; CHECK: movk x0, #1, lsl #16 ; encoding: [0x20,0x00,0xa0,0xf2] 521 522 ;==---------------------------------------------------------------------------== 523 ; Conditionally set flags instructions 524 ;==---------------------------------------------------------------------------== 525 526 ccmn w1, #2, #3, eq 527 ccmn x1, #2, #3, eq 528 ccmp w1, #2, #3, eq 529 ccmp x1, #2, #3, eq 530 531 ; CHECK: encoding: [0x23,0x08,0x42,0x3a] 532 ; CHECK: encoding: [0x23,0x08,0x42,0xba] 533 ; CHECK: encoding: [0x23,0x08,0x42,0x7a] 534 ; CHECK: encoding: [0x23,0x08,0x42,0xfa] 535 536 ccmn w1, w2, #3, eq 537 ccmn x1, x2, #3, eq 538 ccmp w1, w2, #3, eq 539 ccmp x1, x2, #3, eq 540 541 ; CHECK: encoding: [0x23,0x00,0x42,0x3a] 542 ; CHECK: encoding: [0x23,0x00,0x42,0xba] 543 ; CHECK: encoding: [0x23,0x00,0x42,0x7a] 544 ; CHECK: encoding: [0x23,0x00,0x42,0xfa] 545 546 ;==---------------------------------------------------------------------------== 547 ; Conditional select instructions 548 ;==---------------------------------------------------------------------------== 549 550 csel w1, w2, w3, eq 551 csel x1, x2, x3, eq 552 csinc w1, w2, w3, eq 553 csinc x1, x2, x3, eq 554 csinv w1, w2, w3, eq 555 csinv x1, x2, x3, eq 556 csneg w1, w2, w3, eq 557 csneg x1, x2, x3, eq 558 559 ; CHECK: encoding: [0x41,0x00,0x83,0x1a] 560 ; CHECK: encoding: [0x41,0x00,0x83,0x9a] 561 ; CHECK: encoding: [0x41,0x04,0x83,0x1a] 562 ; CHECK: encoding: [0x41,0x04,0x83,0x9a] 563 ; CHECK: encoding: [0x41,0x00,0x83,0x5a] 564 ; CHECK: encoding: [0x41,0x00,0x83,0xda] 565 ; CHECK: encoding: [0x41,0x04,0x83,0x5a] 566 ; CHECK: encoding: [0x41,0x04,0x83,0xda] 567 568 ; Make sure we handle upper case, too. In particular, condition codes. 569 CSEL W16, W7, W27, EQ 570 CSEL W15, W6, W26, NE 571 CSEL W14, W5, W25, CS 572 CSEL W13, W4, W24, HS 573 csel w12, w3, w23, CC 574 csel w11, w2, w22, LO 575 csel w10, w1, w21, MI 576 csel x9, x9, x1, PL 577 csel x8, x8, x2, VS 578 CSEL X7, X7, X3, VC 579 CSEL X6, X7, X4, HI 580 CSEL X5, X6, X5, LS 581 CSEL X4, X5, X6, GE 582 csel x3, x4, x7, LT 583 csel x2, x3, x8, GT 584 csel x1, x2, x9, LE 585 csel x10, x1, x20, AL 586 587 ; CHECK: csel w16, w7, w27, eq ; encoding: [0xf0,0x00,0x9b,0x1a] 588 ; CHECK: csel w15, w6, w26, ne ; encoding: [0xcf,0x10,0x9a,0x1a] 589 ; CHECK: csel w14, w5, w25, hs ; encoding: [0xae,0x20,0x99,0x1a] 590 ; CHECK: csel w13, w4, w24, hs ; encoding: [0x8d,0x20,0x98,0x1a] 591 ; CHECK: csel w12, w3, w23, lo ; encoding: [0x6c,0x30,0x97,0x1a] 592 ; CHECK: csel w11, w2, w22, lo ; encoding: [0x4b,0x30,0x96,0x1a] 593 ; CHECK: csel w10, w1, w21, mi ; encoding: [0x2a,0x40,0x95,0x1a] 594 ; CHECK: csel x9, x9, x1, pl ; encoding: [0x29,0x51,0x81,0x9a] 595 ; CHECK: csel x8, x8, x2, vs ; encoding: [0x08,0x61,0x82,0x9a] 596 ; CHECK: csel x7, x7, x3, vc ; encoding: [0xe7,0x70,0x83,0x9a] 597 ; CHECK: csel x6, x7, x4, hi ; encoding: [0xe6,0x80,0x84,0x9a] 598 ; CHECK: csel x5, x6, x5, ls ; encoding: [0xc5,0x90,0x85,0x9a] 599 ; CHECK: csel x4, x5, x6, ge ; encoding: [0xa4,0xa0,0x86,0x9a] 600 ; CHECK: csel x3, x4, x7, lt ; encoding: [0x83,0xb0,0x87,0x9a] 601 ; CHECK: csel x2, x3, x8, gt ; encoding: [0x62,0xc0,0x88,0x9a] 602 ; CHECK: csel x1, x2, x9, le ; encoding: [0x41,0xd0,0x89,0x9a] 603 ; CHECK: csel x10, x1, x20, al ; encoding: [0x2a,0xe0,0x94,0x9a] 604 605 606 ;==---------------------------------------------------------------------------== 607 ; Scalar saturating arithmetic 608 ;==---------------------------------------------------------------------------== 609 uqxtn b4, h2 610 uqxtn h2, s3 611 uqxtn s9, d2 612 613 ; CHECK: uqxtn b4, h2 ; encoding: [0x44,0x48,0x21,0x7e] 614 ; CHECK: uqxtn h2, s3 ; encoding: [0x62,0x48,0x61,0x7e] 615 ; CHECK: uqxtn s9, d2 ; encoding: [0x49,0x48,0xa1,0x7e] 616