• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=SI %s
2
3
4; FIXME: This currently doesn't do a great job of clustering the
5; loads, which end up with extra moves between them. Right now, it
6; seems the only things areLoadsFromSameBasePtr is accomplishing is
7; ordering the loads so that the lower address loads come first.
8
9; FUNC-LABEL: {{^}}cluster_global_arg_loads:
10; SI-DAG: buffer_load_dword [[REG0:v[0-9]+]], off, s{{\[[0-9]+:[0-9]+\]}}, 0{{$}}
11; SI-DAG: buffer_load_dword [[REG1:v[0-9]+]], off, s{{\[[0-9]+:[0-9]+\]}}, 0 offset:8
12; SI: buffer_store_dword [[REG0]]
13; SI: buffer_store_dword [[REG1]]
14define void @cluster_global_arg_loads(i32 addrspace(1)* %out0, i32 addrspace(1)* %out1, i32 addrspace(1)* %ptr) #0 {
15  %load0 = load i32, i32 addrspace(1)* %ptr, align 4
16  %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 2
17  %load1 = load i32, i32 addrspace(1)* %gep, align 4
18  store i32 %load0, i32 addrspace(1)* %out0, align 4
19  store i32 %load1, i32 addrspace(1)* %out1, align 4
20  ret void
21}
22
23; Test for a crach in SIInstrInfo::areLoadsFromSameBasePtr() when checking
24; an MUBUF load which does not have a vaddr operand.
25; FUNC-LABEL: {{^}}same_base_ptr_crash:
26; SI: buffer_load_dword
27; SI: buffer_load_dword
28define void @same_base_ptr_crash(i32 addrspace(1)* %out, i32 addrspace(1)* %in, i32 %offset) {
29entry:
30  %out1 = getelementptr i32, i32 addrspace(1)* %out, i32 %offset
31  %tmp0 = load i32, i32 addrspace(1)* %out
32  %tmp1 = load i32, i32 addrspace(1)* %out1
33  %tmp2 = add i32 %tmp0, %tmp1
34  store i32 %tmp2, i32 addrspace(1)* %out
35  ret void
36}
37
38attributes #0 = { nounwind }
39attributes #1 = { nounwind readnone }
40