Line 0
Link Here
|
|
|
1 |
--- src/gallium/drivers/radeonsi/si_shader.c.orig 2017-02-20 03:46:54.000000000 -0800 |
2 |
+++ src/gallium/drivers/radeonsi/si_shader.c 2017-03-24 11:21:43.735415000 -0700 |
3 |
@@ -413,7 +413,7 @@ static void declare_input_vs( |
4 |
args[2] = buffer_index; |
5 |
input = lp_build_intrinsic(gallivm->builder, |
6 |
"llvm.SI.vs.load.input", ctx->v4f32, args, 3, |
7 |
- LLVMReadNoneAttribute); |
8 |
+ LP_FUNC_ATTR_READNONE); |
9 |
|
10 |
/* Break up the vec4 into individual components */ |
11 |
for (chan = 0; chan < 4; chan++) { |
12 |
@@ -808,7 +808,7 @@ static LLVMValueRef build_buffer_load(st |
13 |
type_names[func]); |
14 |
|
15 |
return lp_build_intrinsic(gallivm->builder, name, types[func], args, |
16 |
- ARRAY_SIZE(args), LLVMReadOnlyAttribute); |
17 |
+ ARRAY_SIZE(args), LP_FUNC_ATTR_READONLY); |
18 |
} else { |
19 |
LLVMValueRef args[] = { |
20 |
LLVMBuildBitCast(gallivm->builder, rsrc, ctx->v16i8, ""), |
21 |
@@ -839,7 +839,7 @@ static LLVMValueRef build_buffer_load(st |
22 |
type_names[func], arg_type); |
23 |
|
24 |
return lp_build_intrinsic(gallivm->builder, name, types[func], args, |
25 |
- ARRAY_SIZE(args), LLVMReadOnlyAttribute); |
26 |
+ ARRAY_SIZE(args), LP_FUNC_ATTR_READONLY); |
27 |
} |
28 |
} |
29 |
|
30 |
@@ -1126,14 +1126,14 @@ static LLVMValueRef fetch_input_gs( |
31 |
value = lp_build_intrinsic(gallivm->builder, |
32 |
"llvm.SI.buffer.load.dword.i32.i32", |
33 |
ctx->i32, args, 9, |
34 |
- LLVMReadOnlyAttribute); |
35 |
+ LP_FUNC_ATTR_READONLY); |
36 |
if (tgsi_type_is_64bit(type)) { |
37 |
LLVMValueRef value2; |
38 |
args[2] = lp_build_const_int32(gallivm, (param * 4 + swizzle + 1) * 256); |
39 |
value2 = lp_build_intrinsic(gallivm->builder, |
40 |
"llvm.SI.buffer.load.dword.i32.i32", |
41 |
ctx->i32, args, 9, |
42 |
- LLVMReadOnlyAttribute); |
43 |
+ LP_FUNC_ATTR_READONLY); |
44 |
return si_llvm_emit_fetch_64bit(bld_base, type, |
45 |
value, value2); |
46 |
} |
47 |
@@ -1285,12 +1285,12 @@ static void interp_fs_input(struct si_sh |
48 |
args[1] = attr_number; |
49 |
front = lp_build_intrinsic(gallivm->builder, intr_name, |
50 |
ctx->f32, args, args[3] ? 4 : 3, |
51 |
- LLVMReadNoneAttribute); |
52 |
+ LP_FUNC_ATTR_READNONE); |
53 |
|
54 |
args[1] = back_attr_number; |
55 |
back = lp_build_intrinsic(gallivm->builder, intr_name, |
56 |
ctx->f32, args, args[3] ? 4 : 3, |
57 |
- LLVMReadNoneAttribute); |
58 |
+ LP_FUNC_ATTR_READNONE); |
59 |
|
60 |
result[chan] = LLVMBuildSelect(gallivm->builder, |
61 |
is_face_positive, |
62 |
@@ -1307,7 +1307,7 @@ static void interp_fs_input(struct si_sh |
63 |
args[3] = interp_param; |
64 |
result[0] = lp_build_intrinsic(gallivm->builder, intr_name, |
65 |
ctx->f32, args, args[3] ? 4 : 3, |
66 |
- LLVMReadNoneAttribute); |
67 |
+ LP_FUNC_ATTR_READNONE); |
68 |
result[1] = |
69 |
result[2] = lp_build_const_float(gallivm, 0.0f); |
70 |
result[3] = lp_build_const_float(gallivm, 1.0f); |
71 |
@@ -1322,7 +1322,7 @@ static void interp_fs_input(struct si_sh |
72 |
args[3] = interp_param; |
73 |
result[chan] = lp_build_intrinsic(gallivm->builder, intr_name, |
74 |
ctx->f32, args, args[3] ? 4 : 3, |
75 |
- LLVMReadNoneAttribute); |
76 |
+ LP_FUNC_ATTR_READNONE); |
77 |
} |
78 |
} |
79 |
} |
80 |
@@ -1463,18 +1463,18 @@ static LLVMValueRef get_thread_id(struct |
81 |
|
82 |
if (HAVE_LLVM < 0x0308) { |
83 |
tid = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", |
84 |
- ctx->i32, NULL, 0, LLVMReadNoneAttribute); |
85 |
+ ctx->i32, NULL, 0, LP_FUNC_ATTR_READNONE); |
86 |
} else { |
87 |
LLVMValueRef tid_args[2]; |
88 |
tid_args[0] = lp_build_const_int32(gallivm, 0xffffffff); |
89 |
tid_args[1] = lp_build_const_int32(gallivm, 0); |
90 |
tid_args[1] = lp_build_intrinsic(gallivm->builder, |
91 |
"llvm.amdgcn.mbcnt.lo", ctx->i32, |
92 |
- tid_args, 2, LLVMReadNoneAttribute); |
93 |
+ tid_args, 2, LP_FUNC_ATTR_READNONE); |
94 |
|
95 |
tid = lp_build_intrinsic(gallivm->builder, |
96 |
"llvm.amdgcn.mbcnt.hi", ctx->i32, |
97 |
- tid_args, 2, LLVMReadNoneAttribute); |
98 |
+ tid_args, 2, LP_FUNC_ATTR_READNONE); |
99 |
} |
100 |
set_range_metadata(ctx, tid, 0, 64); |
101 |
return tid; |
102 |
@@ -1491,7 +1491,7 @@ static LLVMValueRef buffer_load_const(st |
103 |
LLVMValueRef args[2] = {resource, offset}; |
104 |
|
105 |
return lp_build_intrinsic(builder, "llvm.SI.load.const", ctx->f32, args, 2, |
106 |
- LLVMReadNoneAttribute); |
107 |
+ LP_FUNC_ATTR_READNONE); |
108 |
} |
109 |
|
110 |
static LLVMValueRef load_sample_position(struct si_shader_context *radeon_bld, LLVMValueRef sample_id) |
111 |
@@ -1729,7 +1729,7 @@ static void declare_system_value( |
112 |
value = lp_build_intrinsic(gallivm->builder, |
113 |
"llvm.amdgcn.ps.live", |
114 |
ctx->i1, NULL, 0, |
115 |
- LLVMReadNoneAttribute); |
116 |
+ LP_FUNC_ATTR_READNONE); |
117 |
value = LLVMBuildNot(gallivm->builder, value, ""); |
118 |
value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, ""); |
119 |
break; |
120 |
@@ -1942,7 +1942,7 @@ static void si_llvm_init_export_args(str |
121 |
packed = lp_build_intrinsic(base->gallivm->builder, |
122 |
"llvm.SI.packf16", |
123 |
ctx->i32, pack_args, 2, |
124 |
- LLVMReadNoneAttribute); |
125 |
+ LP_FUNC_ATTR_READNONE); |
126 |
args[chan + 5] = |
127 |
LLVMBuildBitCast(base->gallivm->builder, |
128 |
packed, ctx->f32, ""); |
129 |
@@ -2087,7 +2087,7 @@ static LLVMValueRef si_scale_alpha_by_sa |
130 |
|
131 |
coverage = lp_build_intrinsic(gallivm->builder, "llvm.ctpop.i32", |
132 |
ctx->i32, |
133 |
- &coverage, 1, LLVMReadNoneAttribute); |
134 |
+ &coverage, 1, LP_FUNC_ATTR_READNONE); |
135 |
|
136 |
coverage = LLVMBuildUIToFP(gallivm->builder, coverage, |
137 |
ctx->f32, ""); |
138 |
@@ -3668,7 +3668,7 @@ static void load_emit_buffer(struct si_s |
139 |
emit_data->output[emit_data->chan] = lp_build_intrinsic( |
140 |
builder, intrinsic_name, dst_type, |
141 |
emit_data->args, emit_data->arg_count, |
142 |
- LLVMReadOnlyAttribute); |
143 |
+ LP_FUNC_ATTR_READONLY); |
144 |
} |
145 |
|
146 |
static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx, |
147 |
@@ -3773,7 +3773,7 @@ static void load_emit( |
148 |
lp_build_intrinsic( |
149 |
builder, "llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type, |
150 |
emit_data->args, emit_data->arg_count, |
151 |
- LLVMReadOnlyAttribute); |
152 |
+ LP_FUNC_ATTR_READONLY); |
153 |
} else { |
154 |
get_image_intr_name("llvm.amdgcn.image.load", |
155 |
emit_data->dst_type, /* vdata */ |
156 |
@@ -3785,7 +3785,7 @@ static void load_emit( |
157 |
lp_build_intrinsic( |
158 |
builder, intrinsic_name, emit_data->dst_type, |
159 |
emit_data->args, emit_data->arg_count, |
160 |
- LLVMReadOnlyAttribute); |
161 |
+ LP_FUNC_ATTR_READONLY); |
162 |
} |
163 |
} |
164 |
|
165 |
@@ -4221,7 +4221,7 @@ static void resq_emit( |
166 |
out = lp_build_intrinsic( |
167 |
builder, "llvm.SI.getresinfo.i32", emit_data->dst_type, |
168 |
emit_data->args, emit_data->arg_count, |
169 |
- LLVMReadNoneAttribute); |
170 |
+ LP_FUNC_ATTR_READNONE); |
171 |
|
172 |
/* Divide the number of layers by 6 to get the number of cubes. */ |
173 |
if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY) { |
174 |
@@ -4455,7 +4455,7 @@ static void txq_emit(const struct lp_bui |
175 |
emit_data->output[emit_data->chan] = lp_build_intrinsic( |
176 |
base->gallivm->builder, "llvm.SI.getresinfo.i32", |
177 |
emit_data->dst_type, emit_data->args, emit_data->arg_count, |
178 |
- LLVMReadNoneAttribute); |
179 |
+ LP_FUNC_ATTR_READNONE); |
180 |
|
181 |
/* Divide the number of layers by 6 to get the number of cubes. */ |
182 |
if (target == TGSI_TEXTURE_CUBE_ARRAY || |
183 |
@@ -4873,7 +4873,7 @@ static void si_lower_gather4_integer(str |
184 |
emit_data->output[emit_data->chan] = |
185 |
lp_build_intrinsic(builder, intr_name, emit_data->dst_type, |
186 |
emit_data->args, emit_data->arg_count, |
187 |
- LLVMReadNoneAttribute); |
188 |
+ LP_FUNC_ATTR_READNONE); |
189 |
} |
190 |
|
191 |
static void build_tex_intrinsic(const struct lp_build_tgsi_action *action, |
192 |
@@ -4897,7 +4897,7 @@ static void build_tex_intrinsic(const st |
193 |
base->gallivm->builder, |
194 |
"llvm.SI.vs.load.input", emit_data->dst_type, |
195 |
emit_data->args, emit_data->arg_count, |
196 |
- LLVMReadNoneAttribute); |
197 |
+ LP_FUNC_ATTR_READNONE); |
198 |
return; |
199 |
} |
200 |
|
201 |
@@ -4974,7 +4974,7 @@ static void build_tex_intrinsic(const st |
202 |
emit_data->output[emit_data->chan] = lp_build_intrinsic( |
203 |
base->gallivm->builder, intr_name, emit_data->dst_type, |
204 |
emit_data->args, emit_data->arg_count, |
205 |
- LLVMReadNoneAttribute); |
206 |
+ LP_FUNC_ATTR_READNONE); |
207 |
} |
208 |
|
209 |
static void si_llvm_emit_txqs( |
210 |
@@ -5072,13 +5072,13 @@ static void si_llvm_emit_ddxy( |
211 |
args[1] = val; |
212 |
tl = lp_build_intrinsic(gallivm->builder, |
213 |
"llvm.amdgcn.ds.bpermute", ctx->i32, |
214 |
- args, 2, LLVMReadNoneAttribute); |
215 |
+ args, 2, LP_FUNC_ATTR_READNONE); |
216 |
|
217 |
args[0] = LLVMBuildMul(gallivm->builder, trbl_tid, |
218 |
lp_build_const_int32(gallivm, 4), ""); |
219 |
trbl = lp_build_intrinsic(gallivm->builder, |
220 |
"llvm.amdgcn.ds.bpermute", ctx->i32, |
221 |
- args, 2, LLVMReadNoneAttribute); |
222 |
+ args, 2, LP_FUNC_ATTR_READNONE); |
223 |
} else { |
224 |
LLVMValueRef store_ptr, load_ptr0, load_ptr1; |
225 |
|
226 |
@@ -5261,7 +5261,7 @@ static void build_interp_intrinsic(const |
227 |
emit_data->output[chan] = |
228 |
lp_build_intrinsic(gallivm->builder, intr_name, |
229 |
ctx->f32, args, args[3] ? 4 : 3, |
230 |
- LLVMReadNoneAttribute); |
231 |
+ LP_FUNC_ATTR_READNONE); |
232 |
} |
233 |
} |
234 |
|
235 |
@@ -5446,10 +5446,10 @@ static void si_create_function(struct si |
236 |
* SGPR spilling significantly. |
237 |
*/ |
238 |
if (LLVMGetTypeKind(LLVMTypeOf(P)) == LLVMPointerTypeKind) { |
239 |
- LLVMAddAttribute(P, LLVMByValAttribute); |
240 |
+ lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_BYVAL); |
241 |
lp_add_attr_dereferenceable(P, UINT64_MAX); |
242 |
} else |
243 |
- LLVMAddAttribute(P, LLVMInRegAttribute); |
244 |
+ lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_INREG); |
245 |
} |
246 |
|
247 |
if (ctx->screen->b.debug_flags & DBG_UNSAFE_MATH) { |
248 |
@@ -6395,7 +6395,7 @@ static int si_generate_gs_copy_shader(st |
249 |
lp_build_intrinsic(gallivm->builder, |
250 |
"llvm.SI.buffer.load.dword.i32.i32", |
251 |
ctx->i32, args, 9, |
252 |
- LLVMReadOnlyAttribute), |
253 |
+ LP_FUNC_ATTR_READONLY), |
254 |
ctx->f32, ""); |
255 |
} |
256 |
} |