[Bug target/78857] New: S390: Do not use load-and-test floating-point instruction to compare against 0.0 as SNaN is converted to QNaN.

stli at linux dot vnet.ibm.com gcc-bugzilla@gcc.gnu.org
Mon Dec 19 09:00:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78857

            Bug ID: 78857
           Summary: S390: Do not use load-and-test floating-point
                    instruction to compare against 0.0 as SNaN is
                    converted to QNaN.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stli at linux dot vnet.ibm.com
  Target Milestone: ---
            Target: S390

On s390, a comparison of e.g. a double value against 0.0 is done with ltdbr 
(load and test long BFP) instruction. If the value is a SNaN, this instruction
converts it to QNaN. This differs to a comparison with cdbr (compare long BFP)
instruction, which keeps the SNaN.
Thus, the usage of load-and-test instruction is not allowed, if the value in
the resulting register is used afterwards.

As information:
This leads to glibc "math/test-double" / "math/test-idouble" test failures
where pow is called with x=1.0 and y=SNaN.
The pow function performs a test against zero and y is later used to determine
the return value:
...
if (y == 0)
  return 1.0;
...
if (...)
  return x == 1.0 && !issignaling (y) ? 1.0 : y + y;
...


More information about the Gcc-bugs mailing list