diff options
author | Igor Olivera <igor.oliveira@openbossa.org> | 2010-01-18 13:56:58 -0400 |
---|---|---|
committer | Michal Krol <michal@vmware.com> | 2010-01-19 13:33:53 +0100 |
commit | 9f245bebf29ce08948734620db3eade3085c6673 (patch) | |
tree | be6baf1924737a7597c1acab001a9aa23a0105cc | |
parent | 3f5472a26c129c79eb7593a3a22a0469620227cc (diff) |
tgsi: implement double opcodes
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 127 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_info.c | 11 |
2 files changed, 137 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index b9ea76131c..2842089b65 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -180,6 +180,96 @@ micro_dmov(union tgsi_double_channel *dst, } static void +micro_ddiv(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] / src[1].d[0]; + dst->d[1] = src[0].d[1] / src[1].d[1]; + dst->d[2] = src[0].d[2] / src[1].d[2]; + dst->d[3] = src[0].d[3] / src[1].d[3]; +} + +static void +micro_dmul(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] * src[1].d[0]; + dst->d[1] = src[0].d[1] * src[1].d[1]; + dst->d[2] = src[0].d[2] * src[1].d[2]; + dst->d[3] = src[0].d[3] * src[1].d[3]; +} + +static void +micro_dmax(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] > src[1].d[0] ? src[0].d[0] : src[1].d[0]; + dst->d[1] = src[0].d[1] > src[1].d[1] ? src[0].d[1] : src[1].d[1]; + dst->d[2] = src[0].d[2] > src[1].d[2] ? src[0].d[2] : src[1].d[2]; + dst->d[3] = src[0].d[3] > src[1].d[3] ? src[0].d[3] : src[1].d[3]; +} + +static void +micro_dmin(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] < src[1].d[0] ? src[0].d[0] : src[1].d[0]; + dst->d[1] = src[0].d[1] < src[1].d[1] ? src[0].d[1] : src[1].d[1]; + dst->d[2] = src[0].d[2] < src[1].d[2] ? src[0].d[2] : src[1].d[2]; + dst->d[3] = src[0].d[3] < src[1].d[3] ? src[0].d[3] : src[1].d[3]; +} + +static void +micro_dslt(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] < src[1].d[0] ? 1.0 : 0.0; + dst->d[1] = src[0].d[1] < src[1].d[1] ? 1.0 : 0.0; + dst->d[2] = src[0].d[2] < src[1].d[2] ? 1.0 : 0.0; + dst->d[3] = src[0].d[3] < src[1].d[3] ? 1.0 : 0.0; +} + +static void +micro_dsge(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] >= src[1].d[0] ? 1.0 : 0.0; + dst->d[1] = src[0].d[1] >= src[1].d[1] ? 1.0 : 0.0; + dst->d[2] = src[0].d[2] >= src[1].d[2] ? 1.0 : 0.0; + dst->d[3] = src[0].d[3] >= src[1].d[3] ? 1.0 : 0.0; +} + +static void +micro_dseq(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = src[0].d[0] == src[1].d[0] ? 1.0 : 0.0; + dst->d[1] = src[0].d[1] == src[1].d[1] ? 1.0 : 0.0; + dst->d[2] = src[0].d[2] == src[1].d[2] ? 1.0 : 0.0; + dst->d[3] = src[0].d[3] == src[1].d[3] ? 1.0 : 0.0; +} + +static void +micro_drcp(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = 1.0 / src->d[0]; + dst->d[1] = 1.0 / src->d[1]; + dst->d[2] = 1.0 / src->d[2]; + dst->d[3] = 1.0 / src->d[3]; +} + +static void +micro_dsqrt(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->d[0] = sqrt(src->d[0]); + dst->d[1] = sqrt(src->d[1]); + dst->d[2] = sqrt(src->d[2]); + dst->d[3] = sqrt(src->d[3]); +} + +static void micro_exp2(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { @@ -3729,7 +3819,44 @@ exec_instruction( exec_double_binary(mach, inst, micro_dadd); break; + case TGSI_OPCODE_DDIV: + exec_double_binary(mach, inst, micro_ddiv); + break; + + case TGSI_OPCODE_DMUL: + exec_double_binary(mach, inst, micro_dmul); + break; + + case TGSI_OPCODE_DMAX: + exec_double_binary(mach, inst, micro_dmax); + break; + + case TGSI_OPCODE_DMIN: + exec_double_binary(mach, inst, micro_dmin); + break; + + case TGSI_OPCODE_DSLT: + exec_double_binary(mach, inst, micro_dslt); + break; + + case TGSI_OPCODE_DSGE: + exec_double_binary(mach, inst, micro_dsge); + break; + + case TGSI_OPCODE_DSEQ: + exec_double_binary(mach, inst, micro_dseq); + break; + + case TGSI_OPCODE_DRCP: + exec_double_unary(mach, inst, micro_drcp); + break; + + case TGSI_OPCODE_DSQRT: + exec_double_unary(mach, inst, micro_dsqrt); + break; + default: + printf("%d", inst->Instruction.Opcode); assert( 0 ); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index c02b29c8ca..6403e6158b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -179,7 +179,16 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, 0, 0, "F2D", TGSI_OPCODE_F2D }, { 1, 1, 0, 0, 0, 0, "D2F", TGSI_OPCODE_D2F }, { 1, 1, 0, 0, 0, 0, "DMOV", TGSI_OPCODE_DMOV }, - { 1, 2, 0, 0, 0, 0, "DADD", TGSI_OPCODE_DADD } + { 1, 2, 0, 0, 0, 0, "DADD", TGSI_OPCODE_DADD }, + { 1, 2, 0, 0, 0, 0, "DDIV", TGSI_OPCODE_DDIV }, + { 1, 2, 0, 0, 0, 0, "DMUL", TGSI_OPCODE_DMUL }, + { 1, 2, 0, 0, 0, 0, "DMAX", TGSI_OPCODE_DMAX }, + { 1, 2, 0, 0, 0, 0, "DMIN", TGSI_OPCODE_DMIN }, + { 1, 2, 0, 0, 0, 0, "DSLT", TGSI_OPCODE_DSLT }, + { 1, 2, 0, 0, 0, 0, "DSGE", TGSI_OPCODE_DSGE }, + { 1, 2, 0, 0, 0, 0, "DSEQ", TGSI_OPCODE_DSEQ }, + { 1, 1, 0, 0, 0, 0, "DRCP", TGSI_OPCODE_DRCP }, + { 1, 1, 0, 0 ,0, 0, "DSQRT", TGSI_OPCODE_DSQRT } }; const struct tgsi_opcode_info * |