History

arm-asm: Make "!" optional in asm_block_data_transfer_opcode

Danny Milosavljevic committed 5 years ago

Commit d60d2bb1 parent 704c8162 files · +15 −12Browse files

Unified · Split

2 files
  1. arm-asm.c +13 −12
  2. tests/arm-asm-testsuite.sh +2 −0
arm-asm.c+13−12
@@ -329,7 +329,7 @@ static void asm_binary_opcode(TCCState *s1, int token) · 328 unmodified lines
329329 static void asm_block_data_transfer_opcode(TCCState *s1, int token)
330330 {
331331 uint32_t opcode;
332− int op0_exclam;
332+ int op0_exclam = 0;
333333 Operand ops[2];
334334 int nb_ops = 1;
335335 parse_operand(s1, &ops[0]);
@@ -388,30 +388,30 @@ static void asm_block_data_transfer_opcode(TCCState *s1, int token) · 52 unmodified lines
388388 case TOK_ASM_ldmibeq:
389389 switch (ARM_INSTRUCTION_GROUP(token)) {
390390 case TOK_ASM_stmdaeq: // post-decrement store
391− opcode = 0x82 << 20;
391+ opcode = 0x80 << 20;
392392 break;
393393 case TOK_ASM_ldmdaeq: // post-decrement load
394− opcode = 0x83 << 20;
394+ opcode = 0x81 << 20;
395395 break;
396396 case TOK_ASM_stmeq: // post-increment store
397397 case TOK_ASM_stmiaeq: // post-increment store
398− opcode = 0x8a << 20;
398+ opcode = 0x88 << 20;
399399 break;
400400 case TOK_ASM_ldmeq: // post-increment load
401401 case TOK_ASM_ldmiaeq: // post-increment load
402− opcode = 0x8b << 20;
402+ opcode = 0x89 << 20;
403403 break;
404404 case TOK_ASM_stmdbeq: // pre-decrement store
405− opcode = 0x92 << 20;
405+ opcode = 0x90 << 20;
406406 break;
407407 case TOK_ASM_ldmdbeq: // pre-decrement load
408− opcode = 0x93 << 20;
408+ opcode = 0x91 << 20;
409409 break;
410410 case TOK_ASM_stmibeq: // pre-increment store
411− opcode = 0x9a << 20;
411+ opcode = 0x98 << 20;
412412 break;
413413 case TOK_ASM_ldmibeq: // pre-increment load
414− opcode = 0x9b << 20;
414+ opcode = 0x99 << 20;
415415 break;
416416 default:
417417 tcc_error("internal error: This place should not be reached (fallback in asm_block_data_transfer_opcode)");
@@ -423,10 +423,11 @@ static void asm_block_data_transfer_opcode(TCCState *s1, int token) · 5 unmodified lines
423423 expect("exactly two operands");
424424 else if (ops[0].type != OP_REG32)
425425 expect("(first operand) register");
426− else if (!op0_exclam)
427− tcc_error("first operand of '%s' should have an exclamation mark", get_tok_str(token, NULL));
428− else
426+ else {
427+ if (op0_exclam)
428+ opcode |= 1 << 21; // writeback
429429 asm_emit_opcode(token, opcode | ENCODE_RN(ops[0].reg) | ops[1].regset);
430+ }
430431 break;
431432 default:
432433 expect("block data transfer instruction");
tests/arm-asm-testsuite.sh+2−0
@@ -56,6 +56,8 @@ do · 55 unmodified lines
5656 "{r3,r5,r4}" \
5757 "r2!, {r3,r4,r5}" \
5858 "r2!, {r3,r5,r4}" \
59+ "r2, {r3,r4,r5}" \
60+ "r2, {r3,r5,r4}" \
5961 "r2, [r3, r4]" \
6062 "r2, [r3, r4]!" \
6163 "r2, [r3, -r4]" \

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