llvmpipe: s/uni/scalar/.
authorJosé Fonseca <jfonseca@vmware.com>
Sat, 22 Aug 2009 21:30:03 +0000 (22:30 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 29 Aug 2009 08:21:40 +0000 (09:21 +0100)
More obvious name.

src/gallium/drivers/llvmpipe/lp_bld_alpha.c
src/gallium/drivers/llvmpipe/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_bld_const.c
src/gallium/drivers/llvmpipe/lp_bld_const.h
src/gallium/drivers/llvmpipe/lp_bld_conv.c
src/gallium/drivers/llvmpipe/lp_bld_depth.c
src/gallium/drivers/llvmpipe/lp_bld_logic.c
src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c

index c5f6710c469a40bff91e0f8c40150c384e55f6cd..8d9af4cf6d91cdaead643fab6c2e357c5a9a2010 100644 (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");
index bd854c590d40bc520c7bfc5f71bd6096729734a3..710e6246d746c076c7c1ce616d9c593e8a4e5ea1 100644 (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, "");
    }
 
index a205c33715ba8e31aa6155fee1ce54676ad534dd..21487365eaebb5483dd0718503bb7f942af2713d 100644 (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];
index 18692aa9d813f0eb33a3aa30f77c2b96626d60b4..1934530ea3c7e286028bb5acf069c91ab80af0e4 100644 (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
index 3a54272cbd334c5f3e3bbf9743bbf46f6f13d535..c8954c8a34fd7e538797d8c6fe579d34c71b65d2 100644 (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, "");
        }
index 6018feda1c6d7f924a884b8c649e4ad3baacd71b..2cd6e6b92175cf82b76d10199068637e0c15176b 100644 (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)
index b99fa89be33fa43c1e59aedd126019b0f6c30bfc..1e1ecf805bccad3b80b7d1b165b0eb6915251478 100644 (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, "");
          }
index 27ca9b0edca2de9df2d69ac8e2928f4512866d13..ac7eed9379a51e7c917470471ef6df649762dd0f 100644 (file)
@@ -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)
index a37776aa7f8fc0851418910ccabdbacf7854fb16..60cf5e9af7d9d9c05c061aa925b3e04ecfd036c5 100644 (file)
@@ -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++;