From cad959d90145226c1ef8314c6f6cc1f7094bd572 Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Fri, 15 Sep 2017 16:51:14 +0200 Subject: gallium: add LDEXP TGSI instruction and corresponding cap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Tested-by: Dieter Nützel --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 15 +++++++++++++++ src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 + src/gallium/auxiliary/tgsi/tgsi_info.c | 3 ++- src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/tgsi') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 2a47f5dfaef..9c019a311d7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1453,6 +1453,17 @@ micro_pow( #endif } +static void +micro_ldexp(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1) +{ + dst->f[0] = ldexpf(src0->f[0], src1->i[0]); + dst->f[1] = ldexpf(src0->f[1], src1->i[1]); + dst->f[2] = ldexpf(src0->f[2], src1->i[2]); + dst->f[3] = ldexpf(src0->f[3], src1->i[3]); +} + static void micro_sub(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src0, @@ -5082,6 +5093,10 @@ exec_instruction( exec_scalar_binary(mach, inst, micro_pow, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; + case TGSI_OPCODE_LDEXP: + exec_scalar_binary(mach, inst, micro_ldexp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_INT); + break; + case TGSI_OPCODE_COS: exec_scalar_unary(mach, inst, micro_cos, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index d28d99793b8..514c69ede30 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -534,6 +534,7 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param) case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED: return 1; case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED: + case PIPE_SHADER_CAP_TGSI_LDEXP_SUPPORTED: case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE: return 1; case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED: diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 62b41c031b3..4e399508e5b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -244,7 +244,8 @@ tgsi_opcode_infer_type( uint opcode ) enum tgsi_opcode_type tgsi_opcode_infer_src_type(uint opcode, uint src_idx) { - if (src_idx == 1 && opcode == TGSI_OPCODE_DLDEXP) + if (src_idx == 1 && + (opcode == TGSI_OPCODE_DLDEXP || opcode == TGSI_OPCODE_LDEXP)) return TGSI_TYPE_SIGNED; switch (opcode) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h b/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h index 3f39afe2196..fdb0f1078a1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h +++ b/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h @@ -19,7 +19,7 @@ OPCODE(1, 2, OTHR, TEX_LZ, .is_tex = 1) OPCODE(1, 3, COMP, LRP) OPCODE(1, 3, COMP, FMA) OPCODE(1, 1, REPL, SQRT) -OPCODE_GAP(21) /* removed */ +OPCODE(1, 2, COMP, LDEXP) OPCODE(1, 1, COMP, F2U64) OPCODE(1, 1, COMP, F2I64) OPCODE(1, 1, COMP, FRC) -- cgit v1.2.3