Skip to content

[AArch64] Fix APAS instructions to disassemble to self not to SYS alias #142211

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

Merged
merged 2 commits into from
Jun 2, 2025

Conversation

jthackray
Copy link
Contributor

APAS instructions currently incorrectly disassemble to SYS aliases. Fix this so that they disassemble to the actual APAS instruction.

… alias

`APAS` instructions currently incorrectly disassemble to `SYS` aliases.
Fix this so that they disassemble to the actual `APAS` instruction.
@llvmbot llvmbot added backend:AArch64 mc Machine (object) code labels May 30, 2025
@llvmbot
Copy link
Member

llvmbot commented May 30, 2025

@llvm/pr-subscribers-backend-aarch64

Author: Jonathan Thackray (jthackray)

Changes

APAS instructions currently incorrectly disassemble to SYS aliases. Fix this so that they disassemble to the actual APAS instruction.


Full diff: https://github.com/llvm/llvm-project/pull/142211.diff

2 Files Affected:

  • (modified) llvm/lib/Target/AArch64/AArch64InstrFormats.td (-1)
  • (modified) llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt (+5-5)
diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 5489541fcb318..1e0200ff62b2b 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -1817,7 +1817,6 @@ class APASI : SimpleSystemI<0, (ins GPR64:$Xt), "apas", "\t$Xt">, Sched<[]> {
   bits<5> Xt;
   let Inst{20-5} = 0b0111001110000000;
   let Inst{4-0} = Xt;
-  let DecoderNamespace = "APAS";
 }
 
 // Hint instructions that take both a CRm and a 3-bit immediate.
diff --git a/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt b/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt
index d198771c341b9..1610fbec04640 100644
--- a/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt
+++ b/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt
@@ -9,10 +9,10 @@
 [0xa3,0x21,0x3e,0xd5]
 [0xa4,0x21,0x1e,0xd5]
 
-# CHECK:      	sys	#6, c7, c0, #0, x0
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x1
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x2
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x17
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x30
+# CHECK:      	 apas x0
+# CHECK-NEXT: 	 apas x1
+# CHECK-NEXT: 	 apas x2
+# CHECK-NEXT: 	 apas x17
+# CHECK-NEXT: 	 apas x30
 # CHECK-NEXT: 	mrs	x3, GPCBW_EL3
 # CHECK-NEXT: 	msr	GPCBW_EL3, x4

@llvmbot
Copy link
Member

llvmbot commented May 30, 2025

@llvm/pr-subscribers-mc

Author: Jonathan Thackray (jthackray)

Changes

APAS instructions currently incorrectly disassemble to SYS aliases. Fix this so that they disassemble to the actual APAS instruction.


Full diff: https://github.com/llvm/llvm-project/pull/142211.diff

2 Files Affected:

  • (modified) llvm/lib/Target/AArch64/AArch64InstrFormats.td (-1)
  • (modified) llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt (+5-5)
diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 5489541fcb318..1e0200ff62b2b 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -1817,7 +1817,6 @@ class APASI : SimpleSystemI<0, (ins GPR64:$Xt), "apas", "\t$Xt">, Sched<[]> {
   bits<5> Xt;
   let Inst{20-5} = 0b0111001110000000;
   let Inst{4-0} = Xt;
-  let DecoderNamespace = "APAS";
 }
 
 // Hint instructions that take both a CRm and a 3-bit immediate.
diff --git a/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt b/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt
index d198771c341b9..1610fbec04640 100644
--- a/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt
+++ b/llvm/test/MC/Disassembler/AArch64/armv9.6a-rme-gpc3.txt
@@ -9,10 +9,10 @@
 [0xa3,0x21,0x3e,0xd5]
 [0xa4,0x21,0x1e,0xd5]
 
-# CHECK:      	sys	#6, c7, c0, #0, x0
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x1
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x2
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x17
-# CHECK-NEXT: 	sys	#6, c7, c0, #0, x30
+# CHECK:      	 apas x0
+# CHECK-NEXT: 	 apas x1
+# CHECK-NEXT: 	 apas x2
+# CHECK-NEXT: 	 apas x17
+# CHECK-NEXT: 	 apas x30
 # CHECK-NEXT: 	mrs	x3, GPCBW_EL3
 # CHECK-NEXT: 	msr	GPCBW_EL3, x4

Copy link
Contributor

@virginia-cangelosi virginia-cangelosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@rgwott
Copy link
Contributor

rgwott commented Jun 2, 2025

LGTM other than the formatting.

@jthackray
Copy link
Contributor Author

LGTM other than the formatting.

@rgwott Better?

@rgwott
Copy link
Contributor

rgwott commented Jun 2, 2025

Sure

@jthackray jthackray merged commit 3a45d55 into main Jun 2, 2025
6 of 11 checks passed
@jthackray jthackray deleted the users/jthackray/fix-apas branch June 2, 2025 09:50
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
… alias (llvm#142211)

`APAS` instructions currently incorrectly disassemble to `SYS` aliases.
Fix this so that they disassemble to the actual `APAS` instruction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants