[Mesa-dev] [PATCH 09/38] ac/nir: make ac_build_fract work on all bit sizes

Rhys Perry pendingchaos02 at gmail.com
Fri Dec 7 17:22:02 UTC 2018


Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
---
 src/amd/common/ac_llvm_build.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 1ef28323d1..0a1987c65b 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -2327,16 +2327,9 @@ void ac_build_waitcnt(struct ac_llvm_context *ctx, unsigned simm16)
 LLVMValueRef ac_build_fract(struct ac_llvm_context *ctx, LLVMValueRef src0,
 			    unsigned bitsize)
 {
-	LLVMTypeRef type;
-	char *intr;
-
-	if (bitsize == 32) {
-		intr = "llvm.floor.f32";
-		type = ctx->f32;
-	} else {
-		intr = "llvm.floor.f64";
-		type = ctx->f64;
-	}
+	LLVMTypeRef type = ac_float_of_size(ctx, bitsize);
+	char intr[64];
+	snprintf(intr, sizeof(intr), "llvm.floor.f%d", bitsize);
 
 	LLVMValueRef params[] = {
 		src0,
-- 
2.19.2



More information about the mesa-dev mailing list