Closed Bug 517405 Opened 12 years ago Closed 12 years ago
nanojit: don't compute x86 FP conditions twice(!)
asm_fcond() computes the condition twice. Yes, you read that right. Here's example code: flt2 = flt fdiv1, js_BooleanOrUndefinedToNumber2 ucomisd xmm0,xmm1 lahf test ah, 5 setnp eax movzx eax,eax ucomisd xmm1,xmm0 seta eax movzx eax,eax The first five instructions compute it (badly), then the last three recompute it (better). I don't know how this got past quality control, but simply chopping out a few lines in Nativei386.cpp results in the first five instructions being avoided. Amusingly, the Sparc back-end is heavily based on the x86 back-end but it doesn't make this mistake. It doesn't speed up SunSpider, unfortunately, presumably because asm_fcond() doesn't occur very often (most comparisons are handled within asm_. In fact I'm getting a 6ms slow-down but that clearly must be noise.
Attachment #401382 - Flags: review?(rreitmai)
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tracemonkey
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.