History

arm-asm: Add movw

Danny Milosavljevic committed 5 years ago

Commit 14b79731 parent c882d032 files · +11 −1Browse files

Unified · Split

2 files
  1. arm-asm.c +10 −1
  2. arm-tok.h +1 −0
arm-asm.c+10−1
@@ -228,10 +228,18 @@ static void asm_binary_opcode(TCCState *s1, int token) · 227 unmodified lines
228 if (ops[1].type != OP_REG32) {228 if (ops[1].type != OP_REG32) {
229 switch (ARM_INSTRUCTION_GROUP(token)) {229 switch (ARM_INSTRUCTION_GROUP(token)) {
230 case TOK_ASM_movteq:230 case TOK_ASM_movteq:
231 case TOK_ASM_movweq:
231 if (ops[1].type == OP_IM8 || ops[1].type == OP_IM8N || ops[1].type == OP_IM32) {232 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 if (ops[1].e.v >= 0 && ops[1].e.v <= 0xFFFF) {
233 uint16_t immediate_value = ops[1].e.v;234 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 switch (ARM_INSTRUCTION_GROUP(token)) {
236 case TOK_ASM_movteq:
237 asm_emit_opcode(token, 0x3400000 | (ops[0].reg << 12) | (immediate_value & 0xF000) << 4 | (immediate_value & 0xFFF));
238 break;
239 case TOK_ASM_movweq:
240 asm_emit_opcode(token, 0x3000000 | (ops[0].reg << 12) | (immediate_value & 0xF000) << 4 | (immediate_value & 0xFFF));
241 break;
242 }
235 } else243 } else
236 expect("(source operand) immediate 16 bit value");244 expect("(source operand) immediate 16 bit value");
237 } else245 } else
@@ -1134,6 +1142,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 896 unmodified lines
1134 case TOK_ASM_uxtbeq:1142 case TOK_ASM_uxtbeq:
1135 case TOK_ASM_uxtheq:1143 case TOK_ASM_uxtheq:
1136 case TOK_ASM_movteq:1144 case TOK_ASM_movteq:
1145 case TOK_ASM_movweq:
1137 return asm_binary_opcode(s1, token);1146 return asm_binary_opcode(s1, token);
1138 1147
1139 case TOK_ASM_ldreq:1148 case TOK_ASM_ldreq:
arm-tok.h+1−0
@@ -70,6 +70,7 @@ · 69 unmodified lines
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 DEF_ASM_CONDED(movt)
73 DEF_ASM_CONDED(movw)
73 74
74 /* multiplication */75 /* multiplication */
75 76

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