Revision 9363dedb tcg/i386/tcg-target.c
b/tcg/i386/tcg-target.c | ||
---|---|---|
190 | 190 |
#define OPC_SHIFT_cl (0xd3) |
191 | 191 |
#define OPC_TESTL (0x85) |
192 | 192 |
|
193 |
/* Group 1 opcode extensions for 0x80-0x83. */ |
|
193 |
#define OPC_GRP3_Ev (0xf7) |
|
194 |
#define OPC_GRP5 (0xff) |
|
195 |
|
|
196 |
/* Group 1 opcode extensions for 0x80-0x83. |
|
197 |
These are also used as modifiers for OPC_ARITH. */ |
|
194 | 198 |
#define ARITH_ADD 0 |
195 | 199 |
#define ARITH_OR 1 |
196 | 200 |
#define ARITH_ADC 2 |
... | ... | |
207 | 211 |
#define SHIFT_SHR 5 |
208 | 212 |
#define SHIFT_SAR 7 |
209 | 213 |
|
210 |
/* Group 5 opcode extensions for 0xff. */ |
|
211 |
#define EXT_CALLN_Ev 2 |
|
212 |
#define EXT_JMPN_Ev 4 |
|
214 |
/* Group 3 opcode extensions for 0xf6, 0xf7. To be used with OPC_GRP3. */ |
|
215 |
#define EXT3_NOT 2 |
|
216 |
#define EXT3_NEG 3 |
|
217 |
#define EXT3_MUL 4 |
|
218 |
#define EXT3_IMUL 5 |
|
219 |
#define EXT3_DIV 6 |
|
220 |
#define EXT3_IDIV 7 |
|
221 |
|
|
222 |
/* Group 5 opcode extensions for 0xff. To be used with OPC_GRP5. */ |
|
223 |
#define EXT5_CALLN_Ev 2 |
|
224 |
#define EXT5_JMPN_Ev 4 |
|
213 | 225 |
|
214 | 226 |
/* Condition codes to be added to OPC_JCC_{long,short}. */ |
215 | 227 |
#define JCC_JMP (-1) |
... | ... | |
1060 | 1072 |
tcg_out32(s, 0); |
1061 | 1073 |
} else { |
1062 | 1074 |
/* indirect jump method */ |
1063 |
tcg_out_modrm_offset(s, 0xff, EXT_JMPN_Ev, -1,
|
|
1075 |
tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, -1,
|
|
1064 | 1076 |
(tcg_target_long)(s->tb_next + args[0])); |
1065 | 1077 |
} |
1066 | 1078 |
s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf; |
... | ... | |
1070 | 1082 |
tcg_out_calli(s, args[0]); |
1071 | 1083 |
} else { |
1072 | 1084 |
/* call *reg */ |
1073 |
tcg_out_modrm(s, 0xff, EXT_CALLN_Ev, args[0]);
|
|
1085 |
tcg_out_modrm(s, OPC_GRP5, EXT5_CALLN_Ev, args[0]);
|
|
1074 | 1086 |
} |
1075 | 1087 |
break; |
1076 | 1088 |
case INDEX_op_jmp: |
... | ... | |
1079 | 1091 |
tcg_out32(s, args[0] - (tcg_target_long)s->code_ptr - 4); |
1080 | 1092 |
} else { |
1081 | 1093 |
/* jmp *reg */ |
1082 |
tcg_out_modrm(s, 0xff, EXT_JMPN_Ev, args[0]);
|
|
1094 |
tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, args[0]);
|
|
1083 | 1095 |
} |
1084 | 1096 |
break; |
1085 | 1097 |
case INDEX_op_br: |
... | ... | |
1156 | 1168 |
} |
1157 | 1169 |
break; |
1158 | 1170 |
case INDEX_op_mulu2_i32: |
1159 |
tcg_out_modrm(s, 0xf7, 4, args[3]);
|
|
1171 |
tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_MUL, args[3]);
|
|
1160 | 1172 |
break; |
1161 | 1173 |
case INDEX_op_div2_i32: |
1162 |
tcg_out_modrm(s, 0xf7, 7, args[4]);
|
|
1174 |
tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_IDIV, args[4]);
|
|
1163 | 1175 |
break; |
1164 | 1176 |
case INDEX_op_divu2_i32: |
1165 |
tcg_out_modrm(s, 0xf7, 6, args[4]);
|
|
1177 |
tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_DIV, args[4]);
|
|
1166 | 1178 |
break; |
1167 | 1179 |
case INDEX_op_shl_i32: |
1168 | 1180 |
c = SHIFT_SHL; |
... | ... | |
1226 | 1238 |
break; |
1227 | 1239 |
|
1228 | 1240 |
case INDEX_op_neg_i32: |
1229 |
tcg_out_modrm(s, 0xf7, 3, args[0]);
|
|
1241 |
tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_NEG, args[0]);
|
|
1230 | 1242 |
break; |
1231 | 1243 |
|
1232 | 1244 |
case INDEX_op_not_i32: |
1233 |
tcg_out_modrm(s, 0xf7, 2, args[0]);
|
|
1245 |
tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_NOT, args[0]);
|
|
1234 | 1246 |
break; |
1235 | 1247 |
|
1236 | 1248 |
case INDEX_op_ext8s_i32: |
... | ... | |
1398 | 1410 |
stack_addend = frame_size - push_size; |
1399 | 1411 |
tcg_out_addi(s, TCG_REG_ESP, -stack_addend); |
1400 | 1412 |
|
1401 |
tcg_out_modrm(s, 0xff, EXT_JMPN_Ev, TCG_REG_EAX); /* jmp *%eax */
|
|
1413 |
tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_EAX); /* jmp *%eax */
|
|
1402 | 1414 |
|
1403 | 1415 |
/* TB epilogue */ |
1404 | 1416 |
tb_ret_addr = s->code_ptr; |
Also available in: Unified diff