On 2010-04-08 16:55:25 +0200, Vincent Lefevre wrote:
> If I understand correctly (I've never worked with x86/x86_64 asm
> code), the jne tests the ZF flag, but this flag is set also for
> unordered (the case of NaN). Hence the incorrect result.

The fix is to add a jp. This is what GCC does on more complex code,
e.g. with:

  if (x == x)
    bar1 ();
  else
    bar2 ();

one gets:

        ucomisd %xmm1, %xmm0
        jne     .L7
        jp      .L7
.L6:
        call    bar1
        jmp     .L5
.L7:
        call    bar2
.L5:

-- 
Vincent Lefèvre <[email protected]> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to