]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Make __divdi3 handle div by zero same as hardware.
authorJim Wilson <jimw@sifive.com>
Tue, 2 Jun 2020 18:19:39 +0000 (11:19 -0700)
committerKito Cheng <kito.cheng@sifive.com>
Mon, 20 Feb 2023 11:03:42 +0000 (19:03 +0800)
commitd465a40200324d56c51f02f2c5807e716f9c8775
tree5f47158254a5a5d38dbd8d3af9611c1d6171797c
parentb7fa32ad2b428c7dcb62e6eef8dd330e5186a0c5
RISC-V: Make __divdi3 handle div by zero same as hardware.

The ISA manual specifies that divide by zero always returns -1 as the result.
We were failing to do that when the dividend was negative.

Original patch from Virginie Moser.

libgcc/
* config/riscv/div.S (__divdi3): For negative arguments, change bgez
to bgtz.

(cherry picked from commit 4013baf99c38f7bca06a51f8301e8fb195ccfa33)
libgcc/config/riscv/div.S