[llvm] 94a74b9 - [M68k] Add AssemblerPredicate to existing `AtLeast680x0` predicates

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 14:51:54 PDT 2023


Author: Min-Yih Hsu
Date: 2023-03-31T14:49:52-07:00
New Revision: 94a74b9dbb5c2d082802a7e220078d74d6bb74a9

URL: https://github.com/llvm/llvm-project/commit/94a74b9dbb5c2d082802a7e220078d74d6bb74a9
DIFF: https://github.com/llvm/llvm-project/commit/94a74b9dbb5c2d082802a7e220078d74d6bb74a9.diff

LOG: [M68k] Add AssemblerPredicate to existing `AtLeast680x0` predicates

And refactor how `AtLeast680x0` are defined. This is essentially NFC.

Added: 
    

Modified: 
    llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
    llvm/lib/Target/M68k/M68kInstrInfo.td
    llvm/test/MC/Disassembler/M68k/atomics.txt
    llvm/test/MC/M68k/Atomics/cas.s
    llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp b/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
index f431aae2f23ed..80af08e737e74 100644
--- a/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
+++ b/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
@@ -223,6 +223,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeM68kAsmParser() {
   RegisterMCAsmParser<M68kAsmParser> X(getTheM68kTarget());
 }
 
+#define GET_REGISTER_MATCHER
 #define GET_MATCHER_IMPLEMENTATION
 #include "M68kGenAsmMatcher.inc"
 

diff  --git a/llvm/lib/Target/M68k/M68kInstrInfo.td b/llvm/lib/Target/M68k/M68kInstrInfo.td
index a9591869f9240..b595d3c6c0385 100644
--- a/llvm/lib/Target/M68k/M68kInstrInfo.td
+++ b/llvm/lib/Target/M68k/M68kInstrInfo.td
@@ -430,11 +430,11 @@ def NearData     : Predicate<"TM.getCodeModel() == CodeModel::Small ||"
 def IsPIC        : Predicate<"TM.isPositionIndependent()">;
 def IsNotPIC     : Predicate<"!TM.isPositionIndependent()">;
 
-def AtLeastM68000     : Predicate<"Subtarget->atLeastM68000()">;
-def AtLeastM68010     : Predicate<"Subtarget->atLeastM68010()">;
-def AtLeastM68020     : Predicate<"Subtarget->atLeastM68020()">;
-def AtLeastM68030     : Predicate<"Subtarget->atLeastM68030()">;
-def AtLeastM68040     : Predicate<"Subtarget->atLeastM68040()">;
+// ISA versions
+foreach i = [0,1,2,4,6] in
+def AtLeastM680 # i # "0" : Predicate<"Subtarget->atLeastM680"#i#"0()">,
+                            AssemblerPredicate<(all_of
+                                                !cast<SubtargetFeature>("FeatureISA"#i#"0"))>;
 
 //===----------------------------------------------------------------------===//
 // Condition Codes

diff  --git a/llvm/test/MC/Disassembler/M68k/atomics.txt b/llvm/test/MC/Disassembler/M68k/atomics.txt
index bec3436c90e6a..e005c3bb76dd0 100644
--- a/llvm/test/MC/Disassembler/M68k/atomics.txt
+++ b/llvm/test/MC/Disassembler/M68k/atomics.txt
@@ -1,4 +1,4 @@
-# RUN: llvm-mc -disassemble %s -triple=m68k | FileCheck %s
+# RUN: llvm-mc -disassemble %s -triple=m68k -mcpu=M68020 | FileCheck %s
 
 # CHECK: cas.b %d3, %d2, (%a2)
 0x0a 0xd2 0x00 0x83

diff  --git a/llvm/test/MC/M68k/Atomics/cas.s b/llvm/test/MC/M68k/Atomics/cas.s
index 99e31d3f428b4..cb149e4c2b869 100644
--- a/llvm/test/MC/M68k/Atomics/cas.s
+++ b/llvm/test/MC/M68k/Atomics/cas.s
@@ -1,4 +1,4 @@
-; RUN: llvm-mc -show-encoding -triple=m68k %s | FileCheck %s
+; RUN: llvm-mc -show-encoding -triple=m68k -mcpu=M68020 %s | FileCheck %s
 
 ; CHECK: cas.b %d3, %d2, (%a2)
 ; CHECK-SAME: ; encoding: [0x0a,0xd2,0x00,0x83]

diff  --git a/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s b/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s
index 24ce08ebf8dbd..ffb602d401840 100644
--- a/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s
+++ b/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s
@@ -1,4 +1,4 @@
-; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s
+; RUN: llvm-mc -triple=m68k -mcpu=M68010 -show-encoding %s | FileCheck %s
 
 ; CHECK:      move.w  %d1, %ccr
 ; CHECK-SAME: encoding: [0x44,0xc1]


        


More information about the llvm-commits mailing list