Unified · Split
| @@ -127,31 +127,34 @@ static void parse_operand(TCCState *s1, Operand *op) · 126 unmodified lines | |||
| 127 | op->type = OP_REGSET32; | 127 | op->type = OP_REGSET32; |
| 128 | op->regset = regset; | 128 | op->regset = regset; |
| 129 | } | 129 | } |
| 130 | } else if (tok == '#' || tok == '$') { | 130 | return; |
| 131 | /* constant value */ | ||
| 132 | next(); // skip '#' or '$' | ||
| 133 | asm_expr(s1, &e); | ||
| 134 | op->type = OP_IM32; | ||
| 135 | op->e = e; | ||
| 136 | if (!op->e.sym) { | ||
| 137 | if ((int) op->e.v < 0 && (int) op->e.v >= -255) | ||
| 138 | op->type = OP_IM8N; | ||
| 139 | else if (op->e.v == (uint8_t)op->e.v) | ||
| 140 | op->type = OP_IM8; | ||
| 141 | } else | ||
| 142 | expect("constant"); | ||
| 143 | } else if ((reg = asm_parse_regvar(tok)) != -1) { | 131 | } else if ((reg = asm_parse_regvar(tok)) != -1) { |
| 144 | next(); // skip register name | 132 | next(); // skip register name |
| 145 | op->type = OP_REG32; | 133 | op->type = OP_REG32; |
| 146 | op->reg = (uint8_t) reg; | 134 | op->reg = (uint8_t) reg; |
| 135 | return; | ||
| 147 | } else if ((reg = asm_parse_vfp_regvar(tok, 0)) != -1) { | 136 | } else if ((reg = asm_parse_vfp_regvar(tok, 0)) != -1) { |
| 148 | next(); // skip register name | 137 | next(); // skip register name |
| 149 | op->type = OP_VREG32; | 138 | op->type = OP_VREG32; |
| 150 | op->reg = (uint8_t) reg; | 139 | op->reg = (uint8_t) reg; |
| 140 | return; | ||
| 151 | } else if ((reg = asm_parse_vfp_regvar(tok, 1)) != -1) { | 141 | } else if ((reg = asm_parse_vfp_regvar(tok, 1)) != -1) { |
| 152 | next(); // skip register name | 142 | next(); // skip register name |
| 153 | op->type = OP_VREG64; | 143 | op->type = OP_VREG64; |
| 154 | op->reg = (uint8_t) reg; | 144 | op->reg = (uint8_t) reg; |
| 145 | return; | ||
| 146 | } else if (tok == '#' || tok == '$') { | ||
| 147 | /* constant value */ | ||
| 148 | next(); // skip '#' or '$' | ||
| 149 | } | ||
| 150 | asm_expr(s1, &e); | ||
| 151 | op->type = OP_IM32; | ||
| 152 | op->e = e; | ||
| 153 | if (!op->e.sym) { | ||
| 154 | if ((int) op->e.v < 0 && (int) op->e.v >= -255) | ||
| 155 | op->type = OP_IM8N; | ||
| 156 | else if (op->e.v == (uint8_t)op->e.v) | ||
| 157 | op->type = OP_IM8; | ||
| 155 | } else | 158 | } else |
| 156 | expect("operand"); | 159 | expect("operand"); |
| 157 | } | 160 | } |
| @@ -1784,15 +1787,12 @@ static void asm_floating_point_immediate_data_processing_opcode_tail(TCCState *s · 1626 unmodified lines | |||
| 1784 | 1787 | ||
| 1785 | if (tok == '#' || tok == '$') { | 1788 | if (tok == '#' || tok == '$') { |
| 1786 | next(); | 1789 | next(); |
| 1787 | if (tok == '-') { | ||
| 1788 | op_minus = 1; | ||
| 1789 | next(); | ||
| 1790 | } | ||
| 1791 | immediate_value = vmov_parse_immediate_value(); | ||
| 1792 | } else { | ||
| 1793 | expect("'#'"); | ||
| 1794 | return; | ||
| 1795 | } | 1790 | } |
| 1791 | if (tok == '-') { | ||
| 1792 | op_minus = 1; | ||
| 1793 | next(); | ||
| 1794 | } | ||
| 1795 | immediate_value = vmov_parse_immediate_value(); | ||
| 1796 | 1796 | ||
| 1797 | opcode1 = 11; // "Other" instruction | 1797 | opcode1 = 11; // "Other" instruction |
| 1798 | switch (ARM_INSTRUCTION_GROUP(token)) { | 1798 | switch (ARM_INSTRUCTION_GROUP(token)) { |
| @@ -1959,7 +1959,7 @@ static void asm_floating_point_data_processing_opcode(TCCState *s1, int token) { · 160 unmodified lines | |||
| 1959 | 1959 | ||
| 1960 | for (nb_ops = 0; nb_ops < 3; ) { | 1960 | for (nb_ops = 0; nb_ops < 3; ) { |
| 1961 | // Note: Necessary because parse_operand can't parse decimal numerals. | 1961 | // Note: Necessary because parse_operand can't parse decimal numerals. |
| 1962 | if (nb_ops == 1 && (tok == '#' || tok == '$')) { | 1962 | if (nb_ops == 1 && (tok == '#' || tok == '$' || tok == TOK_PPNUM || tok == '-')) { |
| 1963 | asm_floating_point_immediate_data_processing_opcode_tail(s1, token, coprocessor, ops[0].reg); | 1963 | asm_floating_point_immediate_data_processing_opcode_tail(s1, token, coprocessor, ops[0].reg); |
| 1964 | return; | 1964 | return; |
| 1965 | } | 1965 | } |