[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / builtins-nondeterministic-value.c
blobcc12f95997f046d25a0f919a5d23b4e7d4bdf856
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
3 typedef float float4 __attribute__((ext_vector_type(4)));
4 typedef _Bool bool4 __attribute__((ext_vector_type(4)));
6 int clang_nondet_i( int x ) {
7 // CHECK-LABEL: entry
8 // CHECK: [[A:%.*]] = alloca i32
9 // CHECK: store i32 [[X:%.*]], ptr [[A]]
10 // CHECK: [[R:%.*]] = freeze i32 poison
11 // CHECK: ret i32 [[R]]
12 return __builtin_nondeterministic_value(x);
15 float clang_nondet_f( float x ) {
16 // CHECK-LABEL: entry
17 // CHECK: [[A:%.*]] = alloca float
18 // CHECK: store float [[X:%.*]], ptr [[A]]
19 // CHECK: [[R:%.*]] = freeze float poison
20 // CHECK: ret float [[R]]
21 return __builtin_nondeterministic_value(x);
24 double clang_nondet_d( double x ) {
25 // CHECK-LABEL: entry
26 // CHECK: [[A:%.*]] = alloca double
27 // CHECK: store double [[X:%.*]], ptr [[A]]
28 // CHECK: [[R:%.*]] = freeze double poison
29 // CHECK: ret double [[R]]
30 return __builtin_nondeterministic_value(x);
33 _Bool clang_nondet_b( _Bool x) {
34 // CHECK-LABEL: entry
35 // CHECK: [[A:%.*]] = alloca i8
36 // CHECK: [[B:%.*]] = zext i1 %x to i8
37 // CHECK: store i8 [[B]], ptr [[A]]
38 // CHECK: [[R:%.*]] = freeze i1 poison
39 // CHECK: ret i1 [[R]]
40 return __builtin_nondeterministic_value(x);
43 void clang_nondet_fv( ) {
44 // CHECK-LABEL: entry
45 // CHECK: [[A:%.*]] = alloca <4 x float>
46 // CHECK: [[R:%.*]] = freeze <4 x float> poison
47 // CHECK: store <4 x float> [[R]], ptr [[A]]
48 // CHECK: ret void
49 float4 x = __builtin_nondeterministic_value(x);
52 void clang_nondet_bv( ) {
53 // CHECK: [[A:%.*]] = alloca i8
54 // CHECK: [[V:%.*]] = freeze <4 x i1> poison
55 // CHECK: [[SV:%.*]] = shufflevector <4 x i1> [[V]], <4 x i1> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
56 // CHECK: [[BC:%.*]] = bitcast <8 x i1> [[SV]] to i8
57 // CHECK: store i8 [[BC]], ptr [[A]]
58 // CHECK: ret void
59 bool4 x = __builtin_nondeterministic_value(x);