|
1 | | -// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s |
| 1 | +// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -fnative-half-type -emit-llvm -o - | FileCheck %s |
2 | 2 |
|
| 3 | +typedef _Float16 half; |
| 4 | +typedef half half2 __attribute__((ext_vector_type(2))); |
| 5 | +typedef half half3 __attribute__((ext_vector_type(3))); |
| 6 | +typedef half half4 __attribute__((ext_vector_type(4))); |
3 | 7 | typedef float float2 __attribute__((ext_vector_type(2))); |
4 | 8 | typedef float float3 __attribute__((ext_vector_type(3))); |
5 | 9 | typedef float float4 __attribute__((ext_vector_type(4))); |
6 | 10 |
|
| 11 | +// CHECK-LABEL: define spir_func half @test_refract_half( |
| 12 | +// CHECK-SAME: half noundef [[I:%.*]], half noundef [[N:%.*]], half noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 13 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 14 | +// CHECK: [[SPV_REFRACT:%.*]] = tail call half @llvm.spv.refract.f16.f16(half [[I]], half [[N]], half [[ETA]]) |
| 15 | +// CHECK-NEXT: ret half [[SPV_REFRACT]] |
| 16 | +// |
| 17 | +half test_refract_half(half I, half N, half eta) { return __builtin_spirv_refract(I, N, eta); } |
| 18 | + |
| 19 | +// CHECK-LABEL: define spir_func <2 x half> @test_refract_half2( |
| 20 | +// CHECK-SAME: <2 x half> noundef [[I:%.*]], <2 x half> noundef [[N:%.*]], half noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 21 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 22 | +// CHECK: [[SPV_REFRACT:%.*]] = tail call <2 x half> @llvm.spv.refract.v2f16.f16(<2 x half> [[I]], <2 x half> [[N]], half [[ETA]]) |
| 23 | +// CHECK-NEXT: ret <2 x half> [[SPV_REFRACT]] |
| 24 | +// |
| 25 | +half2 test_refract_half2(half2 I, half2 N, half eta) { return __builtin_spirv_refract(I, N, eta); } |
| 26 | + |
| 27 | +// CHECK-LABEL: define spir_func <3 x half> @test_refract_half3( |
| 28 | +// CHECK-SAME: <3 x half> noundef [[I:%.*]], <3 x half> noundef [[N:%.*]], half noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 29 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 30 | +// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <3 x half> @llvm.spv.refract.v3f16.f16(<3 x half> [[I]], <3 x half> [[N]], half [[ETA]]) |
| 31 | +// CHECK-NEXT: ret <3 x half> [[SPV_REFRACT]] |
| 32 | +// |
| 33 | +half3 test_refract_half3(half3 I, half3 N, half eta) { return __builtin_spirv_refract(I, N, eta); } |
| 34 | + |
| 35 | +// CHECK-LABEL: define spir_func <4 x half> @test_refract_half4( |
| 36 | +// CHECK-SAME: <4 x half> noundef [[I:%.*]], <4 x half> noundef [[N:%.*]], half noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] { |
| 37 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 38 | +// CHECK-NEXT: [[SPV_REFRACT:%.*]] = tail call <4 x half> @llvm.spv.refract.v4f16.f16(<4 x half> [[I]], <4 x half> [[N]], half [[ETA]]) |
| 39 | +// CHECK-NEXT: ret <4 x half> [[SPV_REFRACT]] |
| 40 | +// |
| 41 | +half4 test_refract_half4(half4 I, half4 N, half eta) { return __builtin_spirv_refract(I, N, eta); } |
| 42 | + |
| 43 | + |
| 44 | +// CHECK-LABEL: define spir_func float @test_refract_float( |
| 45 | +// CHECK-SAME: float noundef [[I:%.*]], float noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 46 | +// CHECK-NEXT: [[ENTRY:.*:]] |
| 47 | +// CHECK: [[SPV_REFRACT:%.*]] = tail call float @llvm.spv.refract.f32.f32(float [[I]], float [[N]], float [[ETA]]) |
| 48 | +// CHECK-NEXT: ret float [[SPV_REFRACT]] |
| 49 | +// |
| 50 | +float test_refract_float(float I, float N, float eta) { return __builtin_spirv_refract(I, N, eta); } |
| 51 | + |
7 | 52 | // CHECK-LABEL: define spir_func <2 x float> @test_refract_float2( |
8 | 53 | // CHECK-SAME: <2 x float> noundef [[I:%.*]], <2 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
9 | 54 | // CHECK-NEXT: [[ENTRY:.*:]] |
|
0 commit comments