Better ideas for uint vs int compare MIR code

Werner Sharp wsharp at
Thu Jan 17 14:31:07 PST 2008

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

More information about the Tamarin-devel mailing list