[compiler-rt] r237323 - [Builtins] Implement f2h/h2f by jumping to trunc/extend.
Ahmed Bougacha
ahmed.bougacha at gmail.com
Wed May 13 17:50:29 PDT 2015
Author: ab
Date: Wed May 13 19:50:28 2015
New Revision: 237323
URL: http://llvm.org/viewvc/llvm-project?rev=237323&view=rev
Log:
[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.
Modified:
compiler-rt/trunk/lib/builtins/extendhfsf2.c
compiler-rt/trunk/lib/builtins/truncsfhf2.c
Modified: compiler-rt/trunk/lib/builtins/extendhfsf2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/extendhfsf2.c?rev=237323&r1=237322&r2=237323&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/extendhfsf2.c (original)
+++ compiler-rt/trunk/lib/builtins/extendhfsf2.c Wed May 13 19:50:28 2015
@@ -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);
}
Modified: compiler-rt/trunk/lib/builtins/truncsfhf2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/truncsfhf2.c?rev=237323&r1=237322&r2=237323&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/truncsfhf2.c (original)
+++ compiler-rt/trunk/lib/builtins/truncsfhf2.c Wed May 13 19:50:28 2015
@@ -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);
}
More information about the llvm-commits
mailing list