summaryrefslogtreecommitdiff
path: root/lib/builtins/truncsfhf2.c
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2015-05-14 00:50:28 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2015-05-14 00:50:28 +0000
commit3b4704f0437a68d615e088cbbef62ed7f6366742 (patch)
tree7f1a095bbad1501756f8a4c63139e10f0b57b156 /lib/builtins/truncsfhf2.c
parentae6a431a8322b5ab71806f58e568da943d6a8ead (diff)
[Builtins] Implement f2h/h2f by jumping to trunc/extend.
Follow-up to r237161; seems like we can't use aliases, but we can do better than duplicating the bodies, especially when that body, after inlining, isn't as small as it looks. Better approaches welcome. Perhaps the best thing is just to have an #ifndef __APPLE__ over the GNUEABI names, since they're not used there. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@237323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/truncsfhf2.c')
-rw-r--r--lib/builtins/truncsfhf2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/builtins/truncsfhf2.c b/lib/builtins/truncsfhf2.c
index a25dd83d8..381e590c3 100644
--- a/lib/builtins/truncsfhf2.c
+++ b/lib/builtins/truncsfhf2.c
@@ -11,10 +11,12 @@
#define DST_HALF
#include "fp_trunc_impl.inc"
-COMPILER_RT_ABI uint16_t __truncsfhf2(float a) {
+// Use a forwarding definition and noinline to implement a poor man's alias,
+// as there isn't a good cross-platform way of defining one.
+COMPILER_RT_ABI __attribute__((noinline)) uint16_t __truncsfhf2(float a) {
return __truncXfYf2__(a);
}
COMPILER_RT_ABI uint16_t __gnu_f2h_ieee(float a) {
- return __truncXfYf2__(a);
+ return __truncsfhf2(a);
}