llvmpipe: s/uni/scalar/.

More obvious name.
This commit is contained in:
José Fonseca
2009-08-22 22:30:03 +01:00
parent 5811ed87d7
commit 77b35dc179
9 changed files with 47 additions and 47 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ lp_build_alpha_test(LLVMBuilderRef builder,
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");
+12 -12
View File
@@ -723,7 +723,7 @@ lp_build_exp(struct lp_build_context *bld,
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));
}
@@ -737,7 +737,7 @@ lp_build_log(struct lp_build_context *bld,
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));
}
@@ -766,7 +766,7 @@ lp_build_polynomial(struct lp_build_context *bld,
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
@@ -821,11 +821,11 @@ lp_build_exp2_approx(struct lp_build_context *bld,
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 */
@@ -835,8 +835,8 @@ lp_build_exp2_approx(struct lp_build_context *bld,
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, "");
}
@@ -902,8 +902,8 @@ lp_build_log2_approx(struct lp_build_context *bld,
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;
@@ -927,8 +927,8 @@ lp_build_log2_approx(struct lp_build_context *bld,
}
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, "");
}
+5 -5
View File
@@ -255,7 +255,7 @@ lp_build_one(union lp_type 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;
@@ -269,8 +269,8 @@ lp_build_one(union lp_type type)
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];
@@ -295,8 +295,8 @@ lp_build_const_uni(union lp_type type,
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];
+4 -4
View File
@@ -85,13 +85,13 @@ lp_build_one(union lp_type type);
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
+18 -18
View File
@@ -114,33 +114,33 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
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;
}
@@ -179,10 +179,10 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
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,
@@ -191,7 +191,7 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
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;
}
@@ -341,7 +341,7 @@ lp_build_pack2(LLVMBuilderRef builder,
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);
@@ -484,7 +484,7 @@ lp_build_conv(LLVMBuilderRef builder,
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);
}
@@ -493,7 +493,7 @@ lp_build_conv(LLVMBuilderRef builder,
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);
}
@@ -521,7 +521,7 @@ lp_build_conv(LLVMBuilderRef builder,
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, "");
}
@@ -548,7 +548,7 @@ lp_build_conv(LLVMBuilderRef builder,
/* 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, "");
@@ -621,7 +621,7 @@ lp_build_conv(LLVMBuilderRef builder,
}
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, "");
}
@@ -633,7 +633,7 @@ lp_build_conv(LLVMBuilderRef builder,
/* 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, "");
}
+2 -2
View File
@@ -184,11 +184,11 @@ lp_build_depth_test(LLVMBuilderRef builder,
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)
+1 -1
View File
@@ -159,7 +159,7 @@ lp_build_cmp(struct lp_build_context *bld,
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, "");
}
@@ -144,9 +144,9 @@ lp_build_broadcast_aos(struct lp_build_context *bld,
#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)
@@ -215,7 +215,7 @@ emit_store(
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;
@@ -1487,7 +1487,7 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
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++;