61 lines · c
1// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s2 3typedef float float4 __attribute__((ext_vector_type(4)));4typedef _Bool bool4 __attribute__((ext_vector_type(4)));5 6int clang_nondet_i( int x ) {7// CHECK-LABEL: entry8// CHECK: [[A:%.*]] = alloca i329// CHECK: store i32 [[X:%.*]], ptr [[A]]10// CHECK: [[R:%.*]] = freeze i32 poison11// CHECK: ret i32 [[R]]12 return __builtin_nondeterministic_value(x);13}14 15float clang_nondet_f( float x ) {16// CHECK-LABEL: entry17// CHECK: [[A:%.*]] = alloca float18// CHECK: store float [[X:%.*]], ptr [[A]]19// CHECK: [[R:%.*]] = freeze float poison20// CHECK: ret float [[R]]21 return __builtin_nondeterministic_value(x);22}23 24double clang_nondet_d( double x ) {25// CHECK-LABEL: entry26// CHECK: [[A:%.*]] = alloca double27// CHECK: store double [[X:%.*]], ptr [[A]]28// CHECK: [[R:%.*]] = freeze double poison29// CHECK: ret double [[R]]30 return __builtin_nondeterministic_value(x);31}32 33_Bool clang_nondet_b( _Bool x) {34// CHECK-LABEL: entry35// CHECK: [[A:%.*]] = alloca i836// CHECK: [[B:%.*]] = zext i1 %x to i837// CHECK: store i8 [[B]], ptr [[A]]38// CHECK: [[R:%.*]] = freeze i1 poison39// CHECK: ret i1 [[R]]40 return __builtin_nondeterministic_value(x);41}42 43void clang_nondet_fv( ) {44// CHECK-LABEL: entry45// CHECK: [[A:%.*]] = alloca <4 x float>46// CHECK: [[R:%.*]] = freeze <4 x float> poison47// CHECK: store <4 x float> [[R]], ptr [[A]]48// CHECK: ret void49 float4 x = __builtin_nondeterministic_value(x);50}51 52void clang_nondet_bv( ) {53// CHECK: [[A:%.*]] = alloca i854// CHECK: [[V:%.*]] = freeze <4 x i1> poison55// 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 i857// CHECK: store i8 [[BC]], ptr [[A]]58// CHECK: ret void59 bool4 x = __builtin_nondeterministic_value(x);60}61