diff mbox series

powerpc/sstep: mullw should calculate a 64 bit signed result

Message ID 20170919233219.26184-1-anton@ozlabs.org (mailing list archive)
State Accepted
Commit 1575fe06f6b1d156ed31fb22c8631d49d79751d8
Headers show
Series powerpc/sstep: mullw should calculate a 64 bit signed result | expand

Commit Message

Anton Blanchard Sept. 19, 2017, 11:32 p.m. UTC
From: Anton Blanchard <anton@samba.org>

mullw should do a 32 bit signed multiply and create a 64 bit signed
result. It currently truncates the result to 32 bits.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/lib/sstep.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Michael Ellerman Sept. 21, 2017, 1:46 a.m. UTC | #1
On Tue, 2017-09-19 at 23:32:19 UTC, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
> 
> mullw should do a 32 bit signed multiply and create a 64 bit signed
> result. It currently truncates the result to 32 bits.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/1575fe06f6b1d156ed31fb22c8631d

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index c4cda1afb49d..5e8418c28bd8 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1651,8 +1651,9 @@  int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 			goto arith_done;
 
 		case 235:	/* mullw */
-			op->val = (unsigned int) regs->gpr[ra] *
-				(unsigned int) regs->gpr[rb];
+			op->val = (long)(int) regs->gpr[ra] *
+				(int) regs->gpr[rb];
+
 			goto arith_done;
 
 		case 266:	/* add */