1// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \ 2// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST 3// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s \ 4// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST 5// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \ 6// RUN: | FileCheck %s --check-prefix=CHECK-ERROR 7// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \ 8// RUN: | llvm-objdump -d --mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST 9// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \ 10// RUN: | llvm-objdump -d --mattr=-sve - | FileCheck %s --check-prefix=CHECK-UNKNOWN 11 12cpy z0.b, p0/m, w0 13// CHECK-INST: mov z0.b, p0/m, w0 14// CHECK-ENCODING: [0x00,0xa0,0x28,0x05] 15// CHECK-ERROR: instruction requires: sve or sme 16// CHECK-UNKNOWN: 0528a000 <unknown> 17 18cpy z0.h, p0/m, w0 19// CHECK-INST: mov z0.h, p0/m, w0 20// CHECK-ENCODING: [0x00,0xa0,0x68,0x05] 21// CHECK-ERROR: instruction requires: sve or sme 22// CHECK-UNKNOWN: 0568a000 <unknown> 23 24cpy z0.s, p0/m, w0 25// CHECK-INST: mov z0.s, p0/m, w0 26// CHECK-ENCODING: [0x00,0xa0,0xa8,0x05] 27// CHECK-ERROR: instruction requires: sve or sme 28// CHECK-UNKNOWN: 05a8a000 <unknown> 29 30cpy z0.d, p0/m, x0 31// CHECK-INST: mov z0.d, p0/m, x0 32// CHECK-ENCODING: [0x00,0xa0,0xe8,0x05] 33// CHECK-ERROR: instruction requires: sve or sme 34// CHECK-UNKNOWN: 05e8a000 <unknown> 35 36cpy z31.b, p7/m, wsp 37// CHECK-INST: mov z31.b, p7/m, wsp 38// CHECK-ENCODING: [0xff,0xbf,0x28,0x05] 39// CHECK-ERROR: instruction requires: sve or sme 40// CHECK-UNKNOWN: 0528bfff <unknown> 41 42cpy z31.h, p7/m, wsp 43// CHECK-INST: mov z31.h, p7/m, wsp 44// CHECK-ENCODING: [0xff,0xbf,0x68,0x05] 45// CHECK-ERROR: instruction requires: sve or sme 46// CHECK-UNKNOWN: 0568bfff <unknown> 47 48cpy z31.s, p7/m, wsp 49// CHECK-INST: mov z31.s, p7/m, wsp 50// CHECK-ENCODING: [0xff,0xbf,0xa8,0x05] 51// CHECK-ERROR: instruction requires: sve or sme 52// CHECK-UNKNOWN: 05a8bfff <unknown> 53 54cpy z31.d, p7/m, sp 55// CHECK-INST: mov z31.d, p7/m, sp 56// CHECK-ENCODING: [0xff,0xbf,0xe8,0x05] 57// CHECK-ERROR: instruction requires: sve or sme 58// CHECK-UNKNOWN: 05e8bfff <unknown> 59 60cpy z0.b, p0/m, b0 61// CHECK-INST: mov z0.b, p0/m, b0 62// CHECK-ENCODING: [0x00,0x80,0x20,0x05] 63// CHECK-ERROR: instruction requires: sve or sme 64// CHECK-UNKNOWN: 05208000 <unknown> 65 66cpy z31.b, p7/m, b31 67// CHECK-INST: mov z31.b, p7/m, b31 68// CHECK-ENCODING: [0xff,0x9f,0x20,0x05] 69// CHECK-ERROR: instruction requires: sve or sme 70// CHECK-UNKNOWN: 05209fff <unknown> 71 72cpy z0.h, p0/m, h0 73// CHECK-INST: mov z0.h, p0/m, h0 74// CHECK-ENCODING: [0x00,0x80,0x60,0x05] 75// CHECK-ERROR: instruction requires: sve or sme 76// CHECK-UNKNOWN: 05608000 <unknown> 77 78cpy z31.h, p7/m, h31 79// CHECK-INST: mov z31.h, p7/m, h31 80// CHECK-ENCODING: [0xff,0x9f,0x60,0x05] 81// CHECK-ERROR: instruction requires: sve or sme 82// CHECK-UNKNOWN: 05609fff <unknown> 83 84cpy z0.s, p0/m, s0 85// CHECK-INST: mov z0.s, p0/m, s0 86// CHECK-ENCODING: [0x00,0x80,0xa0,0x05] 87// CHECK-ERROR: instruction requires: sve or sme 88// CHECK-UNKNOWN: 05a08000 <unknown> 89 90cpy z31.s, p7/m, s31 91// CHECK-INST: mov z31.s, p7/m, s31 92// CHECK-ENCODING: [0xff,0x9f,0xa0,0x05] 93// CHECK-ERROR: instruction requires: sve or sme 94// CHECK-UNKNOWN: 05a09fff <unknown> 95 96cpy z0.d, p0/m, d0 97// CHECK-INST: mov z0.d, p0/m, d0 98// CHECK-ENCODING: [0x00,0x80,0xe0,0x05] 99// CHECK-ERROR: instruction requires: sve or sme 100// CHECK-UNKNOWN: 05e08000 <unknown> 101 102cpy z31.d, p7/m, d31 103// CHECK-INST: mov z31.d, p7/m, d31 104// CHECK-ENCODING: [0xff,0x9f,0xe0,0x05] 105// CHECK-ERROR: instruction requires: sve or sme 106// CHECK-UNKNOWN: 05e09fff <unknown> 107 108cpy z5.b, p0/z, #-128 109// CHECK-INST: mov z5.b, p0/z, #-128 110// CHECK-ENCODING: [0x05,0x10,0x10,0x05] 111// CHECK-ERROR: instruction requires: sve or sme 112// CHECK-UNKNOWN: 05101005 <unknown> 113 114cpy z5.b, p0/z, #127 115// CHECK-INST: mov z5.b, p0/z, #127 116// CHECK-ENCODING: [0xe5,0x0f,0x10,0x05] 117// CHECK-ERROR: instruction requires: sve or sme 118// CHECK-UNKNOWN: 05100fe5 <unknown> 119 120cpy z5.b, p0/z, #255 121// CHECK-INST: mov z5.b, p0/z, #-1 122// CHECK-ENCODING: [0xe5,0x1f,0x10,0x05] 123// CHECK-ERROR: instruction requires: sve or sme 124// CHECK-UNKNOWN: 05101fe5 <unknown> 125 126cpy z21.h, p0/z, #-128 127// CHECK-INST: mov z21.h, p0/z, #-128 128// CHECK-ENCODING: [0x15,0x10,0x50,0x05] 129// CHECK-ERROR: instruction requires: sve or sme 130// CHECK-UNKNOWN: 05501015 <unknown> 131 132cpy z21.h, p0/z, #-128, lsl #8 133// CHECK-INST: mov z21.h, p0/z, #-32768 134// CHECK-ENCODING: [0x15,0x30,0x50,0x05] 135// CHECK-ERROR: instruction requires: sve or sme 136// CHECK-UNKNOWN: 05503015 <unknown> 137 138cpy z21.h, p0/z, #-32768 139// CHECK-INST: mov z21.h, p0/z, #-32768 140// CHECK-ENCODING: [0x15,0x30,0x50,0x05] 141// CHECK-ERROR: instruction requires: sve or sme 142// CHECK-UNKNOWN: 05503015 <unknown> 143 144cpy z21.h, p0/z, #127 145// CHECK-INST: mov z21.h, p0/z, #127 146// CHECK-ENCODING: [0xf5,0x0f,0x50,0x05] 147// CHECK-ERROR: instruction requires: sve or sme 148// CHECK-UNKNOWN: 05500ff5 <unknown> 149 150cpy z21.h, p0/z, #127, lsl #8 151// CHECK-INST: mov z21.h, p0/z, #32512 152// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05] 153// CHECK-ERROR: instruction requires: sve or sme 154// CHECK-UNKNOWN: 05502ff5 <unknown> 155 156cpy z21.h, p0/z, #32512 157// CHECK-INST: mov z21.h, p0/z, #32512 158// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05] 159// CHECK-ERROR: instruction requires: sve or sme 160// CHECK-UNKNOWN: 05502ff5 <unknown> 161 162cpy z21.s, p0/z, #-128 163// CHECK-INST: mov z21.s, p0/z, #-128 164// CHECK-ENCODING: [0x15,0x10,0x90,0x05] 165// CHECK-ERROR: instruction requires: sve or sme 166// CHECK-UNKNOWN: 05901015 <unknown> 167 168cpy z21.s, p0/z, #-128, lsl #8 169// CHECK-INST: mov z21.s, p0/z, #-32768 170// CHECK-ENCODING: [0x15,0x30,0x90,0x05] 171// CHECK-ERROR: instruction requires: sve or sme 172// CHECK-UNKNOWN: 05903015 <unknown> 173 174cpy z21.s, p0/z, #-32768 175// CHECK-INST: mov z21.s, p0/z, #-32768 176// CHECK-ENCODING: [0x15,0x30,0x90,0x05] 177// CHECK-ERROR: instruction requires: sve or sme 178// CHECK-UNKNOWN: 05903015 <unknown> 179 180cpy z21.s, p0/z, #127 181// CHECK-INST: mov z21.s, p0/z, #127 182// CHECK-ENCODING: [0xf5,0x0f,0x90,0x05] 183// CHECK-ERROR: instruction requires: sve or sme 184// CHECK-UNKNOWN: 05900ff5 <unknown> 185 186cpy z21.s, p0/z, #127, lsl #8 187// CHECK-INST: mov z21.s, p0/z, #32512 188// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05] 189// CHECK-ERROR: instruction requires: sve or sme 190// CHECK-UNKNOWN: 05902ff5 <unknown> 191 192cpy z21.s, p0/z, #32512 193// CHECK-INST: mov z21.s, p0/z, #32512 194// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05] 195// CHECK-ERROR: instruction requires: sve or sme 196// CHECK-UNKNOWN: 05902ff5 <unknown> 197 198cpy z21.d, p0/z, #-128 199// CHECK-INST: mov z21.d, p0/z, #-128 200// CHECK-ENCODING: [0x15,0x10,0xd0,0x05] 201// CHECK-ERROR: instruction requires: sve or sme 202// CHECK-UNKNOWN: 05d01015 <unknown> 203 204cpy z21.d, p0/z, #-128, lsl #8 205// CHECK-INST: mov z21.d, p0/z, #-32768 206// CHECK-ENCODING: [0x15,0x30,0xd0,0x05] 207// CHECK-ERROR: instruction requires: sve or sme 208// CHECK-UNKNOWN: 05d03015 <unknown> 209 210cpy z21.d, p0/z, #-32768 211// CHECK-INST: mov z21.d, p0/z, #-32768 212// CHECK-ENCODING: [0x15,0x30,0xd0,0x05] 213// CHECK-ERROR: instruction requires: sve or sme 214// CHECK-UNKNOWN: 05d03015 <unknown> 215 216cpy z21.d, p0/z, #127 217// CHECK-INST: mov z21.d, p0/z, #127 218// CHECK-ENCODING: [0xf5,0x0f,0xd0,0x05] 219// CHECK-ERROR: instruction requires: sve or sme 220// CHECK-UNKNOWN: 05d00ff5 <unknown> 221 222cpy z21.d, p0/z, #127, lsl #8 223// CHECK-INST: mov z21.d, p0/z, #32512 224// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05] 225// CHECK-ERROR: instruction requires: sve or sme 226// CHECK-UNKNOWN: 05d02ff5 <unknown> 227 228cpy z21.d, p0/z, #32512 229// CHECK-INST: mov z21.d, p0/z, #32512 230// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05] 231// CHECK-ERROR: instruction requires: sve or sme 232// CHECK-UNKNOWN: 05d02ff5 <unknown> 233 234// --------------------------------------------------------------------------// 235// Tests where the negative immediate is in bounds when interpreted 236// as the element type. 237 238cpy z0.b, p0/z, #-129 239// CHECK-INST: mov z0.b, p0/z, #127 240// CHECK-ENCODING: [0xe0,0x0f,0x10,0x05] 241// CHECK-ERROR: instruction requires: sve or sme 242// CHECK-UNKNOWN: 05100fe0 <unknown> 243 244cpy z0.h, p0/z, #-33024 245// CHECK-INST: mov z0.h, p0/z, #32512 246// CHECK-ENCODING: [0xe0,0x2f,0x50,0x05] 247// CHECK-ERROR: instruction requires: sve or sme 248// CHECK-UNKNOWN: 05502fe0 <unknown> 249 250cpy z0.h, p0/z, #-129, lsl #8 251// CHECK-INST: mov z0.h, p0/z, #32512 252// CHECK-ENCODING: [0xe0,0x2f,0x50,0x05] 253// CHECK-ERROR: instruction requires: sve or sme 254// CHECK-UNKNOWN: 05502fe0 <unknown> 255 256 257// --------------------------------------------------------------------------// 258// Tests for merging variant (/m) and testing the range of predicate (> 7) 259// is allowed. 260 261cpy z5.b, p15/m, #-128 262// CHECK-INST: mov z5.b, p15/m, #-128 263// CHECK-ENCODING: [0x05,0x50,0x1f,0x05] 264// CHECK-ERROR: instruction requires: sve or sme 265// CHECK-UNKNOWN: 051f5005 <unknown> 266 267cpy z21.h, p15/m, #-128 268// CHECK-INST: mov z21.h, p15/m, #-128 269// CHECK-ENCODING: [0x15,0x50,0x5f,0x05] 270// CHECK-ERROR: instruction requires: sve or sme 271// CHECK-UNKNOWN: 055f5015 <unknown> 272 273cpy z21.h, p15/m, #-128, lsl #8 274// CHECK-INST: mov z21.h, p15/m, #-32768 275// CHECK-ENCODING: [0x15,0x70,0x5f,0x05] 276// CHECK-ERROR: instruction requires: sve or sme 277// CHECK-UNKNOWN: 055f7015 <unknown> 278 279cpy z21.s, p15/m, #-128 280// CHECK-INST: mov z21.s, p15/m, #-128 281// CHECK-ENCODING: [0x15,0x50,0x9f,0x05] 282// CHECK-ERROR: instruction requires: sve or sme 283// CHECK-UNKNOWN: 059f5015 <unknown> 284 285cpy z21.s, p15/m, #-128, lsl #8 286// CHECK-INST: mov z21.s, p15/m, #-32768 287// CHECK-ENCODING: [0x15,0x70,0x9f,0x05] 288// CHECK-ERROR: instruction requires: sve or sme 289// CHECK-UNKNOWN: 059f7015 <unknown> 290 291cpy z21.d, p15/m, #-128 292// CHECK-INST: mov z21.d, p15/m, #-128 293// CHECK-ENCODING: [0x15,0x50,0xdf,0x05] 294// CHECK-ERROR: instruction requires: sve or sme 295// CHECK-UNKNOWN: 05df5015 <unknown> 296 297cpy z21.d, p15/m, #-128, lsl #8 298// CHECK-INST: mov z21.d, p15/m, #-32768 299// CHECK-ENCODING: [0x15,0x70,0xdf,0x05] 300// CHECK-ERROR: instruction requires: sve or sme 301// CHECK-UNKNOWN: 05df7015 <unknown> 302 303 304// --------------------------------------------------------------------------// 305// Test compatibility with MOVPRFX instruction. 306 307movprfx z31.d, p7/z, z6.d 308// CHECK-INST: movprfx z31.d, p7/z, z6.d 309// CHECK-ENCODING: [0xdf,0x3c,0xd0,0x04] 310// CHECK-ERROR: instruction requires: sve or sme 311// CHECK-UNKNOWN: 04d03cdf <unknown> 312 313cpy z31.d, p7/m, sp 314// CHECK-INST: mov z31.d, p7/m, sp 315// CHECK-ENCODING: [0xff,0xbf,0xe8,0x05] 316// CHECK-ERROR: instruction requires: sve or sme 317// CHECK-UNKNOWN: 05e8bfff <unknown> 318 319movprfx z31, z6 320// CHECK-INST: movprfx z31, z6 321// CHECK-ENCODING: [0xdf,0xbc,0x20,0x04] 322// CHECK-ERROR: instruction requires: sve or sme 323// CHECK-UNKNOWN: 0420bcdf <unknown> 324 325cpy z31.d, p7/m, sp 326// CHECK-INST: mov z31.d, p7/m, sp 327// CHECK-ENCODING: [0xff,0xbf,0xe8,0x05] 328// CHECK-ERROR: instruction requires: sve or sme 329// CHECK-UNKNOWN: 05e8bfff <unknown> 330 331movprfx z21.d, p7/z, z28.d 332// CHECK-INST: movprfx z21.d, p7/z, z28.d 333// CHECK-ENCODING: [0x95,0x3f,0xd0,0x04] 334// CHECK-ERROR: instruction requires: sve or sme 335// CHECK-UNKNOWN: 04d03f95 <unknown> 336 337cpy z21.d, p7/m, #-128, lsl #8 338// CHECK-INST: mov z21.d, p7/m, #-32768 339// CHECK-ENCODING: [0x15,0x70,0xd7,0x05] 340// CHECK-ERROR: instruction requires: sve or sme 341// CHECK-UNKNOWN: 05d77015 <unknown> 342 343movprfx z21, z28 344// CHECK-INST: movprfx z21, z28 345// CHECK-ENCODING: [0x95,0xbf,0x20,0x04] 346// CHECK-ERROR: instruction requires: sve or sme 347// CHECK-UNKNOWN: 0420bf95 <unknown> 348 349cpy z21.d, p15/m, #-128, lsl #8 350// CHECK-INST: mov z21.d, p15/m, #-32768 351// CHECK-ENCODING: [0x15,0x70,0xdf,0x05] 352// CHECK-ERROR: instruction requires: sve or sme 353// CHECK-UNKNOWN: 05df7015 <unknown> 354 355movprfx z4.d, p7/z, z6.d 356// CHECK-INST: movprfx z4.d, p7/z, z6.d 357// CHECK-ENCODING: [0xc4,0x3c,0xd0,0x04] 358// CHECK-ERROR: instruction requires: sve or sme 359// CHECK-UNKNOWN: 04d03cc4 <unknown> 360 361cpy z4.d, p7/m, d31 362// CHECK-INST: mov z4.d, p7/m, d31 363// CHECK-ENCODING: [0xe4,0x9f,0xe0,0x05] 364// CHECK-ERROR: instruction requires: sve or sme 365// CHECK-UNKNOWN: 05e09fe4 <unknown> 366 367movprfx z4, z6 368// CHECK-INST: movprfx z4, z6 369// CHECK-ENCODING: [0xc4,0xbc,0x20,0x04] 370// CHECK-ERROR: instruction requires: sve or sme 371// CHECK-UNKNOWN: 0420bcc4 <unknown> 372 373cpy z4.d, p7/m, d31 374// CHECK-INST: mov z4.d, p7/m, d31 375// CHECK-ENCODING: [0xe4,0x9f,0xe0,0x05] 376// CHECK-ERROR: instruction requires: sve or sme 377// CHECK-UNKNOWN: 05e09fe4 <unknown> 378