llvm.org GIT mirror llvm / 62b3e22
R600/SI: Add support for 64-bit LDS loads. v2: -Use correct opcode for DS_READ_64 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204273 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 5 years ago
2 changed file(s) with 85 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
412412 def DS_READ_U8 : DS_Load_Helper <0x0000003a, "DS_READ_U8", VReg_32>;
413413 def DS_READ_I16 : DS_Load_Helper <0x0000003b, "DS_READ_I16", VReg_32>;
414414 def DS_READ_U16 : DS_Load_Helper <0x0000003c, "DS_READ_U16", VReg_32>;
415 def DS_READ_B64 : DS_Load_Helper <0x00000076, "DS_READ_B64", VReg_64>;
415416
416417 //def BUFFER_LOAD_FORMAT_X : MUBUF_ <0x00000000, "BUFFER_LOAD_FORMAT_X", []>;
417418 //def BUFFER_LOAD_FORMAT_XY : MUBUF_ <0x00000001, "BUFFER_LOAD_FORMAT_XY", []>;
19311932 defm : DSReadPat ;
19321933 defm : DSReadPat ;
19331934 defm : DSReadPat ;
1935 defm : DSReadPat ;
19341936
19351937 multiclass DSWritePat {
19361938 def : Pat <
0 ; RUN: llc -march=r600 -mcpu=SI < %s | FileCheck -check-prefix=SI %s
1
2 ; SI-LABEL: @local_i32_load
3 ; SI: DS_READ_B32 [[REG:v[0-9]+]], v{{[0-9]+}}, 28, [M0]
4 ; SI: BUFFER_STORE_DWORD [[REG]],
5 define void @local_i32_load(i32 addrspace(1)* %out, i32 addrspace(3)* %in) nounwind {
6 %gep = getelementptr i32 addrspace(3)* %in, i32 7
7 %val = load i32 addrspace(3)* %gep, align 4
8 store i32 %val, i32 addrspace(1)* %out, align 4
9 ret void
10 }
11
12 ; SI-LABEL: @local_i32_load_0_offset
13 ; SI: DS_READ_B32 [[REG:v[0-9]+]], v{{[0-9]+}}, 0, [M0]
14 ; SI: BUFFER_STORE_DWORD [[REG]],
15 define void @local_i32_load_0_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %in) nounwind {
16 %val = load i32 addrspace(3)* %in, align 4
17 store i32 %val, i32 addrspace(1)* %out, align 4
18 ret void
19 }
20
21 ; SI-LABEL: @local_i8_load_i16_max_offset
22 ; SI-NOT: ADD
23 ; SI: DS_READ_U8 [[REG:v[0-9]+]], {{v[0-9]+}}, -1, [M0]
24 ; SI: BUFFER_STORE_BYTE [[REG]],
25 define void @local_i8_load_i16_max_offset(i8 addrspace(1)* %out, i8 addrspace(3)* %in) nounwind {
26 %gep = getelementptr i8 addrspace(3)* %in, i32 65535
27 %val = load i8 addrspace(3)* %gep, align 4
28 store i8 %val, i8 addrspace(1)* %out, align 4
29 ret void
30 }
31
32 ; SI-LABEL: @local_i8_load_over_i16_max_offset
33 ; SI: S_ADD_I32 [[ADDR:s[0-9]+]], s{{[0-9]+}}, 65536
34 ; SI: V_MOV_B32_e32 [[VREGADDR:v[0-9]+]], [[ADDR]]
35 ; SI: DS_READ_U8 [[REG:v[0-9]+]], [[VREGADDR]], 0, [M0]
36 ; SI: BUFFER_STORE_BYTE [[REG]],
37 define void @local_i8_load_over_i16_max_offset(i8 addrspace(1)* %out, i8 addrspace(3)* %in) nounwind {
38 %gep = getelementptr i8 addrspace(3)* %in, i32 65536
39 %val = load i8 addrspace(3)* %gep, align 4
40 store i8 %val, i8 addrspace(1)* %out, align 4
41 ret void
42 }
43
44 ; SI-LABEL: @local_i64_load
45 ; SI-NOT: ADD
46 ; SI: DS_READ_B64 [[REG:v[[0-9]+:[0-9]+]]], v{{[0-9]+}}, 56, [M0]
47 ; SI: BUFFER_STORE_DWORDX2 [[REG]],
48 define void @local_i64_load(i64 addrspace(1)* %out, i64 addrspace(3)* %in) nounwind {
49 %gep = getelementptr i64 addrspace(3)* %in, i32 7
50 %val = load i64 addrspace(3)* %gep, align 8
51 store i64 %val, i64 addrspace(1)* %out, align 8
52 ret void
53 }
54
55 ; SI-LABEL: @local_i64_load_0_offset
56 ; SI: DS_READ_B64 [[REG:v\[[0-9]+:[0-9]+\]]], v{{[0-9]+}}, 0, [M0]
57 ; SI: BUFFER_STORE_DWORDX2 [[REG]],
58 define void @local_i64_load_0_offset(i64 addrspace(1)* %out, i64 addrspace(3)* %in) nounwind {
59 %val = load i64 addrspace(3)* %in, align 8
60 store i64 %val, i64 addrspace(1)* %out, align 8
61 ret void
62 }
63
64 ; SI-LABEL: @local_f64_load
65 ; SI-NOT: ADD
66 ; SI: DS_READ_B64 [[REG:v[[0-9]+:[0-9]+]]], v{{[0-9]+}}, 56, [M0]
67 ; SI: BUFFER_STORE_DWORDX2 [[REG]],
68 define void @local_f64_load(double addrspace(1)* %out, double addrspace(3)* %in) nounwind {
69 %gep = getelementptr double addrspace(3)* %in, i32 7
70 %val = load double addrspace(3)* %gep, align 8
71 store double %val, double addrspace(1)* %out, align 8
72 ret void
73 }
74
75 ; SI-LABEL: @local_f64_load_0_offset
76 ; SI: DS_READ_B64 [[REG:v\[[0-9]+:[0-9]+\]]], v{{[0-9]+}}, 0, [M0]
77 ; SI: BUFFER_STORE_DWORDX2 [[REG]],
78 define void @local_f64_load_0_offset(double addrspace(1)* %out, double addrspace(3)* %in) nounwind {
79 %val = load double addrspace(3)* %in, align 8
80 store double %val, double addrspace(1)* %out, align 8
81 ret void
82 }