| @@ -329,7 +329,7 @@ static void asm_binary_opcode(TCCState *s1, int token) · 328 unmodified lines |
| 329 | 329 | static void asm_block_data_transfer_opcode(TCCState *s1, int token) |
| 330 | 330 | { |
| 331 | 331 | uint32_t opcode; |
| 332 | | − int op0_exclam; |
| 332 | + int op0_exclam = 0; |
| 333 | 333 | Operand ops[2]; |
| 334 | 334 | int nb_ops = 1; |
| 335 | 335 | parse_operand(s1, &ops[0]); |
| @@ -388,30 +388,30 @@ static void asm_block_data_transfer_opcode(TCCState *s1, int token) · 52 unmodified lines |
| 388 | 388 | case TOK_ASM_ldmibeq: |
| 389 | 389 | switch (ARM_INSTRUCTION_GROUP(token)) { |
| 390 | 390 | case TOK_ASM_stmdaeq: // post-decrement store |
| 391 | | − opcode = 0x82 << 20; |
| 391 | + opcode = 0x80 << 20; |
| 392 | 392 | break; |
| 393 | 393 | case TOK_ASM_ldmdaeq: // post-decrement load |
| 394 | | − opcode = 0x83 << 20; |
| 394 | + opcode = 0x81 << 20; |
| 395 | 395 | break; |
| 396 | 396 | case TOK_ASM_stmeq: // post-increment store |
| 397 | 397 | case TOK_ASM_stmiaeq: // post-increment store |
| 398 | | − opcode = 0x8a << 20; |
| 398 | + opcode = 0x88 << 20; |
| 399 | 399 | break; |
| 400 | 400 | case TOK_ASM_ldmeq: // post-increment load |
| 401 | 401 | case TOK_ASM_ldmiaeq: // post-increment load |
| 402 | | − opcode = 0x8b << 20; |
| 402 | + opcode = 0x89 << 20; |
| 403 | 403 | break; |
| 404 | 404 | case TOK_ASM_stmdbeq: // pre-decrement store |
| 405 | | − opcode = 0x92 << 20; |
| 405 | + opcode = 0x90 << 20; |
| 406 | 406 | break; |
| 407 | 407 | case TOK_ASM_ldmdbeq: // pre-decrement load |
| 408 | | − opcode = 0x93 << 20; |
| 408 | + opcode = 0x91 << 20; |
| 409 | 409 | break; |
| 410 | 410 | case TOK_ASM_stmibeq: // pre-increment store |
| 411 | | − opcode = 0x9a << 20; |
| 411 | + opcode = 0x98 << 20; |
| 412 | 412 | break; |
| 413 | 413 | case TOK_ASM_ldmibeq: // pre-increment load |
| 414 | | − opcode = 0x9b << 20; |
| 414 | + opcode = 0x99 << 20; |
| 415 | 415 | break; |
| 416 | 416 | default: |
| 417 | 417 | 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 |
| 423 | 423 | expect("exactly two operands"); |
| 424 | 424 | else if (ops[0].type != OP_REG32) |
| 425 | 425 | 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 |
| 429 | 429 | asm_emit_opcode(token, opcode | ENCODE_RN(ops[0].reg) | ops[1].regset); |
| 430 | + } |
| 430 | 431 | break; |
| 431 | 432 | default: |
| 432 | 433 | expect("block data transfer instruction"); |