summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_logic.c
diff options
context:
space:
mode:
authornobled <nobled@dreamwidth.org>2010-08-09 21:25:18 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-08-10 10:24:26 +0100
commit20b3e40f166c77bd7fa5b7171e5b4169ed035280 (patch)
treed84c490e811198e85c173265d5ca6aa57511c5c1 /src/gallium/auxiliary/gallivm/lp_bld_logic.c
parenta44a6960fab8c0053678fe74ce4c978ef40b06ff (diff)
gallivm: Fix bitwise operations for floats, division for integers
http://bugs.freedesktop.org/29407 Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_logic.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index 96f8e21fc6..7d7db3b0d9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -550,11 +550,22 @@ lp_build_select_aos(struct lp_build_context *bld,
LLVMValueRef
lp_build_andc(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
- assert(lp_check_value(bld->type, a));
- assert(lp_check_value(bld->type, b));
+ const struct lp_type type = bld->type;
+
+ assert(lp_check_value(type, a));
+ assert(lp_check_value(type, b));
+
+ /* can't do bitwise ops on floating-point values */
+ if(type.floating) {
+ a = LLVMBuildBitCast(bld->builder, a, bld->int_vec_type, "");
+ b = LLVMBuildBitCast(bld->builder, b, bld->int_vec_type, "");
+ }
b = LLVMBuildNot(bld->builder, b, "");
b = LLVMBuildAnd(bld->builder, a, b, "");
+ if(type.floating) {
+ b = LLVMBuildBitCast(bld->builder, b, bld->vec_type, "");
+ }
return b;
}