summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-02-06 14:34:55 +1100
committerTimothy Arceri <[email protected]>2018-02-09 09:42:59 +1100
commit19f9839f0b94146227076f45dbbc62077d64e7a9 (patch)
treee7cb8ca60b938e14a443d538d5e2c71ea097b6c2 /src
parentbb750d265c5c27136cf10460fc423503a4d7d5aa (diff)
ac: add 64bit bitCount support
v2: use LLVMBuildTrunc() Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 550c12d249c..b842641383c 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1917,7 +1917,12 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
result = ac_build_intrinsic(&ctx->ac, "llvm.bitreverse.i32", ctx->ac.i32, src, 1, AC_FUNC_ATTR_READNONE);
break;
case nir_op_bit_count:
- result = ac_build_intrinsic(&ctx->ac, "llvm.ctpop.i32", ctx->ac.i32, src, 1, AC_FUNC_ATTR_READNONE);
+ if (get_elem_bits(&ctx->ac, LLVMTypeOf(src[0])) == 32)
+ result = ac_build_intrinsic(&ctx->ac, "llvm.ctpop.i32", ctx->ac.i32, src, 1, AC_FUNC_ATTR_READNONE);
+ else {
+ result = ac_build_intrinsic(&ctx->ac, "llvm.ctpop.i64", ctx->ac.i64, src, 1, AC_FUNC_ATTR_READNONE);
+ result = LLVMBuildTrunc(ctx->ac.builder, result, ctx->ac.i32, "");
+ }
break;
case nir_op_vec2:
case nir_op_vec3: