ac/llvm: open code fpow on LLVM 12 using fmul.legacy
A quick look at the asm shows that this enables source modifiers (neg, abs) for v_mul_legacy_f32. Totals from affected shaders: SGPRS: 110104 -> 110400 (0.27 %) VGPRS: 57632 -> 57636 (0.01 %) Spilled SGPRs: 66 -> 63 (-4.55 %) Spilled VGPRs: 0 -> 0 (0.00 %) Private memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size: 3290412 -> 3283068 (-0.22 %) bytes Max Waves: 32141 -> 32141 (0.00 %) Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9395>
This commit is contained in:
@@ -852,6 +852,17 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
||||
ac_to_float_type(&ctx->ac, def_type), result);
|
||||
break;
|
||||
}
|
||||
if (LLVM_VERSION_MAJOR >= 12) {
|
||||
result = emit_intrin_1f_param(&ctx->ac, "llvm.log2",
|
||||
ac_to_float_type(&ctx->ac, def_type), src[0]);
|
||||
result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.fmul.legacy", ctx->ac.f32,
|
||||
(LLVMValueRef[]){result, ac_to_float(&ctx->ac, src[1])},
|
||||
2, AC_FUNC_ATTR_READNONE);
|
||||
result = emit_intrin_1f_param(&ctx->ac, "llvm.exp2",
|
||||
ac_to_float_type(&ctx->ac, def_type), result);
|
||||
break;
|
||||
}
|
||||
/* Older LLVM doesn't have fmul.legacy. */
|
||||
result = emit_intrin_2f_param(&ctx->ac, "llvm.pow", ac_to_float_type(&ctx->ac, def_type),
|
||||
src[0], src[1]);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user