Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td =================================================================== --- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -3762,4 +3762,5 @@ defm DUPQ_ZZI : sve2p1_dupq<"dupq">; def EXTQ_ZZI : sve2p1_extq<"extq">; +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 @@ -9363,3 +9363,31 @@ let DestructiveInstType = DestructiveOther; let ElementSize = ZPR8.ElementSize; } + + +// Programmable table lookup within each quadword vector segment (merging) +class sve2p1_tbxq sz, string mnemonic, ZPRRegOp zprty> + : I<(outs zprty:$Zd), (ins zprty:$_Zd, zprty:$Zn, zprty:$Zm), + mnemonic, "\t$Zd, $Zn, $Zm", + "", []>, Sched<[]> { + bits<5> Zd; + bits<5> Zn; + bits<5> Zm; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz; + let Inst{21} = 0b1; + let Inst{20-16} = Zm; + let Inst{15-10} = 0b001101; + let Inst{9-5} = Zn; + let Inst{4-0} = Zd; + + let Constraints = "$Zd = $_Zd"; +} + + +multiclass sve2p1_tbxq { + def _B : sve2p1_tbxq<0b00, mnemonic, ZPR8>; + def _H : sve2p1_tbxq<0b01, mnemonic, ZPR16>; + def _S : sve2p1_tbxq<0b10, mnemonic, ZPR32>; + def _D : sve2p1_tbxq<0b11, 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 +