radeon/llvm: use integer comparison for IF
authorVadim Girlin <vadimgirlin@gmail.com>
Mon, 7 May 2012 09:14:58 +0000 (13:14 +0400)
committerVadim Girlin <vadimgirlin@gmail.com>
Mon, 7 May 2012 21:18:22 +0000 (01:18 +0400)
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@gmail.com>
src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c

index 06af13486055230af038ba2e1e8aaaaa98e2440c..c9b43651a91bae05000ff88618e314678604d431 100644 (file)
@@ -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");