Post Reply 
 
Thread Rating:
  • 1 Votes - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PPSSPP on a mips device?
06-09-2013, 08:21 PM (This post was last modified: 06-09-2013 08:27 PM by [Unknown].)
Post: #8
RE: PPSSPP on a mips device?
Well, for CPU at least, the most crucial difference between MIPS and ARM is how they handle 32-bit constants, which turns out to be pretty common.

In MIPS, you'll often see:
lui a0, 0x1234
addiu a0, a0, 0x5678

On x86, this would be (and the jit combines it automatically):
MOV edx, 0x12346578

On ARM, it's reversed on ARMv6T2+ and has to eat a memory cycle on older ones.
MOV r2, 0x5678
MOVT r2, 0x1234

This seems like a trivial diffence, but it ends up adding a lot of ops from what I've seen. PSP games will lui once, and then use that same reg to displace other addresses. For example:
lui a0, 0x1234
addiu a1, a0, 0x4123
lw a2, a0(0x3214)
addiu a3, a0, 0x4980

This makes a lot of sense because of the way it's written. But in ARM, that has to end up something like this in the best case:
MOV r2, 0
MOVW r2, 0x1234
MOV r0, 0x4123
ADD r3, r2, r0
MOV r0, 0x3214
ADD r0, r0, r2
LDR r4, r11, +r0 ; All memory access has to be offset.
MOV r0, 0x4980
ADD r5, r2, r0

In practice, I think we actually do worse than the above with extra MOVW's. However, for *certain* constants we're able to optimize this down to less ops.

That's at least double as many instructions, just because they handle immediate values so differently. In contrast, here's what x64 (just to type simple reg names) looks like:

MOV rdx, 0x12340000
MOV r8, 0x12344123
MOV r9, [rbx + 0x12343214] ; All memory access has to be offset.
MOV r10, 0x12344980

So x86 is actually a lot more efficient in this case.

-[Unknown]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
PPSSPP on a mips device? - EIREXE - 06-09-2013, 09:35 AM
RE: PPSSPP on a mips device? - Orphis - 06-09-2013, 10:32 AM
RE: PPSSPP on a mips device? - [Unknown] - 06-09-2013, 02:32 PM
RE: PPSSPP on a mips device? - EIREXE - 06-09-2013, 06:20 PM
RE: PPSSPP on a mips device? - [Unknown] - 06-09-2013, 06:56 PM
RE: PPSSPP on a mips device? - EIREXE - 06-09-2013, 07:44 PM
RE: PPSSPP on a mips device? - VIRGIN KLM - 06-09-2013, 07:50 PM
RE: PPSSPP on a mips device? - [Unknown] - 06-09-2013 08:21 PM
RE: PPSSPP on a mips device? - [Unknown] - 08-30-2014, 05:20 PM
RE: PPSSPP on a mips device? - xsacha - 11-12-2014, 07:42 AM
RE: PPSSPP on a mips device? - Henrik - 11-12-2014, 09:18 AM
RE: PPSSPP on a mips device? - xsacha - 11-14-2014, 05:24 AM

Forum Jump: