1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3
2 // RUN: %clang_cc1 -triple powerpc-linux-gnu -emit-llvm \
3 // RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK-BE32
4 // RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm \
5 // RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK-BE64
6 // RUN: %clang_cc1 -triple powerpc64le-linux-gnu -emit-llvm \
7 // RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK-LE
11 long double ld
= -1.0L;
12 // CHECK-BE32-LABEL: define dso_local void @_Z12test_signbitv(
13 // CHECK-BE32-SAME: ) #[[ATTR0:[0-9]+]] {
14 // CHECK-BE32-NEXT: entry:
15 // CHECK-BE32-NEXT: store i8 0, ptr @b, align 1
16 // CHECK-BE32-NEXT: [[TMP0:%.*]] = load ppc_fp128, ptr @ld, align 16
17 // CHECK-BE32-NEXT: [[TMP1:%.*]] = bitcast ppc_fp128 [[TMP0]] to i128
18 // CHECK-BE32-NEXT: [[TMP2:%.*]] = lshr i128 [[TMP1]], 64
19 // CHECK-BE32-NEXT: [[TMP3:%.*]] = trunc i128 [[TMP2]] to i64
20 // CHECK-BE32-NEXT: [[TMP4:%.*]] = icmp slt i64 [[TMP3]], 0
21 // CHECK-BE32-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP4]] to i8
22 // CHECK-BE32-NEXT: store i8 [[FROMBOOL]], ptr @b, align 1
23 // CHECK-BE32-NEXT: store i8 0, ptr @b, align 1
24 // CHECK-BE32-NEXT: [[TMP5:%.*]] = load double, ptr @d, align 8
25 // CHECK-BE32-NEXT: [[CONV:%.*]] = fptrunc double [[TMP5]] to float
26 // CHECK-BE32-NEXT: [[TMP6:%.*]] = bitcast float [[CONV]] to i32
27 // CHECK-BE32-NEXT: [[TMP7:%.*]] = icmp slt i32 [[TMP6]], 0
28 // CHECK-BE32-NEXT: [[FROMBOOL1:%.*]] = zext i1 [[TMP7]] to i8
29 // CHECK-BE32-NEXT: store i8 [[FROMBOOL1]], ptr @b, align 1
30 // CHECK-BE32-NEXT: store i8 0, ptr @b, align 1
31 // CHECK-BE32-NEXT: [[TMP8:%.*]] = load ppc_fp128, ptr @ld, align 16
32 // CHECK-BE32-NEXT: [[TMP9:%.*]] = bitcast ppc_fp128 [[TMP8]] to i128
33 // CHECK-BE32-NEXT: [[TMP10:%.*]] = lshr i128 [[TMP9]], 64
34 // CHECK-BE32-NEXT: [[TMP11:%.*]] = trunc i128 [[TMP10]] to i64
35 // CHECK-BE32-NEXT: [[TMP12:%.*]] = icmp slt i64 [[TMP11]], 0
36 // CHECK-BE32-NEXT: [[FROMBOOL2:%.*]] = zext i1 [[TMP12]] to i8
37 // CHECK-BE32-NEXT: store i8 [[FROMBOOL2]], ptr @b, align 1
38 // CHECK-BE32-NEXT: ret void
40 // CHECK-BE64-LABEL: define dso_local void @_Z12test_signbitv(
41 // CHECK-BE64-SAME: ) #[[ATTR0:[0-9]+]] {
42 // CHECK-BE64-NEXT: entry:
43 // CHECK-BE64-NEXT: store i8 0, ptr @b, align 1
44 // CHECK-BE64-NEXT: [[TMP0:%.*]] = load ppc_fp128, ptr @ld, align 16
45 // CHECK-BE64-NEXT: [[TMP1:%.*]] = bitcast ppc_fp128 [[TMP0]] to i128
46 // CHECK-BE64-NEXT: [[TMP2:%.*]] = lshr i128 [[TMP1]], 64
47 // CHECK-BE64-NEXT: [[TMP3:%.*]] = trunc i128 [[TMP2]] to i64
48 // CHECK-BE64-NEXT: [[TMP4:%.*]] = icmp slt i64 [[TMP3]], 0
49 // CHECK-BE64-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP4]] to i8
50 // CHECK-BE64-NEXT: store i8 [[FROMBOOL]], ptr @b, align 1
51 // CHECK-BE64-NEXT: store i8 0, ptr @b, align 1
52 // CHECK-BE64-NEXT: [[TMP5:%.*]] = load double, ptr @d, align 8
53 // CHECK-BE64-NEXT: [[CONV:%.*]] = fptrunc double [[TMP5]] to float
54 // CHECK-BE64-NEXT: [[TMP6:%.*]] = bitcast float [[CONV]] to i32
55 // CHECK-BE64-NEXT: [[TMP7:%.*]] = icmp slt i32 [[TMP6]], 0
56 // CHECK-BE64-NEXT: [[FROMBOOL1:%.*]] = zext i1 [[TMP7]] to i8
57 // CHECK-BE64-NEXT: store i8 [[FROMBOOL1]], ptr @b, align 1
58 // CHECK-BE64-NEXT: store i8 0, ptr @b, align 1
59 // CHECK-BE64-NEXT: [[TMP8:%.*]] = load ppc_fp128, ptr @ld, align 16
60 // CHECK-BE64-NEXT: [[TMP9:%.*]] = bitcast ppc_fp128 [[TMP8]] to i128
61 // CHECK-BE64-NEXT: [[TMP10:%.*]] = lshr i128 [[TMP9]], 64
62 // CHECK-BE64-NEXT: [[TMP11:%.*]] = trunc i128 [[TMP10]] to i64
63 // CHECK-BE64-NEXT: [[TMP12:%.*]] = icmp slt i64 [[TMP11]], 0
64 // CHECK-BE64-NEXT: [[FROMBOOL2:%.*]] = zext i1 [[TMP12]] to i8
65 // CHECK-BE64-NEXT: store i8 [[FROMBOOL2]], ptr @b, align 1
66 // CHECK-BE64-NEXT: ret void
68 // CHECK-LE-LABEL: define dso_local void @_Z12test_signbitv(
69 // CHECK-LE-SAME: ) #[[ATTR0:[0-9]+]] {
70 // CHECK-LE-NEXT: entry:
71 // CHECK-LE-NEXT: store i8 0, ptr @b, align 1
72 // CHECK-LE-NEXT: [[TMP0:%.*]] = load ppc_fp128, ptr @ld, align 16
73 // CHECK-LE-NEXT: [[TMP1:%.*]] = bitcast ppc_fp128 [[TMP0]] to i128
74 // CHECK-LE-NEXT: [[TMP2:%.*]] = trunc i128 [[TMP1]] to i64
75 // CHECK-LE-NEXT: [[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
76 // CHECK-LE-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP3]] to i8
77 // CHECK-LE-NEXT: store i8 [[FROMBOOL]], ptr @b, align 1
78 // CHECK-LE-NEXT: store i8 0, ptr @b, align 1
79 // CHECK-LE-NEXT: [[TMP4:%.*]] = load double, ptr @d, align 8
80 // CHECK-LE-NEXT: [[CONV:%.*]] = fptrunc double [[TMP4]] to float
81 // CHECK-LE-NEXT: [[TMP5:%.*]] = bitcast float [[CONV]] to i32
82 // CHECK-LE-NEXT: [[TMP6:%.*]] = icmp slt i32 [[TMP5]], 0
83 // CHECK-LE-NEXT: [[FROMBOOL1:%.*]] = zext i1 [[TMP6]] to i8
84 // CHECK-LE-NEXT: store i8 [[FROMBOOL1]], ptr @b, align 1
85 // CHECK-LE-NEXT: store i8 0, ptr @b, align 1
86 // CHECK-LE-NEXT: [[TMP7:%.*]] = load ppc_fp128, ptr @ld, align 16
87 // CHECK-LE-NEXT: [[TMP8:%.*]] = bitcast ppc_fp128 [[TMP7]] to i128
88 // CHECK-LE-NEXT: [[TMP9:%.*]] = trunc i128 [[TMP8]] to i64
89 // CHECK-LE-NEXT: [[TMP10:%.*]] = icmp slt i64 [[TMP9]], 0
90 // CHECK-LE-NEXT: [[FROMBOOL2:%.*]] = zext i1 [[TMP10]] to i8
91 // CHECK-LE-NEXT: store i8 [[FROMBOOL2]], ptr @b, align 1
92 // CHECK-LE-NEXT: ret void
96 b
= __builtin_signbit(1.0L);
98 b
= __builtin_signbit(ld
);
100 b
= __builtin_signbitf(1.0);
102 b
= __builtin_signbitf(d
);
104 b
= __builtin_signbitl(1.0L);
106 b
= __builtin_signbitl(ld
);