llvm.org GIT mirror llvm / b17ae4f
Merging r226584: ------------------------------------------------------------------------ r226584 | thomas.stellard | 2015-01-20 12:49:43 -0500 (Tue, 20 Jan 2015) | 6 lines R600/SI: Don't store scratch buffer frame index in MUBUF offset field We don't have a good way of legalizing this if the frame index offset is more than the 12-bits, which is size of MUBUF's offset field, so now we store the frame index in the vaddr field. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@226723 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 4 years ago
2 changed file(s) with 81 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
987987 }
988988 }
989989
990 // (add FI, n0)
991 if ((Addr.getOpcode() == ISD::ADD || Addr.getOpcode() == ISD::OR) &&
992 isa(Addr.getOperand(0))) {
993 VAddr = Addr.getOperand(1);
994 ImmOffset = Addr.getOperand(0);
995 return true;
996 }
997
998 // (FI)
999 if (isa(Addr)) {
1000 VAddr = SDValue(CurDAG->getMachineNode(AMDGPU::V_MOV_B32_e32, DL, MVT::i32,
1001 CurDAG->getConstant(0, MVT::i32)), 0);
1002 ImmOffset = Addr;
1003 return true;
1004 }
1005
1006990 // (node)
1007991 VAddr = Addr;
1008992 ImmOffset = CurDAG->getTargetConstant(0, MVT::i16);
0 ; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=SI < %s | FileCheck %s
1
2 ; When a frame index offset is more than 12-bits, make sure we don't store
3 ; it in mubuf's offset field.
4
5 ; CHECK-LABEL: {{^}}legal_offset_fi:
6 ; CHECK: buffer_store_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen
7 ; CHECK: v_mov_b32_e32 [[OFFSET:v[0-9]+]], 0x8000
8 ; CHECK: buffer_store_dword v{{[0-9]+}}, [[OFFSET]], s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen{{$}}
9
10 define void @legal_offset_fi(i32 addrspace(1)* %out, i32 %cond, i32 %if_offset, i32 %else_offset) {
11 entry:
12 %scratch0 = alloca [8192 x i32]
13 %scratch1 = alloca [8192 x i32]
14
15 %scratchptr0 = getelementptr [8192 x i32]* %scratch0, i32 0, i32 0
16 store i32 1, i32* %scratchptr0
17
18 %scratchptr1 = getelementptr [8192 x i32]* %scratch1, i32 0, i32 0
19 store i32 2, i32* %scratchptr1
20
21 %cmp = icmp eq i32 %cond, 0
22 br i1 %cmp, label %if, label %else
23
24 if:
25 %if_ptr = getelementptr [8192 x i32]* %scratch0, i32 0, i32 %if_offset
26 %if_value = load i32* %if_ptr
27 br label %done
28
29 else:
30 %else_ptr = getelementptr [8192 x i32]* %scratch1, i32 0, i32 %else_offset
31 %else_value = load i32* %else_ptr
32 br label %done
33
34 done:
35 %value = phi i32 [%if_value, %if], [%else_value, %else]
36 store i32 %value, i32 addrspace(1)* %out
37 ret void
38
39 ret void
40
41 }
42
43 ; CHECK-LABEL: {{^}}legal_offset_fi_offset
44 ; CHECK: buffer_store_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen
45 ; CHECK: v_add_i32_e32 [[OFFSET:v[0-9]+]], 0x8000
46 ; CHECK: buffer_store_dword v{{[0-9]+}}, [[OFFSET]], s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen{{$}}
47
48 define void @legal_offset_fi_offset(i32 addrspace(1)* %out, i32 %cond, i32 addrspace(1)* %offsets, i32 %if_offset, i32 %else_offset) {
49 entry:
50 %scratch0 = alloca [8192 x i32]
51 %scratch1 = alloca [8192 x i32]
52
53 %offset0 = load i32 addrspace(1)* %offsets
54 %scratchptr0 = getelementptr [8192 x i32]* %scratch0, i32 0, i32 %offset0
55 store i32 %offset0, i32* %scratchptr0
56
57 %offsetptr1 = getelementptr i32 addrspace(1)* %offsets, i32 1
58 %offset1 = load i32 addrspace(1)* %offsetptr1
59 %scratchptr1 = getelementptr [8192 x i32]* %scratch1, i32 0, i32 %offset1
60 store i32 %offset1, i32* %scratchptr1
61
62 %cmp = icmp eq i32 %cond, 0
63 br i1 %cmp, label %if, label %else
64
65 if:
66 %if_ptr = getelementptr [8192 x i32]* %scratch0, i32 0, i32 %if_offset
67 %if_value = load i32* %if_ptr
68 br label %done
69
70 else:
71 %else_ptr = getelementptr [8192 x i32]* %scratch1, i32 0, i32 %else_offset
72 %else_value = load i32* %else_ptr
73 br label %done
74
75 done:
76 %value = phi i32 [%if_value, %if], [%else_value, %else]
77 store i32 %value, i32 addrspace(1)* %out
78 ret void
79 }
80