[Mesa-dev] [PATCH 02/12] radeon/llvm: use integer comparison for IF

Vadim Girlin vadimgirlin at gmail.com
Mon May 7 10:08:44 PDT 2012


Replacing "float equal to 1.0f" with "int not equal to 0".
This should help for further optimization of boolean computations.

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---
 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 06af134..c9b4365 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -465,8 +465,10 @@ static void if_emit(
 	struct gallivm_state * gallivm = bld_base->base.gallivm;
 	LLVMValueRef cond;
 	LLVMBasicBlockRef if_block, else_block, endif_block;
-	cond = LLVMBuildFCmp(gallivm->builder, LLVMRealOEQ, emit_data->args[0],
-							bld_base->base.one, "");
+
+	cond = LLVMBuildICmp(gallivm->builder, LLVMIntNE,
+	        bitcast(bld_base, TGSI_TYPE_UNSIGNED, emit_data->args[0]),
+			bld_base->int_bld.zero, "");
 
 	endif_block = LLVMAppendBasicBlockInContext(gallivm->context,
 						ctx->main_fn, "ENDIF");
-- 
1.7.10.1



More information about the mesa-dev mailing list