summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/builtin_float.c
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-12-16 11:15:48 -0800
committerErich Keane <erich.keane@intel.com>2019-12-17 06:58:29 -0800
commit1ed832e42446ef8c4afe08f980db2e54ac316bf3 (patch)
tree934a6c57d2ac75076064041081cd1d78a021bf10 /clang/test/CodeGen/builtin_float.c
parentb852b3c982d2e8ad3f13c626b3e3655e5b3c399e (diff)
downloadbcm5719-llvm-1ed832e42446ef8c4afe08f980db2e54ac316bf3.tar.gz
bcm5719-llvm-1ed832e42446ef8c4afe08f980db2e54ac316bf3.zip
Reland [NFC-I] Remove hack for fp-classification builtins
The FP-classification builtins (__builtin_isfinite, etc) use variadic packs in the definition file to mean an overload set. Because of that, floats were converted to doubles, which is incorrect. There WAS a patch to remove the cast after the fact. THis patch switches these builtins to just be custom type checking, calls the implicit conversions for the integer members, and makes sure the correct L->R casts are put into place, then does type checking like normal. A future direction (that wouldn't be NFC) would consider making conversions for the floating point parameter legal. Note: The initial patch for this missed that certain systems need to still convert half to float, since they dont' support that type.
Diffstat (limited to 'clang/test/CodeGen/builtin_float.c')
-rw-r--r--clang/test/CodeGen/builtin_float.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/test/CodeGen/builtin_float.c b/clang/test/CodeGen/builtin_float.c
index b97cf1be348..b257854278c 100644
--- a/clang/test/CodeGen/builtin_float.c
+++ b/clang/test/CodeGen/builtin_float.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-windows-pc -o - %s | FileCheck %s --check-prefixes=CHECK,FP16
+// RUN: %clang_cc1 -emit-llvm -triple ppc64-be -o - %s -DNO_FP16 | FileCheck %s --check-prefixes=CHECK,NOFP16
// test to ensure that these builtins don't do the variadic promotion of float->double.
void test_floats(float f1, float f2) {
@@ -43,6 +44,15 @@ void test_doubles(double d1, double f2) {
// CHECK-NEXT: zext i1
}
+void test_half(__fp16 *H, __fp16 *H2) {
+ (void)__builtin_isgreater(*H, *H2);
+ // CHECK: fcmp ogt float
+ // CHECK-NEXT: zext i1
+ (void)__builtin_isinf(*H);
+ // NOFP16: fcmp oeq float %{{.+}}, 0x7FF
+ // FP16: fcmp oeq half %{{.+}}, 0xH7C
+}
+
void test_mixed(double d1, float f2) {
(void)__builtin_isgreater(d1, f2);
// CHECK: fpext float {{.*}} to double
OpenPOWER on IntegriCloud