More obvious name.
lp_build_context_init(&bld, builder, type);
if(state->enabled) {
- LLVMValueRef ref = lp_build_const_uni(type, state->ref_value);
+ LLVMValueRef ref = lp_build_const_scalar(type, state->ref_value);
LLVMValueRef test = lp_build_cmp(&bld, state->func, alpha, ref);
lp_build_name(test, "alpha_mask");
LLVMValueRef x)
{
/* log2(e) = 1/log(2) */
- LLVMValueRef log2e = lp_build_const_uni(bld->type, 1.4426950408889634);
+ LLVMValueRef log2e = lp_build_const_scalar(bld->type, 1.4426950408889634);
return lp_build_mul(bld, log2e, lp_build_exp2(bld, x));
}
LLVMValueRef x)
{
/* log(2) */
- LLVMValueRef log2 = lp_build_const_uni(bld->type, 1.4426950408889634);
+ LLVMValueRef log2 = lp_build_const_scalar(bld->type, 1.4426950408889634);
return lp_build_mul(bld, log2, lp_build_exp2(bld, x));
}
debug_printf("%s: inefficient/imprecise constant arithmetic\n");
for (i = num_coeffs; i--; ) {
- LLVMValueRef coeff = lp_build_const_uni(type, coeffs[i]);
+ LLVMValueRef coeff = lp_build_const_scalar(type, coeffs[i]);
if(res)
res = lp_build_add(bld, coeff, lp_build_mul(bld, x, res));
else
assert(type.floating && type.width == 32);
- x = lp_build_min(bld, x, lp_build_const_uni(type, 129.0));
- x = lp_build_max(bld, x, lp_build_const_uni(type, -126.99999));
+ x = lp_build_min(bld, x, lp_build_const_scalar(type, 129.0));
+ x = lp_build_max(bld, x, lp_build_const_scalar(type, -126.99999));
/* ipart = int(x - 0.5) */
- ipart = LLVMBuildSub(bld->builder, x, lp_build_const_uni(type, 0.5f), "");
+ ipart = LLVMBuildSub(bld->builder, x, lp_build_const_scalar(type, 0.5f), "");
ipart = LLVMBuildFPToSI(bld->builder, ipart, int_vec_type, "");
/* fpart = x - ipart */
if(p_exp2_int_part || p_exp2) {
/* expipart = (float) (1 << ipart) */
- expipart = LLVMBuildAdd(bld->builder, ipart, lp_build_int_const_uni(type, 127), "");
- expipart = LLVMBuildShl(bld->builder, expipart, lp_build_int_const_uni(type, 23), "");
+ expipart = LLVMBuildAdd(bld->builder, ipart, lp_build_int_const_scalar(type, 127), "");
+ expipart = LLVMBuildShl(bld->builder, expipart, lp_build_int_const_scalar(type, 23), "");
expipart = LLVMBuildBitCast(bld->builder, expipart, vec_type, "");
}
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
- LLVMValueRef expmask = lp_build_int_const_uni(type, 0x7f800000);
- LLVMValueRef mantmask = lp_build_int_const_uni(type, 0x007fffff);
+ LLVMValueRef expmask = lp_build_int_const_scalar(type, 0x7f800000);
+ LLVMValueRef mantmask = lp_build_int_const_scalar(type, 0x007fffff);
LLVMValueRef one = LLVMConstBitCast(bld->one, int_vec_type);
LLVMValueRef i = NULL;
}
if(p_floor_log2 || p_log2) {
- logexp = LLVMBuildLShr(bld->builder, exp, lp_build_int_const_uni(type, 23), "");
- logexp = LLVMBuildSub(bld->builder, logexp, lp_build_int_const_uni(type, 127), "");
+ logexp = LLVMBuildLShr(bld->builder, exp, lp_build_int_const_scalar(type, 23), "");
+ logexp = LLVMBuildSub(bld->builder, logexp, lp_build_int_const_scalar(type, 127), "");
logexp = LLVMBuildSIToFP(bld->builder, logexp, vec_type, "");
}
if(type.sign)
/* 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));
+ vec = LLVMConstLShr(vec, lp_build_int_const_scalar(type, 1));
#endif
return vec;
LLVMValueRef
-lp_build_const_uni(union lp_type type,
- double val)
+lp_build_const_scalar(union lp_type type,
+ double val)
{
LLVMTypeRef elem_type = lp_build_elem_type(type);
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
LLVMValueRef
-lp_build_int_const_uni(union lp_type type,
- long long val)
+lp_build_int_const_scalar(union lp_type type,
+ long long val)
{
LLVMTypeRef elem_type = lp_build_int_elem_type(type);
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
LLVMValueRef
-lp_build_const_uni(union lp_type type,
- double val);
+lp_build_const_scalar(union lp_type type,
+ double val);
LLVMValueRef
-lp_build_int_const_uni(union lp_type type,
- long long val);
+lp_build_int_const_scalar(union lp_type type,
+ long long val);
LLVMValueRef
scale = (double)mask/ubound;
bias = (double)((unsigned long long)1 << (mantissa - n));
- res = LLVMBuildMul(builder, src, lp_build_const_uni(src_type, scale), "");
- res = LLVMBuildAdd(builder, res, lp_build_const_uni(src_type, bias), "");
+ res = LLVMBuildMul(builder, src, lp_build_const_scalar(src_type, scale), "");
+ res = LLVMBuildAdd(builder, res, lp_build_const_scalar(src_type, bias), "");
res = LLVMBuildBitCast(builder, res, int_vec_type, "");
if(dst_width > n) {
int shift = dst_width - n;
- res = LLVMBuildShl(builder, res, lp_build_int_const_uni(src_type, shift), "");
+ res = LLVMBuildShl(builder, res, lp_build_int_const_scalar(src_type, shift), "");
/* Fill in the empty lower bits for added precision? */
#if 0
{
LLVMValueRef msb;
- msb = LLVMBuildLShr(builder, res, lp_build_int_const_uni(src_type, dst_width - 1), "");
- msb = LLVMBuildShl(builder, msb, lp_build_int_const_uni(src_type, shift), "");
- msb = LLVMBuildSub(builder, msb, lp_build_int_const_uni(src_type, 1), "");
+ msb = LLVMBuildLShr(builder, res, lp_build_int_const_scalar(src_type, dst_width - 1), "");
+ msb = LLVMBuildShl(builder, msb, lp_build_int_const_scalar(src_type, shift), "");
+ msb = LLVMBuildSub(builder, msb, lp_build_int_const_scalar(src_type, 1), "");
res = LLVMBuildOr(builder, res, msb, "");
}
#elif 0
while(shift > 0) {
- res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_int_const_uni(src_type, n), ""), "");
+ res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_int_const_scalar(src_type, n), ""), "");
shift -= n;
n *= 2;
}
#endif
}
else
- res = LLVMBuildAnd(builder, res, lp_build_int_const_uni(src_type, mask), "");
+ res = LLVMBuildAnd(builder, res, lp_build_int_const_scalar(src_type, mask), "");
return res;
}
if(src_width > mantissa) {
int shift = src_width - mantissa;
- res = LLVMBuildLShr(builder, res, lp_build_int_const_uni(dst_type, shift), "");
+ res = LLVMBuildLShr(builder, res, lp_build_int_const_scalar(dst_type, shift), "");
}
- bias_ = lp_build_const_uni(dst_type, bias);
+ bias_ = lp_build_const_scalar(dst_type, bias);
res = LLVMBuildOr(builder,
res,
res = LLVMBuildBitCast(builder, res, vec_type, "");
res = LLVMBuildSub(builder, res, bias_, "");
- res = LLVMBuildMul(builder, res, lp_build_const_uni(dst_type, scale), "");
+ res = LLVMBuildMul(builder, res, lp_build_const_scalar(dst_type, scale), "");
return res;
}
if(!src_type.sign && !clamped) {
struct lp_build_context bld;
unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width;
- LLVMValueRef dst_max = lp_build_int_const_uni(src_type, ((unsigned long long)1 << dst_bits) - 1);
+ LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1);
lp_build_context_init(&bld, builder, src_type);
lo = lp_build_min(&bld, lo, dst_max);
hi = lp_build_min(&bld, hi, dst_max);
if(dst_min == 0.0)
thres = bld.zero;
else
- thres = lp_build_const_uni(src_type, dst_min);
+ thres = lp_build_const_scalar(src_type, dst_min);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_max(&bld, tmp[i], thres);
}
if(dst_max == 1.0)
thres = bld.one;
else
- thres = lp_build_const_uni(src_type, dst_max);
+ thres = lp_build_const_scalar(src_type, dst_max);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_min(&bld, tmp[i], thres);
}
LLVMTypeRef tmp_vec_type;
if (dst_scale != 1.0) {
- LLVMValueRef scale = lp_build_const_uni(tmp_type, dst_scale);
+ LLVMValueRef scale = lp_build_const_scalar(tmp_type, dst_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildMul(builder, tmp[i], scale, "");
}
/* FIXME: compensate different offsets too */
if(src_shift > dst_shift) {
- LLVMValueRef shift = lp_build_int_const_uni(tmp_type, src_shift - dst_shift);
+ LLVMValueRef shift = lp_build_int_const_scalar(tmp_type, src_shift - dst_shift);
for(i = 0; i < num_tmps; ++i)
if(src_type.sign)
tmp[i] = LLVMBuildAShr(builder, tmp[i], shift, "");
}
if (src_scale != 1.0) {
- LLVMValueRef scale = lp_build_const_uni(tmp_type, 1.0/src_scale);
+ LLVMValueRef scale = lp_build_const_scalar(tmp_type, 1.0/src_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildMul(builder, tmp[i], scale, "");
}
/* FIXME: compensate different offsets too */
if(src_shift < dst_shift) {
- LLVMValueRef shift = lp_build_int_const_uni(tmp_type, dst_shift - src_shift);
+ LLVMValueRef shift = lp_build_int_const_scalar(tmp_type, dst_shift - src_shift);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildShl(builder, tmp[i], shift, "");
}
if(padding_left || padding_right) {
const long long mask_left = ((long long)1 << (format_desc->block.bits - padding_left)) - 1;
const long long mask_right = ((long long)1 << (padding_right)) - 1;
- z_bitmask = lp_build_int_const_uni(type, mask_left & mask_right);
+ z_bitmask = lp_build_int_const_scalar(type, mask_left & mask_right);
}
if(padding_left)
- src = LLVMBuildLShr(builder, src, lp_build_int_const_uni(type, padding_left), "");
+ src = LLVMBuildLShr(builder, src, lp_build_int_const_scalar(type, padding_left), "");
if(padding_right)
src = LLVMBuildAnd(builder, src, z_bitmask, "");
if(padding_left || padding_right)
if(table[func].gt &&
((type.width == 8 && type.sign) ||
(type.width != 8 && !type.sign))) {
- LLVMValueRef msb = lp_build_int_const_uni(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef msb = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1));
a = LLVMBuildXor(bld->builder, a, msb, "");
b = LLVMBuildXor(bld->builder, b, msb, "");
}
#endif
if(shift > 0)
- tmp = LLVMBuildLShr(bld->builder, a, lp_build_int_const_uni(type4, shift*type.width), "");
+ tmp = LLVMBuildLShr(bld->builder, a, lp_build_int_const_scalar(type4, shift*type.width), "");
if(shift < 0)
- tmp = LLVMBuildShl(bld->builder, a, lp_build_int_const_uni(type4, -shift*type.width), "");
+ tmp = LLVMBuildShl(bld->builder, a, lp_build_int_const_scalar(type4, -shift*type.width), "");
assert(tmp);
if(tmp)
break;
case TGSI_SAT_MINUS_PLUS_ONE:
- value = lp_build_max(&bld->base, value, lp_build_const_uni(bld->base.type, -1.0));
+ value = lp_build_max(&bld->base, value, lp_build_const_scalar(bld->base.type, -1.0));
value = lp_build_min(&bld->base, value, bld->base.one);
break;
assert(num_immediates < LP_MAX_IMMEDIATES);
for( i = 0; i < size; ++i )
bld.immediates[num_immediates][i] =
- lp_build_const_uni(type, parse.FullToken.FullImmediate.u[i].Float);
+ lp_build_const_scalar(type, parse.FullToken.FullImmediate.u[i].Float);
for( i = size; i < 4; ++i )
bld.immediates[num_immediates][i] = bld.base.undef;
num_immediates++;