Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td =================================================================== --- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -3784,4 +3784,6 @@ defm PMOV_PZI : sve2p1_vector_to_pred<"pmov">; defm PMOV_ZIP : sve2p1_pred_to_vector<"pmov">; + +defm TBXQ_ZZZ : sve2p1_tbxq<"tbxq">; } // End HasSVE2p1_or_HasSME2p1 Index: llvm/lib/Target/AArch64/SVEInstrFormats.td =================================================================== --- llvm/lib/Target/AArch64/SVEInstrFormats.td +++ llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -1355,7 +1355,7 @@ nxv8i16:$Op3))>; } -class sve2_int_perm_tbx sz8_64, string asm, ZPRRegOp zprty> +class sve2_int_perm_tbx sz8_64, bits<2> op, string asm, ZPRRegOp zprty> : I<(outs zprty:$Zd), (ins zprty:$_Zd, zprty:$Zn, zprty:$Zm), asm, "\t$Zd, $Zn, $Zm", "", @@ -1367,7 +1367,9 @@ let Inst{23-22} = sz8_64; let Inst{21} = 0b1; let Inst{20-16} = Zm; - let Inst{15-10} = 0b001011; + let Inst{15-13} = 0b001; + let Inst{12-11} = op; + let Inst{10} = 0b1; let Inst{9-5} = Zn; let Inst{4-0} = Zd; @@ -1375,10 +1377,10 @@ } multiclass sve2_int_perm_tbx { - def _B : sve2_int_perm_tbx<0b00, asm, ZPR8>; - def _H : sve2_int_perm_tbx<0b01, asm, ZPR16>; - def _S : sve2_int_perm_tbx<0b10, asm, ZPR32>; - def _D : sve2_int_perm_tbx<0b11, asm, ZPR64>; + def _B : sve2_int_perm_tbx<0b00, 0b01, asm, ZPR8>; + def _H : sve2_int_perm_tbx<0b01, 0b01, asm, ZPR16>; + def _S : sve2_int_perm_tbx<0b10, 0b01, asm, ZPR32>; + def _D : sve2_int_perm_tbx<0b11, 0b01, asm, ZPR64>; def : SVE_3_Op_Pat(NAME # _B)>; def : SVE_3_Op_Pat(NAME # _H)>; @@ -9501,3 +9503,11 @@ def : InstAlias(NAME # _B) ZPRAny:$Zd, 0, PPR8:$Pn), 1>; } + + +multiclass sve2p1_tbxq { + def _B : sve2_int_perm_tbx<0b00, 0b10, mnemonic, ZPR8>; + def _H : sve2_int_perm_tbx<0b01, 0b10, mnemonic, ZPR16>; + def _S : sve2_int_perm_tbx<0b10, 0b10, mnemonic, ZPR32>; + def _D : sve2_int_perm_tbx<0b11, 0b10, mnemonic, ZPR64>; +} Index: llvm/test/MC/AArch64/SVE2p1/tbxq-diagnostics.s =================================================================== --- /dev/null +++ llvm/test/MC/AArch64/SVE2p1/tbxq-diagnostics.s @@ -0,0 +1,14 @@ +// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s + +// --------------------------------------------------------------------------// +// Invalid vector suffix + +tbxq z0.b, z0.h, z0.h +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid +// CHECK-NEXT: tbxq z0.b, z0.h, z0.h +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: + +tbxq z23.d, z23.s, z13.s +// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width +// CHECK-NEXT: tbxq z23.d, z23.s, z13.s +// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: Index: llvm/test/MC/AArch64/SVE2p1/tbxq.s =================================================================== --- /dev/null +++ llvm/test/MC/AArch64/SVE2p1/tbxq.s @@ -0,0 +1,115 @@ +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p1 < %s \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %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=+sme2p1 < %s \ +// RUN: | llvm-objdump -d --no-print-imm-hex --mattr=+sme2p1 - | FileCheck %s --check-prefix=CHECK-INST +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2p1 < %s \ +// RUN: | llvm-objdump -d --mattr=-sme2p1,-sve2p1 - | FileCheck %s --check-prefix=CHECK-UNKNOWN +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p1 < %s \ +// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \ +// RUN: | llvm-mc -triple=aarch64 -mattr=+sme2p1 -disassemble -show-encoding \ +// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST + + +tbxq z0.h, z0.h, z0.h // 00000101-01100000-00110100-00000000 +// CHECK-INST: tbxq z0.h, z0.h, z0.h +// CHECK-ENCODING: [0x00,0x34,0x60,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05603400 + +tbxq z21.h, z10.h, z21.h // 00000101-01110101-00110101-01010101 +// CHECK-INST: tbxq z21.h, z10.h, z21.h +// CHECK-ENCODING: [0x55,0x35,0x75,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05753555 + +tbxq z23.h, z13.h, z8.h // 00000101-01101000-00110101-10110111 +// CHECK-INST: tbxq z23.h, z13.h, z8.h +// CHECK-ENCODING: [0xb7,0x35,0x68,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 056835b7 + +tbxq z31.h, z31.h, z31.h // 00000101-01111111-00110111-11111111 +// CHECK-INST: tbxq z31.h, z31.h, z31.h +// CHECK-ENCODING: [0xff,0x37,0x7f,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 057f37ff + + +tbxq z0.s, z0.s, z0.s // 00000101-10100000-00110100-00000000 +// CHECK-INST: tbxq z0.s, z0.s, z0.s +// CHECK-ENCODING: [0x00,0x34,0xa0,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05a03400 + +tbxq z21.s, z10.s, z21.s // 00000101-10110101-00110101-01010101 +// CHECK-INST: tbxq z21.s, z10.s, z21.s +// CHECK-ENCODING: [0x55,0x35,0xb5,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05b53555 + +tbxq z23.s, z13.s, z8.s // 00000101-10101000-00110101-10110111 +// CHECK-INST: tbxq z23.s, z13.s, z8.s +// CHECK-ENCODING: [0xb7,0x35,0xa8,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05a835b7 + +tbxq z31.s, z31.s, z31.s // 00000101-10111111-00110111-11111111 +// CHECK-INST: tbxq z31.s, z31.s, z31.s +// CHECK-ENCODING: [0xff,0x37,0xbf,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05bf37ff + + +tbxq z0.d, z0.d, z0.d // 00000101-11100000-00110100-00000000 +// CHECK-INST: tbxq z0.d, z0.d, z0.d +// CHECK-ENCODING: [0x00,0x34,0xe0,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05e03400 + +tbxq z21.d, z10.d, z21.d // 00000101-11110101-00110101-01010101 +// CHECK-INST: tbxq z21.d, z10.d, z21.d +// CHECK-ENCODING: [0x55,0x35,0xf5,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05f53555 + +tbxq z23.d, z13.d, z8.d // 00000101-11101000-00110101-10110111 +// CHECK-INST: tbxq z23.d, z13.d, z8.d +// CHECK-ENCODING: [0xb7,0x35,0xe8,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05e835b7 + +tbxq z31.d, z31.d, z31.d // 00000101-11111111-00110111-11111111 +// CHECK-INST: tbxq z31.d, z31.d, z31.d +// CHECK-ENCODING: [0xff,0x37,0xff,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05ff37ff + + +tbxq z0.b, z0.b, z0.b // 00000101-00100000-00110100-00000000 +// CHECK-INST: tbxq z0.b, z0.b, z0.b +// CHECK-ENCODING: [0x00,0x34,0x20,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05203400 + +tbxq z21.b, z10.b, z21.b // 00000101-00110101-00110101-01010101 +// CHECK-INST: tbxq z21.b, z10.b, z21.b +// CHECK-ENCODING: [0x55,0x35,0x35,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 05353555 + +tbxq z23.b, z13.b, z8.b // 00000101-00101000-00110101-10110111 +// CHECK-INST: tbxq z23.b, z13.b, z8.b +// CHECK-ENCODING: [0xb7,0x35,0x28,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 052835b7 + +tbxq z31.b, z31.b, z31.b // 00000101-00111111-00110111-11111111 +// CHECK-INST: tbxq z31.b, z31.b, z31.b +// CHECK-ENCODING: [0xff,0x37,0x3f,0x05] +// CHECK-ERROR: instruction requires: sme2p1 or sve2p1 +// CHECK-UNKNOWN: 053f37ff +