From: Nicolai Hähnle <nicolai.haeh...@amd.com> For simplicitly, always store system values as 32-bit values or arrays of 32-bit values. 64-bit values are unpacked and packed accordingly. --- .../drivers/radeonsi/si_shader_tgsi_setup.c | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index efc9452..da463c2 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -757,27 +757,43 @@ LLVMValueRef si_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base, return bitcast(bld_base, type, result); } static LLVMValueRef fetch_system_value(struct lp_build_tgsi_context *bld_base, const struct tgsi_full_src_register *reg, enum tgsi_opcode_type type, unsigned swizzle) { struct si_shader_context *ctx = si_shader_context(bld_base); - struct gallivm_state *gallivm = bld_base->base.gallivm; - + LLVMBuilderRef builder = ctx->gallivm.builder; LLVMValueRef cval = ctx->system_values[reg->Register.Index]; + + if (tgsi_type_is_64bit(type)) { + LLVMValueRef lo, hi; + + assert(swizzle == 0 || swizzle == 2); + + lo = LLVMBuildExtractElement( + builder, cval, LLVMConstInt(ctx->i32, swizzle, 0), ""); + hi = LLVMBuildExtractElement( + builder, cval, LLVMConstInt(ctx->i32, swizzle + 1, 0), ""); + + return si_llvm_emit_fetch_64bit(bld_base, type, lo, hi); + } + if (LLVMGetTypeKind(LLVMTypeOf(cval)) == LLVMVectorTypeKind) { - cval = LLVMBuildExtractElement(gallivm->builder, cval, - lp_build_const_int32(gallivm, swizzle), ""); + cval = LLVMBuildExtractElement( + builder, cval, LLVMConstInt(ctx->i32, swizzle, 0), ""); + } else { + assert(swizzle == 0); } + return bitcast(bld_base, type, cval); } static void emit_declaration(struct lp_build_tgsi_context *bld_base, const struct tgsi_full_declaration *decl) { struct si_shader_context *ctx = si_shader_context(bld_base); LLVMBuilderRef builder = bld_base->base.gallivm->builder; unsigned first, last, i; switch(decl->Declaration.File) { -- 2.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev