1 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-pixel %s -fnative-half-type -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -finclude-default-header -triple spirv-vulkan-pixel %s -fnative-half-type -emit-llvm -o - | FileCheck %s --check-prefix=SPIRV
5 void test_scalar(float Buf) {
6 // CHECK: define void @{{.*}}test_scalar{{.*}}(float {{.*}} [[VALP:%.*]])
7 // CHECK: [[LOAD:%.*]] = load float, ptr [[VALP]].addr, align 4
8 // CHECK-NEXT: [[FCMP:%.*]] = fcmp olt float [[LOAD]], 0.000000e+00
9 // CHECK-NO: call i1 @llvm.dx.any
10 // CHECK-NEXT: call void @llvm.dx.discard(i1 [[FCMP]])
12 // SPIRV: define spir_func void @{{.*}}test_scalar{{.*}}(float {{.*}} [[VALP:%.*]])
13 // SPIRV: [[LOAD:%.*]] = load float, ptr [[VALP]].addr, align 4
14 // SPIRV-NEXT: [[FCMP:%.*]] = fcmp olt float [[LOAD]], 0.000000e+00
15 // SPIRV-NO: call i1 @llvm.spv.any
16 // SPIRV-NEXT: br i1 [[FCMP]], label %[[LTL:.*]], label %[[ENDL:.*]]
17 // SPIRV: [[LTL]]: ; preds = %entry
18 // SPIRV-NEXT: call void @llvm.spv.discard()
19 // SPIRV: br label %[[ENDL]]
23 void test_vector4(float4 Buf) {
24 // CHECK: define void @{{.*}}test_vector{{.*}}(<4 x float> {{.*}} [[VALP:%.*]])
25 // CHECK: [[LOAD:%.*]] = load <4 x float>, ptr [[VALP]].addr, align 16
26 // CHECK-NEXT: [[FCMP:%.*]] = fcmp olt <4 x float> [[LOAD]], zeroinitializer
27 // CHECK-NEXT: [[ANYC:%.*]] = call i1 @llvm.dx.any.v4i1(<4 x i1> [[FCMP]])
28 // CHECK-NEXT: call void @llvm.dx.discard(i1 [[ANYC]])
30 // SPIRV: define spir_func void @{{.*}}test_vector{{.*}}(<4 x float> {{.*}} [[VALP:%.*]])
31 // SPIRV: [[LOAD:%.*]] = load <4 x float>, ptr [[VALP]].addr, align 16
32 // SPIRV-NEXT: [[FCMP:%.*]] = fcmp olt <4 x float> [[LOAD]], zeroinitializer
33 // SPIRV-NEXT: [[ANYC:%.*]] = call i1 @llvm.spv.any.v4i1(<4 x i1> [[FCMP]])
34 // SPIRV-NEXT: br i1 [[ANYC]], label %[[LTL:.*]], label %[[ENDL:.*]]
35 // SPIRV: [[LTL]]: ; preds = %entry
36 // SPIRV-NEXT: call void @llvm.spv.discard()
37 // SPIRV-NEXT: br label %[[ENDL]]