summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/builtins
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
commit9a43d5be2f37c728d67dda5cb65ae3edda7a20e0 (patch)
tree39ce83c3f05a996d4945e9b09f04e8e40b272526 /compiler-rt/lib/builtins
parentb2d643146fd7c8540e907ceb38d799a060de87fa (diff)
downloadbcm5719-llvm-9a43d5be2f37c728d67dda5cb65ae3edda7a20e0.tar.gz
bcm5719-llvm-9a43d5be2f37c728d67dda5cb65ae3edda7a20e0.zip
[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. llvm-svn: 237323
Diffstat (limited to 'compiler-rt/lib/builtins')
-rw-r--r--compiler-rt/lib/builtins/extendhfsf2.c6
-rw-r--r--compiler-rt/lib/builtins/truncsfhf2.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/compiler-rt/lib/builtins/extendhfsf2.c b/compiler-rt/lib/builtins/extendhfsf2.c
index f0b3c37c302..7524e2ea7ed 100644
--- a/compiler-rt/lib/builtins/extendhfsf2.c
+++ b/compiler-rt/lib/builtins/extendhfsf2.c
@@ -12,10 +12,12 @@
#define DST_SINGLE
#include "fp_extend_impl.inc"
-COMPILER_RT_ABI float __extendhfsf2(uint16_t 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)) float __extendhfsf2(uint16_t a) {
return __extendXfYf2__(a);
}
COMPILER_RT_ABI float __gnu_h2f_ieee(uint16_t a) {
- return __extendXfYf2__(a);
+ return __extendhfsf2(a);
}
diff --git a/compiler-rt/lib/builtins/truncsfhf2.c b/compiler-rt/lib/builtins/truncsfhf2.c
index a25dd83d868..381e590c342 100644
--- a/compiler-rt/lib/builtins/truncsfhf2.c
+++ b/compiler-rt/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);
}
OpenPOWER on IntegriCloud