diff --git a/clang/test/CodeGen/builtins-nondet.c b/clang/test/CodeGen/builtins-nondet.c --- a/clang/test/CodeGen/builtins-nondet.c +++ b/clang/test/CodeGen/builtins-nondet.c @@ -1,6 +1,7 @@ // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s typedef float float4 __attribute__((ext_vector_type(4))); +typedef _Bool bool4 __attribute__((ext_vector_type(4))); int clang_nondet_i( int x ) { // CHECK-LABEL: entry @@ -29,7 +30,17 @@ return __builtin_nondet(x); } -float4 clang_nondet_v( float4 x ) { +_Bool clang_nondet_b( _Bool x) { +// CHECK-LABEL: entry +// CHECK: [[A:%.*]] = alloca i8, align 1 +// CHECK: [[B:%.*]] = zext i1 %x to i8 +// CHECK: store i8 [[B]], ptr [[A]], align 1 +// CHECK: [[R:%.*]] = freeze i1 poison +// CHECK: ret i1 [[R]] + return __builtin_nondet(x); +} + +float4 clang_nondet_fv( float4 x ) { // CHECK-LABEL: entry // CHECK: [[A:%.*]] = alloca <4 x float>, align 16 // CHECK: store <4 x float> [[X:%.*]], ptr [[A]], align 16 @@ -38,3 +49,14 @@ return __builtin_nondet(x); } +bool4 clang_nondet_bv( bool4 x ) { +// CHECK-LABEL: entry +// CHECK: [[A:%.*]] = alloca i8, align 1 +// CHECK: [[V:%.*]] = shufflevector <4 x i1> [[X:%.*]], <4 x i1> poison, <8 x i32> +// CHECK: [[B:%.*]] = bitcast <8 x i1> [[V]] to i8 +// CHECK: store i8 [[B]], ptr [[A]], align 1 +// CHECK: [[R:%.*]] = freeze <4 x i1> poison +// CHECK: ret <4 x i1> [[R]] + return __builtin_nondet(x); +} +