blob: 73258fce51ae37c7078ca17cc86d1c8a468a18e1 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc -mtriple=amdgpu11.01-mesa-mesa3d < %s | FileCheck %s
; Split 16-bit typed loads from an address that is only known to be 2-byte
; aligned must not be merged, even if the immediate offsets are aligned.
define amdgpu_vs <3 x float> @split_16bit_typed_loads(ptr addrspace(8) inreg %rsrc, i32 %vidx, i32 %voff) {
; CHECK-LABEL: split_16bit_typed_loads:
; CHECK: ; %bb.0:
; CHECK-NEXT: s_clause 0x2
; CHECK-NEXT: tbuffer_load_format_x v4, v[0:1], s[0:3], 0 format:[BUF_FMT_16_FLOAT] idxen offen
; CHECK-NEXT: tbuffer_load_format_x v3, v[0:1], s[0:3], 0 format:[BUF_FMT_16_FLOAT] idxen offen offset:2
; CHECK-NEXT: tbuffer_load_format_x v2, v[0:1], s[0:3], 0 format:[BUF_FMT_16_FLOAT] idxen offen offset:4
; CHECK-NEXT: s_waitcnt vmcnt(1)
; CHECK-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v3
; CHECK-NEXT: s_waitcnt vmcnt(0)
; CHECK-NEXT: ; return to shader part epilog
%o2 = add i32 %voff, 2
%o4 = add i32 %voff, 4
%a = call float @llvm.amdgcn.struct.ptr.tbuffer.load.f32(ptr addrspace(8) %rsrc, i32 %vidx, i32 %voff, i32 0, i32 13, i32 0)
%b = call float @llvm.amdgcn.struct.ptr.tbuffer.load.f32(ptr addrspace(8) %rsrc, i32 %vidx, i32 %o2, i32 0, i32 13, i32 0)
%c = call float @llvm.amdgcn.struct.ptr.tbuffer.load.f32(ptr addrspace(8) %rsrc, i32 %vidx, i32 %o4, i32 0, i32 13, i32 0)
%r0 = insertelement <3 x float> poison, float %a, i32 0
%r1 = insertelement <3 x float> %r0, float %b, i32 1
%r2 = insertelement <3 x float> %r1, float %c, i32 2
ret <3 x float> %r2
}
; Typed loads with 32-bit components must already be 4-byte aligned, so they can
; be merged.
define amdgpu_vs <2 x float> @split_32bit_typed_loads(ptr addrspace(8) inreg %rsrc, i32 %vidx, i32 %voff) {
; CHECK-LABEL: split_32bit_typed_loads:
; CHECK: ; %bb.0:
; CHECK-NEXT: tbuffer_load_format_xy v[0:1], v[0:1], s[0:3], 0 format:[BUF_FMT_32_32_FLOAT] idxen offen
; CHECK-NEXT: s_waitcnt vmcnt(0)
; CHECK-NEXT: ; return to shader part epilog
%o4 = add i32 %voff, 4
%a = call float @llvm.amdgcn.struct.ptr.tbuffer.load.f32(ptr addrspace(8) %rsrc, i32 %vidx, i32 %voff, i32 0, i32 22, i32 0)
%b = call float @llvm.amdgcn.struct.ptr.tbuffer.load.f32(ptr addrspace(8) %rsrc, i32 %vidx, i32 %o4, i32 0, i32 22, i32 0)
%r0 = insertelement <2 x float> poison, float %a, i32 0
%r1 = insertelement <2 x float> %r0, float %b, i32 1
ret <2 x float> %r1
}
declare float @llvm.amdgcn.struct.ptr.tbuffer.load.f32(ptr addrspace(8), i32, i32, i32, i32 immarg, i32 immarg)
!llvm.module.flags = !{!0}
!0 = !{i32 7, !"amdgpu.tbuffer.oob.mode", i32 1}