[binutils-gdb] LoongArch: Add test for divide by zero in instructions

liu zhensong liuzhensong@sourceware.org
Wed Apr 23 06:52:16 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1b4493da0897761187816d795de2562cf91ffc8a

commit 1b4493da0897761187816d795de2562cf91ffc8a
Author: Lulu Cai <cailulu@loongson.cn>
Date:   Mon Apr 21 10:47:43 2025 +0800

    LoongArch: Add test for divide by zero in instructions
    
    Added tests for division/modulo by zero for instruction expressions.

Diff:
---
 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(+)

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"
   }
 }


More information about the Binutils-cvs mailing list