Index: llvm/trunk/lib/Target/AArch64/AArch64SVEInstrInfo.td =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ llvm/trunk/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -40,6 +40,10 @@ defm FDUP_ZI : sve_int_dup_fpimm<"fdup">; defm DUPM_ZI : sve_int_dup_mask_imm<"dupm">; + // Splat immediate (predicated) + defm CPY_ZPmI : sve_int_dup_imm_pred_merge<"cpy">; + defm CPY_ZPzI : sve_int_dup_imm_pred_zero<"cpy">; + // continuous load with reg+immediate defm LD1B_IMM : sve_mem_cld_si<0b0000, "ld1b", Z_b, ZPR8>; defm LD1B_H_IMM : sve_mem_cld_si<0b0001, "ld1b", Z_h, ZPR16>; Index: llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td =================================================================== --- llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td +++ llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td @@ -616,6 +616,64 @@ let Inst{4-0} = Zd; } + +//===----------------------------------------------------------------------===// +// SVE Integer Wide Immediate - Predicated Group +//===----------------------------------------------------------------------===// + +class sve_int_dup_imm_pred sz8_64, bit m, string asm, + ZPRRegOp zprty, string pred_qual, dag iops> +: I<(outs zprty:$Zd), iops, + asm, "\t$Zd, $Pg"#pred_qual#", $imm", + "", []>, Sched<[]> { + bits<5> Zd; + bits<4> Pg; + bits<9> imm; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz8_64; + let Inst{21-20} = 0b01; + let Inst{19-16} = Pg; + let Inst{15} = 0b0; + let Inst{14} = m; + let Inst{13} = imm{8}; // sh + let Inst{12-5} = imm{7-0}; // imm8 + let Inst{4-0} = Zd; +} + +multiclass sve_int_dup_imm_pred_merge { + let Constraints = "$Zd = $_Zd" in { + def _B : sve_int_dup_imm_pred<0b00, 1, asm, ZPR8, "/m", (ins ZPR8:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>; + def _H : sve_int_dup_imm_pred<0b01, 1, asm, ZPR16, "/m", (ins ZPR16:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>; + def _S : sve_int_dup_imm_pred<0b10, 1, asm, ZPR32, "/m", (ins ZPR32:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>; + def _D : sve_int_dup_imm_pred<0b11, 1, asm, ZPR64, "/m", (ins ZPR64:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>; + } + + def : InstAlias<"mov $Zd, $Pg/m, $imm", + (!cast(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>; + def : InstAlias<"mov $Zd, $Pg/m, $imm", + (!cast(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>; + def : InstAlias<"mov $Zd, $Pg/m, $imm", + (!cast(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>; + def : InstAlias<"mov $Zd, $Pg/m, $imm", + (!cast(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>; +} + +multiclass sve_int_dup_imm_pred_zero { + def _B : sve_int_dup_imm_pred<0b00, 0, asm, ZPR8, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>; + def _H : sve_int_dup_imm_pred<0b01, 0, asm, ZPR16, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>; + def _S : sve_int_dup_imm_pred<0b10, 0, asm, ZPR32, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>; + def _D : sve_int_dup_imm_pred<0b11, 0, asm, ZPR64, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>; + + def : InstAlias<"mov $Zd, $Pg/z, $imm", + (!cast(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>; + def : InstAlias<"mov $Zd, $Pg/z, $imm", + (!cast(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>; + def : InstAlias<"mov $Zd, $Pg/z, $imm", + (!cast(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>; + def : InstAlias<"mov $Zd, $Pg/z, $imm", + (!cast(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>; +} + //===----------------------------------------------------------------------===// //SVE Index Generation Group //===----------------------------------------------------------------------===// Index: llvm/trunk/test/MC/AArch64/SVE/cpy-diagnostics.s =================================================================== --- llvm/trunk/test/MC/AArch64/SVE/cpy-diagnostics.s +++ llvm/trunk/test/MC/AArch64/SVE/cpy-diagnostics.s @@ -0,0 +1,119 @@ +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s + +// --------------------------------------------------------------------------// +// Invalid immediates + +cpy z0.b, p0/z, #0, lsl #8 // #0, lsl #8 is not valid for .b +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: cpy z0.b, p0/z, #0, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.b, p0/z, #-129 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: cpy z0.b, p0/z, #-129 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.b, p0/z, #-1, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: cpy z0.b, p0/z, #-1, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.b, p0/z, #256 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: cpy z0.b, p0/z, #256 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.b, p0/z, #1, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: cpy z0.b, p0/z, #1, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.h, p0/z, #-33024 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.h, p0/z, #-33024 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.h, p0/z, #-32769 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.h, p0/z, #-32769 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.h, p0/z, #-129, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.h, p0/z, #-129, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.h, p0/z, #32513 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.h, p0/z, #32513 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.h, p0/z, #32768 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.h, p0/z, #32768 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.h, p0/z, #128, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.h, p0/z, #128, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.s, p0/z, #-33024 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.s, p0/z, #-33024 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.s, p0/z, #-32769 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.s, p0/z, #-32769 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.s, p0/z, #-129, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.s, p0/z, #-129, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.s, p0/z, #32513 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.s, p0/z, #32513 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.s, p0/z, #32768 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.s, p0/z, #32768 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.s, p0/z, #128, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.s, p0/z, #128, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.d, p0/z, #-33024 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.d, p0/z, #-33024 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.d, p0/z, #-32769 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.d, p0/z, #-32769 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.d, p0/z, #-129, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.d, p0/z, #-129, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.d, p0/z, #32513 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.d, p0/z, #32513 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.d, p0/z, #32768 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.d, p0/z, #32768 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +cpy z0.d, p0/z, #128, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: cpy z0.d, p0/z, #128, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: Index: llvm/trunk/test/MC/AArch64/SVE/cpy.s =================================================================== --- llvm/trunk/test/MC/AArch64/SVE/cpy.s +++ llvm/trunk/test/MC/AArch64/SVE/cpy.s @@ -0,0 +1,181 @@ +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-ERROR +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \ +// RUN: | llvm-objdump -d -mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \ +// RUN: | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN + +cpy z5.b, p0/z, #-128 +// CHECK-INST: mov z5.b, p0/z, #-128 +// CHECK-ENCODING: [0x05,0x10,0x10,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 05 10 10 05 + +cpy z5.b, p0/z, #127 +// CHECK-INST: mov z5.b, p0/z, #127 +// CHECK-ENCODING: [0xe5,0x0f,0x10,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: e5 0f 10 05 + +cpy z5.b, p0/z, #255 +// CHECK-INST: mov z5.b, p0/z, #-1 +// CHECK-ENCODING: [0xe5,0x1f,0x10,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: e5 1f 10 05 + +cpy z21.h, p0/z, #-128 +// CHECK-INST: mov z21.h, p0/z, #-128 +// CHECK-ENCODING: [0x15,0x10,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 10 50 05 + +cpy z21.h, p0/z, #-128, lsl #8 +// CHECK-INST: mov z21.h, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 50 05 + +cpy z21.h, p0/z, #-32768 +// CHECK-INST: mov z21.h, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 50 05 + +cpy z21.h, p0/z, #127 +// CHECK-INST: mov z21.h, p0/z, #127 +// CHECK-ENCODING: [0xf5,0x0f,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 0f 50 05 + +cpy z21.h, p0/z, #127, lsl #8 +// CHECK-INST: mov z21.h, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 50 05 + +cpy z21.h, p0/z, #32512 +// CHECK-INST: mov z21.h, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 50 05 + +cpy z21.s, p0/z, #-128 +// CHECK-INST: mov z21.s, p0/z, #-128 +// CHECK-ENCODING: [0x15,0x10,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 10 90 05 + +cpy z21.s, p0/z, #-128, lsl #8 +// CHECK-INST: mov z21.s, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 90 05 + +cpy z21.s, p0/z, #-32768 +// CHECK-INST: mov z21.s, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 90 05 + +cpy z21.s, p0/z, #127 +// CHECK-INST: mov z21.s, p0/z, #127 +// CHECK-ENCODING: [0xf5,0x0f,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 0f 90 05 + +cpy z21.s, p0/z, #127, lsl #8 +// CHECK-INST: mov z21.s, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 90 05 + +cpy z21.s, p0/z, #32512 +// CHECK-INST: mov z21.s, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 90 05 + +cpy z21.d, p0/z, #-128 +// CHECK-INST: mov z21.d, p0/z, #-128 +// CHECK-ENCODING: [0x15,0x10,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 10 d0 05 + +cpy z21.d, p0/z, #-128, lsl #8 +// CHECK-INST: mov z21.d, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 d0 05 + +cpy z21.d, p0/z, #-32768 +// CHECK-INST: mov z21.d, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 d0 05 + +cpy z21.d, p0/z, #127 +// CHECK-INST: mov z21.d, p0/z, #127 +// CHECK-ENCODING: [0xf5,0x0f,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 0f d0 05 + +cpy z21.d, p0/z, #127, lsl #8 +// CHECK-INST: mov z21.d, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f d0 05 + +cpy z21.d, p0/z, #32512 +// CHECK-INST: mov z21.d, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f d0 05 + + +// --------------------------------------------------------------------------// +// Tests for merging variant (/m) and testing the range of predicate (> 7) +// is allowed. + +cpy z5.b, p15/m, #-128 +// CHECK-INST: mov z5.b, p15/m, #-128 +// CHECK-ENCODING: [0x05,0x50,0x1f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 05 50 1f 05 + +cpy z21.h, p15/m, #-128 +// CHECK-INST: mov z21.h, p15/m, #-128 +// CHECK-ENCODING: [0x15,0x50,0x5f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 5f 05 + +cpy z21.h, p15/m, #-128, lsl #8 +// CHECK-INST: mov z21.h, p15/m, #-32768 +// CHECK-ENCODING: [0x15,0x70,0x5f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 70 5f 05 + +cpy z21.s, p15/m, #-128 +// CHECK-INST: mov z21.s, p15/m, #-128 +// CHECK-ENCODING: [0x15,0x50,0x9f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 9f 05 + +cpy z21.s, p15/m, #-128, lsl #8 +// CHECK-INST: mov z21.s, p15/m, #-32768 +// CHECK-ENCODING: [0x15,0x70,0x9f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 70 9f 05 + +cpy z21.d, p15/m, #-128 +// CHECK-INST: mov z21.d, p15/m, #-128 +// CHECK-ENCODING: [0x15,0x50,0xdf,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 df 05 + +cpy z21.d, p15/m, #-128, lsl #8 +// CHECK-INST: mov z21.d, p15/m, #-32768 +// CHECK-ENCODING: [0x15,0x70,0xdf,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 70 df 05 Index: llvm/trunk/test/MC/AArch64/SVE/mov-diagnostics.s =================================================================== --- llvm/trunk/test/MC/AArch64/SVE/mov-diagnostics.s +++ llvm/trunk/test/MC/AArch64/SVE/mov-diagnostics.s @@ -154,3 +154,118 @@ // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] // CHECK-NEXT: mov z5.s, #0xffffffffffffff9 // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.b, p0/z, #0, lsl #8 // #0, lsl #8 is not valid for .b +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: mov z0.b, p0/z, #0, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.b, p0/z, #-129 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: mov z0.b, p0/z, #-129 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.b, p0/z, #-1, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: mov z0.b, p0/z, #-1, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.b, p0/z, #256 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: mov z0.b, p0/z, #256 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.b, p0/z, #1, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 255] +// CHECK-NEXT: mov z0.b, p0/z, #1, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.h, p0/z, #-33024 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.h, p0/z, #-33024 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.h, p0/z, #-32769 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.h, p0/z, #-32769 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.h, p0/z, #-129, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.h, p0/z, #-129, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.h, p0/z, #32513 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.h, p0/z, #32513 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.h, p0/z, #32768 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.h, p0/z, #32768 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.h, p0/z, #128, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.h, p0/z, #128, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.s, p0/z, #-33024 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.s, p0/z, #-33024 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.s, p0/z, #-32769 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.s, p0/z, #-32769 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.s, p0/z, #-129, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.s, p0/z, #-129, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.s, p0/z, #32513 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.s, p0/z, #32513 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.s, p0/z, #32768 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.s, p0/z, #32768 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.s, p0/z, #128, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.s, p0/z, #128, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.d, p0/z, #-33024 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.d, p0/z, #-33024 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.d, p0/z, #-32769 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.d, p0/z, #-32769 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.d, p0/z, #-129, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.d, p0/z, #-129, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.d, p0/z, #32513 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.d, p0/z, #32513 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.d, p0/z, #32768 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.d, p0/z, #32768 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +mov z0.d, p0/z, #128, lsl #8 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [-128, 127] or a multiple of 256 in range [-32768, 32512] +// CHECK-NEXT: mov z0.d, p0/z, #128, lsl #8 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: Index: llvm/trunk/test/MC/AArch64/SVE/mov.s =================================================================== --- llvm/trunk/test/MC/AArch64/SVE/mov.s +++ llvm/trunk/test/MC/AArch64/SVE/mov.s @@ -228,3 +228,176 @@ // CHECK-ENCODING: [0x80,0x19,0xc2,0x05] // CHECK-ERROR: instruction requires: sve // CHECK-UNKNOWN: 80 19 c2 05 + +mov z5.b, p0/z, #-128 +// CHECK-INST: mov z5.b, p0/z, #-128 +// CHECK-ENCODING: [0x05,0x10,0x10,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 05 10 10 05 + +mov z5.b, p0/z, #127 +// CHECK-INST: mov z5.b, p0/z, #127 +// CHECK-ENCODING: [0xe5,0x0f,0x10,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: e5 0f 10 05 + +mov z5.b, p0/z, #255 +// CHECK-INST: mov z5.b, p0/z, #-1 +// CHECK-ENCODING: [0xe5,0x1f,0x10,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: e5 1f 10 05 + +mov z21.h, p0/z, #-128 +// CHECK-INST: mov z21.h, p0/z, #-128 +// CHECK-ENCODING: [0x15,0x10,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 10 50 05 + +mov z21.h, p0/z, #-128, lsl #8 +// CHECK-INST: mov z21.h, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 50 05 + +mov z21.h, p0/z, #-32768 +// CHECK-INST: mov z21.h, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 50 05 + +mov z21.h, p0/z, #127 +// CHECK-INST: mov z21.h, p0/z, #127 +// CHECK-ENCODING: [0xf5,0x0f,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 0f 50 05 + +mov z21.h, p0/z, #127, lsl #8 +// CHECK-INST: mov z21.h, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 50 05 + +mov z21.h, p0/z, #32512 +// CHECK-INST: mov z21.h, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 50 05 + +mov z21.s, p0/z, #-128 +// CHECK-INST: mov z21.s, p0/z, #-128 +// CHECK-ENCODING: [0x15,0x10,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 10 90 05 + +mov z21.s, p0/z, #-128, lsl #8 +// CHECK-INST: mov z21.s, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 90 05 + +mov z21.s, p0/z, #-32768 +// CHECK-INST: mov z21.s, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 90 05 + +mov z21.s, p0/z, #127 +// CHECK-INST: mov z21.s, p0/z, #127 +// CHECK-ENCODING: [0xf5,0x0f,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 0f 90 05 + +mov z21.s, p0/z, #127, lsl #8 +// CHECK-INST: mov z21.s, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 90 05 + +mov z21.s, p0/z, #32512 +// CHECK-INST: mov z21.s, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f 90 05 + +mov z21.d, p0/z, #-128 +// CHECK-INST: mov z21.d, p0/z, #-128 +// CHECK-ENCODING: [0x15,0x10,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 10 d0 05 + +mov z21.d, p0/z, #-128, lsl #8 +// CHECK-INST: mov z21.d, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 d0 05 + +mov z21.d, p0/z, #-32768 +// CHECK-INST: mov z21.d, p0/z, #-32768 +// CHECK-ENCODING: [0x15,0x30,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 30 d0 05 + +mov z21.d, p0/z, #127 +// CHECK-INST: mov z21.d, p0/z, #127 +// CHECK-ENCODING: [0xf5,0x0f,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 0f d0 05 + +mov z21.d, p0/z, #127, lsl #8 +// CHECK-INST: mov z21.d, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f d0 05 + +mov z21.d, p0/z, #32512 +// CHECK-INST: mov z21.d, p0/z, #32512 +// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f5 2f d0 05 + + +// --------------------------------------------------------------------------// +// Tests for merging variant (/m) and testing the range of predicate (> 7) +// is allowed. + +mov z5.b, p15/m, #-128 +// CHECK-INST: mov z5.b, p15/m, #-128 +// CHECK-ENCODING: [0x05,0x50,0x1f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 05 50 1f 05 + +mov z21.h, p15/m, #-128 +// CHECK-INST: mov z21.h, p15/m, #-128 +// CHECK-ENCODING: [0x15,0x50,0x5f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 5f 05 + +mov z21.h, p15/m, #-128, lsl #8 +// CHECK-INST: mov z21.h, p15/m, #-32768 +// CHECK-ENCODING: [0x15,0x70,0x5f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 70 5f 05 + +mov z21.s, p15/m, #-128 +// CHECK-INST: mov z21.s, p15/m, #-128 +// CHECK-ENCODING: [0x15,0x50,0x9f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 9f 05 + +mov z21.s, p15/m, #-128, lsl #8 +// CHECK-INST: mov z21.s, p15/m, #-32768 +// CHECK-ENCODING: [0x15,0x70,0x9f,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 70 9f 05 + +mov z21.d, p15/m, #-128 +// CHECK-INST: mov z21.d, p15/m, #-128 +// CHECK-ENCODING: [0x15,0x50,0xdf,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 df 05 + +mov z21.d, p15/m, #-128, lsl #8 +// CHECK-INST: mov z21.d, p15/m, #-32768 +// CHECK-ENCODING: [0x15,0x70,0xdf,0x05] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 70 df 05