|
2 | 2 |
|
3 | 3 | // RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s |
4 | 4 |
|
| 5 | +typedef _Float16 half; |
| 6 | +typedef half half2 __attribute__((ext_vector_type(2))); |
| 7 | +typedef half half3 __attribute__((ext_vector_type(3))); |
| 8 | +typedef half half4 __attribute__((ext_vector_type(4))); |
5 | 9 | typedef float float2 __attribute__((ext_vector_type(2))); |
6 | 10 | typedef float float3 __attribute__((ext_vector_type(3))); |
7 | 11 | typedef float float4 __attribute__((ext_vector_type(4))); |
8 | 12 |
|
| 13 | +// CHECK-LABEL: define spir_func half @test_faceforward_half( |
| 14 | +// CHECK-SAME: half noundef [[N:%.*]], half noundef [[I:%.*]], half noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 15 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 16 | +// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call half @llvm.spv.smoothstep.f16(half [[N]], half [[I]], half [[NG]]) |
| 17 | +// CHECK-NEXT: ret half [[SPV_FACEFORWARD]] |
| 18 | +half test_faceforward_half(half N, half I, half Ng) { return __builtin_spirv_faceforward(N, I, Ng); } |
| 19 | + |
| 20 | +// CHECK-LABEL: define spir_func <2 x half> @test_faceforward_half2( |
| 21 | +// CHECK-SAME: <2 x half> noundef [[N:%.*]], <2 x half> noundef [[I:%.*]], <2 x half> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 22 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 23 | +// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <2 x half> @llvm.spv.smoothstep.v2f16(<2 x half> [[N]], <2 x half> [[I]], <2 x half> [[NG]]) |
| 24 | +// CHECK-NEXT: ret <2 x half> [[SPV_FACEFORWARD]] |
| 25 | +half2 test_faceforward_half2(half2 N, half2 I, half2 Ng) { return __builtin_spirv_faceforward(N, I, Ng); } |
| 26 | + |
| 27 | +// CHECK-LABEL: define spir_func <3 x half> @test_faceforward_half3( |
| 28 | +// CHECK-SAME: <3 x half> noundef [[N:%.*]], <3 x half> noundef [[I:%.*]], <3 x half> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 29 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 30 | +// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <3 x half> @llvm.spv.smoothstep.v3f16(<3 x half> [[N]], <3 x half> [[I]], <3 x half> [[NG]]) |
| 31 | +// CHECK-NEXT: ret <3 x half> [[SPV_FACEFORWARD]] |
| 32 | +half3 test_faceforward_half3(half3 N, half3 I, half3 Ng) { return __builtin_spirv_faceforward(N, I, Ng); } |
| 33 | + |
| 34 | +// CHECK-LABEL: define spir_func <4 x half> @test_faceforward_half4( |
| 35 | +// CHECK-SAME: <4 x half> noundef [[N:%.*]], <4 x half> noundef [[I:%.*]], <4 x half> noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 36 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 37 | +// CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call <4 x half> @llvm.spv.smoothstep.v4f16(<4 x half> [[N]], <4 x half> [[I]], <4 x half> [[NG]]) |
| 38 | +// CHECK-NEXT: ret <4 x half> [[SPV_FACEFORWARD]] |
| 39 | +half4 test_faceforward_half4(half4 N, half4 I, half4 Ng) { return __builtin_spirv_faceforward(N, I, Ng); } |
| 40 | + |
9 | 41 | // CHECK-LABEL: define spir_func float @test_faceforward_float( |
10 | | -// CHECK-SAME: float noundef [[N:%.*]], float noundef [[I:%.*]], float noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 42 | +// CHECK-SAME: float noundef [[N:%.*]], float noundef [[I:%.*]], float noundef [[NG:%.*]]) local_unnamed_addr #[[ATTR0]] { |
11 | 43 | // CHECK-NEXT: [[ENTRY:.*:]] |
12 | 44 | // CHECK-NEXT: [[SPV_FACEFORWARD:%.*]] = tail call float @llvm.spv.smoothstep.f32(float [[N]], float [[I]], float [[NG]]) |
13 | 45 | // CHECK-NEXT: ret float [[SPV_FACEFORWARD]] |
|
0 commit comments