代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/binutils 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 75fd1d4832ec228aa66be49e24ba686bfeb5507b Mon Sep 17 00:00:00 2001
From: Lulu Cai <cailulu@loongson.cn>
Date: Mon, 2 Sep 2024 12:05:54 +0800
Subject: [PATCH 119/123] 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 "-".
---
gas/config/loongarch-parse.y | 24 ++++++++++++------------
gas/testsuite/gas/loongarch/insn_expr.d | 10 ++++++++++
gas/testsuite/gas/loongarch/insn_expr.s | 1 +
3 files changed, 23 insertions(+), 12 deletions(-)
create mode 100644 gas/testsuite/gas/loongarch/insn_expr.d
create mode 100644 gas/testsuite/gas/loongarch/insn_expr.s
diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y
index f786fdae..ec5a4166 100644
--- a/gas/config/loongarch-parse.y
+++ b/gas/config/loongarch-parse.y
@@ -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
diff --git a/gas/testsuite/gas/loongarch/insn_expr.d b/gas/testsuite/gas/loongarch/insn_expr.d
new file mode 100644
index 00000000..9abc711a
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/insn_expr.d
@@ -0,0 +1,10 @@
+#as:
+#objdump: -d
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+0+ <\.text>:
+ 0: 02c00ca4 addi.d \$a0, \$a1, 3
diff --git a/gas/testsuite/gas/loongarch/insn_expr.s b/gas/testsuite/gas/loongarch/insn_expr.s
new file mode 100644
index 00000000..3b9ef08a
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/insn_expr.s
@@ -0,0 +1 @@
+addi.d $a0,$a1,(8 >> 2 + 1)
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。