History

arm-asm: Add movt

Danny Milosavljevic committed 5 years ago

Commit c882d031 parent 86cc9c52 files · +16 −1Browse files

Unified · Split

2 files
  1. arm-asm.c +15 −1
  2. arm-tok.h +1 −0
arm-asm.c+15−1
@@ -226,7 +226,20 @@ static void asm_binary_opcode(TCCState *s1, int token) · 225 unmodified lines
226 tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL));226 tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL));
227 227
228 if (ops[1].type != OP_REG32) {228 if (ops[1].type != OP_REG32) {
229 expect("(source operand) register");229 switch (ARM_INSTRUCTION_GROUP(token)) {
230 case TOK_ASM_movteq:
231 if (ops[1].type == OP_IM8 || ops[1].type == OP_IM8N || ops[1].type == OP_IM32) {
232 if (ops[1].e.v >= 0 && ops[1].e.v <= 0xFFFF) {
233 uint16_t immediate_value = ops[1].e.v;
234 asm_emit_opcode(token, 0x3400000 | (ops[0].reg << 12) | (immediate_value & 0xF000) << 4 | (immediate_value & 0xFFF));
235 } else
236 expect("(source operand) immediate 16 bit value");
237 } else
238 expect("(source operand) immediate");
239 break;
240 default:
241 expect("(source operand) register");
242 }
230 return;243 return;
231 }244 }
232 245
@@ -1120,6 +1133,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 887 unmodified lines
1120 case TOK_ASM_sxtheq:1133 case TOK_ASM_sxtheq:
1121 case TOK_ASM_uxtbeq:1134 case TOK_ASM_uxtbeq:
1122 case TOK_ASM_uxtheq:1135 case TOK_ASM_uxtheq:
1136 case TOK_ASM_movteq:
1123 return asm_binary_opcode(s1, token);1137 return asm_binary_opcode(s1, token);
1124 1138
1125 case TOK_ASM_ldreq:1139 case TOK_ASM_ldreq:
arm-tok.h+1−0
@@ -69,6 +69,7 @@ · 68 unmodified lines
69 DEF_ASM_CONDED(sxth)69 DEF_ASM_CONDED(sxth)
70 DEF_ASM_CONDED(uxtb)70 DEF_ASM_CONDED(uxtb)
71 DEF_ASM_CONDED(uxth)71 DEF_ASM_CONDED(uxth)
72 DEF_ASM_CONDED(movt)
72 73
73 /* multiplication */74 /* multiplication */
74 75

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t