1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple x86_64-unknown-unknown | FileCheck %s
4 #pragma float_control(except, on)
6 int printf(const char *, ...);
10 // CHECK-NEXT: [[STR_ADDR:%.*]] = alloca ptr, align 8
11 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4
12 // CHECK-NEXT: store ptr [[STR:%.*]], ptr [[STR_ADDR]], align 8
13 // CHECK-NEXT: store i32 [[X:%.*]], ptr [[X_ADDR]], align 4
14 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[STR_ADDR]], align 8
15 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[X_ADDR]], align 4
16 // CHECK-NEXT: [[CALL:%.*]] = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef [[TMP0]], i32 noundef [[TMP1]]) #[[ATTR3:[0-9]+]]
17 // CHECK-NEXT: ret void
19 void p(char *str
, int x
) {
20 printf("%s: %d\n", str
, x
);
23 #define P(n,args) p(#n #args, __builtin_##n args)
25 // CHECK-LABEL: @test_long_double_isinf(
27 // CHECK-NEXT: [[LD_ADDR:%.*]] = alloca x86_fp80, align 16
28 // CHECK-NEXT: store x86_fp80 [[LD:%.*]], ptr [[LD_ADDR]], align 16
29 // CHECK-NEXT: [[TMP0:%.*]] = load x86_fp80, ptr [[LD_ADDR]], align 16
30 // CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.is.fpclass.f80(x86_fp80 [[TMP0]], i32 516) #[[ATTR3]]
31 // CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
32 // CHECK-NEXT: call void @p(ptr noundef @.str.1, i32 noundef [[TMP2]]) #[[ATTR3]]
33 // CHECK-NEXT: ret void
35 void test_long_double_isinf(long double ld
) {
41 // CHECK-LABEL: @test_long_double_isfinite(
43 // CHECK-NEXT: [[LD_ADDR:%.*]] = alloca x86_fp80, align 16
44 // CHECK-NEXT: store x86_fp80 [[LD:%.*]], ptr [[LD_ADDR]], align 16
45 // CHECK-NEXT: [[TMP0:%.*]] = load x86_fp80, ptr [[LD_ADDR]], align 16
46 // CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.is.fpclass.f80(x86_fp80 [[TMP0]], i32 504) #[[ATTR3]]
47 // CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
48 // CHECK-NEXT: call void @p(ptr noundef @.str.2, i32 noundef [[TMP2]]) #[[ATTR3]]
49 // CHECK-NEXT: ret void
51 void test_long_double_isfinite(long double ld
) {
57 // CHECK-LABEL: @test_long_double_isnan(
59 // CHECK-NEXT: [[LD_ADDR:%.*]] = alloca x86_fp80, align 16
60 // CHECK-NEXT: store x86_fp80 [[LD:%.*]], ptr [[LD_ADDR]], align 16
61 // CHECK-NEXT: [[TMP0:%.*]] = load x86_fp80, ptr [[LD_ADDR]], align 16
62 // CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.is.fpclass.f80(x86_fp80 [[TMP0]], i32 3) #[[ATTR3]]
63 // CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
64 // CHECK-NEXT: call void @p(ptr noundef @.str.3, i32 noundef [[TMP2]]) #[[ATTR3]]
65 // CHECK-NEXT: ret void
67 void test_long_double_isnan(long double ld
) {