From f4f0e3a3954ae2bfb545dea37b8967c3d7ce1909 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 19 Mar 2019 23:40:32 +0100 Subject: [PATCH] ac: use llvm.amdgcn.fract intrinsic for nir_op_ffract Noticed with a Doom shader. 29077 shaders in 15096 tests Totals: SGPRS: 1282125 -> 1282133 (0.00 %) VGPRS: 908716 -> 908616 (-0.01 %) Spilled SGPRs: 24811 -> 24779 (-0.13 %) Code Size: 49048176 -> 48936488 (-0.23 %) bytes Max Waves: 244232 -> 244226 (-0.00 %) Totals from affected shaders: SGPRS: 229584 -> 229592 (0.00 %) VGPRS: 163268 -> 163168 (-0.06 %) Spilled SGPRs: 8682 -> 8650 (-0.37 %) Code Size: 12819572 -> 12707884 (-0.87 %) bytes Max Waves: 24398 -> 24392 (-0.02 %) Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/common/ac_llvm_build.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 0cab4d4a9b5..9cf1c6f8792 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -2155,19 +2155,18 @@ LLVMValueRef ac_build_fract(struct ac_llvm_context *ctx, LLVMValueRef src0, char *intr; if (bitsize == 32) { - intr = "llvm.floor.f32"; + intr = "llvm.amdgcn.fract.f32"; type = ctx->f32; } else { - intr = "llvm.floor.f64"; + intr = "llvm.amdgcn.fract.f64"; type = ctx->f64; } LLVMValueRef params[] = { src0, }; - LLVMValueRef floor = ac_build_intrinsic(ctx, intr, type, params, 1, - AC_FUNC_ATTR_READNONE); - return LLVMBuildFSub(ctx->builder, src0, floor, ""); + return ac_build_intrinsic(ctx, intr, type, params, 1, + AC_FUNC_ATTR_READNONE); } LLVMValueRef ac_build_isign(struct ac_llvm_context *ctx, LLVMValueRef src0, -- 2.30.2