diff options
author | Tom Stellard <[email protected]> | 2012-01-14 09:09:54 -0500 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-01-30 13:37:00 -0500 |
commit | 82b71db03ddaf0eed504412c9169db37cf9bdadc (patch) | |
tree | 4f4e6e3f0f3b875bfd17ed101f06fd42d9bd3a66 | |
parent | 6b63e25b3d7a6ac0bd738c139ead0c7e7ad84368 (diff) |
gallium: Move duplicated helper macros to tgsi_exec.h
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 219 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.h | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ppc.c | 78 |
3 files changed, 148 insertions, 162 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 84a26761dbd..1ad0b74b00e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -63,19 +63,6 @@ #include "lp_bld_printf.h" -#define FOR_EACH_CHANNEL( CHAN )\ - for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) - -#define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST)->Dst[0].Register.WriteMask & (1 << (CHAN))) - -#define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) - -#define FOR_EACH_DST0_ENABLED_CHANNEL( INST, CHAN )\ - FOR_EACH_CHANNEL( CHAN )\ - IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN ) - #define NUM_CHANNELS 4 #define LP_MAX_INSTRUCTIONS 256 @@ -839,7 +826,7 @@ emit_fetch_predicate( unsigned chan; if (!inst->Instruction.Predicate) { - FOR_EACH_CHANNEL( chan ) { + TGSI_FOR_EACH_CHANNEL( chan ) { pred[chan] = NULL; } return; @@ -853,7 +840,7 @@ emit_fetch_predicate( index = inst->Predicate.Index; assert(index < LP_MAX_TGSI_PREDS); - FOR_EACH_CHANNEL( chan ) { + TGSI_FOR_EACH_CHANNEL( chan ) { unsigned swizzle = swizzles[chan]; /* @@ -1203,7 +1190,7 @@ emit_kil( memset(&terms, 0, sizeof terms); - FOR_EACH_CHANNEL( chan_index ) { + TGSI_FOR_EACH_CHANNEL( chan_index ) { unsigned swizzle; /* Unswizzle channel */ @@ -1217,7 +1204,7 @@ emit_kil( } mask = NULL; - FOR_EACH_CHANNEL( chan_index ) { + TGSI_FOR_EACH_CHANNEL( chan_index ) { if(terms[chan_index]) { LLVMValueRef chan_mask; @@ -1408,14 +1395,14 @@ emit_instruction( assert(info->num_dst <= 1); if (info->num_dst) { - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = bld->base.undef; } } switch (inst->Instruction.Opcode) { case TGSI_OPCODE_ARL: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); tmp0 = lp_build_floor(&bld->base, tmp0); dst0[chan_index] = tmp0; @@ -1423,20 +1410,20 @@ emit_instruction( break; case TGSI_OPCODE_MOV: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = emit_fetch( bld, inst, 0, chan_index ); } break; case TGSI_OPCODE_LIT: - if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ) { + if(TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) ) { dst0[TGSI_CHAN_X] = bld->base.one; } - if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ) { + if(TGSI_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, TGSI_CHAN_Z ) ) { + if(TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) { /* XMM[1] = SrcReg[0].yyyy */ tmp1 = emit_fetch( bld, inst, 0, TGSI_CHAN_Y ); /* XMM[1] = max(XMM[1], 0) */ @@ -1448,7 +1435,7 @@ emit_instruction( tmp2 = lp_build_cmp(&bld->base, PIPE_FUNC_GREATER, tmp0, bld->base.zero); dst0[TGSI_CHAN_Z] = lp_build_select(&bld->base, tmp2, tmp1, bld->base.zero); } - if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) ) { + if(TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) ) { dst0[TGSI_CHAN_W] = bld->base.one; } break; @@ -1457,7 +1444,7 @@ emit_instruction( /* TGSI_OPCODE_RECIP */ src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); res = lp_build_rcp(&bld->base, src0); - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = res; } break; @@ -1467,47 +1454,47 @@ emit_instruction( 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = res; } break; case TGSI_OPCODE_EXP: - 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 )) { + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) || + TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) || + TGSI_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, TGSI_CHAN_X ); - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X )) p_exp2_int_part = &tmp0; - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) p_frac_part = &tmp1; - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) + if (TGSI_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, TGSI_CHAN_X )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X )) dst0[TGSI_CHAN_X] = tmp0; - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) dst0[TGSI_CHAN_Y] = tmp1; - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) dst0[TGSI_CHAN_Z] = tmp2; } /* dst.w = 1.0 */ - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) { + if (TGSI_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, TGSI_CHAN_X ) || - IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) || - IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) { + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) || + TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) || + TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) { LLVMValueRef *p_floor_log2 = NULL; LLVMValueRef *p_exp = NULL; LLVMValueRef *p_log2 = NULL; @@ -1515,34 +1502,34 @@ emit_instruction( src0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); src0 = lp_build_abs( &bld->base, src0 ); - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X )) p_floor_log2 = &tmp0; - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y )) p_exp = &tmp1; - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) + if (TGSI_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, TGSI_CHAN_X )) + if (TGSI_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, TGSI_CHAN_Y )) { + if (TGSI_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, TGSI_CHAN_Z )) + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z )) dst0[TGSI_CHAN_Z] = tmp2; } /* dst.w = 1.0 */ - if (IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) { + if (TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W )) { dst0[TGSI_CHAN_W] = bld->base.one; } break; case TGSI_OPCODE_MUL: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); dst0[chan_index] = lp_build_mul(&bld->base, src0, src1); @@ -1550,7 +1537,7 @@ emit_instruction( break; case TGSI_OPCODE_ADD: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); dst0[chan_index] = lp_build_add(&bld->base, src0, src1); @@ -1570,7 +1557,7 @@ emit_instruction( 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; @@ -1592,30 +1579,30 @@ emit_instruction( 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; case TGSI_OPCODE_DST: - IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) { dst0[TGSI_CHAN_X] = bld->base.one; } - IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) { + TGSI_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, TGSI_CHAN_Z ) { + TGSI_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, TGSI_CHAN_W ) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) { dst0[TGSI_CHAN_W] = emit_fetch( bld, inst, 1, TGSI_CHAN_W ); } break; case TGSI_OPCODE_MIN: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); dst0[chan_index] = lp_build_min( &bld->base, src0, src1 ); @@ -1623,7 +1610,7 @@ emit_instruction( break; case TGSI_OPCODE_MAX: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); dst0[chan_index] = lp_build_max( &bld->base, src0, src1 ); @@ -1632,7 +1619,7 @@ emit_instruction( case TGSI_OPCODE_SLT: /* TGSI_OPCODE_SETLT */ - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_LESS, src0, src1 ); @@ -1642,7 +1629,7 @@ emit_instruction( case TGSI_OPCODE_SGE: /* TGSI_OPCODE_SETGE */ - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_GEQUAL, src0, src1 ); @@ -1652,7 +1639,7 @@ emit_instruction( case TGSI_OPCODE_MAD: /* TGSI_OPCODE_MADD */ - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); tmp1 = emit_fetch( bld, inst, 1, chan_index ); tmp2 = emit_fetch( bld, inst, 2, chan_index ); @@ -1663,7 +1650,7 @@ emit_instruction( break; case TGSI_OPCODE_SUB: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); tmp1 = emit_fetch( bld, inst, 1, chan_index ); dst0[chan_index] = lp_build_sub( &bld->base, tmp0, tmp1); @@ -1671,7 +1658,7 @@ emit_instruction( break; case TGSI_OPCODE_LRP: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); src2 = emit_fetch( bld, inst, 2, chan_index ); @@ -1682,7 +1669,7 @@ emit_instruction( break; case TGSI_OPCODE_CND: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); src2 = emit_fetch( bld, inst, 2, chan_index ); @@ -1702,13 +1689,13 @@ emit_instruction( tmp0 = lp_build_add( &bld->base, tmp0, tmp1); /* xmm0 = xmm0 + xmm1 */ 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; /* dest[ch] = xmm0 */ } break; case TGSI_OPCODE_FRC: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); tmp0 = lp_build_floor(&bld->base, src0); tmp0 = lp_build_sub(&bld->base, src0, tmp0); @@ -1717,7 +1704,7 @@ emit_instruction( break; case TGSI_OPCODE_CLAMP: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); src2 = emit_fetch( bld, inst, 2, chan_index ); @@ -1728,14 +1715,14 @@ emit_instruction( break; case TGSI_OPCODE_FLR: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); dst0[chan_index] = lp_build_floor(&bld->base, tmp0); } break; case TGSI_OPCODE_ROUND: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); dst0[chan_index] = lp_build_round(&bld->base, tmp0); } @@ -1744,7 +1731,7 @@ emit_instruction( case TGSI_OPCODE_EX2: { tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); tmp0 = lp_build_exp2( &bld->base, tmp0); - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; @@ -1753,7 +1740,7 @@ emit_instruction( case TGSI_OPCODE_LG2: tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); tmp0 = lp_build_log2( &bld->base, tmp0); - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; @@ -1762,23 +1749,23 @@ emit_instruction( 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = res; } break; case TGSI_OPCODE_XPD: - if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) || - IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) ) { + if(TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) || + TGSI_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, TGSI_CHAN_X ) || - IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) { + if(TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) || + TGSI_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, TGSI_CHAN_X ) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) { tmp2 = tmp0; tmp2 = lp_build_mul( &bld->base, tmp2, tmp1); tmp5 = tmp3; @@ -1786,30 +1773,30 @@ emit_instruction( tmp2 = lp_build_sub( &bld->base, tmp2, tmp5); dst0[TGSI_CHAN_X] = tmp2; } - if( IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) || - IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) ) { + if(TGSI_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Y ) || + TGSI_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, TGSI_CHAN_Y ) { + TGSI_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[TGSI_CHAN_Y] = tmp3; } - IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) { + TGSI_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[TGSI_CHAN_Z] = tmp5; } - IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) { dst0[TGSI_CHAN_W] = bld->base.one; } break; case TGSI_OPCODE_ABS: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); dst0[chan_index] = lp_build_abs( &bld->base, tmp0 ); } @@ -1834,7 +1821,7 @@ emit_instruction( tmp0 = lp_build_add( &bld->base, tmp0, tmp1); 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; @@ -1842,19 +1829,19 @@ emit_instruction( case TGSI_OPCODE_COS: tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); tmp0 = lp_build_cos( &bld->base, tmp0 ); - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; case TGSI_OPCODE_DDX: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { emit_fetch_deriv( bld, inst, 0, chan_index, NULL, &dst0[chan_index], NULL); } break; case TGSI_OPCODE_DDY: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { emit_fetch_deriv( bld, inst, 0, chan_index, NULL, NULL, &dst0[chan_index]); } break; @@ -1890,7 +1877,7 @@ emit_instruction( break; case TGSI_OPCODE_SEQ: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_EQUAL, src0, src1 ); @@ -1899,13 +1886,13 @@ emit_instruction( break; case TGSI_OPCODE_SFL: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = bld->base.zero; } break; case TGSI_OPCODE_SGT: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_GREATER, src0, src1 ); @@ -1916,13 +1903,13 @@ emit_instruction( case TGSI_OPCODE_SIN: tmp0 = emit_fetch( bld, inst, 0, TGSI_CHAN_X ); tmp0 = lp_build_sin( &bld->base, tmp0 ); - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; } break; case TGSI_OPCODE_SLE: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_LEQUAL, src0, src1 ); @@ -1931,7 +1918,7 @@ emit_instruction( break; case TGSI_OPCODE_SNE: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_NOTEQUAL, src0, src1 ); @@ -1940,7 +1927,7 @@ emit_instruction( break; case TGSI_OPCODE_STR: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = bld->base.one; } break; @@ -1990,7 +1977,7 @@ emit_instruction( break; case TGSI_OPCODE_ARR: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); tmp0 = lp_build_round(&bld->base, tmp0); dst0[chan_index] = tmp0; @@ -2024,14 +2011,14 @@ emit_instruction( case TGSI_OPCODE_SSG: /* TGSI_OPCODE_SGN */ - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); dst0[chan_index] = lp_build_sgn( &bld->base, tmp0 ); } break; case TGSI_OPCODE_CMP: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); src1 = emit_fetch( bld, inst, 1, chan_index ); src2 = emit_fetch( bld, inst, 2, chan_index ); @@ -2041,18 +2028,18 @@ emit_instruction( break; case TGSI_OPCODE_SCS: - IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_X ) { + TGSI_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, TGSI_CHAN_Y ) { + TGSI_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, TGSI_CHAN_Z ) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_Z ) { dst0[TGSI_CHAN_Z] = bld->base.zero; } - IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED( inst, TGSI_CHAN_W ) { dst0[TGSI_CHAN_W] = bld->base.one; } break; @@ -2068,17 +2055,17 @@ emit_instruction( { uint dims = (inst->Instruction.Opcode == TGSI_OPCODE_NRM) ? 3 : 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)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) || + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y) || + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z) || + (TGSI_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, TGSI_CHAN_X); - if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) { tmp4 = tmp0; } tmp0 = lp_build_mul( &bld->base, tmp0, tmp0); @@ -2086,7 +2073,7 @@ emit_instruction( /* xmm5 = src.y */ /* xmm0 = xmm0 + src.y * src.y */ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_Y); - if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { tmp5 = tmp1; } tmp1 = lp_build_mul( &bld->base, tmp1, tmp1); @@ -2095,7 +2082,7 @@ emit_instruction( /* xmm6 = src.z */ /* xmm0 = xmm0 + src.z * src.z */ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_Z); - if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { tmp6 = tmp1; } tmp1 = lp_build_mul( &bld->base, tmp1, tmp1); @@ -2105,7 +2092,7 @@ emit_instruction( /* xmm7 = src.w */ /* xmm0 = xmm0 + src.w * src.w */ tmp1 = emit_fetch(bld, inst, 0, TGSI_CHAN_W); - if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) { tmp7 = tmp1; } tmp1 = lp_build_mul( &bld->base, tmp1, tmp1); @@ -2116,28 +2103,28 @@ emit_instruction( tmp1 = lp_build_rsqrt( &bld->base, tmp0); /* dst.x = xmm1 * src.x */ - if (IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) { + if (TGSI_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, TGSI_CHAN_Y)) { + if (TGSI_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, TGSI_CHAN_Z)) { + if (TGSI_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, TGSI_CHAN_X) && dims == 4) { + if (TGSI_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, TGSI_CHAN_W) && dims == 3) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W) && dims == 3) { dst0[TGSI_CHAN_W] = bld->base.one; } } @@ -2157,7 +2144,7 @@ emit_instruction( 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 ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = tmp0; /* dest[ch] = xmm0 */ } break; @@ -2218,7 +2205,7 @@ emit_instruction( break; case TGSI_OPCODE_CEIL: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); dst0[chan_index] = lp_build_ceil(&bld->base, tmp0); } @@ -2237,7 +2224,7 @@ emit_instruction( break; case TGSI_OPCODE_TRUNC: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { tmp0 = emit_fetch( bld, inst, 0, chan_index ); dst0[chan_index] = lp_build_trunc(&bld->base, tmp0); } @@ -2321,7 +2308,7 @@ emit_instruction( emit_fetch_predicate( bld, inst, pred ); - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { emit_store( bld, inst, 0, chan_index, pred[chan_index], dst0[chan_index]); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 613b3837eb3..d9e93ce138d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -45,6 +45,19 @@ extern "C" { #define TGSI_NUM_CHANNELS 4 /* R,G,B,A */ #define TGSI_QUAD_SIZE 4 /* 4 pixel/quad */ +#define TGSI_FOR_EACH_CHANNEL( CHAN )\ + for (CHAN = 0; CHAN < TGSI_NUM_CHANNELS; CHAN++) + +#define TGSI_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ + ((INST)->Dst[0].Register.WriteMask & (1 << (CHAN))) + +#define TGSI_IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ + if (TGSI_IS_DST0_CHANNEL_ENABLED( INST, CHAN )) + +#define TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( INST, CHAN )\ + TGSI_FOR_EACH_CHANNEL( CHAN )\ + TGSI_IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN ) + /** * Registers may be treated as float, signed int or unsigned int. diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index 36400c7fe68..1e00e2e54ed 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -56,20 +56,6 @@ ppc_builtin_constants[] = { 1.0f, -128.0f, 128.0, 0.0 }; - -#define FOR_EACH_CHANNEL( CHAN )\ - for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) - -#define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST).Dst[0].Register.WriteMask & (1 << (CHAN))) - -#define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) - -#define FOR_EACH_DST0_ENABLED_CHANNEL( INST, CHAN )\ - FOR_EACH_CHANNEL( CHAN )\ - IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN ) - /** * How many TGSI temps should be implemented with real PPC vector registers * rather than memory. @@ -583,7 +569,7 @@ emit_scalar_unaryop(struct gen_context *gen, struct tgsi_full_instruction *inst) assert(0); } - FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { emit_store(gen, v1, inst, chan_index, FALSE); } @@ -597,7 +583,7 @@ emit_unaryop(struct gen_context *gen, struct tgsi_full_instruction *inst) { uint chan_index; - FOR_EACH_DST0_ENABLED_CHANNEL(*inst, chan_index) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan_index) { int v0 = get_src_vec(gen, inst, 0, chan_index); /* v0 = srcreg[0] */ int v1 = get_dst_vec(gen, inst, chan_index); switch (inst->Instruction.Opcode) { @@ -647,7 +633,7 @@ emit_binop(struct gen_context *gen, struct tgsi_full_instruction *inst) ppc_vzero(gen->f, zero_vec); } - FOR_EACH_DST0_ENABLED_CHANNEL(*inst, chan) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan) { /* fetch src operands */ int v0 = get_src_vec(gen, inst, 0, chan); int v1 = get_src_vec(gen, inst, 1, chan); @@ -690,7 +676,7 @@ emit_triop(struct gen_context *gen, struct tgsi_full_instruction *inst) { uint chan; - FOR_EACH_DST0_ENABLED_CHANNEL(*inst, chan) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan) { /* fetch src operands */ int v0 = get_src_vec(gen, inst, 0, chan); int v1 = get_src_vec(gen, inst, 1, chan); @@ -727,7 +713,7 @@ emit_inequality(struct gen_context *gen, struct tgsi_full_instruction *inst) uint chan; int one_vec = gen_one_vec(gen); - FOR_EACH_DST0_ENABLED_CHANNEL(*inst, chan) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan) { /* fetch src operands */ int v0 = get_src_vec(gen, inst, 0, chan); int v1 = get_src_vec(gen, inst, 1, chan); @@ -806,7 +792,7 @@ emit_dotprod(struct gen_context *gen, struct tgsi_full_instruction *inst) ppc_vaddfp(gen->f, v2, v2, v1); /* v2 = v2 + v1 */ } - FOR_EACH_DST0_ENABLED_CHANNEL(*inst, chan_index) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan_index) { emit_store(gen, v2, inst, chan_index, FALSE); /* store v2, free v2 later */ } @@ -841,13 +827,13 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) int one_vec = gen_one_vec(gen); /* Compute X */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) { emit_store(gen, one_vec, inst, TGSI_CHAN_X, FALSE); } /* Compute Y, Z */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y) || - IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y) || + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { int x_vec; int zero_vec = ppc_allocate_vec_register(gen->f); @@ -856,11 +842,11 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) ppc_vzero(gen->f, zero_vec); /* zero = {0,0,0,0} */ ppc_vmaxfp(gen->f, x_vec, x_vec, zero_vec); /* x_vec = max(x_vec, 0) */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { emit_store(gen, x_vec, inst, TGSI_CHAN_Y, FALSE); } - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { int y_vec, w_vec; int z_vec = ppc_allocate_vec_register(gen->f); int pow_vec = ppc_allocate_vec_register(gen->f); @@ -901,7 +887,7 @@ emit_lit(struct gen_context *gen, struct tgsi_full_instruction *inst) } /* Compute W */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_W)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) { emit_store(gen, one_vec, inst, TGSI_CHAN_W, FALSE); } @@ -919,7 +905,7 @@ emit_exp(struct gen_context *gen, struct tgsi_full_instruction *inst) src_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X); /* Compute X = 2^floor(src) */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) { int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_X); int tmp_vec = ppc_allocate_vec_register(gen->f); ppc_vrfim(gen->f, tmp_vec, src_vec); /* tmp = floor(src); */ @@ -929,7 +915,7 @@ emit_exp(struct gen_context *gen, struct tgsi_full_instruction *inst) } /* Compute Y = src - floor(src) */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_Y); int tmp_vec = ppc_allocate_vec_register(gen->f); ppc_vrfim(gen->f, tmp_vec, src_vec); /* tmp = floor(src); */ @@ -939,14 +925,14 @@ emit_exp(struct gen_context *gen, struct tgsi_full_instruction *inst) } /* Compute Z = RoughApprox2ToX(src) */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_Z); ppc_vexptefp(gen->f, dst_vec, src_vec); /* dst = 2 ^ src */ emit_store(gen, dst_vec, inst, TGSI_CHAN_Z, TRUE); } /* Compute W = 1.0 */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_W)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) { emit_store(gen, one_vec, inst, TGSI_CHAN_W, FALSE); } @@ -968,8 +954,8 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) abs_vec = ppc_allocate_vec_register(gen->f); ppc_vandc(gen->f, abs_vec, src_vec, bit31_vec); /* abs = src & ~bit31 */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) && - IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) && + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { /* compute tmp = floor(log2(abs)) */ int tmp_vec = ppc_allocate_vec_register(gen->f); @@ -977,12 +963,12 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) ppc_vrfim(gen->f, tmp_vec, tmp_vec); /* tmp = floor(tmp); */ /* Compute X = tmp */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X)) { emit_store(gen, tmp_vec, inst, TGSI_CHAN_X, FALSE); } /* Compute Y = abs / 2^tmp */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { const int zero_vec = ppc_allocate_vec_register(gen->f); ppc_vzero(gen->f, zero_vec); ppc_vexptefp(gen->f, tmp_vec, tmp_vec); /* tmp = 2 ^ tmp */ @@ -997,14 +983,14 @@ emit_log(struct gen_context *gen, struct tgsi_full_instruction *inst) } /* Compute Z = RoughApproxLog2(abs) */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { int dst_vec = get_dst_vec(gen, inst, TGSI_CHAN_Z); ppc_vlogefp(gen->f, dst_vec, abs_vec); /* dst = log2(abs) */ emit_store(gen, dst_vec, inst, TGSI_CHAN_Z, TRUE); } /* Compute W = 1.0 */ - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_W)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_W)) { emit_store(gen, one_vec, inst, TGSI_CHAN_W, FALSE); } @@ -1023,7 +1009,7 @@ emit_pow(struct gen_context *gen, struct tgsi_full_instruction *inst) ppc_vec_pow(gen->f, pow_vec, s0_vec, s1_vec); - FOR_EACH_DST0_ENABLED_CHANNEL(*inst, chan) { + TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan) { emit_store(gen, pow_vec, inst, chan, FALSE); } @@ -1047,37 +1033,37 @@ emit_xpd(struct gen_context *gen, struct tgsi_full_instruction *inst) tmp_vec = ppc_allocate_vec_register(gen->f); tmp2_vec = ppc_allocate_vec_register(gen->f); - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y) || - IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y) || + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { x0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_X); x1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_X); } - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) || - IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) || + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z)) { y0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_Y); y1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_Y); } - if (IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) || - IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y)) { + if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) || + TGSI_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y)) { z0_vec = get_src_vec(gen, inst, 0, TGSI_CHAN_Z); z1_vec = get_src_vec(gen, inst, 1, TGSI_CHAN_Z); } - IF_IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_X) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_X) { /* tmp = y0 * z1 */ ppc_vmaddfp(gen->f, tmp_vec, y0_vec, z1_vec, zero_vec); /* tmp = tmp - z0 * y1*/ ppc_vnmsubfp(gen->f, tmp_vec, tmp_vec, z0_vec, y1_vec); emit_store(gen, tmp_vec, inst, TGSI_CHAN_X, FALSE); } - IF_IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Y) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Y) { /* tmp = z0 * x1 */ ppc_vmaddfp(gen->f, tmp_vec, z0_vec, x1_vec, zero_vec); /* tmp = tmp - x0 * z1 */ ppc_vnmsubfp(gen->f, tmp_vec, tmp_vec, x0_vec, z1_vec); emit_store(gen, tmp_vec, inst, TGSI_CHAN_Y, FALSE); } - IF_IS_DST0_CHANNEL_ENABLED(*inst, TGSI_CHAN_Z) { + TGSI_IF_IS_DST0_CHANNEL_ENABLED(inst, TGSI_CHAN_Z) { /* tmp = x0 * y1 */ ppc_vmaddfp(gen->f, tmp_vec, x0_vec, y1_vec, zero_vec); /* tmp = tmp - y0 * x1 */ |