tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Re: incorrect generated code for == on x86_64


From: Vincent Lefevre
Subject: [Tinycc-devel] Re: incorrect generated code for == on x86_64
Date: Thu, 8 Apr 2010 17:06:22 +0200
User-agent: Mutt/1.5.20-6072-vl-r35499 (2010-04-03)

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 <address@hidden> - 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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]