summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-09-15 17:40:05 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-09-16 13:18:42 +0200
commit03f0ec745a2bd118bf68a0e7d82b05acad5933a6 (patch)
treebc5fc8536f6fd2220e254d5c86aace41d0a82f25
parente386844c732569db582959941931787ee59f34d2 (diff)
tgsi: infer that DLDEXP's second source has an integer type
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.c4
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c7
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c5
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.h2
4 files changed, 11 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index c6b1dcbad3..e450092a82 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -202,7 +202,7 @@ static int get_src_chan_idx(unsigned opcode,
int dst_chan_index)
{
enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(opcode);
- enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(opcode);
+ enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(opcode, 0);
if (!tgsi_type_is_64bit(dtype) && !tgsi_type_is_64bit(stype))
return dst_chan_index;
@@ -420,7 +420,7 @@ lp_build_emit_fetch(
{
const struct tgsi_full_src_register *reg = &inst->Src[src_op];
enum tgsi_opcode_type stype =
- tgsi_opcode_infer_src_type(inst->Instruction.Opcode);
+ tgsi_opcode_infer_src_type(inst->Instruction.Opcode, src_op);
return lp_build_emit_fetch_src(bld_base, reg, stype, chan_index);
}
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index aa715dcae2..e64e724550 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -766,12 +766,13 @@ ttn_get_var(struct ttn_compile *c, struct tgsi_full_dst_register *tgsi_fdst)
}
static nir_ssa_def *
-ttn_get_src(struct ttn_compile *c, struct tgsi_full_src_register *tgsi_fsrc)
+ttn_get_src(struct ttn_compile *c, struct tgsi_full_src_register *tgsi_fsrc,
+ int src_idx)
{
nir_builder *b = &c->build;
struct tgsi_src_register *tgsi_src = &tgsi_fsrc->Register;
unsigned tgsi_opcode = c->token->FullInstruction.Instruction.Opcode;
- unsigned tgsi_src_type = tgsi_opcode_infer_src_type(tgsi_opcode);
+ unsigned tgsi_src_type = tgsi_opcode_infer_src_type(tgsi_opcode, src_idx);
bool src_is_float = !(tgsi_src_type == TGSI_TYPE_SIGNED ||
tgsi_src_type == TGSI_TYPE_UNSIGNED);
nir_alu_src src;
@@ -1643,7 +1644,7 @@ ttn_emit_instruction(struct ttn_compile *c)
nir_ssa_def *src[TGSI_FULL_MAX_SRC_REGISTERS];
for (i = 0; i < tgsi_inst->Instruction.NumSrcRegs; i++) {
- src[i] = ttn_get_src(c, &tgsi_inst->Src[i]);
+ src[i] = ttn_get_src(c, &tgsi_inst->Src[i], i);
}
nir_alu_dest dest = ttn_get_dest(c, tgsi_dst);
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 08bce6380c..36be463dc8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -242,8 +242,11 @@ tgsi_opcode_infer_type( uint opcode )
* infer the source type of a TGSI opcode.
*/
enum tgsi_opcode_type
-tgsi_opcode_infer_src_type( uint opcode )
+tgsi_opcode_infer_src_type(uint opcode, uint src_idx)
{
+ if (src_idx == 1 && opcode == TGSI_OPCODE_DLDEXP)
+ return TGSI_TYPE_SIGNED;
+
switch (opcode) {
case TGSI_OPCODE_UIF:
case TGSI_OPCODE_TXF:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h
index 74bff18692..f3ef46fb4a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -111,7 +111,7 @@ static inline bool tgsi_type_is_64bit(enum tgsi_opcode_type type)
}
enum tgsi_opcode_type
-tgsi_opcode_infer_src_type( uint opcode );
+tgsi_opcode_infer_src_type( uint opcode, uint src_idx );
enum tgsi_opcode_type
tgsi_opcode_infer_dst_type( uint opcode );