brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · f399462 Raw
75 lines · c
1// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -fnative-half-type -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-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//17half 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//25half2 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//33half3 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//41half4 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//50float test_refract_float(float I, float N, float eta) { return __builtin_spirv_refract(I, N, eta); }51 52// CHECK-LABEL: define spir_func <2 x float> @test_refract_float2(53// CHECK-SAME: <2 x float> noundef [[I:%.*]], <2 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {54// CHECK-NEXT:  [[ENTRY:.*:]]55// CHECK:    [[SPV_REFRACT:%.*]] = tail call <2 x float> @llvm.spv.refract.v2f32.f32(<2 x float> [[I]], <2 x float> [[N]], float [[ETA]])56// CHECK-NEXT:    ret <2 x float> [[SPV_REFRACT]]57//58float2 test_refract_float2(float2 I, float2 N, float eta) { return __builtin_spirv_refract(I, N, eta); }59 60// CHECK-LABEL: define spir_func <3 x float> @test_refract_float3(61// CHECK-SAME: <3 x float> noundef [[I:%.*]], <3 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] {62// CHECK-NEXT:  [[ENTRY:.*:]]63// CHECK-NEXT:    [[SPV_REFRACT:%.*]] = tail call <3 x float> @llvm.spv.refract.v3f32.f32(<3 x float> [[I]], <3 x float> [[N]], float [[ETA]])64// CHECK-NEXT:    ret <3 x float> [[SPV_REFRACT]]65//66float3 test_refract_float3(float3 I, float3 N, float eta) { return __builtin_spirv_refract(I, N, eta); }67 68// CHECK-LABEL: define spir_func <4 x float> @test_refract_float4(69// CHECK-SAME: <4 x float> noundef [[I:%.*]], <4 x float> noundef [[N:%.*]], float noundef [[ETA:%.*]]) local_unnamed_addr #[[ATTR0]] {70// CHECK-NEXT:  [[ENTRY:.*:]]71// CHECK-NEXT:    [[SPV_REFRACT:%.*]] = tail call <4 x float> @llvm.spv.refract.v4f32.f32(<4 x float> [[I]], <4 x float> [[N]], float [[ETA]])72// CHECK-NEXT:    ret <4 x float> [[SPV_REFRACT]]73//74float4 test_refract_float4(float4 I, float4 N, float eta) { return __builtin_spirv_refract(I, N, eta); }75