Skip to content

Commit ef4a95c

Browse files
[AArch64] Enable certain instruction aliases for SVE/SME (#77745)
Several SVE instruction aliases accept predicate-as-counter register names as a convenience. These ought to be enabled with SVE/SME because the underlying encoding is valid and it's required by Arm ARM.
1 parent 13b5882 commit ef4a95c

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4006,7 +4006,9 @@ defm WHILEHS_CXX : sve2p1_int_while_rr_pn<"whilehs", 0b100>;
40064006
defm WHILEHI_CXX : sve2p1_int_while_rr_pn<"whilehi", 0b101>;
40074007
defm WHILELO_CXX : sve2p1_int_while_rr_pn<"whilelo", 0b110>;
40084008
defm WHILELS_CXX : sve2p1_int_while_rr_pn<"whilels", 0b111>;
4009+
} // End HasSVE2p1_or_HasSME2
40094010

4011+
let Predicates = [HasSVEorSME] in {
40104012

40114013
// Aliases for existing SVE instructions for which predicate-as-counter are
40124014
// accepted as an operand to the instruction
@@ -4025,7 +4027,7 @@ def : InstAlias<"mov $Pd, $Pn",
40254027

40264028
def : InstAlias<"pfalse\t$Pd", (PFALSE PNRasPPR8:$Pd), 0>;
40274029

4028-
} // End HasSVE2p1_or_HasSME2
4030+
}
40294031

40304032
//===----------------------------------------------------------------------===//
40314033
// Non-widening BFloat16 to BFloat16 instructions
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
1+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3-
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
3+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
55
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
66
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
7-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2p1 < %s \
8-
// RUN: | llvm-objdump --no-print-imm-hex -d --mattr=+sve2p1 - | FileCheck %s --check-prefix=CHECK-INST
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2p1 < %s \
7+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
8+
// RUN: | llvm-objdump --no-print-imm-hex -d --mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
9+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
1010
// RUN: | llvm-objdump --no-print-imm-hex -d --mattr=-sve - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1111

1212

1313
ldr pn0, [x0]
1414
// CHECK-INST: ldr p0, [x0]
1515
// CHECK-ENCODING: [0x00,0x00,0x80,0x85]
16-
// CHECK-ERROR: instruction requires: sme2 or sve2p1
16+
// CHECK-ERROR: instruction requires: sve or sme
1717
// CHECK-UNKNOWN: 85800000 <unknown>
1818

1919
ldr pn5, [x10, #255, mul vl]
2020
// CHECK-INST: ldr p5, [x10, #255, mul vl]
2121
// CHECK-ENCODING: [0x45,0x1d,0x9f,0x85]
22-
// CHECK-ERROR: instruction requires: sme2 or sve2p1
22+
// CHECK-ERROR: instruction requires: sve or sme
2323
// CHECK-UNKNOWN: 859f1d45 <unknown>
2424

2525

2626
str pn0, [x0]
2727
// CHECK-INST: str p0, [x0]
2828
// CHECK-ENCODING: [0x00,0x00,0x80,0xe5]
29-
// CHECK-ERROR: instruction requires: sme2 or sve2p1
29+
// CHECK-ERROR: instruction requires: sve or sme
3030
// CHECK-UNKNOWN: e5800000 <unknown>
3131

3232
str pn5, [x10, #255, mul vl]
3333
// CHECK-INST: str p5, [x10, #255, mul vl]
3434
// CHECK-ENCODING: [0x45,0x1d,0x9f,0xe5]
35-
// CHECK-ERROR: instruction requires: sme2 or sve2p1
35+
// CHECK-ERROR: instruction requires: sve or sme
3636
// CHECK-UNKNOWN: e59f1d45 <unknown>
3737

3838

3939
mov pn0.b, pn0.b
4040
// CHECK-INST: mov p0.b, p0.b
4141
// CHECK-ENCODING: [0x00,0x40,0x80,0x25]
42-
// CHECK-ERROR: instruction requires: sme2 or sve2p1
42+
// CHECK-ERROR: instruction requires: sve or sme
4343
// CHECK-UNKNOWN: 25804000 <unknown>
4444

4545

4646
pfalse pn15.b
4747
// CHECK-INST: pfalse p15.b
4848
// CHECK-ENCODING: [0x0f,0xe4,0x18,0x25]
49-
// CHECK-ERROR: instruction requires: sme2 or sve2p1
49+
// CHECK-ERROR: instruction requires: sve or sme
5050
// CHECK-UNKNOWN: 2518e40f <unknown>

0 commit comments

Comments
 (0)