summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_llvm_build.c
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-08-16 12:46:27 +0200
committerConnor Abbott <[email protected]>2019-08-18 15:15:45 +0200
commitc550d367a747472ee71ed4c99e210174730aa82b (patch)
treec142bc645b52f31c139272ef7bf4846231376f78 /src/amd/common/ac_llvm_build.c
parent0e394cda0db60ce8b584aac37913b793847ad518 (diff)
ac/nir: Fix store_scratch with a non-full writemask
By adding one more helper to ac_llvm_build, we can also easily keep vector stores together. Fixes the tests/spec/glsl-1.30/execution/fs-large-local-array-vec4.shader_test piglit test. Fixes: 74470baebbd ("ac/nir: Lower large indirect variables to scratch") Reviewed-by: Marek Olšák <[email protected]
Diffstat (limited to 'src/amd/common/ac_llvm_build.c')
-rw-r--r--src/amd/common/ac_llvm_build.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 24970769b87..823bf34acdb 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -626,6 +626,22 @@ ac_build_expand(struct ac_llvm_context *ctx,
return ac_build_gather_values(ctx, chan, dst_channels);
}
+/* Extract components [start, start + channels) from a vector.
+ */
+LLVMValueRef
+ac_extract_components(struct ac_llvm_context *ctx,
+ LLVMValueRef value,
+ unsigned start,
+ unsigned channels)
+{
+ LLVMValueRef chan[channels];
+
+ for (unsigned i = 0; i < channels; i++)
+ chan[i] = ac_llvm_extract_elem(ctx, value, i + start);
+
+ return ac_build_gather_values(ctx, chan, channels);
+}
+
/* Expand a scalar or vector to <4 x type> by filling the remaining channels
* with undef. Extract at most num_channels components from the input.
*/