From 9f3e5b7bbbef4c8fd2f0cbbe62a4fef5582f465f Mon Sep 17 00:00:00 2001
From: suijingfeng <suijingfeng@loongson.cn>
Date: Mon, 16 Aug 2021 14:42:57 +0800
Subject: [PATCH 3/4] gallivm: arit: use LLVMBuildFPToUI when the float is not
 signed

---
 src/gallium/auxiliary/gallivm/lp_bld_arit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 1c71c05..b1eb5ef 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -2403,7 +2403,10 @@ lp_build_iround(struct lp_build_context *bld,
       res = LLVMBuildFAdd(builder, a, half, "");
    }
 
-   res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
+   if (type.sign)
+      res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
+   else
+      res = LLVMBuildFPToUI(builder, res, int_vec_type, "");
 
    return res;
 }
-- 
2.20.1

