[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
This commit is contained in:
Ahmed Bougacha 2015-05-14 00:50:28 +00:00
parent b2d643146f
commit 9a43d5be2f
2 changed files with 8 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);
}