From 77b35dc179473afbbd8c709c9f32c0f537c90776 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 22 Aug 2009 22:30:03 +0100 Subject: [PATCH] llvmpipe: s/uni/scalar/. More obvious name. --- src/gallium/drivers/llvmpipe/lp_bld_alpha.c | 2 +- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 24 ++++++------- src/gallium/drivers/llvmpipe/lp_bld_const.c | 10 +++--- src/gallium/drivers/llvmpipe/lp_bld_const.h | 8 ++--- src/gallium/drivers/llvmpipe/lp_bld_conv.c | 36 +++++++++---------- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 4 +-- src/gallium/drivers/llvmpipe/lp_bld_logic.c | 2 +- src/gallium/drivers/llvmpipe/lp_bld_swizzle.c | 4 +-- .../drivers/llvmpipe/lp_bld_tgsi_soa.c | 4 +-- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c index c5f6710c469..8d9af4cf6d9 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c @@ -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"); diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index bd854c590d4..710e6246d74 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -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, ""); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.c b/src/gallium/drivers/llvmpipe/lp_bld_const.c index a205c33715b..21487365eae 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_const.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_const.c @@ -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]; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.h b/src/gallium/drivers/llvmpipe/lp_bld_const.h index 18692aa9d81..1934530ea3c 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_const.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_const.h @@ -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 diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.c b/src/gallium/drivers/llvmpipe/lp_bld_conv.c index 3a54272cbd3..c8954c8a34f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.c @@ -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, ""); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 6018feda1c6..2cd6e6b9217 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -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) diff --git a/src/gallium/drivers/llvmpipe/lp_bld_logic.c b/src/gallium/drivers/llvmpipe/lp_bld_logic.c index b99fa89be33..1e1ecf805bc 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_logic.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_logic.c @@ -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, ""); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c index 27ca9b0edca..ac7eed9379a 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c @@ -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) diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index a37776aa7f8..60cf5e9af7d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -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++; -- 2.30.2