brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · db19c13 Raw
42 lines · c
1// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s2 3typedef _Float16 half;4typedef half half2 __attribute__((ext_vector_type(2)));5typedef half half3 __attribute__((ext_vector_type(3)));6typedef half half4 __attribute__((ext_vector_type(4)));7typedef float float2 __attribute__((ext_vector_type(2)));8typedef float float3 __attribute__((ext_vector_type(3)));9typedef float float4 __attribute__((ext_vector_type(4)));10 11// CHECK: [[fwidth0:%.*]] = tail call half @llvm.spv.fwidth.f16(half {{%.*}})12// CHECK: ret half [[fwidth0]]13half 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]]17half2 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]]21half3 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]]25half4 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]]29float 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]]33float2 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]]37float3 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]]41float4 test_fwidth_float4(float4 X) { return __builtin_spirv_fwidth(X); }42