[M68k] Add AssemblerPredicate to existing `AtLeast680x0` predicates
authorMin-Yih Hsu <minyihh@uci.edu>
Fri, 31 Mar 2023 21:46:39 +0000 (14:46 -0700)
committerMin-Yih Hsu <minyihh@uci.edu>
Fri, 31 Mar 2023 21:49:52 +0000 (14:49 -0700)
And refactor how `AtLeast680x0` are defined. This is essentially NFC.

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

index f431aae..80af08e 100644 (file)
@@ -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"
 
index a959186..b595d3c 100644 (file)
@@ -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
index bec3436..e005c3b 100644 (file)
@@ -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
index 99e31d3..cb149e4 100644 (file)
@@ -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]
index 24ce08e..ffb602d 100644 (file)
@@ -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]