Skip to content

Commit f6c2a35

Browse files
authored
[AArch64] Add Apple assembly syntax for recent instructions (#152111)
Some vector instructions override AsmString in the tablegen description, but did not include the Apple syntax variant, so were printed without operands. Fixes #151330
1 parent 0a1eff2 commit f6c2a35

File tree

2 files changed

+46
-9
lines changed

2 files changed

+46
-9
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6484,7 +6484,9 @@ class BaseSIMDThreeSameVectorDot<bit Q, bit U, bits<2> sz, bits<4> opc, string a
64846484
(OpNode (AccumType RegType:$Rd),
64856485
(InputType RegType:$Rn),
64866486
(InputType RegType:$Rm)))]> {
6487-
let AsmString = !strconcat(asm, "{\t$Rd" # kind1 # ", $Rn" # kind2 # ", $Rm" # kind2 # "}");
6487+
6488+
let AsmString = !strconcat(asm, "{\t$Rd" # kind1 # ", $Rn" # kind2 # ", $Rm" # kind2 #
6489+
"|" # kind1 # "\t$Rd, $Rn, $Rm}");
64886490
}
64896491

64906492
multiclass SIMDThreeSameVectorDot<bit U, bit Mixed, string asm, SDPatternOperator OpNode> {
@@ -6507,7 +6509,8 @@ class BaseSIMDThreeSameVectorFML<bit Q, bit U, bit b13, bits<3> size, string asm
65076509
(OpNode (AccumType RegType:$Rd),
65086510
(InputType RegType:$Rn),
65096511
(InputType RegType:$Rm)))]> {
6510-
let AsmString = !strconcat(asm, "{\t$Rd" # kind1 # ", $Rn" # kind2 # ", $Rm" # kind2 # "}");
6512+
let AsmString = !strconcat(asm, "{\t$Rd" # kind1 # ", $Rn" # kind2 # ", $Rm" # kind2 #
6513+
"|" # kind1 # "\t$Rd, $Rn, $Rm}");
65116514
let Inst{13} = b13;
65126515
}
65136516

@@ -8986,7 +8989,8 @@ class BaseSIMDThreeSameVectorBFDot<bit Q, bit U, string asm, string kind1,
89868989
(InputType RegType:$Rm)))]> {
89878990
let AsmString = !strconcat(asm,
89888991
"{\t$Rd" # kind1 # ", $Rn" # kind2 #
8989-
", $Rm" # kind2 # "}");
8992+
", $Rm" # kind2 #
8993+
"|" # kind1 # "\t$Rd, $Rn, $Rm}");
89908994
}
89918995

89928996
multiclass SIMDThreeSameVectorBFDot<bit U, string asm> {
@@ -9032,7 +9036,7 @@ class SIMDBF16MLAL<bit Q, string asm, SDPatternOperator OpNode>
90329036
[(set (v4f32 V128:$dst), (OpNode (v4f32 V128:$Rd),
90339037
(v8bf16 V128:$Rn),
90349038
(v8bf16 V128:$Rm)))]> {
9035-
let AsmString = !strconcat(asm, "{\t$Rd.4s, $Rn.8h, $Rm.8h}");
9039+
let AsmString = !strconcat(asm, "{\t$Rd.4s, $Rn.8h, $Rm.8h|.4s\t$Rd, $Rn, $Rm}");
90369040
}
90379041

90389042
let mayRaiseFPException = 1, Uses = [FPCR] in
@@ -9071,8 +9075,7 @@ class SIMDThreeSameVectorBF16MatrixMul<string asm>
90719075
(int_aarch64_neon_bfmmla (v4f32 V128:$Rd),
90729076
(v8bf16 V128:$Rn),
90739077
(v8bf16 V128:$Rm)))]> {
9074-
let AsmString = !strconcat(asm, "{\t$Rd", ".4s", ", $Rn", ".8h",
9075-
", $Rm", ".8h", "}");
9078+
let AsmString = !strconcat(asm, "{\t$Rd.4s, $Rn.8h, $Rm.8h|.4s\t$Rd, $Rn, $Rm}");
90769079
}
90779080

90789081
let mayRaiseFPException = 1, Uses = [FPCR] in
@@ -9143,7 +9146,7 @@ class SIMDThreeSameVectorMatMul<bit B, bit U, string asm, SDPatternOperator OpNo
91439146
[(set (v4i32 V128:$dst), (OpNode (v4i32 V128:$Rd),
91449147
(v16i8 V128:$Rn),
91459148
(v16i8 V128:$Rm)))]> {
9146-
let AsmString = asm # "{\t$Rd.4s, $Rn.16b, $Rm.16b}";
9149+
let AsmString = asm # "{\t$Rd.4s, $Rn.16b, $Rm.16b|.4s\t$Rd, $Rn, $Rm}";
91479150
}
91489151

91499152
//----------------------------------------------------------------------------
@@ -13344,8 +13347,8 @@ multiclass AtomicFPStore<bit R, bits<3> op0, string asm> {
1334413347
class BaseSIMDThreeSameVectorFP8MatrixMul<string asm, bits<2> size, string kind>
1334513348
: BaseSIMDThreeSameVectorTied<1, 1, {size, 0}, 0b11101,
1334613349
V128, asm, ".16b", []> {
13347-
let AsmString = !strconcat(asm, "{\t$Rd", kind, ", $Rn", ".16b",
13348-
", $Rm", ".16b", "}");
13350+
let AsmString = !strconcat(asm, "{\t$Rd", kind, ", $Rn.16b, $Rm.16b",
13351+
"|", kind, "\t$Rd, $Rn, $Rm}");
1334913352
}
1335013353

1335113354
multiclass SIMDThreeSameVectorFP8MatrixMul<string asm>{
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# RUN: llvm-mc < %s --triple=aarch64 -mattr=+dotprod,+fp16fml,+bf16,+i8mm,+f8f32mm,+f8f16mm --disassemble --output-asm-variant=0 | FileCheck %s --check-prefix=GENERIC
2+
# RUN: llvm-mc < %s --triple=aarch64 -mattr=+dotprod,+fp16fml,+bf16,+i8mm,+f8f32mm,+f8f16mm --disassemble --output-asm-variant=1 | FileCheck %s --check-prefix=APPLE
3+
4+
[0xd3,0x94,0x92,0x4e]
5+
# GENERIC: sdot v19.4s, v6.16b, v18.16b
6+
# APPLE: sdot.4s v19, v6, v18
7+
8+
[0xd3,0xec,0x32,0x4e]
9+
# GENERIC: fmlal v19.4s, v6.4h, v18.4h
10+
# APPLE: fmlal.4s v19, v6, v18
11+
12+
[0xd3,0xfc,0x52,0x6e]
13+
# GENERIC: bfdot v19.4s, v6.8h, v18.8h
14+
# APPLE: bfdot.4s v19, v6, v18
15+
16+
[0xd3,0xfc,0xd2,0x2e]
17+
# GENERIC: bfmlalb v19.4s, v6.8h, v18.8h
18+
# APPLE: bfmlalb.4s v19, v6, v18
19+
20+
[0xd3,0xec,0x52,0x6e]
21+
# GENERIC: bfmmla v19.4s, v6.8h, v18.8h
22+
# APPLE: bfmmla.4s v19, v6, v18
23+
24+
[0xd3,0xa4,0x92,0x4e]
25+
# GENERIC: smmla v19.4s, v6.16b, v18.16b
26+
# APPLE: smmla.4s v19, v6, v18
27+
28+
[0xd3,0xec,0x92,0x6e]
29+
# GENERIC: fmmla v19.4s, v6.16b, v18.16b
30+
# APPLE: fmmla.4s v19, v6, v18
31+
32+
[0xd3,0xec,0x12,0x6e]
33+
# GENERIC: fmmla v19.8h, v6.16b, v18.16b
34+
# APPLE: fmmla.8h v19, v6, v18

0 commit comments

Comments
 (0)