diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-08-08 22:56:22 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-08-29 09:21:26 +0100 |
commit | a9771d2b7580ae1273c4edeb9eebcafab39a72bb (patch) | |
tree | db0d6540d723d00b24263e096ceb19c422c847ee | |
parent | 8244d6e5adfcc668676e3783ac6ce53e8dcc2a88 (diff) |
llvmpipe: Fix one const generation for some signed integers.
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_const.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.c b/src/gallium/drivers/llvmpipe/lp_bld_const.c index 2109a85ceb..20f0d3c40b 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_const.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_const.c @@ -125,14 +125,20 @@ lp_build_one(union lp_type type) elems[0] = LLVMConstInt(elem_type, 1LL << (type.width/2), 0); else if(!type.norm) elems[0] = LLVMConstInt(elem_type, 1, 0); + else if(type.sign) + elems[0] = LLVMConstInt(elem_type, (1LL << (type.width - 1)) - 1, 0); else { /* special case' -- 1.0 for normalized types is more easily attained if * we start with a vector consisting of all bits set */ LLVMTypeRef vec_type = LLVMVectorType(elem_type, type.length); LLVMValueRef vec = LLVMConstAllOnes(vec_type); +#if 0 if(type.sign) - vec = LLVMConstLShr(vec, LLVMConstInt(LLVMInt32Type(), 1, 0)); + /* TODO: Unfortunately this caused "Tried to create a shift operation + * on a non-integer type!" */ + vec = LLVMConstLShr(vec, lp_build_int_const_uni(type, 1)); +#endif return vec; } |