This commits moves all OpenCL builtins under a top-level 'opencl' directory, akin to how the CLC builtins are organized. This new structure aims to better convey the separation of the two layers and that 'CLC' is not a subset of OpenCL or a libclc target. In doing so this commit moves the location of the 'lib' directory to match CLC: libclc/generic/lib/ becomes libclc/opencl/lib/generic/. This allows us to remove some special casing in CMake and ensure a common directory structure. It also tries to better communicate that the OpenCL headers are libclc-specific OpenCL headers and should not be confused with or used as standard OpenCL headers. It does so by ensuring includes are of the form <clc/opencl/*>. It might be that we don't specifically need the libclc OpenCL headers and we simply could use clang's built-in declarations, but we can revisit that later. Aside from the code move, there is some code formatting and updating a couple of OpenCL builtin includes to use the readily available gentype helpers. This allows us to remove some '.inc' files.
96 lines
3.5 KiB
LLVM
96 lines
3.5 KiB
LLVM
;;===----------------------------------------------------------------------===;;
|
|
;
|
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
; See https://llvm.org/LICENSE.txt for license information.
|
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
;
|
|
;;===----------------------------------------------------------------------===;;
|
|
|
|
%opencl.image2d_t = type opaque
|
|
%opencl.image3d_t = type opaque
|
|
|
|
declare i32 @llvm.OpenCL.image.get.resource.id.2d(
|
|
%opencl.image2d_t addrspace(1)*) nounwind readnone
|
|
declare i32 @llvm.OpenCL.image.get.resource.id.3d(
|
|
%opencl.image3d_t addrspace(1)*) nounwind readnone
|
|
|
|
declare [3 x i32] @llvm.OpenCL.image.get.size.2d(
|
|
%opencl.image2d_t addrspace(1)*) nounwind readnone
|
|
declare [3 x i32] @llvm.OpenCL.image.get.size.3d(
|
|
%opencl.image3d_t addrspace(1)*) nounwind readnone
|
|
|
|
declare [2 x i32] @llvm.OpenCL.image.get.format.2d(
|
|
%opencl.image2d_t addrspace(1)*) nounwind readnone
|
|
declare [2 x i32] @llvm.OpenCL.image.get.format.3d(
|
|
%opencl.image3d_t addrspace(1)*) nounwind readnone
|
|
|
|
define i32 @__clc_get_image_width_2d(
|
|
%opencl.image2d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.2d(
|
|
%opencl.image2d_t addrspace(1)* %img)
|
|
%2 = extractvalue [3 x i32] %1, 0
|
|
ret i32 %2
|
|
}
|
|
define i32 @__clc_get_image_width_3d(
|
|
%opencl.image3d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d(
|
|
%opencl.image3d_t addrspace(1)* %img)
|
|
%2 = extractvalue [3 x i32] %1, 0
|
|
ret i32 %2
|
|
}
|
|
|
|
define i32 @__clc_get_image_height_2d(
|
|
%opencl.image2d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.2d(
|
|
%opencl.image2d_t addrspace(1)* %img)
|
|
%2 = extractvalue [3 x i32] %1, 1
|
|
ret i32 %2
|
|
}
|
|
define i32 @__clc_get_image_height_3d(
|
|
%opencl.image3d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d(
|
|
%opencl.image3d_t addrspace(1)* %img)
|
|
%2 = extractvalue [3 x i32] %1, 1
|
|
ret i32 %2
|
|
}
|
|
|
|
define i32 @__clc_get_image_depth_3d(
|
|
%opencl.image3d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d(
|
|
%opencl.image3d_t addrspace(1)* %img)
|
|
%2 = extractvalue [3 x i32] %1, 2
|
|
ret i32 %2
|
|
}
|
|
|
|
define i32 @__clc_get_image_channel_data_type_2d(
|
|
%opencl.image2d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.2d(
|
|
%opencl.image2d_t addrspace(1)* %img)
|
|
%2 = extractvalue [2 x i32] %1, 0
|
|
ret i32 %2
|
|
}
|
|
define i32 @__clc_get_image_channel_data_type_3d(
|
|
%opencl.image3d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.3d(
|
|
%opencl.image3d_t addrspace(1)* %img)
|
|
%2 = extractvalue [2 x i32] %1, 0
|
|
ret i32 %2
|
|
}
|
|
|
|
define i32 @__clc_get_image_channel_order_2d(
|
|
%opencl.image2d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.2d(
|
|
%opencl.image2d_t addrspace(1)* %img)
|
|
%2 = extractvalue [2 x i32] %1, 1
|
|
ret i32 %2
|
|
}
|
|
define i32 @__clc_get_image_channel_order_3d(
|
|
%opencl.image3d_t addrspace(1)* nocapture %img) #0 {
|
|
%1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.3d(
|
|
%opencl.image3d_t addrspace(1)* %img)
|
|
%2 = extractvalue [2 x i32] %1, 1
|
|
ret i32 %2
|
|
}
|
|
|
|
attributes #0 = { nounwind readnone alwaysinline }
|