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)
committerJim Wilson <jimw@sifive.com>
Tue, 2 Jun 2020 18:44:44 +0000 (11:44 -0700)
commit4013baf99c38f7bca06a51f8301e8fb195ccfa33
treeeb2611cf552e6acf4c9eaeb55b33f1ec3d9d46c2
parent578c013aa697cb81a46e9b335ce61c82c009c77f
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.
libgcc/config/riscv/div.S