summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c291
1 files changed, 144 insertions, 147 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 40744e3bc91..84a26761dbd 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -42,6 +42,7 @@
#include "util/u_math.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_info.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
@@ -75,10 +76,6 @@
FOR_EACH_CHANNEL( CHAN )\
IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )
-#define CHAN_X 0
-#define CHAN_Y 1
-#define CHAN_Z 2
-#define CHAN_W 3
#define NUM_CHANNELS 4
#define LP_MAX_INSTRUCTIONS 256
@@ -1432,33 +1429,33 @@ emit_instruction(
break;
case TGSI_OPCODE_LIT:
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ) {
- dst0[CHAN_X] = bld->base.one;
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ) {
+ dst0[TGSI_CHAN_X] = bld->base.one;
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ) {
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
- dst0[CHAN_Y] = lp_build_max( &bld->base, src0, bld->base.zero);
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ) {
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ dst0[TGSI_CHAN_Y] = lp_build_max( &bld->base, src0, bld->base.zero);
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) ) {
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) {
/* XMM[1] = SrcReg[0].yyyy */
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
/* XMM[1] = max(XMM[1], 0) */
tmp1 = lp_build_max( &bld->base, tmp1, bld->base.zero);
/* XMM[2] = SrcReg[0].wwww */
- tmp2 = emit_fetch( bld, inst, 0, CHAN_W );
+ tmp2 = emit_fetch( bld, inst, 0, TGSI_CHAN_W );
tmp1 = lp_build_pow( &bld->base, tmp1, tmp2);
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp2 = lp_build_cmp(&bld->base, PIPE_FUNC_GREATER, tmp0, bld->base.zero);
- dst0[CHAN_Z] = lp_build_select(&bld->base, tmp2, tmp1, bld->base.zero);
+ dst0[TGSI_CHAN_Z] = lp_build_select(&bld->base, tmp2, tmp1, bld->base.zero);
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) ) {
- dst0[CHAN_W] = bld->base.one;
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) ) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
case TGSI_OPCODE_RCP:
/* TGSI_OPCODE_RECIP */
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
res = lp_build_rcp(&bld->base, src0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = res;
@@ -1467,7 +1464,7 @@ emit_instruction(
case TGSI_OPCODE_RSQ:
/* TGSI_OPCODE_RECIPSQRT */
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
src0 = lp_build_abs(&bld->base, src0);
res = lp_build_rsqrt(&bld->base, src0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
@@ -1476,71 +1473,71 @@ emit_instruction(
break;
case TGSI_OPCODE_EXP:
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z )) {
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) {
LLVMValueRef *p_exp2_int_part = NULL;
LLVMValueRef *p_frac_part = NULL;
LLVMValueRef *p_exp2 = NULL;
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
p_exp2_int_part = &tmp0;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ))
p_frac_part = &tmp1;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
p_exp2 = &tmp2;
lp_build_exp2_approx(&bld->base, src0, p_exp2_int_part, p_frac_part, p_exp2);
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
- dst0[CHAN_X] = tmp0;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ))
- dst0[CHAN_Y] = tmp1;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
- dst0[CHAN_Z] = tmp2;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
+ dst0[TGSI_CHAN_X] = tmp0;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ))
+ dst0[TGSI_CHAN_Y] = tmp1;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
+ dst0[TGSI_CHAN_Z] = tmp2;
}
/* dst.w = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_W )) {
- dst0[CHAN_W] = bld->base.one;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
case TGSI_OPCODE_LOG:
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z )) {
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) {
LLVMValueRef *p_floor_log2 = NULL;
LLVMValueRef *p_exp = NULL;
LLVMValueRef *p_log2 = NULL;
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
src0 = lp_build_abs( &bld->base, src0 );
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
p_floor_log2 = &tmp0;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ))
p_exp = &tmp1;
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
p_log2 = &tmp2;
lp_build_log2_approx(&bld->base, src0, p_exp, p_floor_log2, p_log2);
/* dst.x = floor(lg2(abs(src.x))) */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ))
- dst0[CHAN_X] = tmp0;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ))
+ dst0[TGSI_CHAN_X] = tmp0;
/* dst.y = abs(src)/ex2(floor(lg2(abs(src.x)))) */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y )) {
- dst0[CHAN_Y] = lp_build_div( &bld->base, src0, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) {
+ dst0[TGSI_CHAN_Y] = lp_build_div( &bld->base, src0, tmp1);
}
/* dst.z = lg2(abs(src.x)) */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ))
- dst0[CHAN_Z] = tmp2;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ))
+ dst0[TGSI_CHAN_Z] = tmp2;
}
/* dst.w = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_W )) {
- dst0[CHAN_W] = bld->base.one;
+ if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
@@ -1562,15 +1559,15 @@ emit_instruction(
case TGSI_OPCODE_DP3:
/* TGSI_OPCODE_DOT3 */
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Z );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Z );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
@@ -1580,19 +1577,19 @@ emit_instruction(
case TGSI_OPCODE_DP4:
/* TGSI_OPCODE_DOT4 */
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Z );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Z );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_W );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_W );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_W );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_W );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
@@ -1601,19 +1598,19 @@ emit_instruction(
break;
case TGSI_OPCODE_DST:
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) {
- dst0[CHAN_X] = bld->base.one;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) {
+ dst0[TGSI_CHAN_X] = bld->base.one;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_Y );
- dst0[CHAN_Y] = lp_build_mul( &bld->base, tmp0, tmp1);
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
+ dst0[TGSI_CHAN_Y] = lp_build_mul( &bld->base, tmp0, tmp1);
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) {
- dst0[CHAN_Z] = emit_fetch( bld, inst, 0, CHAN_Z );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) {
+ dst0[TGSI_CHAN_Z] = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) {
- dst0[CHAN_W] = emit_fetch( bld, inst, 1, CHAN_W );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) {
+ dst0[TGSI_CHAN_W] = emit_fetch( bld, inst, 1, TGSI_CHAN_W );
}
break;
@@ -1696,14 +1693,14 @@ emit_instruction(
break;
case TGSI_OPCODE_DP2A:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X ); /* xmm0 = src[0].x */
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X ); /* xmm1 = src[1].x */
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); /* xmm0 = src[0].x */
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X ); /* xmm1 = src[1].x */
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 * xmm1 */
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y ); /* xmm1 = src[0].y */
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y ); /* xmm2 = src[1].y */
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y ); /* xmm1 = src[0].y */
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y ); /* xmm2 = src[1].y */
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2); /* xmm1 = xmm1 * xmm2 */
tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */
- tmp1 = emit_fetch( bld, inst, 2, CHAN_X ); /* xmm1 = src[2].x */
+ tmp1 = emit_fetch( bld, inst, 2, TGSI_CHAN_X ); /* xmm1 = src[2].x */
tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0; /* dest[ch] = xmm0 */
@@ -1745,7 +1742,7 @@ emit_instruction(
break;
case TGSI_OPCODE_EX2: {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_exp2( &bld->base, tmp0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
@@ -1754,7 +1751,7 @@ emit_instruction(
}
case TGSI_OPCODE_LG2:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_log2( &bld->base, tmp0);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
@@ -1762,8 +1759,8 @@ emit_instruction(
break;
case TGSI_OPCODE_POW:
- src0 = emit_fetch( bld, inst, 0, CHAN_X );
- src1 = emit_fetch( bld, inst, 1, CHAN_X );
+ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ src1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
res = lp_build_pow( &bld->base, src0, src1 );
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = res;
@@ -1771,43 +1768,43 @@ emit_instruction(
break;
case TGSI_OPCODE_XPD:
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ) {
- tmp1 = emit_fetch( bld, inst, 1, CHAN_Z );
- tmp3 = emit_fetch( bld, inst, 0, CHAN_Z );
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ) {
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
+ tmp3 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp4 = emit_fetch( bld, inst, 1, CHAN_Y );
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp4 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) {
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) {
tmp2 = tmp0;
tmp2 = lp_build_mul( &bld->base, tmp2, tmp1);
tmp5 = tmp3;
tmp5 = lp_build_mul( &bld->base, tmp5, tmp4);
tmp2 = lp_build_sub( &bld->base, tmp2, tmp5);
- dst0[CHAN_X] = tmp2;
+ dst0[TGSI_CHAN_X] = tmp2;
}
- if( IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) ||
- IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) ) {
- tmp2 = emit_fetch( bld, inst, 1, CHAN_X );
- tmp5 = emit_fetch( bld, inst, 0, CHAN_X );
+ if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ||
+ IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) {
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
+ tmp5 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) {
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) {
tmp3 = lp_build_mul( &bld->base, tmp3, tmp2);
tmp1 = lp_build_mul( &bld->base, tmp1, tmp5);
tmp3 = lp_build_sub( &bld->base, tmp3, tmp1);
- dst0[CHAN_Y] = tmp3;
+ dst0[TGSI_CHAN_Y] = tmp3;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) {
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) {
tmp5 = lp_build_mul( &bld->base, tmp5, tmp4);
tmp0 = lp_build_mul( &bld->base, tmp0, tmp2);
tmp5 = lp_build_sub( &bld->base, tmp5, tmp0);
- dst0[CHAN_Z] = tmp5;
+ dst0[TGSI_CHAN_Z] = tmp5;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) {
- dst0[CHAN_W] = bld->base.one;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
@@ -1824,18 +1821,18 @@ emit_instruction(
return FALSE;
case TGSI_OPCODE_DPH:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X );
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Z );
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Z );
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Z );
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Z );
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2);
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
- tmp1 = emit_fetch( bld, inst, 1, CHAN_W );
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_W );
tmp0 = lp_build_add( &bld->base, tmp0, tmp1);
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
@@ -1843,7 +1840,7 @@ emit_instruction(
break;
case TGSI_OPCODE_COS:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_cos( &bld->base, tmp0 );
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
@@ -1917,7 +1914,7 @@ emit_instruction(
break;
case TGSI_OPCODE_SIN:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
tmp0 = lp_build_sin( &bld->base, tmp0 );
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
dst0[chan_index] = tmp0;
@@ -2044,19 +2041,19 @@ emit_instruction(
break;
case TGSI_OPCODE_SCS:
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- dst0[CHAN_X] = lp_build_cos( &bld->base, tmp0 );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ dst0[TGSI_CHAN_X] = lp_build_cos( &bld->base, tmp0 );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) {
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X );
- dst0[CHAN_Y] = lp_build_sin( &bld->base, tmp0 );
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) {
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X );
+ dst0[TGSI_CHAN_Y] = lp_build_sin( &bld->base, tmp0 );
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z ) {
- dst0[CHAN_Z] = bld->base.zero;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) {
+ dst0[TGSI_CHAN_Z] = bld->base.zero;
}
- IF_IS_DST0_CHANNEL_ENABLED( inst, CHAN_W ) {
- dst0[CHAN_W] = bld->base.one;
+ IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
break;
@@ -2071,25 +2068,25 @@ emit_instruction(
{
uint dims = (inst->Instruction.Opcode == TGSI_OPCODE_NRM) ? 3 : 4;
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X) ||
- IS_DST0_CHANNEL_ENABLED(inst, CHAN_Y) ||
- IS_DST0_CHANNEL_ENABLED(inst, CHAN_Z) ||
- (IS_DST0_CHANNEL_ENABLED(inst, CHAN_W) && dims == 4)) {
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) ||
+ IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y) ||
+ IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z) ||
+ (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W) && dims == 4)) {
/* NOTE: Cannot use xmm regs 2/3 here (see emit_rsqrt() above). */
/* xmm4 = src.x */
/* xmm0 = src.x * src.x */
- tmp0 = emit_fetch(bld, inst, 0, CHAN_X);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X)) {
+ tmp0 = emit_fetch(bld, inst, 0, TGSI_CHAN_X);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) {
tmp4 = tmp0;
}
tmp0 = lp_build_mul( &bld->base, tmp0, tmp0);
/* xmm5 = src.y */
/* xmm0 = xmm0 + src.y * src.y */
- tmp1 = emit_fetch(bld, inst, 0, CHAN_Y);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Y)) {
+ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_Y);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) {
tmp5 = tmp1;
}
tmp1 = lp_build_mul( &bld->base, tmp1, tmp1);
@@ -2097,8 +2094,8 @@ emit_instruction(
/* xmm6 = src.z */
/* xmm0 = xmm0 + src.z * src.z */
- tmp1 = emit_fetch(bld, inst, 0, CHAN_Z);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Z)) {
+ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_Z);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) {
tmp6 = tmp1;
}
tmp1 = lp_build_mul( &bld->base, tmp1, tmp1);
@@ -2107,8 +2104,8 @@ emit_instruction(
if (dims == 4) {
/* xmm7 = src.w */
/* xmm0 = xmm0 + src.w * src.w */
- tmp1 = emit_fetch(bld, inst, 0, CHAN_W);
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_W)) {
+ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_W);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) {
tmp7 = tmp1;
}
tmp1 = lp_build_mul( &bld->base, tmp1, tmp1);
@@ -2119,29 +2116,29 @@ emit_instruction(
tmp1 = lp_build_rsqrt( &bld->base, tmp0);
/* dst.x = xmm1 * src.x */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X)) {
- dst0[CHAN_X] = lp_build_mul( &bld->base, tmp4, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) {
+ dst0[TGSI_CHAN_X] = lp_build_mul( &bld->base, tmp4, tmp1);
}
/* dst.y = xmm1 * src.y */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Y)) {
- dst0[CHAN_Y] = lp_build_mul( &bld->base, tmp5, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) {
+ dst0[TGSI_CHAN_Y] = lp_build_mul( &bld->base, tmp5, tmp1);
}
/* dst.z = xmm1 * src.z */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_Z)) {
- dst0[CHAN_Z] = lp_build_mul( &bld->base, tmp6, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) {
+ dst0[TGSI_CHAN_Z] = lp_build_mul( &bld->base, tmp6, tmp1);
}
/* dst.w = xmm1 * src.w */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_X) && dims == 4) {
- dst0[CHAN_W] = lp_build_mul( &bld->base, tmp7, tmp1);
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) && dims == 4) {
+ dst0[TGSI_CHAN_W] = lp_build_mul( &bld->base, tmp7, tmp1);
}
}
/* dst.w = 1.0 */
- if (IS_DST0_CHANNEL_ENABLED(inst, CHAN_W) && dims == 3) {
- dst0[CHAN_W] = bld->base.one;
+ if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W) && dims == 3) {
+ dst0[TGSI_CHAN_W] = bld->base.one;
}
}
break;
@@ -2153,11 +2150,11 @@ emit_instruction(
break;
case TGSI_OPCODE_DP2:
- tmp0 = emit_fetch( bld, inst, 0, CHAN_X ); /* xmm0 = src[0].x */
- tmp1 = emit_fetch( bld, inst, 1, CHAN_X ); /* xmm1 = src[1].x */
+ tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); /* xmm0 = src[0].x */
+ tmp1 = emit_fetch( bld, inst, 1, TGSI_CHAN_X ); /* xmm1 = src[1].x */
tmp0 = lp_build_mul( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 * xmm1 */
- tmp1 = emit_fetch( bld, inst, 0, CHAN_Y ); /* xmm1 = src[0].y */
- tmp2 = emit_fetch( bld, inst, 1, CHAN_Y ); /* xmm2 = src[1].y */
+ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y ); /* xmm1 = src[0].y */
+ tmp2 = emit_fetch( bld, inst, 1, TGSI_CHAN_Y ); /* xmm2 = src[1].y */
tmp1 = lp_build_mul( &bld->base, tmp1, tmp2); /* xmm1 = xmm1 * xmm2 */
tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
@@ -2178,7 +2175,7 @@ emit_instruction(
break;
case TGSI_OPCODE_IF:
- tmp0 = emit_fetch(bld, inst, 0, CHAN_X);
+ tmp0 = emit_fetch(bld, inst, 0, TGSI_CHAN_X);
tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_NOTEQUAL,
tmp0, bld->base.zero);
lp_exec_mask_cond_push(&bld->exec_mask, tmp0);