Index: lib/Target/AArch64/AArch64InstrFormats.td =================================================================== --- lib/Target/AArch64/AArch64InstrFormats.td +++ lib/Target/AArch64/AArch64InstrFormats.td @@ -241,6 +241,12 @@ let DecoderMethod = "DecodeSImm<9>"; } +def SImm6Operand : SImmOperand<6>; +def simm6_32b : Operand, ImmLeaf= -32 && Imm < 32; }]> { + let ParserMatchClass = SImm6Operand; + let DecoderMethod = "DecodeSImm<6>"; +} + // simm7sN predicate - True if the immediate is a multiple of N in the range // [-64 * N, 63 * N]. class SImm7Scaled : AsmOperandClass { Index: lib/Target/AArch64/AArch64SVEInstrInfo.td =================================================================== --- lib/Target/AArch64/AArch64SVEInstrInfo.td +++ lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -25,4 +25,8 @@ defm ZIP2_PPP : sve_int_perm_bin_perm_pp<0b001, "zip2">; defm DUP_ZR : sve_int_perm_dup_r<"dup">; + + def RDVLI_XI : sve_int_read_vl_a<0b011111, "rdvl">; + def ADDVL_XXI : sve_int_arith_vl<0b0, "addvl">; + def ADDPL_XXI : sve_int_arith_vl<0b1, "addpl">; } Index: lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp =================================================================== --- lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -3551,6 +3551,8 @@ case Match_InvalidFPImm: return Error(Loc, "expected compatible register or floating-point constant"); + case Match_InvalidMemoryIndexedSImm6: + return Error(Loc, "index must be an integer in range [-32, 31]."); case Match_InvalidMemoryIndexedSImm9: return Error(Loc, "index must be an integer in range [-256, 255]."); case Match_InvalidMemoryIndexedSImm10: @@ -4063,6 +4065,7 @@ case Match_InvalidMemoryXExtend32: case Match_InvalidMemoryXExtend64: case Match_InvalidMemoryXExtend128: + case Match_InvalidMemoryIndexedSImm6: case Match_InvalidMemoryIndexed4SImm7: case Match_InvalidMemoryIndexed8SImm7: case Match_InvalidMemoryIndexed16SImm7: Index: lib/Target/AArch64/SVEInstrFormats.td =================================================================== --- lib/Target/AArch64/SVEInstrFormats.td +++ lib/Target/AArch64/SVEInstrFormats.td @@ -76,6 +76,43 @@ } //===----------------------------------------------------------------------===// +// SVE Stack Allocation Group +//===----------------------------------------------------------------------===// + +class sve_int_arith_vl +: I<(outs GPR64sp:$Rd), (ins GPR64sp:$Rn, simm6_32b:$imm6), + asm, "\t$Rd, $Rn, $imm6", + "", + []>, Sched<[]> { + bits<5> Rd; + bits<5> Rn; + bits<6> imm6; + let Inst{31-23} = 0b000001000; + let Inst{22} = opc; + let Inst{21} = 0b1; + let Inst{20-16} = Rn; + let Inst{15-11} = 0b01010; + let Inst{10-5} = imm6; + let Inst{4-0} = Rd; +} + +class sve_int_read_vl_a opc, string asm> +: I<(outs GPR64:$Rd), (ins simm6_32b:$imm6), + asm, "\t$Rd, $imm6", + "", + []>, Sched<[]> { + bits<5> Rd; + bits<6> imm6; + let Inst{31-23} = 0b000001001; + let Inst{22} = opc{5}; + let Inst{21} = 0b1; + let Inst{20-16} = opc{4-0}; + let Inst{15-11} = 0b01010; + let Inst{10-5} = imm6; + let Inst{4-0} = Rd; +} + +//===----------------------------------------------------------------------===// // SVE Permute - In Lane Group //===----------------------------------------------------------------------===// Index: test/MC/AArch64/SVE/addpl-diagnostics.s =================================================================== --- /dev/null +++ test/MC/AArch64/SVE/addpl-diagnostics.s @@ -0,0 +1,8 @@ +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s + +// Immediate out of upper bound [-32, 31]. +addpl x19, x14, #32 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: index must be an integer in range [-32, 31]. +// CHECK-NEXT: addpl x19, x14, #32 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + Index: test/MC/AArch64/SVE/addpl.s =================================================================== --- /dev/null +++ test/MC/AArch64/SVE/addpl.s @@ -0,0 +1,32 @@ +// 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 + +addpl x21, x21, #0 +// CHECK-INST: addpl x21, x21, #0 +// CHECK-ENCODING: [0x15,0x50,0x75,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 75 04 + +addpl x23, x8, #-1 +// CHECK-INST: addpl x23, x8, #-1 +// CHECK-ENCODING: [0xf7,0x57,0x68,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f7 57 68 04 + +addpl sp, sp, #31 +// CHECK-INST: addpl sp, sp, #31 +// CHECK-ENCODING: [0xff,0x53,0x7f,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: ff 53 7f 04 + +addpl x0, x0, #-32 +// CHECK-INST: addpl x0, x0, #-32 +// CHECK-ENCODING: [0x00,0x54,0x60,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 00 54 60 04 Index: test/MC/AArch64/SVE/addvl-diagnostics.s =================================================================== --- /dev/null +++ test/MC/AArch64/SVE/addvl-diagnostics.s @@ -0,0 +1,8 @@ +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s + +// Immediate out of upper bound [-32, 31]. +addvl x3, x5, #32 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: index must be an integer in range [-32, 31]. +// CHECK-NEXT: addvl x3, x5, #32 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + Index: test/MC/AArch64/SVE/addvl.s =================================================================== --- /dev/null +++ test/MC/AArch64/SVE/addvl.s @@ -0,0 +1,32 @@ +// 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 + +addvl x21, x21, #0 +// CHECK-INST: addvl x21, x21, #0 +// CHECK-ENCODING: [0x15,0x50,0x35,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 50 35 04 + +addvl x23, x8, #-1 +// CHECK-INST: addvl x23, x8, #-1 +// CHECK-ENCODING: [0xf7,0x57,0x28,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f7 57 28 04 + +addvl sp, sp, #31 +// CHECK-INST: addvl sp, sp, #31 +// CHECK-ENCODING: [0xff,0x53,0x3f,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: ff 53 3f 04 + +addvl x0, x0, #-32 +// CHECK-INST: addvl x0, x0, #-32 +// CHECK-ENCODING: [0x00,0x54,0x20,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 00 54 20 04 Index: test/MC/AArch64/SVE/rdvl-diagnostics.s =================================================================== --- /dev/null +++ test/MC/AArch64/SVE/rdvl-diagnostics.s @@ -0,0 +1,7 @@ +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s + +// Immediate out of upper bound [-32, 31]. +rdvl x9, #32 +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: index must be an integer in range [-32, 31]. +// CHECK-NEXT: rdvl x9, #32 +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: Index: test/MC/AArch64/SVE/rdvl.s =================================================================== --- /dev/null +++ test/MC/AArch64/SVE/rdvl.s @@ -0,0 +1,32 @@ +// 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 + +rdvl x0, #0 +// CHECK-INST: rdvl x0, #0 +// CHECK-ENCODING: [0x00,0x50,0xbf,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 00 50 bf 04 + +rdvl xzr, #-1 +// CHECK-INST: rdvl xzr, #-1 +// CHECK-ENCODING: [0xff,0x57,0xbf,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: ff 57 bf 04 + +rdvl x23, #31 +// CHECK-INST: rdvl x23, #31 +// CHECK-ENCODING: [0xf7,0x53,0xbf,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: f7 53 bf 04 + +rdvl x21, #-32 +// CHECK-INST: rdvl x21, #-32 +// CHECK-ENCODING: [0x15,0x54,0xbf,0x04] +// CHECK-ERROR: instruction requires: sve +// CHECK-UNKNOWN: 15 54 bf 04