diff options
author | nobled <nobled@dreamwidth.org> | 2010-08-08 19:44:54 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-08-09 17:31:18 +0100 |
commit | fc9a49b638c26801951c33a570178bbb2b67ec60 (patch) | |
tree | 3f9a08b0d0b4d33f4a45a99cad17ea62bb135f18 /src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | |
parent | 65b9747a54490dd56cd5cee4c2c1b9f51d35f133 (diff) |
gallivm: Always use floating-point operators for floating-point types
This fixes the assert added in LLVM 2.8:
assert(getType()->isIntOrIntVectorTy() &&
"Tried to create an integer operation on a non-integer type!")
But it also fixes some subtle bugs, since we should've been doing this
since LLVM 2.6 anyway.
Includes a modified patch from steckdenis@yahoo.fr for the
FNeg instructions in emit_fetch(); thanks for pointing those out.
http://bugs.freedesktop.org/29404
http://bugs.freedesktop.org/29407
Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 42d796cb95..becbd3bece 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -506,6 +506,7 @@ emit_fetch( const unsigned chan_index ) { const struct tgsi_full_src_register *reg = &inst->Src[src_op]; + const struct lp_type type = bld->base.type; const unsigned swizzle = tgsi_util_get_full_src_register_swizzle(reg, chan_index); LLVMValueRef res; @@ -612,11 +613,12 @@ emit_fetch( case TGSI_UTIL_SIGN_SET: /* TODO: Use bitwese OR for floating point */ res = lp_build_abs( &bld->base, res ); - res = LLVMBuildNeg( bld->base.builder, res, "" ); - break; - + /* fall through */ case TGSI_UTIL_SIGN_TOGGLE: - res = LLVMBuildNeg( bld->base.builder, res, "" ); + if (type.floating) + res = LLVMBuildFNeg( bld->base.builder, res, "" ); + else + res = LLVMBuildNeg( bld->base.builder, res, "" ); break; case TGSI_UTIL_SIGN_KEEP: |