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
226226 tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL));
227227
228228 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+ }
230243 return;
231244 }
232245
@@ -1120,6 +1133,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 887 unmodified lines
11201133 case TOK_ASM_sxtheq:
11211134 case TOK_ASM_uxtbeq:
11221135 case TOK_ASM_uxtheq:
1136+ case TOK_ASM_movteq:
11231137 return asm_binary_opcode(s1, token);
11241138
11251139 case TOK_ASM_ldreq:
arm-tok.h+1−0
@@ -69,6 +69,7 @@ · 68 unmodified lines
6969 DEF_ASM_CONDED(sxth)
7070 DEF_ASM_CONDED(uxtb)
7171 DEF_ASM_CONDED(uxth)
72+ DEF_ASM_CONDED(movt)
7273
7374 /* multiplication */
7475

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