summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2017-06-30 19:10:43 -0700
committerConnor Abbott <[email protected]>2017-07-03 11:58:59 -0700
commit2ec77f7a3c95802cd54b015f613b044c0d135f72 (patch)
treeb26317030a8ff6ec773b92477edf8f7a3b55211e /src
parent7168425dd77f37fa048de5a4639619763556c331 (diff)
ac/nir: fix 64-bit shifts
NIR always makes the shift amount 32 bits, but LLVM asserts if the two sources aren't the same type. Zero-extend the shift amount to make LLVM happy. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 88f3f44e92c..e72747ab78a 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1621,13 +1621,22 @@ static void visit_alu(struct nir_to_llvm_context *ctx, const nir_alu_instr *inst
result = LLVMBuildXor(ctx->builder, src[0], src[1], "");
break;
case nir_op_ishl:
- result = LLVMBuildShl(ctx->builder, src[0], src[1], "");
+ result = LLVMBuildShl(ctx->builder, src[0],
+ LLVMBuildZExt(ctx->builder, src[1],
+ LLVMTypeOf(src[0]), ""),
+ "");
break;
case nir_op_ishr:
- result = LLVMBuildAShr(ctx->builder, src[0], src[1], "");
+ result = LLVMBuildAShr(ctx->builder, src[0],
+ LLVMBuildZExt(ctx->builder, src[1],
+ LLVMTypeOf(src[0]), ""),
+ "");
break;
case nir_op_ushr:
- result = LLVMBuildLShr(ctx->builder, src[0], src[1], "");
+ result = LLVMBuildLShr(ctx->builder, src[0],
+ LLVMBuildZExt(ctx->builder, src[1],
+ LLVMTypeOf(src[0]), ""),
+ "");
break;
case nir_op_ilt:
result = emit_int_cmp(&ctx->ac, LLVMIntSLT, src[0], src[1]);