[PATCH] D28146: [compiler-rt] [test] [builtins] Remove obsolete/UB tests in __fixuns?fdi based

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 28 15:36:20 PST 2016


mgorny created this revision.
mgorny added reviewers: ddunbar, sdmitrouk, dschuff.
mgorny added a subscriber: cfe-commits.
Herald added subscribers: mehdi_amini, dberris.

Remove the failing tests for __fixunssfdi() and __fixunsdfdi() that
relied on undefined (and most likely obsolete in terms of compiler-rt
implementation behavior).

Both tests presumed that 0x1.p+64 would be converted to
0xFFFFFFFFFFFFFFFFLL, that is the largest value in uint64 range.
However, the C/C++ standards do not specify the behavior for converting
a floating-point value to an integer of smaller range, and in this case
both libgcc and compiler-rt implementations return 0 instead.

Since the current behavior is correct with regards to standards
and there is no good way of expressing 0xFFFFFFFFFFFFFFFFLL in single-
or double-precision float, I've removed the failing test altogether.


https://reviews.llvm.org/D28146

Files:
  test/builtins/Unit/fixunsdfdi_test.c
  test/builtins/Unit/fixunssfdi_test.c


Index: test/builtins/Unit/fixunssfdi_test.c
===================================================================
--- test/builtins/Unit/fixunssfdi_test.c
+++ test/builtins/Unit/fixunssfdi_test.c
@@ -79,8 +79,6 @@
         return 1;
     if (test__fixunssfdi(0x1.000000p+63F, 0x8000000000000000LL))
         return 1;
-    if (test__fixunssfdi(0x1.000000p+64F, 0xFFFFFFFFFFFFFFFFLL))
-        return 1;
     if (test__fixunssfdi(0x1.FFFFFEp+62F, 0x7FFFFF8000000000LL))
         return 1;
     if (test__fixunssfdi(0x1.FFFFFCp+62F, 0x7FFFFF0000000000LL))
Index: test/builtins/Unit/fixunsdfdi_test.c
===================================================================
--- test/builtins/Unit/fixunsdfdi_test.c
+++ test/builtins/Unit/fixunsdfdi_test.c
@@ -95,9 +95,6 @@
     if (test__fixunsdfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL))
         return 1;
 
-    if (test__fixunsdfdi(0x1.p+64, 0xFFFFFFFFFFFFFFFFLL))
-        return 1;
-
 #if !TARGET_LIBGCC
     if (test__fixunsdfdi(-0x1.FFFFFFFFFFFFFp+62, 0))
         return 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28146.82625.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161228/ea8137ab/attachment.bin>


More information about the cfe-commits mailing list