Better ideas for uint vs int compare MIR code

Edwin Smith edwsmith at
Fri Jan 18 09:03:46 PST 2008

Captured as


-----Original Message-----
From: tamarin-devel-bounces at
[mailto:tamarin-devel-bounces at] On Behalf Of Werner Sharp
Sent: Thursday, January 17, 2008 5:31 PM
To: tamarin-devel at
Subject: Better ideas for uint vs int compare MIR code

Hi all,

Currently, when doing an unsigned integer vs. integer comparison in the
JITed code, Tamarin emits two coercions to the Number type and does the
comparison using SSE registers.  This is the ugly MIR_u2d sequence:

MOV (disp+4, ESP, 0);			// high 32 bits = 0
MOV (disp, ESP, (Register)(vReg&0x7)); // low 32 bits = unsigned value
FILDQ(disp, ESP); // load 64bit int (won't lose precision)
FSTPQ(disp, ESP); // store + pop as 64bit double
MOVSD(r, disp, ESP); // load double into XMM

Does anyone have a better/faster/cleverer idea to compare an unsigned
integer vs. an integer in registers?  Perhaps checking the upper bit of
the unsigned value first and then doing the standard signed integer

Tamarin-devel mailing list
Tamarin-devel at

More information about the Tamarin-devel mailing list