brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 00b80b6 Raw
55 lines · plain
1;;===----------------------------------------------------------------------===;;2;3; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4; See https://llvm.org/LICENSE.txt for license information.5; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6;7;;===----------------------------------------------------------------------===;;8 9%opencl.image2d_t = type opaque10 11declare <4 x float> @llvm.R600.tex(<4 x float>, i32, i32, i32, i32, i32, i32,12                                   i32, i32, i32) readnone13declare i32 @llvm.OpenCL.image.get.resource.id.2d(14  %opencl.image2d_t addrspace(1)*) nounwind readnone15declare i32 @llvm.OpenCL.sampler.get.resource.id(i32) readnone16 17define <4 x float> @__clc_v4f_from_v2f(<2 x float> %v) alwaysinline {18  %e0 = extractelement <2 x float> %v, i32 019  %e1 = extractelement <2 x float> %v, i32 120  %res.0 = insertelement <4 x float> poison, float %e0, i32 021  %res.1 = insertelement <4 x float> %res.0, float %e1, i32 122  %res.2 = insertelement <4 x float> %res.1, float 0.0, i32 223  %res.3 = insertelement <4 x float> %res.2, float 0.0, i32 324  ret <4 x float> %res.325}26 27define <4 x float> @__clc_read_imagef_tex(28    %opencl.image2d_t addrspace(1)* nocapture %img,29    i32 %sampler, <2 x float> %coord) alwaysinline {30entry:31  %coord_v4 = call <4 x float> @__clc_v4f_from_v2f(<2 x float> %coord)32  %smp_id = call i32 @llvm.OpenCL.sampler.get.resource.id(i32 %sampler)33  %img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d(34      %opencl.image2d_t addrspace(1)* %img)35  %tex_id = add i32 %img_id, 2    ; First 2 IDs are reserved.36 37  %coord_norm = and i32 %sampler, 138  %is_norm = icmp eq i32 %coord_norm, 139  br i1 %is_norm, label %NormCoord, label %UnnormCoord40NormCoord:41  %data.norm = call <4 x float> @llvm.R600.tex(42      <4 x float> %coord_v4,43      i32 0, i32 0, i32 0,        ; Offset.44      i32 2, i32 %smp_id,45      i32 1, i32 1, i32 1, i32 1) ; Normalized coords.46  ret <4 x float> %data.norm47UnnormCoord:48  %data.unnorm = call <4 x float> @llvm.R600.tex(49      <4 x float> %coord_v4,50      i32 0, i32 0, i32 0,        ; Offset.51      i32 %tex_id, i32 %smp_id,52      i32 0, i32 0, i32 0, i32 0) ; Unnormalized coords.53  ret <4 x float> %data.unnorm54}55