[clang] e77b5c4 - Add __builtin_isnan(__fp16) testcase
Thomas Preud'homme via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 2 13:01:50 PST 2021
Author: Thomas Preud'homme
Date: 2021-03-02T21:01:51Z
New Revision: e77b5c40d57633a66842e75410585696895ecf4d
URL: https://github.com/llvm/llvm-project/commit/e77b5c40d57633a66842e75410585696895ecf4d
DIFF: https://github.com/llvm/llvm-project/commit/e77b5c40d57633a66842e75410585696895ecf4d.diff
LOG: Add __builtin_isnan(__fp16) testcase
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D97777
Added:
Modified:
clang/test/CodeGen/strictfp_builtins.c
Removed:
################################################################################
diff --git a/clang/test/CodeGen/strictfp_builtins.c b/clang/test/CodeGen/strictfp_builtins.c
index 618bb70d5ed3d..3afc9d8c8a402 100644
--- a/clang/test/CodeGen/strictfp_builtins.c
+++ b/clang/test/CodeGen/strictfp_builtins.c
@@ -129,6 +129,25 @@ void test_isinf_sign(double d) {
return;
}
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT: store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT: [[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT: [[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT: [[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT: [[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT: [[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT: [[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT: call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT: ret void
+//
+void test_fp16_isnan(__fp16 h) {
+ P(isnan, (h));
+
+ return;
+}
+
// CHECK-LABEL: @test_float_isnan(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[F_ADDR:%.*]] = alloca float, align 4
More information about the cfe-commits
mailing list