[PATCH] LoongArch: Add test for divide by zero in instructions
Lulu Cai
cailulu@loongson.cn
Mon Apr 21 03:17:34 GMT 2025
Added tests for division/modulo by zero for instruction expressions.
---
gas/testsuite/gas/loongarch/div_zero.l | 4 ++++
gas/testsuite/gas/loongarch/div_zero.s | 2 ++
gas/testsuite/gas/loongarch/loongarch.exp | 1 +
3 files changed, 7 insertions(+)
create mode 100644 gas/testsuite/gas/loongarch/div_zero.l
create mode 100644 gas/testsuite/gas/loongarch/div_zero.s
diff --git a/gas/testsuite/gas/loongarch/div_zero.l b/gas/testsuite/gas/loongarch/div_zero.l
new file mode 100644
index 00000000000..b30c6657ecf
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/div_zero.l
@@ -0,0 +1,4 @@
+#source: div_zero.s
+.*: Assembler messages:
+.*: Warning: Divide by zero!
+.*: Warning: Divide by zero!
diff --git a/gas/testsuite/gas/loongarch/div_zero.s b/gas/testsuite/gas/loongarch/div_zero.s
new file mode 100644
index 00000000000..44a5c269da6
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/div_zero.s
@@ -0,0 +1,2 @@
+addi.w $a0,$a1,2/0
+addi.d $a0,$a1,4%0
diff --git a/gas/testsuite/gas/loongarch/loongarch.exp b/gas/testsuite/gas/loongarch/loongarch.exp
index 0e836f7f217..d2008f4e9ed 100644
--- a/gas/testsuite/gas/loongarch/loongarch.exp
+++ b/gas/testsuite/gas/loongarch/loongarch.exp
@@ -37,5 +37,6 @@ if [istarget loongarch*-*-*] {
run_list_test "illegal-operand"
run_list_test "pseudo_op_option_fail"
run_list_test "negative_right_shift"
+ run_list_test "div_zero"
}
}
--
2.34.1
More information about the Binutils
mailing list