aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLulu Cai <cailulu@loongson.cn>2025-04-21 10:47:43 +0800
committercailulu <cailulu@loongson.cn>2025-04-23 14:51:39 +0800
commit1b4493da0897761187816d795de2562cf91ffc8a (patch)
tree41e534e2a9f0a6d5b773f2663288104a63e3f743
parent9dd98830e85cf98aafa224e485b3823210a20350 (diff)
downloadbinutils-1b4493da0897761187816d795de2562cf91ffc8a.zip
binutils-1b4493da0897761187816d795de2562cf91ffc8a.tar.gz
binutils-1b4493da0897761187816d795de2562cf91ffc8a.tar.bz2
LoongArch: Add test for divide by zero in instructions
Added tests for division/modulo by zero for instruction expressions.
-rw-r--r--gas/testsuite/gas/loongarch/div_zero.l4
-rw-r--r--gas/testsuite/gas/loongarch/div_zero.s2
-rw-r--r--gas/testsuite/gas/loongarch/loongarch.exp1
3 files changed, 7 insertions, 0 deletions
diff --git a/gas/testsuite/gas/loongarch/div_zero.l b/gas/testsuite/gas/loongarch/div_zero.l
new file mode 100644
index 0000000..b30c665
--- /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 0000000..44a5c26
--- /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 0e836f7..d2008f4 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"
}
}