mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
LoongArch: Fixed precedence of expression operators in instructions
The precedence of the operators "+" and "-" in the current loongarch instruction expression is higher than "<<" and ">>", which is different from the explanation in the user guide. We modified the precedence of "<<" and ">>" to be higher than "+" and "-".
This commit is contained in:
parent
4bc828f876
commit
6c2358b90a
@ -368,24 +368,24 @@ multiplicative_expression
|
||||
| multiplicative_expression '%' unary_expression {emit_bin ('%');}
|
||||
;
|
||||
|
||||
additive_expression
|
||||
shift_expression
|
||||
: multiplicative_expression
|
||||
| additive_expression '+' multiplicative_expression {emit_bin ('+');}
|
||||
| additive_expression '-' multiplicative_expression {emit_bin ('-');}
|
||||
| shift_expression LEFT_OP multiplicative_expression {emit_bin (LEFT_OP);}
|
||||
| shift_expression RIGHT_OP multiplicative_expression {emit_bin (RIGHT_OP);}
|
||||
;
|
||||
|
||||
shift_expression
|
||||
: additive_expression
|
||||
| shift_expression LEFT_OP additive_expression {emit_bin (LEFT_OP);}
|
||||
| shift_expression RIGHT_OP additive_expression {emit_bin (RIGHT_OP);}
|
||||
additive_expression
|
||||
: shift_expression
|
||||
| additive_expression '+' shift_expression {emit_bin ('+');}
|
||||
| additive_expression '-' shift_expression {emit_bin ('-');}
|
||||
;
|
||||
|
||||
relational_expression
|
||||
: shift_expression
|
||||
| relational_expression '<' shift_expression {emit_bin ('<');}
|
||||
| relational_expression '>' shift_expression {emit_bin ('>');}
|
||||
| relational_expression LE_OP shift_expression {emit_bin (LE_OP);}
|
||||
| relational_expression GE_OP shift_expression {emit_bin (GE_OP);}
|
||||
: additive_expression
|
||||
| relational_expression '<' additive_expression {emit_bin ('<');}
|
||||
| relational_expression '>' additive_expression {emit_bin ('>');}
|
||||
| relational_expression LE_OP additive_expression {emit_bin (LE_OP);}
|
||||
| relational_expression GE_OP additive_expression {emit_bin (GE_OP);}
|
||||
;
|
||||
|
||||
equality_expression
|
||||
|
10
gas/testsuite/gas/loongarch/insn_expr.d
Normal file
10
gas/testsuite/gas/loongarch/insn_expr.d
Normal file
@ -0,0 +1,10 @@
|
||||
#as:
|
||||
#objdump: -d
|
||||
|
||||
.*: file format .*
|
||||
|
||||
|
||||
Disassembly of section \.text:
|
||||
|
||||
0+ <\.text>:
|
||||
0: 02c00ca4 addi.d \$a0, \$a1, 3
|
1
gas/testsuite/gas/loongarch/insn_expr.s
Normal file
1
gas/testsuite/gas/loongarch/insn_expr.s
Normal file
@ -0,0 +1 @@
|
||||
addi.d $a0,$a1,(8 >> 2 + 1)
|
Loading…
Reference in New Issue
Block a user