mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-15 05:20:06 +08:00
arm-asm: Add movt
This commit is contained in:
parent
86cc9c587b
commit
c882d03673
14
arm-asm.c
14
arm-asm.c
@ -226,7 +226,20 @@ static void asm_binary_opcode(TCCState *s1, int token)
|
|||||||
tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL));
|
tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL));
|
||||||
|
|
||||||
if (ops[1].type != OP_REG32) {
|
if (ops[1].type != OP_REG32) {
|
||||||
|
switch (ARM_INSTRUCTION_GROUP(token)) {
|
||||||
|
case TOK_ASM_movteq:
|
||||||
|
if (ops[1].type == OP_IM8 || ops[1].type == OP_IM8N || ops[1].type == OP_IM32) {
|
||||||
|
if (ops[1].e.v >= 0 && ops[1].e.v <= 0xFFFF) {
|
||||||
|
uint16_t immediate_value = ops[1].e.v;
|
||||||
|
asm_emit_opcode(token, 0x3400000 | (ops[0].reg << 12) | (immediate_value & 0xF000) << 4 | (immediate_value & 0xFFF));
|
||||||
|
} else
|
||||||
|
expect("(source operand) immediate 16 bit value");
|
||||||
|
} else
|
||||||
|
expect("(source operand) immediate");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
expect("(source operand) register");
|
expect("(source operand) register");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1120,6 +1133,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int token)
|
|||||||
case TOK_ASM_sxtheq:
|
case TOK_ASM_sxtheq:
|
||||||
case TOK_ASM_uxtbeq:
|
case TOK_ASM_uxtbeq:
|
||||||
case TOK_ASM_uxtheq:
|
case TOK_ASM_uxtheq:
|
||||||
|
case TOK_ASM_movteq:
|
||||||
return asm_binary_opcode(s1, token);
|
return asm_binary_opcode(s1, token);
|
||||||
|
|
||||||
case TOK_ASM_ldreq:
|
case TOK_ASM_ldreq:
|
||||||
|
Loading…
Reference in New Issue
Block a user