[llvm] [SPARC][IAS] Add `illtrap` alias for `unimp` (PR #105928)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 24 00:25:45 PDT 2024


https://github.com/koachan created https://github.com/llvm/llvm-project/pull/105928

This follows GNU and Solaris behavior of allowing both mnemonics all the time.

Fixes https://github.com/llvm/llvm-project/issues/105639.

>From 27b71e6eb9373a7c88aaf25de96aa09045bf2332 Mon Sep 17 00:00:00 2001
From: Koakuma <koachan at protonmail.com>
Date: Sat, 24 Aug 2024 14:07:06 +0700
Subject: [PATCH] [SPARC][IAS] Add `illtrap` alias for `unimp`

This follows GNU and Solaris behavior of allowing both mnemonics all the time.
---
 llvm/lib/Target/Sparc/SparcInstrAliases.td   | 4 ++++
 llvm/test/MC/Sparc/sparc-misc-instructions.s | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/llvm/lib/Target/Sparc/SparcInstrAliases.td b/llvm/lib/Target/Sparc/SparcInstrAliases.td
index e77b7f5c376bf4..722e0463b7bcaa 100644
--- a/llvm/lib/Target/Sparc/SparcInstrAliases.td
+++ b/llvm/lib/Target/Sparc/SparcInstrAliases.td
@@ -601,6 +601,10 @@ def : InstAlias<"flush", (FLUSH), 0>;
 // unimp -> unimp 0
 def : InstAlias<"unimp", (UNIMP 0), 0>;
 
+// Not in spec, but we follow GNU & Solaris behavior of having `illtrap`
+// interchangeable with `unimp` all the time.
+def : MnemonicAlias<"illtrap", "unimp">;
+
 def : MnemonicAlias<"iflush", "flush">;
 
 def : MnemonicAlias<"stub", "stb">;
diff --git a/llvm/test/MC/Sparc/sparc-misc-instructions.s b/llvm/test/MC/Sparc/sparc-misc-instructions.s
index 0547575eb3db51..8119088cd0dbb1 100644
--- a/llvm/test/MC/Sparc/sparc-misc-instructions.s
+++ b/llvm/test/MC/Sparc/sparc-misc-instructions.s
@@ -6,3 +6,9 @@
 
         ! CHECK: unimp 0   ! encoding: [0x00,0x00,0x00,0x00]
         unimp 0
+
+        ! CHECK: unimp 0   ! encoding: [0x00,0x00,0x00,0x00]
+        illtrap
+
+        ! CHECK: unimp 0   ! encoding: [0x00,0x00,0x00,0x00]
+        illtrap 0



More information about the llvm-commits mailing list