From 6d8738e6e4066777102d036025a2cb2b16580972 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 15 Apr 2017 10:35:01 +0100 Subject: [PATCH 1/3] IR_X86: Simplify trinary expressions --- Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp index bf03519aee..1ba2e209f8 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp @@ -788,7 +788,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) { InstLoc I = ibuild->ReadBackward(); unsigned int op = getOpcode(*I); - bool thisUsed = regReadUse(RI, I) ? true : false; + bool thisUsed = regReadUse(RI, I) != 0; switch (op) { @@ -962,7 +962,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) for (unsigned i = 0; i != RI.IInfo.size(); i++) { InstLoc I = ibuild->ReadForward(); - bool thisUsed = regReadUse(RI, I) ? true : false; + bool thisUsed = regReadUse(RI, I) != 0; if (thisUsed) { // Needed for IR Writer From 860ac52a7980f9a07323eaa836bc8af8b80534c4 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 15 Apr 2017 10:35:24 +0100 Subject: [PATCH 2/3] IR_X86: Use PtrOffset instead of casting pointers --- Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp index 1ba2e209f8..7417101f92 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp @@ -1621,7 +1621,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) w ? Jit->asm_routines.singleLoadQuantized : Jit->asm_routines.pairedLoadQuantized; Jit->MOV(32, R(RSCRATCH_EXTRA), regLocForInst(RI, getOp1(I))); - Jit->CALLptr(MScaled(RSCRATCH, SCALE_8, (u32)(u64)table)); + Jit->CALLptr(MScaled(RSCRATCH, SCALE_8, PtrOffset(table))); Jit->MOVAPD(reg, R(XMM0)); RI.fregs[reg] = I; regNormalRegClear(RI, I); @@ -1679,7 +1679,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) Jit->MOV(32, R(RSCRATCH_EXTRA), regLocForInst(RI, getOp2(I))); Jit->MOVAPD(XMM0, fregLocForInst(RI, getOp1(I))); - Jit->CALLptr(MScaled(RSCRATCH, SCALE_8, (u32)(u64)(Jit->asm_routines.pairedStoreQuantized))); + Jit->CALLptr(MScaled(RSCRATCH, SCALE_8, PtrOffset(Jit->asm_routines.pairedStoreQuantized))); if (RI.IInfo[I - RI.FirstI] & 4) fregClearInst(RI, getOp1(I)); if (RI.IInfo[I - RI.FirstI] & 8) From cb900106c6d627bdd8a894ce73760b4a81e9297c Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 15 Apr 2017 10:35:40 +0100 Subject: [PATCH 3/3] IR_X86: Prefer static_cast to C-style casts --- Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp index 7417101f92..6ef5e3c26e 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp @@ -2101,10 +2101,10 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) X64Reg reg = regFindFreeReg(RI); u64 val = ibuild->GetImmValue64(I); - if ((u32)val == val) - Jit->MOV(32, R(reg), Imm32((u32)val)); - else if ((s32)val == (s64)val) - Jit->MOV(64, R(reg), Imm32((s32)val)); + if (static_cast(val) == val) + Jit->MOV(32, R(reg), Imm32(static_cast(val))); + else if (static_cast(val) == static_cast(val)) + Jit->MOV(64, R(reg), Imm32(static_cast(val))); else Jit->MOV(64, R(reg), Imm64(val)); RI.regs[reg] = I;