Page MenuHomePhabricator

[builtins] Deduplicate __eqsf2 and __gtsf2
ClosedPublic

Authored by phosek on May 14 2019, 2:46 PM.

Details

Summary

The only difference between eqsf2 and gtsf2 is whether they return
1 or -1 on NaN. Rather than duplicating all the code, use a macro to
define the function twice and use an argument to decide whether to
negate the return value.

Diff Detail

Event Timeline

phosek created this revision.May 14 2019, 2:46 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 14 2019, 2:46 PM
Herald added subscribers: llvm-commits, Restricted Project, javed.absar. · View Herald Transcript
mcgrathr accepted this revision.May 14 2019, 2:49 PM
mcgrathr added a subscriber: mcgrathr.

Lgtm

This revision is now accepted and ready to land.May 14 2019, 2:49 PM
This revision was automatically updated to reflect the committed changes.
yln added a subscriber: yln.May 28 2019, 11:58 AM

Hi Petr (@phosek),

this change broke 2 of our internal bots that test on older OS/Compilers: MacOS 10.13/Xcode 9.1 and MacOS 10.12/Xcode 8.3.3.

Can you make sense of the following build error?

FAILED: projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.soft_static_armv7m_macho_embedded.dir/arm/comparesf2.S.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/builtins -I/Users/buildslave/jenkins/workspace/stash-master-sanitizer-10.13-incremental/clang/src/projects/compiler-rt/lib/builtins -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2 -Iinclude -I/Users/buildslave/jenkins/workspace/stash-master-sanitizer-10.13-incremental/clang/src/include -O2 -g -DNDEBUG    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk -Oz -Wall -fomit-frame-pointer -ffreestanding -arch armv7m -static -mfloat-abi=soft -MD -MT projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.soft_static_armv7m_macho_embedded.dir/arm/comparesf2.S.o -MF projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.soft_static_armv7m_macho_embedded.dir/arm/comparesf2.S.o.d -o projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.soft_static_armv7m_macho_embedded.dir/arm/comparesf2.S.o -c /Users/buildslave/jenkins/workspace/stash-master-sanitizer-10.13-incremental/clang/src/projects/compiler-rt/lib/builtins/arm/comparesf2.S
<instantiation>:4:46: error: unexpected token in directive
.thumb ; .subsections_via_symbols ; .globl _ __eqsf2 ; ; .thumb_func ; _ __eqsf2:
                                             ^
/Users/buildslave/jenkins/workspace/stash-master-sanitizer-10.13-incremental/clang/src/projects/compiler-rt/lib/builtins/arm/comparesf2.S:88:1: note: while in macro instantiation
COMPARESF2_FUNCTION __eqsf2, __eqsf2_handle_nan
^
<instantiation>:4:81: error: unexpected token in argument list
.thumb ; .subsections_via_symbols ; .globl _ __eqsf2 ; ; .thumb_func ; _ __eqsf2:
                                                                                ^
/Users/buildslave/jenkins/workspace/stash-master-sanitizer-10.13-incremental/clang/src/projects/compiler-rt/lib/builtins/arm/comparesf2.S:88:1: note: while in macro instantiation
COMPARESF2_FUNCTION __eqsf2, __eqsf2_handle_nan
^
<instantiation>:4:46: error: unexpected token in directive
.thumb ; .subsections_via_symbols ; .globl _ __gtsf2 ; ; .thumb_func ; _ __gtsf2:
                                             ^
/var/folders/dk/vj0dyfmd1kb6tzqbcbmzz58m0000gn/T/comparesf2-16b20c.s:75:1: note: while in macro instantiation
COMPARESF2_FUNCTION __gtsf2, __gtsf2_handle_nan
^
<instantiation>:4:81: error: unexpected token in argument list
.thumb ; .subsections_via_symbols ; .globl _ __gtsf2 ; ; .thumb_func ; _ __gtsf2:
                                                                                ^
/var/folders/dk/vj0dyfmd1kb6tzqbcbmzz58m0000gn/T/comparesf2-16b20c.s:75:1: note: while in macro instantiation
COMPARESF2_FUNCTION __gtsf2, __gtsf2_handle_nan
^