| @@ -155,7 +155,7 @@ ST_FUNC void gen_expr32(ExprValue *pe) · 154 unmodified lines |
| 155 | 155 | |
| 156 | 156 | static uint32_t condition_code_of_token(int token) { |
| 157 | 157 | if (token < TOK_ASM_nopeq) { |
| 158 | | − expect("instruction"); |
| 158 | + expect("condition-enabled instruction"); |
| 159 | 159 | return 0; |
| 160 | 160 | } else |
| 161 | 161 | return (token - TOK_ASM_nopeq) & 15; |
| @@ -335,6 +335,7 @@ static void asm_coprocessor_opcode(TCCState *s1, int token) { · 173 unmodified lines |
| 335 | 335 | Operand opcode2; |
| 336 | 336 | uint8_t registers[3]; |
| 337 | 337 | unsigned int i; |
| 338 | + uint8_t high_nibble; |
| 338 | 339 | |
| 339 | 340 | if (tok >= TOK_ASM_p0 && tok <= TOK_ASM_p15) { |
| 340 | 341 | coprocessor = tok - TOK_ASM_p0; |
| @@ -380,7 +381,11 @@ static void asm_coprocessor_opcode(TCCState *s1, int token) { · 39 unmodified lines |
| 380 | 381 | return; |
| 381 | 382 | } |
| 382 | 383 | |
| 383 | | − asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode1.e.v, registers[0], registers[1], registers[2], opcode2.e.v, 0); |
| 384 | + if (token == TOK_ASM_cdp2) |
| 385 | + high_nibble = 0xF; |
| 386 | + else |
| 387 | + high_nibble = condition_code_of_token(token); |
| 388 | + asm_emit_coprocessor_opcode(high_nibble, coprocessor, opcode1.e.v, registers[0], registers[1], registers[2], opcode2.e.v, 0); |
| 384 | 389 | } |
| 385 | 390 | |
| 386 | 391 | /* data processing and single data transfer instructions only */ |
| @@ -1426,9 +1431,14 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 1039 unmodified lines |
| 1426 | 1431 | } |
| 1427 | 1432 | if (token == TOK_EOF) |
| 1428 | 1433 | return; |
| 1429 | | − if (token < TOK_ASM_nopeq) { |
| 1430 | | − expect("instruction"); |
| 1431 | | − return; |
| 1434 | + if (token < TOK_ASM_nopeq) { // no condition code |
| 1435 | + switch (token) { |
| 1436 | + case TOK_ASM_cdp2: |
| 1437 | + return asm_coprocessor_opcode(s1, token); |
| 1438 | + default: |
| 1439 | + expect("instruction"); |
| 1440 | + return; |
| 1441 | + } |
| 1432 | 1442 | } |
| 1433 | 1443 | |
| 1434 | 1444 | switch (ARM_INSTRUCTION_GROUP(token)) { |