Skip to contentSkip to conversation

sparc,sparc64: replace parentheses in pmul()

PATCH In review Roel Kluin 2 participants 2 messages Nov 5, 2009 – Nov 8, 2009 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 sparc,sparc64: replace parentheses in pmul()

>>' has a higher precedence than ?' so src2 evaluated to either 16 or 0 dependent on the bits set in rs2.

---
 arch/sparc/kernel/visemul.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I am not 100% sure that the code was incorrect, however, if it was intended I think it is a very strange way to write it.

Roel

arch/sparc/kernel/visemul.c +1 -1
index b956fd7..d231cbd 100644
@@ -617,7 +617,7 @@ static void pmul(struct pt_regs *regs, unsigned int insn, unsigned int opf)
 		rs2 = fps_regval(f, RS2(insn));
 
 		rd_val = 0;
-		src2 = (rs2 >> (opf == FMUL8x16AU_OPF) ? 16 : 0);
+		src2 = rs2 >> (opf == FMUL8x16AU_OPF ? 16 : 0);
 		for (byte = 0; byte < 4; byte++) {
 			u16 src1 = (rs1 >> (byte * 8)) & 0x00ff;
 			u32 prod = src1 * src2;
maintainer
#1 lore raw

From: Roel Kluin <[email protected]>
Date: Thu, 05 Nov 2009 17:40:44 +0100

Quoted 10 lines

>>' has a higher precedence than ?' so src2 evaluated to either 16 or 0 dependent on the bits set in rs2.

---
 arch/sparc/kernel/visemul.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I am not 100% sure that the code was incorrect, however, if it was intended I think it is a very strange way to write it.

Your fix is correct, thanks Roel!

I really need to write a testsuite for this VIS emulation code.