v2: don't use ac_int_of_size()
Signed-off-by: Rhys Perry <[email protected]>
---
src/amd/common/ac_llvm_build.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 71eaac4b7bd..aa92c55c822 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -2868,9 +2868,15 @@ ac_build_readlane(struct ac_llvm_context *ctx,
LLVMValueRef src, LLVMValueRef la
{
LLVMTypeRef src_type = LLVMTypeOf(src);
src = ac_to_integer(ctx, src);
- unsigned bits = LLVMGetIntTypeWidth(LLVMTypeOf(src));
+ unsigned src_bits = LLVMGetIntTypeWidth(LLVMTypeOf(src));
+ unsigned bits = src_bits;
LLVMValueRef ret;
+ if (bits < 32) {
+ src = LLVMBuildZExt(ctx->builder, src, ctx->i32, "");
+ bits = 32;
+ }
+
if (bits == 32) {
ret = _ac_build_readlane(ctx, src, lane);
} else {
@@ -2887,6 +2893,10 @@ ac_build_readlane(struct ac_llvm_context *ctx,
LLVMValueRef src, LLVMValueRef la
LLVMConstInt(ctx->i32, i, 0),
"");
}
}
+
+ if (src_bits < 32)
+ ret = LLVMBuildTrunc(ctx->builder, ret,
LLVMIntTypeInContext(ctx->context, src_bits), "");
+
return LLVMBuildBitCast(ctx->builder, ret, src_type, "");
}
--
2.20.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev