diff options
author | José Fonseca <[email protected]> | 2009-08-17 07:51:54 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-08-29 09:21:33 +0100 |
commit | 1aae039ee279f8ad300919d8af0fc4691ca2f514 (patch) | |
tree | 63de9848e01f967fdf30f5b44671f1d30ad52645 /src | |
parent | aede39efd86d200ffbace8fc012104e31f673973 (diff) |
llvmpipe: Implement comparison opcodes.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index 7ef01c04514..000b7d01985 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -693,17 +693,27 @@ emit_instruction( } break; -#if 0 case TGSI_OPCODE_SLT: /* TGSI_OPCODE_SETLT */ - emit_setcc( bld, inst, cc_LessThan ); + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_LESS, src0, src1 ); + dst0 = lp_build_select( &bld->base, tmp0, bld->base.one, bld->base.zero ); + STORE( bld, *inst, 0, chan_index, dst0); + } break; case TGSI_OPCODE_SGE: /* TGSI_OPCODE_SETGE */ - emit_setcc( bld, inst, cc_NotLessThan ); + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_GEQUAL, src0, src1 ); + dst0 = lp_build_select( &bld->base, tmp0, bld->base.one, bld->base.zero ); + STORE( bld, *inst, 0, chan_index, dst0); + } break; -#endif case TGSI_OPCODE_MAD: /* TGSI_OPCODE_MADD */ @@ -940,7 +950,13 @@ emit_instruction( break; case TGSI_OPCODE_SEQ: - return 0; + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_EQUAL, src0, src1 ); + dst0 = lp_build_select( &bld->base, tmp0, bld->base.one, bld->base.zero ); + STORE( bld, *inst, 0, chan_index, dst0); + } break; case TGSI_OPCODE_SFL: @@ -948,7 +964,13 @@ emit_instruction( break; case TGSI_OPCODE_SGT: - return 0; + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_GREATER, src0, src1 ); + dst0 = lp_build_select( &bld->base, tmp0, bld->base.one, bld->base.zero ); + STORE( bld, *inst, 0, chan_index, dst0); + } break; case TGSI_OPCODE_SIN: @@ -960,11 +982,23 @@ emit_instruction( break; case TGSI_OPCODE_SLE: - return 0; + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_LEQUAL, src0, src1 ); + dst0 = lp_build_select( &bld->base, tmp0, bld->base.one, bld->base.zero ); + STORE( bld, *inst, 0, chan_index, dst0); + } break; case TGSI_OPCODE_SNE: - return 0; + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_NOTEQUAL, src0, src1 ); + dst0 = lp_build_select( &bld->base, tmp0, bld->base.one, bld->base.zero ); + STORE( bld, *inst, 0, chan_index, dst0); + } break; case TGSI_OPCODE_STR: @@ -1040,11 +1074,18 @@ emit_instruction( STORE( bld, *inst, 0, chan_index, tmp0); } break; +#endif case TGSI_OPCODE_CMP: - emit_cmp (bld, inst); + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + src0 = FETCH( bld, *inst, 0, chan_index ); + src1 = FETCH( bld, *inst, 1, chan_index ); + src2 = FETCH( bld, *inst, 2, chan_index ); + tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_LESS, src0, bld->base.zero ); + dst0 = lp_build_select( &bld->base, tmp0, src1, src2); + STORE( bld, *inst, 0, chan_index, dst0); + } break; -#endif case TGSI_OPCODE_SCS: IF_IS_DST0_CHANNEL_ENABLED( *inst, CHAN_X ) { |