-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AArch64] Add assembly/disassembly for FRINT{32,64}{X,Z} (merging) #113562
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…structions Add assembly/disassembly support for the following SVE2.2 instructions - FRINT32X (merging) - FRINT32Z (merging) - FRINT64X (merging) - FRINT64Z (merging)
@llvm/pr-subscribers-mc @llvm/pr-subscribers-backend-aarch64 Author: None (SpencerAbson) ChangesThis patch adds assembly/disassembly support for the following SVE2.2 instructions
Full diff: https://github.com/llvm/llvm-project/pull/113562.diff 11 Files Affected:
diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td
index 2262ad1dfd0cc9..9bb508b783c36a 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -73,8 +73,13 @@ def SVEUnsupported : AArch64Unsupported {
SVE2Unsupported.F);
}
-let F = [HasSME2p1, HasSVE2p1_or_HasSME2p1, HasSVE2p1orSSVE_AES] in
-def SME2p1Unsupported : AArch64Unsupported;
+let F = [HasSME2p2, HasSVE2p2orSME2p2] in
+def SME2p2Unsupported : AArch64Unsupported;
+
+def SME2p1Unsupported : AArch64Unsupported {
+ let F = !listconcat([HasSME2p1, HasSVE2p1_or_HasSME2p1, HasSVE2p1orSSVE_AES],
+ SME2p2Unsupported.F);
+}
def SME2Unsupported : AArch64Unsupported {
let F = !listconcat([HasSME2, HasSVE2orSME2, HasSVE2p1_or_HasSME2, HasSSVE_FP8FMA,
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index a097c138c5d6af..7b56f607a9de59 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -4226,6 +4226,13 @@ let Predicates = [HasSVE2p2orSME2p2] in {
// SVE2p2 floating-point convert single-to-bf (placing odd), zeroing predicate
def BFCVTNT_ZPzZ : sve_fp_fcvt2z<0b1010, "bfcvtnt", ZPR16, ZPR32>;
+
+ // Floating point round to integral fp value in integer size range
+ // Merging
+ defm FRINT32Z_ZPmZ : sve_fp_2op_p_zd_frint<0b00, "frint32z">;
+ defm FRINT32X_ZPmZ : sve_fp_2op_p_zd_frint<0b01, "frint32x">;
+ defm FRINT64X_ZPmZ : sve_fp_2op_p_zd_frint<0b10, "frint64z">;
+ defm FRINT64Z_ZPmZ : sve_fp_2op_p_zd_frint<0b11, "frint64x">;
} // End HasSME2p2orSVE2p2
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 42e00b53400816..b45119512f8cc7 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -3104,6 +3104,11 @@ multiclass sve2_fp_convert_down_odd_rounding<string asm, string op, SDPatternOpe
def : SVE_1_Op_Passthru_Pat<nxv2f32, ir_op, nxv2i1, nxv2f64, !cast<Instruction>(NAME # _DtoS)>;
}
+multiclass sve_fp_2op_p_zd_frint<bits<2> opc, string asm> {
+ def _S : sve_fp_2op_p_zd<{ 0b0010, opc{1}, 0, opc{0} }, asm, ZPR32, ZPR32, ElementSizeS>;
+ def _D : sve_fp_2op_p_zd<{ 0b0010, opc{1}, 1, opc{0} }, asm, ZPR64, ZPR64, ElementSizeD>;
+}
+
//===----------------------------------------------------------------------===//
// SVE Floating Point Unary Operations - Unpredicated Group
//===----------------------------------------------------------------------===//
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint32x-diagnostics.s b/llvm/test/MC/AArch64/SVE2p2/frint32x-diagnostics.s
new file mode 100644
index 00000000000000..8daeb7c9362320
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint32x-diagnostics.s
@@ -0,0 +1,32 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 2>&1 < %s| FileCheck %s
+
+// ------------------------------------------------------------------------- //
+// Invalid element width
+
+frint32x z31.b, p7/m, z31.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32x z31.b, p7/m, z31.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint32x z31.h, p7/m, z31.h
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32x z31.h, p7/m, z31.h
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint32x z31.s, p7/m, z31.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32x z31.s, p7/m, z31.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint32x z31.d, p7/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32x z31.d, p7/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// ------------------------------------------------------------------------- //
+// Invalid predicate
+
+frint32x z31.s, p8/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
+// CHECK-NEXT: frint32x z31.s, p8/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint32x.s b/llvm/test/MC/AArch64/SVE2p2/frint32x.s
new file mode 100644
index 00000000000000..abf402a1903ae6
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint32x.s
@@ -0,0 +1,49 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p2 < %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=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=+sve2p2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=-sme2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// Disassemble encoding and check the re-encoding (-show-encoding) matches.
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN: | llvm-mc -triple=aarch64 -mattr=+sve2p2 -disassemble -show-encoding \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+movprfx z23.d, p3/m, z31.d
+frint32x z23.d, p3/m, z13.d // 01100101-00010011-10101101-10110111
+// CHECK-INST: movprfx z23.d, p3/m, z31.d
+// CHECK-INST: frint32x z23.d, p3/m, z13.d
+// CHECK-ENCODING: [0xb7,0xad,0x13,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6513adb7 <unknown>
+
+movprfx z23, z31
+frint32x z23.s, p3/m, z13.s // 01100101-00010001-10101101-10110111
+// CHECK-INST: movprfx z23, z31
+// CHECK-INST: frint32x z23.s, p3/m, z13.s
+// CHECK-ENCODING: [0xb7,0xad,0x11,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6511adb7 <unknown>
+
+frint32x z0.s, p0/m, z0.s // 01100101-00010001-10100000-00000000
+// CHECK-INST: frint32x z0.s, p0/m, z0.s
+// CHECK-ENCODING: [0x00,0xa0,0x11,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6511a000 <unknown>
+
+frint32x z21.d, p5/m, z10.d // 01100101-00010011-10110101-01010101
+// CHECK-INST: frint32x z21.d, p5/m, z10.d
+// CHECK-ENCODING: [0x55,0xb5,0x13,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6513b555 <unknown>
+
+frint32x z31.d, p7/m, z31.d // 01100101-00010011-10111111-11111111
+// CHECK-INST: frint32x z31.d, p7/m, z31.d
+// CHECK-ENCODING: [0xff,0xbf,0x13,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6513bfff <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint32z-diagnostics.s b/llvm/test/MC/AArch64/SVE2p2/frint32z-diagnostics.s
new file mode 100644
index 00000000000000..9fb6f5f2253079
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint32z-diagnostics.s
@@ -0,0 +1,32 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 2>&1 < %s| FileCheck %s
+
+// ------------------------------------------------------------------------- //
+// Invalid element width
+
+frint32z z31.b, p7/m, z31.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32z z31.b, p7/m, z31.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint32z z31.h, p7/m, z31.h
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32z z31.h, p7/m, z31.h
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint32z z31.s, p7/m, z31.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32z z31.s, p7/m, z31.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint32z z31.d, p7/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint32z z31.d, p7/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// ------------------------------------------------------------------------- //
+// Invalid predicate
+
+frint32z z31.s, p8/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
+// CHECK-NEXT: frint32z z31.s, p8/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
\ No newline at end of file
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint32z.s b/llvm/test/MC/AArch64/SVE2p2/frint32z.s
new file mode 100644
index 00000000000000..117d8715a12c98
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint32z.s
@@ -0,0 +1,49 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p2 < %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=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=+sve2p2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=-sme2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// Disassemble encoding and check the re-encoding (-show-encoding) matches.
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN: | llvm-mc -triple=aarch64 -mattr=+sve2p2 -disassemble -show-encoding \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+movprfx z23.d, p3/m, z31.d
+frint32z z23.d, p3/m, z13.d // 01100101-00010010-10101101-10110111
+// CHECK-INST: movprfx z23.d, p3/m, z31.d
+// CHECK-INST: frint32z z23.d, p3/m, z13.d
+// CHECK-ENCODING: [0xb7,0xad,0x12,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6512adb7 <unknown>
+
+movprfx z23, z31
+frint32z z23.s, p3/m, z13.s // 01100101-00010000-10101101-10110111
+// CHECK-INST: movprfx z23, z31
+// CHECK-INST: frint32z z23.s, p3/m, z13.s
+// CHECK-ENCODING: [0xb7,0xad,0x10,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6510adb7 <unknown>
+
+frint32z z0.s, p0/m, z0.s // 01100101-00010000-10100000-00000000
+// CHECK-INST: frint32z z0.s, p0/m, z0.s
+// CHECK-ENCODING: [0x00,0xa0,0x10,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6510a000 <unknown>
+
+frint32z z21.d, p5/m, z10.d // 01100101-00010010-10110101-01010101
+// CHECK-INST: frint32z z21.d, p5/m, z10.d
+// CHECK-ENCODING: [0x55,0xb5,0x12,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6512b555 <unknown>
+
+frint32z z31.d, p7/m, z31.d // 01100101-00010010-10111111-11111111
+// CHECK-INST: frint32z z31.d, p7/m, z31.d
+// CHECK-ENCODING: [0xff,0xbf,0x12,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6512bfff <unknown>
\ No newline at end of file
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint64x-diagnostics.s b/llvm/test/MC/AArch64/SVE2p2/frint64x-diagnostics.s
new file mode 100644
index 00000000000000..d37e0488564afa
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint64x-diagnostics.s
@@ -0,0 +1,32 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 2>&1 < %s| FileCheck %s
+
+// ------------------------------------------------------------------------- //
+// Invalid element width
+
+frint64x z31.b, p7/m, z31.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64x z31.b, p7/m, z31.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint64x z31.h, p7/m, z31.h
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64x z31.h, p7/m, z31.h
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint64x z31.s, p7/m, z31.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64x z31.s, p7/m, z31.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint64x z31.d, p7/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64x z31.d, p7/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// ------------------------------------------------------------------------- //
+// Invalid predicate
+
+frint64x z31.s, p8/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
+// CHECK-NEXT: frint64x z31.s, p8/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
\ No newline at end of file
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint64x.s b/llvm/test/MC/AArch64/SVE2p2/frint64x.s
new file mode 100644
index 00000000000000..25e3f3b1739524
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint64x.s
@@ -0,0 +1,49 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p2 < %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=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=+sve2p2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=-sme2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// Disassemble encoding and check the re-encoding (-show-encoding) matches.
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN: | llvm-mc -triple=aarch64 -mattr=+sve2p2 -disassemble -show-encoding \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+movprfx z23.d, p3/m, z31.d
+frint64x z23.d, p3/m, z13.d // 01100101-00010111-10101101-10110111
+// CHECK-INST: movprfx z23.d, p3/m, z31.d
+// CHECK-INST: frint64x z23.d, p3/m, z13.d
+// CHECK-ENCODING: [0xb7,0xad,0x17,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6517adb7 <unknown>
+
+movprfx z23, z31
+frint64x z23.s, p3/m, z13.s // 01100101-00010101-10101101-10110111
+// CHECK-INST: movprfx z23, z31
+// CHECK-INST: frint64x z23.s, p3/m, z13.s
+// CHECK-ENCODING: [0xb7,0xad,0x15,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6515adb7 <unknown>
+
+frint64x z21.d, p5/m, z10.d // 01100101-00010111-10110101-01010101
+// CHECK-INST: frint64x z21.d, p5/m, z10.d
+// CHECK-ENCODING: [0x55,0xb5,0x17,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6517b555 <unknown>
+
+frint64x z31.d, p7/m, z31.d // 01100101-00010111-10111111-11111111
+// CHECK-INST: frint64x z31.d, p7/m, z31.d
+// CHECK-ENCODING: [0xff,0xbf,0x17,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6517bfff <unknown>
+
+frint64x z31.s, p7/m, z31.s // 01100101-00010101-10111111-11111111
+// CHECK-INST: frint64x z31.s, p7/m, z31.s
+// CHECK-ENCODING: [0xff,0xbf,0x15,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6515bfff <unknown>
\ No newline at end of file
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint64z-diagnostics.s b/llvm/test/MC/AArch64/SVE2p2/frint64z-diagnostics.s
new file mode 100644
index 00000000000000..b6dff833f9f5a4
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint64z-diagnostics.s
@@ -0,0 +1,32 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 2>&1 < %s| FileCheck %s
+
+// ------------------------------------------------------------------------- //
+// Invalid element width
+
+frint64z z31.b, p7/m, z31.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64z z31.b, p7/m, z31.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint64z z31.h, p7/m, z31.h
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64z z31.h, p7/m, z31.h
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint64z z31.s, p7/m, z31.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64z z31.s, p7/m, z31.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+frint64z z31.d, p7/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: frint64z z31.d, p7/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// ------------------------------------------------------------------------- //
+// Invalid predicate
+
+frint64z z31.s, p8/m, z31.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid restricted predicate register, expected p0..p7 (without element suffix)
+// CHECK-NEXT: frint64z z31.s, p8/m, z31.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
\ No newline at end of file
diff --git a/llvm/test/MC/AArch64/SVE2p2/frint64z.s b/llvm/test/MC/AArch64/SVE2p2/frint64z.s
new file mode 100644
index 00000000000000..d871d70112f013
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p2/frint64z.s
@@ -0,0 +1,49 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p2 < %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=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=+sve2p2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2p2 < %s \
+// RUN: | llvm-objdump -d --mattr=-sme2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// Disassemble encoding and check the re-encoding (-show-encoding) matches.
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p2 < %s \
+// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN: | llvm-mc -triple=aarch64 -mattr=+sve2p2 -disassemble -show-encoding \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+movprfx z23.d, p3/m, z31.d
+frint64z z23.d, p3/m, z13.d // 01100101-00010110-10101101-10110111
+// CHECK-INST: movprfx z23.d, p3/m, z31.d
+// CHECK-INST: frint64z z23.d, p3/m, z13.d
+// CHECK-ENCODING: [0xb7,0xad,0x16,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6516adb7 <unknown>
+
+movprfx z23, z31
+frint64z z23.s, p3/m, z13.s // 01100101-00010100-10101101-10110111
+// CHECK-INST: movprfx z23, z31
+// CHECK-INST: frint64z z23.s, p3/m, z13.s
+// CHECK-ENCODING: [0xb7,0xad,0x14,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6514adb7 <unknown>
+
+frint64z z0.s, p0/m, z0.s // 01100101-00010100-10100000-00000000
+// CHECK-INST: frint64z z0.s, p0/m, z0.s
+// CHECK-ENCODING: [0x00,0xa0,0x14,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6514a000 <unknown>
+
+frint64z z21.d, p5/m, z10.d // 01100101-00010110-10110101-01010101
+// CHECK-INST: frint64z z21.d, p5/m, z10.d
+// CHECK-ENCODING: [0x55,0xb5,0x16,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6516b555 <unknown>
+
+frint64z z31.d, p7/m, z31.d // 01100101-00010110-10111111-11111111
+// CHECK-INST: frint64z z31.d, p7/m, z31.d
+// CHECK-ENCODING: [0xff,0xbf,0x16,0x65]
+// CHECK-ERROR: instruction requires: sme2p2 or sve2p2
+// CHECK-UNKNOWN: 6516bfff <unknown>
\ No newline at end of file
|
jthackray
approved these changes
Oct 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closed
NoumanAmir657
pushed a commit
to NoumanAmir657/llvm-project
that referenced
this pull request
Nov 4, 2024
…lvm#113562) This patch adds assembly/disassembly support for the following SVE2.2 instructions - FRINT32X (merging) - FRINT32Z (merging) - FRINT64X (merging) - FRINT64Z (merging) - In accordance with: https://developer.arm.com/documentation/ddi0602/latest/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds assembly/disassembly support for the following SVE2.2 instructions