summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_const.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-05-08 23:07:09 +0100
committerJosé Fonseca <[email protected]>2010-05-08 23:29:05 +0100
commitff7542ab90154769930c80d58597cfec40844bd9 (patch)
treef71e1c8c29f8bf5b83b662fe4759c54a221d2ede /src/gallium/auxiliary/gallivm/lp_bld_const.c
parentffebc7f2a7eaa2db5c998448412a91a7594f241c (diff)
gallivm: Actually do floor/ceil/trunc for scalars.
Also start axing the code duplication for scalar case. The olution is to treat the scalar case specially in a few innermost functions, and leave outer functions untouched.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_const.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 57843e9a60c..031ce9d1a37 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -301,6 +301,9 @@ lp_build_const_vec(struct lp_type type,
elems[0] = LLVMConstInt(elem_type, val*dscale + 0.5, 0);
}
+ if (type.length == 1)
+ return elems[0];
+
for(i = 1; i < type.length; ++i)
elems[i] = elems[0];
@@ -321,6 +324,9 @@ lp_build_const_int_vec(struct lp_type type,
for(i = 0; i < type.length; ++i)
elems[i] = LLVMConstInt(elem_type, val, type.sign ? 1 : 0);
+ if (type.length == 1)
+ return elems[0];
+
return LLVMConstVector(elems, type.length);
}