|
13 | 13 | /// Machine:
|
14 | 14 | ///
|
15 | 15 | /// ADD [~] ADDA [~] ADDI [~] ADDQ [ ] ADDX [~]
|
16 |
| -/// CLR [ ] CMP [~] CMPA [~] CMPI [~] CMPM [ ] |
| 16 | +/// CLR [~] CMP [~] CMPA [~] CMPI [~] CMPM [ ] |
17 | 17 | /// CMP2 [ ] DIVS/DIVU [~] DIVSL/DIVUL [ ] EXT [~] EXTB [ ]
|
18 | 18 | /// MULS/MULU [~] NEG [~] NEGX [~] NOT [~] SUB [~]
|
19 | 19 | /// SUBA [~] SUBI [~] SUBQ [ ] SUBX [~]
|
@@ -1106,3 +1106,60 @@ defm FADD : MxFBinaryOp<"add", 0b1100010, 0b1100110, 0b0100010>;
|
1106 | 1106 | defm FSUB : MxFBinaryOp<"sub", 0b1101000, 0b1101100, 0b0101000>;
|
1107 | 1107 | defm FMUL : MxFBinaryOp<"mul", 0b1100011, 0b1100111, 0b0100011>;
|
1108 | 1108 | defm FDIV : MxFBinaryOp<"div", 0b1100000, 0b1100100, 0b0100000>;
|
| 1109 | + |
| 1110 | + |
| 1111 | +//===----------------------------------------------------------------------===// |
| 1112 | +// CLR |
| 1113 | +//===----------------------------------------------------------------------===// |
| 1114 | + |
| 1115 | +/// --------------------------------------------------- |
| 1116 | +/// F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 |
| 1117 | +/// --------------------------------------------------- |
| 1118 | +/// | | EFFECTIVE ADDRESS |
| 1119 | +/// 0 1 0 0 0 0 1 0 | SIZE | MODE | REG |
| 1120 | +/// --------------------------------------------------- |
| 1121 | + |
| 1122 | +let Defs = [CCR] in { |
| 1123 | + |
| 1124 | +class MxClr_D<MxType TYPE> |
| 1125 | + : MxInst<(outs TYPE.ROp:$dst), (ins), |
| 1126 | + "clr."#TYPE.Prefix#"\t$dst", |
| 1127 | + [(set TYPE.VT:$dst, (TYPE.VT 0))]> { |
| 1128 | + let Inst = (descend 0b01000010, |
| 1129 | + /*SIZE*/!cast<MxEncSize>("MxEncSize"#TYPE.Size).Value, |
| 1130 | + //MODE without last bit |
| 1131 | + 0b00, |
| 1132 | + //REGISTER prefixed by D/A bit |
| 1133 | + (operand "$dst", 4) |
| 1134 | + ); |
| 1135 | +} |
| 1136 | + |
| 1137 | +// CLR reads memory before clearing on M68000 and M68008 |
| 1138 | +// TODO: mayLoad is *only* applicable on M68000 and M68008 |
| 1139 | +let mayLoad = 1, mayStore = 1 in |
| 1140 | +class MxClr_M<MxType TYPE, MxOpBundle DST, MxEncMemOp DST_ENC> |
| 1141 | + : MxInst<(outs), (ins DST.Op:$dst), |
| 1142 | + "clr."#TYPE.Prefix#"\t$dst", |
| 1143 | + [(store (TYPE.VT 0), DST.Pat:$dst)]> { |
| 1144 | + let Inst = (ascend |
| 1145 | + (descend 0b01000010, |
| 1146 | + /*SIZE*/!cast<MxEncSize>("MxEncSize"#TYPE.Size).Value, |
| 1147 | + DST_ENC.EA), DST_ENC.Supplement |
| 1148 | + ); |
| 1149 | +} |
| 1150 | +} // let Defs = [CCR] |
| 1151 | + |
| 1152 | +foreach S = [8, 16, 32] in { |
| 1153 | + defvar DTYPE = !cast<MxType>("MxType"#S#"d"); |
| 1154 | + def CLR#S#d : MxClr_D<DTYPE>; |
| 1155 | + |
| 1156 | + defvar MTYPE = !cast<MxType>("MxType"#S); |
| 1157 | + def CLR#S#j : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_j"), MxEncAddrMode_j<"dst">>; |
| 1158 | + def CLR#S#o : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_o"), MxEncAddrMode_o<"dst">>; |
| 1159 | + def CLR#S#e : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_e"), MxEncAddrMode_e<"dst">>; |
| 1160 | + def CLR#S#p : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_p"), MxEncAddrMode_p<"dst">>; |
| 1161 | + def CLR#S#f : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_f"), MxEncAddrMode_f<"dst">>; |
| 1162 | + def CLR#S#b : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_b"), MxEncAddrMode_abs<"dst", true>>; |
| 1163 | + def CLR#S#q : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_q"), MxEncAddrMode_q<"dst">>; |
| 1164 | + def CLR#S#k : MxClr_M<MTYPE, !cast<MxOpBundle>("MxOp"#S#"AddrMode_k"), MxEncAddrMode_k<"dst">>; |
| 1165 | +} |
0 commit comments