mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-19 13:53:29 +08:00
Fix for MUL instruction on the v850
* sim/v850/simops.c (Multiply64): Properly test if we need to negate either of the operands. * sim/testsuite/v850/mul.cgs: New test.
This commit is contained in:
15
sim/testsuite/v850/mul.cgs
Normal file
15
sim/testsuite/v850/mul.cgs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# v850e mul
|
||||||
|
# mach: v850e
|
||||||
|
# as(v850e): -mv850e
|
||||||
|
|
||||||
|
.include "testutils.inc"
|
||||||
|
|
||||||
|
# Trivial regression test for incorrect sign bit handling in mul
|
||||||
|
|
||||||
|
seti -10, r1
|
||||||
|
seti 2, r2
|
||||||
|
mul r1, r2, r3
|
||||||
|
reg r2, -20
|
||||||
|
reg r3, -1
|
||||||
|
|
||||||
|
pass
|
@ -339,10 +339,10 @@ Multiply64 (int sign, unsigned long op0)
|
|||||||
|
|
||||||
sign = (op0 ^ op1) & 0x80000000;
|
sign = (op0 ^ op1) & 0x80000000;
|
||||||
|
|
||||||
if (((signed long) op0) < 0)
|
if (op0 & 0x80000000)
|
||||||
op0 = - op0;
|
op0 = - op0;
|
||||||
|
|
||||||
if (((signed long) op1) < 0)
|
if (op1 & 0x80000000)
|
||||||
op1 = - op1;
|
op1 = - op1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user