[Builtins] Implement half-precision conversions.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Tue, 12 May 2015 18:33:42 +0000 (18:33 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Tue, 12 May 2015 18:33:42 +0000 (18:33 +0000)
commitf1ac850e7721a79238e213f2e6624bf8a2f3a7bd
tree7ae8061a2392ab8792adb1ee34b64d27eb4751cc
parent7a38d75bcd98f8d4e41ec72b813265b77c971f7c
[Builtins] Implement half-precision conversions.

Mostly uninteresting, except:
- in __extendXfYf2, when checking if the number is normal, the old
  code relied on the unsignedness of src_rep_t, which is a problem
  when sizeof(src_rep_t) < sizeof(int): the result gets promoted to
  int, the signedness of which breaks the comparison.
  I added an explicit cast; it shouldn't affect other types.
- we can't pass __fp16, so src_t and src_rep_t are the same.
- the gnu_*_ieee symbols are simply duplicated definitions, as aliases
  are problematic on mach-o (where only weak aliases are supported;
  that's not what we want).

Differential Revision: http://reviews.llvm.org/D9693

llvm-svn: 237161
compiler-rt/lib/builtins/CMakeLists.txt
compiler-rt/lib/builtins/extendhfsf2.c [new file with mode: 0644]
compiler-rt/lib/builtins/fp_extend.h
compiler-rt/lib/builtins/fp_extend_impl.inc
compiler-rt/lib/builtins/fp_trunc.h
compiler-rt/lib/builtins/truncdfhf2.c [new file with mode: 0644]
compiler-rt/lib/builtins/truncsfhf2.c [new file with mode: 0644]
compiler-rt/test/builtins/Unit/extendhfsf2_test.c [new file with mode: 0644]
compiler-rt/test/builtins/Unit/fp_test.h
compiler-rt/test/builtins/Unit/truncdfhf2_test.c [new file with mode: 0644]
compiler-rt/test/builtins/Unit/truncsfhf2_test.c [new file with mode: 0644]