|
| 1 | +// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s |
| 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))); |
| 7 | +typedef float float2 __attribute__((ext_vector_type(2))); |
| 8 | +typedef float float3 __attribute__((ext_vector_type(3))); |
| 9 | +typedef float float4 __attribute__((ext_vector_type(4))); |
| 10 | + |
| 11 | +// CHECK: [[fwidth0:%.*]] = tail call half @llvm.spv.fwidth.f16(half {{%.*}}) |
| 12 | +// CHECK: ret half [[fwidth0]] |
| 13 | +half test_fwidth_half(half X) { return __builtin_spirv_fwidth(X); } |
| 14 | + |
| 15 | +// CHECK: [[fwidth0:%.*]] = tail call <2 x half> @llvm.spv.fwidth.v2f16(<2 x half> {{%.*}}) |
| 16 | +// CHECK: ret <2 x half> [[fwidth0]] |
| 17 | +half2 test_fwidth_half2(half2 X) { return __builtin_spirv_fwidth(X); } |
| 18 | + |
| 19 | +// CHECK: [[fwidth0:%.*]] = tail call <3 x half> @llvm.spv.fwidth.v3f16(<3 x half> {{%.*}}) |
| 20 | +// CHECK: ret <3 x half> [[fwidth0]] |
| 21 | +half3 test_fwidth_half3(half3 X) { return __builtin_spirv_fwidth(X); } |
| 22 | + |
| 23 | +// CHECK: [[fwidth0:%.*]] = tail call <4 x half> @llvm.spv.fwidth.v4f16(<4 x half> {{%.*}}) |
| 24 | +// CHECK: ret <4 x half> [[fwidth0]] |
| 25 | +half4 test_fwidth_half4(half4 X) { return __builtin_spirv_fwidth(X); } |
| 26 | + |
| 27 | +// CHECK: [[fwidth0:%.*]] = tail call float @llvm.spv.fwidth.f32(float {{%.*}}) |
| 28 | +// CHECK: ret float [[fwidth0]] |
| 29 | +float test_fwidth_float(float X) { return __builtin_spirv_fwidth(X); } |
| 30 | + |
| 31 | +// CHECK: [[fwidth1:%.*]] = tail call <2 x float> @llvm.spv.fwidth.v2f32(<2 x float> {{%.*}}) |
| 32 | +// CHECK: ret <2 x float> [[fwidth1]] |
| 33 | +float2 test_fwidth_float2(float2 X) { return __builtin_spirv_fwidth(X); } |
| 34 | + |
| 35 | +// CHECK: [[fwidth2:%.*]] = tail call <3 x float> @llvm.spv.fwidth.v3f32(<3 x float> {{%.*}}) |
| 36 | +// CHECK: ret <3 x float> [[fwidth2]] |
| 37 | +float3 test_fwidth_float3(float3 X) { return __builtin_spirv_fwidth(X); } |
| 38 | + |
| 39 | +// CHECK: [[fwidth3:%.*]] = tail call <4 x float> @llvm.spv.fwidth.v4f32(<4 x float> {{%.*}}) |
| 40 | +// CHECK: ret <4 x float> [[fwidth3]] |
| 41 | +float4 test_fwidth_float4(float4 X) { return __builtin_spirv_fwidth(X); } |
0 commit comments