From 2e73ccb485b968a6d3b46d7b30611e9e49aa9473 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 6 Mar 2017 08:32:24 +1000 Subject: [PATCH] radv/ac: use bitfield extract new intrinsics. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index ebfb457259c..be97c676479 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1052,14 +1052,13 @@ static LLVMValueRef emit_imul_high(struct nir_to_llvm_context *ctx, } static LLVMValueRef emit_bitfield_extract(struct nir_to_llvm_context *ctx, - const char *intrin, unsigned attr_mask, + bool is_signed, LLVMValueRef srcs[3]) { LLVMValueRef result; LLVMValueRef icond = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), ""); - result = ac_build_intrinsic(&ctx->ac, intrin, ctx->i32, srcs, 3, - AC_FUNC_ATTR_READNONE | attr_mask); + result = ac_build_bfe(&ctx->ac, srcs[0], srcs[1], srcs[2], is_signed); result = LLVMBuildSelect(ctx->builder, icond, srcs[0], result, ""); return result; } @@ -1432,12 +1431,10 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr) to_float_type(ctx, def_type), src[0], src[1], src[2]); break; case nir_op_ibitfield_extract: - result = emit_bitfield_extract(ctx, "llvm.AMDGPU.bfe.i32", - AC_FUNC_ATTR_LEGACY, src); + result = emit_bitfield_extract(ctx, true, src); break; case nir_op_ubitfield_extract: - result = emit_bitfield_extract(ctx, "llvm.AMDGPU.bfe.u32", - AC_FUNC_ATTR_LEGACY, src); + result = emit_bitfield_extract(ctx, false, src); break; case nir_op_bitfield_insert: result = emit_bitfield_insert(ctx, src[0], src[1], src[2], src[3]); -- 2.30.2