[compiler-rt] r360264 - [compiler-rt] Make builtins test pass when using i386 gcc as host compiler

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 08:50:21 PDT 2019


Author: nico
Date: Wed May  8 08:50:21 2019
New Revision: 360264

URL: http://llvm.org/viewvc/llvm-project?rev=360264&view=rev
Log:
[compiler-rt] Make builtins test pass when using i386 gcc as host compiler

Just-built-clang is used to compile the test, but the library is built
with gcc, so the usual 80-bit FPU vs 32-bit SSE mismatch makes the
floating computations not bitwise identical. Fixes PR32910, see there
for details.

This uses the same technique used in all the other *c3* tests, see in
particular mulsc3_test.c.

(It might be cleaner to add compareResultCF to fp_test.h to force the
floats into 32-bit in memory, but this is the less invasive fix.)

Differential Revision: https://reviews.llvm.org/D61684

Modified:
    compiler-rt/trunk/test/builtins/Unit/divsc3_test.c

Modified: compiler-rt/trunk/test/builtins/Unit/divsc3_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/builtins/Unit/divsc3_test.c?rev=360264&r1=360263&r2=360264&view=diff
==============================================================================
--- compiler-rt/trunk/test/builtins/Unit/divsc3_test.c (original)
+++ compiler-rt/trunk/test/builtins/Unit/divsc3_test.c Wed May  8 08:50:21 2019
@@ -102,7 +102,7 @@ int test__divsc3(float a, float b, float
             {
             float _Complex z = (a * c + b * d) / (c * c + d * d)
                              + (b * c - a * d) / (c * c + d * d) * _Complex_I;
-            if (r != z)
+            if (cabsf((r-z)/r) > 1.e-6)
                 return 1;
             }
             break;




More information about the llvm-commits mailing list