[Mesa-dev] [PATCH v2 11/41] ac/nir: make ac_build_fract work on all bit sizes

Rhys Perry pendingchaos02 at gmail.com
Sat Feb 16 00:22:00 UTC 2019


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 667f9700764..db937eb66fb 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -2049,16 +2049,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.20.1



More information about the mesa-dev mailing list