www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21816] New: testing XMM for nan does not work

https://issues.dlang.org/show_bug.cgi?id=21816

          Issue ID: 21816
           Summary: testing XMM for nan does not work
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following fails the assert:

 bool testf(float t) {
    return cast(bool)t;
 }

 void test3918() {
    assert(testf(float.nan));
 }

 int main() {
    test3918();
    return 0;
 }

when compiling with -O for XMM. The generated code is:

                xorps   XMM1,XMM1
                ucomiss XMM1,XMM0
                jne     LC
(*)             jp      LC
                xor     EAX,EAX
                jmp short       L11
    LC:         mov     EAX,1
    L11:        ret


The (*) instruction is missing.

--
Apr 10 2021