Files
clang-p2996/libclc/generic/lib/shared/vload_impl.ll
Tom Stellard 922ac056e3 libclc: Add assembly versions of vload for global int4/8/16
The assembly should be generic, but at least currently R600 only supports
32-bit loads of int1/4, and I believe that only global is well-supported.

R600 lowers the 8/16 component vectors to multiple 4-bit loads.

The unoptimized C versions of the other stuff is left in place.

Patch by: Aaron Watry

llvm-svn: 185008
2013-06-26 18:22:15 +00:00

50 lines
2.0 KiB
LLVM

; This provides optimized implementations of vload4/8/16 for 32-bit int/uint
define <2 x i32> @__clc_vload2_impl_i32__global(i32 %offset, i32 addrspace(1)* nocapture %addr) nounwind readonly alwaysinline {
%1 = ptrtoint i32 addrspace(1)* %addr to i32
%2 = add i32 %1, %offset
%3 = inttoptr i32 %2 to <2 x i32> addrspace(1)*
%4 = load <2 x i32> addrspace(1)* %3, align 4, !tbaa !3
ret <2 x i32> %4
}
define <3 x i32> @__clc_vload3_impl_i32__global(i32 %offset, i32 addrspace(1)* nocapture %addr) nounwind readonly alwaysinline {
%1 = ptrtoint i32 addrspace(1)* %addr to i32
%2 = add i32 %1, %offset
%3 = inttoptr i32 %2 to <3 x i32> addrspace(1)*
%4 = load <3 x i32> addrspace(1)* %3, align 4, !tbaa !3
ret <3 x i32> %4
}
define <4 x i32> @__clc_vload4_impl_i32__global(i32 %offset, i32 addrspace(1)* nocapture %addr) nounwind readonly alwaysinline {
%1 = ptrtoint i32 addrspace(1)* %addr to i32
%2 = add i32 %1, %offset
%3 = inttoptr i32 %2 to <4 x i32> addrspace(1)*
%4 = load <4 x i32> addrspace(1)* %3, align 4, !tbaa !3
ret <4 x i32> %4
}
define <8 x i32> @__clc_vload8_impl_i32__global(i32 %offset, i32 addrspace(1)* nocapture %addr) nounwind readonly alwaysinline {
%1 = ptrtoint i32 addrspace(1)* %addr to i32
%2 = add i32 %1, %offset
%3 = inttoptr i32 %2 to <8 x i32> addrspace(1)*
%4 = load <8 x i32> addrspace(1)* %3, align 4, !tbaa !3
ret <8 x i32> %4
}
define <16 x i32> @__clc_vload16_impl_i32__global(i32 %offset, i32 addrspace(1)* nocapture %addr) nounwind readonly alwaysinline {
%1 = ptrtoint i32 addrspace(1)* %addr to i32
%2 = add i32 %1, %offset
%3 = inttoptr i32 %2 to <16 x i32> addrspace(1)*
%4 = load <16 x i32> addrspace(1)* %3, align 4, !tbaa !3
ret <16 x i32> %4
}
!1 = metadata !{metadata !"char", metadata !5}
!2 = metadata !{metadata !"short", metadata !5}
!3 = metadata !{metadata !"int", metadata !5}
!4 = metadata !{metadata !"long", metadata !5}
!5 = metadata !{metadata !"omnipotent char", metadata !6}
!6 = metadata !{metadata !"Simple C/C++ TBAA"}