blob: 4d70ba837816948739e92ed87ee352c368f6a192 [file] [log] [blame]
Matt Arsenault711b3902015-08-07 20:18:34 +00001; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=bonaire < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-CI %s
2; RUN: opt -S -codegenprepare -mtriple=amdgcn-unknown-unknown -mcpu=tonga < %s | FileCheck -check-prefix=OPT -check-prefix=OPT-VI %s
3; RUN: llc -march=amdgcn -mcpu=bonaire -mattr=-promote-alloca < %s | FileCheck -check-prefix=GCN -check-prefix=CI %s
4; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-promote-alloca < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
5
6; OPT-LABEL: @test_no_sink_flat_small_offset_i32(
7; OPT: getelementptr i32, i32 addrspace(4)* %in
8; OPT: br i1
9; OPT-NOT: ptrtoint
10
11; GCN-LABEL: {{^}}test_no_sink_flat_small_offset_i32:
12; GCN: flat_load_dword
13; GCN: {{^}}BB0_2:
14define void @test_no_sink_flat_small_offset_i32(i32 addrspace(4)* %out, i32 addrspace(4)* %in, i32 %cond) {
15entry:
16 %out.gep = getelementptr i32, i32 addrspace(4)* %out, i64 999999
17 %in.gep = getelementptr i32, i32 addrspace(4)* %in, i64 7
18 %tmp0 = icmp eq i32 %cond, 0
19 br i1 %tmp0, label %endif, label %if
20
21if:
22 %tmp1 = load i32, i32 addrspace(4)* %in.gep
23 br label %endif
24
25endif:
26 %x = phi i32 [ %tmp1, %if ], [ 0, %entry ]
27 store i32 %x, i32 addrspace(4)* %out.gep
28 br label %done
29
30done:
31 ret void
32}