[llvm] 974c639 - [M68k] Add MC support for bchg, bclr and bset instruction
Jim Lin via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 20:53:56 PDT 2023
Author: Jim Lin
Date: 2023-08-19T11:53:21+08:00
New Revision: 974c6393297c18c968ffafc43ba37f0827d536ea
URL: https://github.com/llvm/llvm-project/commit/974c6393297c18c968ffafc43ba37f0827d536ea
DIFF: https://github.com/llvm/llvm-project/commit/974c6393297c18c968ffafc43ba37f0827d536ea.diff
LOG: [M68k] Add MC support for bchg, bclr and bset instruction
Reviewed By: myhsu
Differential Revision: https://reviews.llvm.org/D116993
Added:
Modified:
llvm/lib/Target/M68k/M68kInstrBits.td
llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s
llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s
llvm/test/MC/M68k/Bits/Classes/MxBTST_RR.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/M68k/M68kInstrBits.td b/llvm/lib/Target/M68k/M68kInstrBits.td
index abd2ab3cf012c42..55c95e467096a0d 100644
--- a/llvm/lib/Target/M68k/M68kInstrBits.td
+++ b/llvm/lib/Target/M68k/M68kInstrBits.td
@@ -12,7 +12,7 @@
///
/// Machine:
///
-/// BCHG [ ] BCLR [ ] BSET [ ] BTST [~]
+/// BCHG [~] BCLR [~] BSET [~] BTST [~]
///
/// Map:
///
@@ -30,92 +30,134 @@
/// ------------+---------+---------+---------+---------
/// F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0
/// ------------+---------+---------+---------+---------
-/// 0 0 0 0 | REG | 1 0 0 | MODE | REG
+/// 0 0 0 0 | REG | OP MODE | MODE | REG
/// ------------+---------+---------+---------+---------
-class MxBTSTEnc_R<MxEncMemOp dst_enc, string bitno_name> {
+class MxBITEnc_R<bits<3> opmode, MxEncMemOp dst_enc, string bitno_name> {
dag Value = (ascend
(descend 0b0000,
(operand "$"#bitno_name, 3),
- 0b100, dst_enc.EA
+ opmode, dst_enc.EA
),
dst_enc.Supplement
);
}
-/// -------------------------------+---------+---------
-/// F E D C B A 9 8 . 7 6 | 5 4 3 | 2 1 0
-/// -------------------------------+---------+---------
-/// 0 0 0 0 1 0 0 0 . 0 0 | MODE | REG
-/// ------------------------+------+---------+---------
+/// ---------------------+---------+---------+---------
+/// F E D C B A 9 | 8 7 6 | 5 4 3 | 2 1 0
+/// ---------------------+---------+---------+---------
+/// 0 0 0 0 1 0 0 | OP MODE | MODE | REG
+/// ---------------------+--+------+---------+---------
/// 0 0 0 0 0 0 0 0 | BIT NUMBER
/// ------------------------+--------------------------
-class MxBTSTEnc_I<MxEncMemOp dst_enc, string bitno_name> {
+class MxBITEnc_I<bits<3> opmode, MxEncMemOp dst_enc, string bitno_name> {
dag Value = (ascend
- (descend 0b0000100000, dst_enc.EA),
+ (descend 0b0000100, opmode, dst_enc.EA),
(descend 0b00000000, (operand "$"#bitno_name, 8)),
dst_enc.Supplement
);
}
let Defs = [CCR] in {
-class MxBTST_RR<MxType TYPE>
- : MxInst<(outs), (ins TYPE.ROp:$dst, TYPE.ROp:$bitno), "btst\t$bitno, $dst",
- [(set CCR, (MxBtst TYPE.VT:$dst, TYPE.VT:$bitno))]> {
- let Inst = MxBTSTEnc_R<MxEncAddrMode_r<"dst">, "bitno">.Value;
+class MxBIT_RR<string MN, bits<3> OPMODE, MxType TYPE>
+ : MxInst<(outs), (ins TYPE.ROp:$dst, TYPE.ROp:$bitno),
+ MN#"\t$bitno, $dst"> {
+ let Inst = MxBITEnc_R<OPMODE, MxEncAddrMode_r<"dst">, "bitno">.Value;
}
-class MxBTST_RI<MxType TYPE>
- : MxInst<(outs), (ins TYPE.ROp:$dst, TYPE.IOp:$bitno), "btst\t$bitno, $dst",
- [(set CCR, (MxBtst TYPE.VT:$dst, TYPE.IPat:$bitno))]> {
- let Inst = MxBTSTEnc_I<MxEncAddrMode_r<"dst">, "bitno">.Value;
+class MxBIT_RI<string MN, bits<3> OPMODE, MxType TYPE>
+ : MxInst<(outs), (ins TYPE.ROp:$dst, TYPE.IOp:$bitno),
+ MN#"\t$bitno, $dst"> {
+ let Inst = MxBITEnc_I<OPMODE, MxEncAddrMode_r<"dst">, "bitno">.Value;
}
-class MxBTST_MR<MxType TYPE, MxOperand MEMOpd, ComplexPattern MEMPat,
- MxEncMemOp DST_ENC>
- : MxInst<(outs), (ins MEMOpd:$dst, TYPE.ROp:$bitno), "btst\t$bitno, $dst",
- [(set CCR, (MxBtst (TYPE.Load MEMPat:$dst), TYPE.VT:$bitno))]> {
- let Inst = MxBTSTEnc_R<DST_ENC, "bitno">.Value;
+class MxBIT_MR<string MN, bits<3> OPMODE, MxType TYPE,
+ MxOperand MEMOpd, MxEncMemOp DST_ENC>
+ : MxInst<(outs), (ins MEMOpd:$dst, TYPE.ROp:$bitno),
+ MN#"\t$bitno, $dst"> {
+ let Inst = MxBITEnc_R<OPMODE, DST_ENC, "bitno">.Value;
}
-class MxBTST_MI<MxType TYPE, MxOperand MEMOpd, ComplexPattern MEMPat,
- MxEncMemOp DST_ENC>
- : MxInst<(outs), (ins MEMOpd:$dst, TYPE.IOp:$bitno), "btst\t$bitno, $dst",
- [(set CCR, (MxBtst (TYPE.Load MEMPat:$dst), TYPE.IPat:$bitno))]> {
- let Inst = MxBTSTEnc_I<DST_ENC, "bitno">.Value;
+class MxBIT_MI<string MN, bits<3> OPMODE, MxType TYPE,
+ MxOperand MEMOpd, MxEncMemOp DST_ENC>
+ : MxInst<(outs), (ins MEMOpd:$dst, TYPE.IOp:$bitno),
+ MN#"\t$bitno, $dst"> {
+ let Inst = MxBITEnc_I<OPMODE, DST_ENC, "bitno">.Value;
}
} // Defs = [CCR]
-// Register BTST limited to 32 bits only
-def BTST32dd : MxBTST_RR<MxType32d>;
-def BTST32di : MxBTST_RI<MxType32d>;
-
-// Memory BTST limited to 8 bits only
-def BTST8jd : MxBTST_MR<MxType8d, MxType8.JOp, MxType8.JPat,
- MxEncAddrMode_j<"dst">>;
-def BTST8od : MxBTST_MR<MxType8d, MxType8.OOp, MxType8.OPat,
- MxEncAddrMode_o<"dst">>;
-def BTST8ed : MxBTST_MR<MxType8d, MxType8.EOp, MxType8.EPat,
- MxEncAddrMode_e<"dst">>;
-def BTST8pd : MxBTST_MR<MxType8d, MxType8.POp, MxType8.PPat,
- MxEncAddrMode_p<"dst">>;
-def BTST8fd : MxBTST_MR<MxType8d, MxType8.FOp, MxType8.FPat,
- MxEncAddrMode_f<"dst">>;
-def BTST8qd : MxBTST_MR<MxType8d, MxType8.QOp, MxType8.QPat,
+def BTST8qd : MxBIT_MR<"btst", 0b100, MxType8d, MxType8.QOp,
MxEncAddrMode_q<"dst">>;
-def BTST8kd : MxBTST_MR<MxType8d, MxType8.KOp, MxType8.KPat,
+def BTST8kd : MxBIT_MR<"btst", 0b100, MxType8d, MxType8.KOp,
MxEncAddrMode_k<"dst">>;
-
-def BTST8ji : MxBTST_MI<MxType8d, MxType8.JOp, MxType8.JPat,
- MxEncAddrMode_j<"dst">>;
-def BTST8oi : MxBTST_MI<MxType8d, MxType8.OOp, MxType8.OPat,
- MxEncAddrMode_o<"dst">>;
-def BTST8ei : MxBTST_MI<MxType8d, MxType8.EOp, MxType8.EPat,
- MxEncAddrMode_e<"dst">>;
-def BTST8pi : MxBTST_MI<MxType8d, MxType8.POp, MxType8.PPat,
- MxEncAddrMode_p<"dst">>;
-def BTST8fi : MxBTST_MI<MxType8d, MxType8.FOp, MxType8.FPat,
- MxEncAddrMode_f<"dst">>;
-def BTST8qi : MxBTST_MI<MxType8d, MxType8.QOp, MxType8.QPat,
+def BTST8qi : MxBIT_MI<"btst", 0b000, MxType8d, MxType8.QOp,
MxEncAddrMode_q<"dst">>;
-def BTST8ki : MxBTST_MI<MxType8d, MxType8.KOp, MxType8.KPat,
+def BTST8ki : MxBIT_MI<"btst", 0b000, MxType8d, MxType8.KOp,
MxEncAddrMode_k<"dst">>;
+
+multiclass MxBIT<string MN, bits<3> OP, bits<3> OPI> {
+ // Register Bit manipulation limited to 32 bits only
+ def NAME#32dd : MxBIT_RR<MN, OP, MxType32d>;
+ def NAME#32di : MxBIT_RI<MN, OPI, MxType32d>;
+
+ // Memory Bit manipulation limited to 8 bits only
+ def NAME#8jd : MxBIT_MR<MN, OP, MxType8d,
+ MxType8.JOp, MxEncAddrMode_j<"dst">>;
+ def NAME#8od : MxBIT_MR<MN, OP, MxType8d,
+ MxType8.OOp, MxEncAddrMode_o<"dst">>;
+ def NAME#8ed : MxBIT_MR<MN, OP, MxType8d,
+ MxType8.EOp, MxEncAddrMode_e<"dst">>;
+ def NAME#8pd : MxBIT_MR<MN, OP, MxType8d,
+ MxType8.POp, MxEncAddrMode_p<"dst">>;
+ def NAME#8fd : MxBIT_MR<MN, OP, MxType8d,
+ MxType8.FOp, MxEncAddrMode_f<"dst">>;
+
+ def NAME#8ji : MxBIT_MI<MN, OPI, MxType8d,
+ MxType8.JOp, MxEncAddrMode_j<"dst">>;
+ def NAME#8oi : MxBIT_MI<MN, OPI, MxType8d,
+ MxType8.OOp, MxEncAddrMode_o<"dst">>;
+ def NAME#8ei : MxBIT_MI<MN, OPI, MxType8d,
+ MxType8.EOp, MxEncAddrMode_e<"dst">>;
+ def NAME#8pi : MxBIT_MI<MN, OPI, MxType8d,
+ MxType8.POp, MxEncAddrMode_p<"dst">>;
+ def NAME#8fi : MxBIT_MI<MN, OPI, MxType8d,
+ MxType8.FOp, MxEncAddrMode_f<"dst">>;
+}
+
+defm BCHG : MxBIT<"bchg", 0b101, 0b001>;
+defm BCLR : MxBIT<"bclr", 0b110, 0b010>;
+defm BSET : MxBIT<"bset", 0b111, 0b011>;
+defm BTST : MxBIT<"btst", 0b100, 0b000>;
+
+// Codegen patterns
+
+multiclass MxBITPatR<MxInst INSTd, MxInst INSTi, SDNode NODE> {
+def : Pat<(NODE MxType32d.VT:$dst, MxType32d.VT:$bitno),
+ (INSTd MxType32d.ROp:$dst, MxType32d.ROp:$bitno)>;
+def : Pat<(NODE MxType32d.VT:$dst, MxType32d.IPat:$bitno),
+ (INSTi MxType32d.ROp:$dst, MxType32d.IOp:$bitno)>;
+}
+
+defm : MxBITPatR<BTST32dd, BTST32di, MxBtst>;
+
+multiclass MxBITPatM<MxInst INSTd, MxInst INSTi, SDNode NODE, MxType TYPE,
+ MxOperand MEMOpd, ComplexPattern MEMPat> {
+def : Pat<(NODE (TYPE.Load MEMPat:$dst), TYPE.VT:$bitno),
+ (INSTd MEMOpd:$dst, TYPE.ROp:$bitno)>;
+def : Pat<(NODE (TYPE.Load MEMPat:$dst), TYPE.IPat:$bitno),
+ (INSTi MEMOpd:$dst, TYPE.IOp:$bitno)>;
+}
+
+defm : MxBITPatM<BTST8qd, BTST8qi, MxBtst,
+ MxType8d, MxType8.QOp, MxType8.QPat>;
+defm : MxBITPatM<BTST8kd, BTST8ki, MxBtst,
+ MxType8d, MxType8.KOp, MxType8.KPat>;
+defm : MxBITPatM<BTST8jd, BTST8ji, MxBtst,
+ MxType8d, MxType8.JOp, MxType8.JPat>;
+defm : MxBITPatM<BTST8od, BTST8oi, MxBtst,
+ MxType8d, MxType8.OOp, MxType8.OPat>;
+defm : MxBITPatM<BTST8ed, BTST8ei, MxBtst,
+ MxType8d, MxType8.EOp, MxType8.EPat>;
+defm : MxBITPatM<BTST8pd, BTST8pi, MxBtst,
+ MxType8d, MxType8.POp, MxType8.PPat>;
+defm : MxBITPatM<BTST8fd, BTST8fi, MxBtst,
+ MxType8d, MxType8.FOp, MxType8.FPat>;
diff --git a/llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s b/llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s
index 25270bed3b8a3aa..fd176a1b73c1c73 100644
--- a/llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s
+++ b/llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s
@@ -1,5 +1,26 @@
; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s
+; CHECK: bchg #0, (%a1)
+; CHECK-SAME: encoding: [0x08,0x51,0x00,0x00]
+bchg #0, (%a1)
+; CHECK: bchg #-1, (%a0)
+; CHECK-SAME: encoding: [0x08,0x50,0x00,0xff]
+bchg #-1, (%a0)
+
+; CHECK: bclr #0, (%a1)
+; CHECK-SAME: encoding: [0x08,0x91,0x00,0x00]
+bclr #0, (%a1)
+; CHECK: bclr #-1, (%a0)
+; CHECK-SAME: encoding: [0x08,0x90,0x00,0xff]
+bclr #-1, (%a0)
+
+; CHECK: bset #0, (%a1)
+; CHECK-SAME: encoding: [0x08,0xd1,0x00,0x00]
+bset #0, (%a1)
+; CHECK: bset #-1, (%a0)
+; CHECK-SAME: encoding: [0x08,0xd0,0x00,0xff]
+bset #-1, (%a0)
+
; CHECK: btst #0, (%a1)
; CHECK-SAME: encoding: [0x08,0x11,0x00,0x00]
btst #0, (%a1)
@@ -7,6 +28,27 @@ btst #0, (%a1)
; CHECK-SAME: encoding: [0x08,0x10,0x00,0xff]
btst #-1, (%a0)
+; CHECK: bchg #0, (%a1)+
+; CHECK-SAME: encoding: [0x08,0x59,0x00,0x00]
+bchg #0, (%a1)+
+; CHECK: bchg #-1, (%a0)+
+; CHECK-SAME: encoding: [0x08,0x58,0x00,0xff]
+bchg #-1, (%a0)+
+
+; CHECK: bclr #0, (%a1)+
+; CHECK-SAME: encoding: [0x08,0x99,0x00,0x00]
+bclr #0, (%a1)+
+; CHECK: bclr #-1, (%a0)+
+; CHECK-SAME: encoding: [0x08,0x98,0x00,0xff]
+bclr #-1, (%a0)+
+
+; CHECK: bset #0, (%a1)+
+; CHECK-SAME: encoding: [0x08,0xd9,0x00,0x00]
+bset #0, (%a1)+
+; CHECK: bset #-1, (%a0)+
+; CHECK-SAME: encoding: [0x08,0xd8,0x00,0xff]
+bset #-1, (%a0)+
+
; CHECK: btst #0, (%a1)+
; CHECK-SAME: encoding: [0x08,0x19,0x00,0x00]
btst #0, (%a1)+
@@ -14,6 +56,27 @@ btst #0, (%a1)+
; CHECK-SAME: encoding: [0x08,0x18,0x00,0xff]
btst #-1, (%a0)+
+; CHECK: bchg #0, -(%a1)
+; CHECK-SAME: encoding: [0x08,0x61,0x00,0x00]
+bchg #0, -(%a1)
+; CHECK: bchg #-1, -(%a0)
+; CHECK-SAME: encoding: [0x08,0x60,0x00,0xff]
+bchg #-1, -(%a0)
+
+; CHECK: bclr #0, -(%a1)
+; CHECK-SAME: encoding: [0x08,0xa1,0x00,0x00]
+bclr #0, -(%a1)
+; CHECK: bclr #-1, -(%a0)
+; CHECK-SAME: encoding: [0x08,0xa0,0x00,0xff]
+bclr #-1, -(%a0)
+
+; CHECK: bset #0, -(%a1)
+; CHECK-SAME: encoding: [0x08,0xe1,0x00,0x00]
+bset #0, -(%a1)
+; CHECK: bset #-1, -(%a0)
+; CHECK-SAME: encoding: [0x08,0xe0,0x00,0xff]
+bset #-1, -(%a0)
+
; CHECK: btst #0, -(%a1)
; CHECK-SAME: encoding: [0x08,0x21,0x00,0x00]
btst #0, -(%a1)
@@ -21,6 +84,27 @@ btst #0, -(%a1)
; CHECK-SAME: encoding: [0x08,0x20,0x00,0xff]
btst #-1, -(%a0)
+; CHECK: bchg #0, (-1,%a1)
+; CHECK-SAME: encoding: [0x08,0x69,0x00,0x00,0xff,0xff]
+bchg #0, (-1,%a1)
+; CHECK: bchg #-1, (0,%a0)
+; CHECK-SAME: encoding: [0x08,0x68,0x00,0xff,0x00,0x00]
+bchg #-1, (0,%a0)
+
+; CHECK: bclr #0, (-1,%a1)
+; CHECK-SAME: encoding: [0x08,0xa9,0x00,0x00,0xff,0xff]
+bclr #0, (-1,%a1)
+; CHECK: bclr #-1, (0,%a0)
+; CHECK-SAME: encoding: [0x08,0xa8,0x00,0xff,0x00,0x00]
+bclr #-1, (0,%a0)
+
+; CHECK: bset #0, (-1,%a1)
+; CHECK-SAME: encoding: [0x08,0xe9,0x00,0x00,0xff,0xff]
+bset #0, (-1,%a1)
+; CHECK: bset #-1, (0,%a0)
+; CHECK-SAME: encoding: [0x08,0xe8,0x00,0xff,0x00,0x00]
+bset #-1, (0,%a0)
+
; CHECK: btst #0, (-1,%a1)
; CHECK-SAME: encoding: [0x08,0x29,0x00,0x00,0xff,0xff]
btst #0, (-1,%a1)
@@ -28,6 +112,27 @@ btst #0, (-1,%a1)
; CHECK-SAME: encoding: [0x08,0x28,0x00,0xff,0x00,0x00]
btst #-1, (0,%a0)
+; CHECK: bchg #0, (-1,%a1,%a0)
+; CHECK-SAME: encoding: [0x08,0x71,0x00,0x00,0x88,0xff]
+bchg #0, (-1,%a1,%a0)
+; CHECK: bchg #-1, (0,%a0,%a0)
+; CHECK-SAME: encoding: [0x08,0x70,0x00,0xff,0x88,0x00]
+bchg #-1, (0,%a0,%a0)
+
+; CHECK: bclr #0, (-1,%a1,%a0)
+; CHECK-SAME: encoding: [0x08,0xb1,0x00,0x00,0x88,0xff]
+bclr #0, (-1,%a1,%a0)
+; CHECK: bclr #-1, (0,%a0,%a0)
+; CHECK-SAME: encoding: [0x08,0xb0,0x00,0xff,0x88,0x00]
+bclr #-1, (0,%a0,%a0)
+
+; CHECK: bset #0, (-1,%a1,%a0)
+; CHECK-SAME: encoding: [0x08,0xf1,0x00,0x00,0x88,0xff]
+bset #0, (-1,%a1,%a0)
+; CHECK: bset #-1, (0,%a0,%a0)
+; CHECK-SAME: encoding: [0x08,0xf0,0x00,0xff,0x88,0x00]
+bset #-1, (0,%a0,%a0)
+
; CHECK: btst #0, (-1,%a1,%a0)
; CHECK-SAME: encoding: [0x08,0x31,0x00,0x00,0x88,0xff]
btst #0, (-1,%a1,%a0)
diff --git a/llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s b/llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s
index 15d00b89f0f4f95..d0aa7a7d208f40e 100644
--- a/llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s
+++ b/llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s
@@ -1,5 +1,26 @@
; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s
+; CHECK: bchg %d0, (%a1)
+; CHECK-SAME: encoding: [0x01,0x51]
+bchg %d0, (%a1)
+; CHECK: bchg %d1, (%a0)
+; CHECK-SAME: encoding: [0x03,0x50]
+bchg %d1, (%a0)
+
+; CHECK: bclr %d0, (%a1)
+; CHECK-SAME: encoding: [0x01,0x91]
+bclr %d0, (%a1)
+; CHECK: bclr %d1, (%a0)
+; CHECK-SAME: encoding: [0x03,0x90]
+bclr %d1, (%a0)
+
+; CHECK: bset %d0, (%a1)
+; CHECK-SAME: encoding: [0x01,0xd1]
+bset %d0, (%a1)
+; CHECK: bset %d1, (%a0)
+; CHECK-SAME: encoding: [0x03,0xd0]
+bset %d1, (%a0)
+
; CHECK: btst %d0, (%a1)
; CHECK-SAME: encoding: [0x01,0x11]
btst %d0, (%a1)
@@ -7,6 +28,27 @@ btst %d0, (%a1)
; CHECK-SAME: encoding: [0x03,0x10]
btst %d1, (%a0)
+; CHECK: bchg %d0, (%a1)+
+; CHECK-SAME: encoding: [0x01,0x59]
+bchg %d0, (%a1)+
+; CHECK: bchg %d1, (%a0)+
+; CHECK-SAME: encoding: [0x03,0x58]
+bchg %d1, (%a0)+
+
+; CHECK: bclr %d0, (%a1)+
+; CHECK-SAME: encoding: [0x01,0x99]
+bclr %d0, (%a1)+
+; CHECK: bclr %d1, (%a0)+
+; CHECK-SAME: encoding: [0x03,0x98]
+bclr %d1, (%a0)+
+
+; CHECK: bset %d0, (%a1)+
+; CHECK-SAME: encoding: [0x01,0xd9]
+bset %d0, (%a1)+
+; CHECK: bset %d1, (%a0)+
+; CHECK-SAME: encoding: [0x03,0xd8]
+bset %d1, (%a0)+
+
; CHECK: btst %d0, (%a1)+
; CHECK-SAME: encoding: [0x01,0x19]
btst %d0, (%a1)+
@@ -14,6 +56,27 @@ btst %d0, (%a1)+
; CHECK-SAME: encoding: [0x03,0x18]
btst %d1, (%a0)+
+; CHECK: bchg %d0, -(%a1)
+; CHECK-SAME: encoding: [0x01,0x61]
+bchg %d0, -(%a1)
+; CHECK: bchg %d1, -(%a0)
+; CHECK-SAME: encoding: [0x03,0x60]
+bchg %d1, -(%a0)
+
+; CHECK: bclr %d0, -(%a1)
+; CHECK-SAME: encoding: [0x01,0xa1]
+bclr %d0, -(%a1)
+; CHECK: bclr %d1, -(%a0)
+; CHECK-SAME: encoding: [0x03,0xa0]
+bclr %d1, -(%a0)
+
+; CHECK: bset %d0, -(%a1)
+; CHECK-SAME: encoding: [0x01,0xe1]
+bset %d0, -(%a1)
+; CHECK: bset %d1, -(%a0)
+; CHECK-SAME: encoding: [0x03,0xe0]
+bset %d1, -(%a0)
+
; CHECK: btst %d0, -(%a1)
; CHECK-SAME: encoding: [0x01,0x21]
btst %d0, -(%a1)
@@ -21,6 +84,27 @@ btst %d0, -(%a1)
; CHECK-SAME: encoding: [0x03,0x20]
btst %d1, -(%a0)
+; CHECK: bchg %d0, (-1,%a1)
+; CHECK-SAME: encoding: [0x01,0x69,0xff,0xff]
+bchg %d0, (-1,%a1)
+; CHECK: bchg %d1, (0,%a0)
+; CHECK-SAME: encoding: [0x03,0x68,0x00,0x00]
+bchg %d1, (0,%a0)
+
+; CHECK: bclr %d0, (-1,%a1)
+; CHECK-SAME: encoding: [0x01,0xa9,0xff,0xff]
+bclr %d0, (-1,%a1)
+; CHECK: bclr %d1, (0,%a0)
+; CHECK-SAME: encoding: [0x03,0xa8,0x00,0x00]
+bclr %d1, (0,%a0)
+
+; CHECK: bset %d0, (-1,%a1)
+; CHECK-SAME: encoding: [0x01,0xe9,0xff,0xff]
+bset %d0, (-1,%a1)
+; CHECK: bset %d1, (0,%a0)
+; CHECK-SAME: encoding: [0x03,0xe8,0x00,0x00]
+bset %d1, (0,%a0)
+
; CHECK: btst %d0, (-1,%a1)
; CHECK-SAME: encoding: [0x01,0x29,0xff,0xff]
btst %d0, (-1,%a1)
@@ -28,6 +112,27 @@ btst %d0, (-1,%a1)
; CHECK-SAME: encoding: [0x03,0x28,0x00,0x00]
btst %d1, (0,%a0)
+; CHECK: bchg %d0, (-1,%a1,%a0)
+; CHECK-SAME: encoding: [0x01,0x71,0x88,0xff]
+bchg %d0, (-1,%a1,%a0)
+; CHECK: bchg %d1, (0,%a0,%a0)
+; CHECK-SAME: encoding: [0x03,0x70,0x88,0x00]
+bchg %d1, (0,%a0,%a0)
+
+; CHECK: bclr %d0, (-1,%a1,%a0)
+; CHECK-SAME: encoding: [0x01,0xb1,0x88,0xff]
+bclr %d0, (-1,%a1,%a0)
+; CHECK: bclr %d1, (0,%a0,%a0)
+; CHECK-SAME: encoding: [0x03,0xb0,0x88,0x00]
+bclr %d1, (0,%a0,%a0)
+
+; CHECK: bset %d0, (-1,%a1,%a0)
+; CHECK-SAME: encoding: [0x01,0xf1,0x88,0xff]
+bset %d0, (-1,%a1,%a0)
+; CHECK: bset %d1, (0,%a0,%a0)
+; CHECK-SAME: encoding: [0x03,0xf0,0x88,0x00]
+bset %d1, (0,%a0,%a0)
+
; CHECK: btst %d0, (-1,%a1,%a0)
; CHECK-SAME: encoding: [0x01,0x31,0x88,0xff]
btst %d0, (-1,%a1,%a0)
diff --git a/llvm/test/MC/M68k/Bits/Classes/MxBTST_RR.s b/llvm/test/MC/M68k/Bits/Classes/MxBTST_RR.s
index 9d72e608bec482a..ba3dc7095ca579c 100644
--- a/llvm/test/MC/M68k/Bits/Classes/MxBTST_RR.s
+++ b/llvm/test/MC/M68k/Bits/Classes/MxBTST_RR.s
@@ -1,5 +1,26 @@
; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s
+; CHECK: bchg %d1, %d0
+; CHECK-SAME: encoding: [0x03,0x40]
+bchg %d1, %d0
+; CHECK: bchg %d0, %d3
+; CHECK-SAME: encoding: [0x01,0x43]
+bchg %d0, %d3
+
+; CHECK: bclr %d1, %d0
+; CHECK-SAME: encoding: [0x03,0x80]
+bclr %d1, %d0
+; CHECK: bclr %d0, %d3
+; CHECK-SAME: encoding: [0x01,0x83]
+bclr %d0, %d3
+
+; CHECK: bset %d1, %d0
+; CHECK-SAME: encoding: [0x03,0xc0]
+bset %d1, %d0
+; CHECK: bset %d0, %d3
+; CHECK-SAME: encoding: [0x01,0xc3]
+bset %d0, %d3
+
; CHECK: btst %d1, %d0
; CHECK-SAME: encoding: [0x03,0x00]
btst %d1, %d0
More information about the llvm-commits
mailing list