Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sh4: Fix FTRC (ipr, canonical, x86) by using correct positive cutoff value #1428

Merged
merged 1 commit into from Oct 2, 2018

Conversation

Projects
None yet
4 participants
@flyinghead
Copy link
Collaborator

commented Oct 2, 2018

Fix for interpreter, common dynarec and x86 rec.

Fixes wrong car color in Tokyo Xtreme Racer car selection screen.

Fix sh4 FTRC op to use correct positive cutoff value.
Fix for interpreter, common dynarec and x86 rec.

Fixes wrong car color in Tokyo Xtreme Racer car selection screen.

@skmp skmp changed the title Fix sh4 FTRC op to use correct positive cutoff value. sh4: Fix canonical, x86 FTRC op to use correct positive cutoff value. Oct 2, 2018

@skmp skmp changed the title sh4: Fix canonical, x86 FTRC op to use correct positive cutoff value. sh4: Fix FTRC (ipr, canonical, x86) by using correct positive cutoff value Oct 2, 2018

@skmp skmp merged commit 84bf6ab into master Oct 2, 2018

@skmp skmp deleted the fh/ftrc-op-fix branch Oct 2, 2018

@baka0815
Copy link
Contributor

left a comment

We should avoid magic numbers as much as possible and use constants with speaking names instead.

if (f1 > 0x7FFFFFBF)
f1 = 0x7FFFFFBF;
return (s32)f1;
if (f1 > 2147483520.0f) // IEEE 754: 0x4effffff

This comment has been minimized.

Copy link
@baka0815

baka0815 Oct 4, 2018

Contributor

We should propably use a const for this instead of some magic number...

@@ -628,22 +628,25 @@ sh4op(i1111_nnnn_0011_1101)
if (fpscr.PR == 0)
{
u32 n = GetN(op);
fpul = (u32)(s32)min(fr[n],(float)0x7FFFFFBF);
fpul = (u32)(s32)min(fr[n], 2147483520.0f); // IEEE 754: 0x4effffff

This comment has been minimized.

Copy link
@baka0815

baka0815 Oct 4, 2018

Contributor

...that way it would be much easier...

@@ -1453,7 +1453,7 @@ void ngen_opcode(RuntimeBlockInfo* block, shil_opcode* op,x86_block* x86e, bool
verify(op->rs1.is_r32f());
verify(reg.IsAllocg(op->rd));
verify(reg.IsAllocf(op->rs1));
static f32 sse_ftrc_saturate = 0x7FFFFFBF;//1.11111111111111111111111 << 31
static f32 sse_ftrc_saturate = 2147483520.0f; // IEEE 754: 0x4effffff

This comment has been minimized.

Copy link
@baka0815

baka0815 Oct 4, 2018

Contributor

...to see that all these are the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.