tgsi: infer that dst[1] of DFRACEXP is an integer
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 15 Sep 2017 16:47:52 +0000 (18:47 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 29 Sep 2017 10:07:59 +0000 (12:07 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/auxiliary/tgsi/tgsi_info.c
src/gallium/auxiliary/tgsi/tgsi_info.h
src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c

index b33976bb647eb53bfa4f080f7ca7f1ded238318e..079a6eed4963f5a6046d368defac34ef347038ed 100644 (file)
@@ -201,7 +201,7 @@ void lp_build_fetch_args(
 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 dtype = tgsi_opcode_infer_dst_type(opcode, 0);
    enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(opcode, 0);
 
    if (!tgsi_type_is_64bit(dtype) && !tgsi_type_is_64bit(stype))
index 435d1075aaaebbdc7124da05fce39a085207d62b..e5d0293b8f9cb53a6f7ee84d8ad720797d84a673 100644 (file)
@@ -1751,7 +1751,7 @@ emit_store_chan(
    struct lp_build_context *float_bld = &bld_base->base;
    struct lp_build_context *int_bld = &bld_base->int_bld;
    LLVMValueRef indirect_index = NULL;
-   enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode);
+   enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode, index);
 
    /*
     * Apply saturation.
@@ -1917,7 +1917,7 @@ emit_store(
    LLVMValueRef dst[4])
 
 {
-   enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode);
+   enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode, index);
 
    unsigned writemask = inst->Dst[index].Register.WriteMask;
    while (writemask) {
index 36be463dc84d6cf7c8dcbfac7ee8b30b5af42bb0..62b41c031b34e819500e30805b0bdb7bde696319 100644 (file)
@@ -312,7 +312,10 @@ tgsi_opcode_infer_src_type(uint opcode, uint src_idx)
  * infer the destination type of a TGSI opcode.
  */
 enum tgsi_opcode_type
-tgsi_opcode_infer_dst_type( uint opcode )
+tgsi_opcode_infer_dst_type( uint opcode, uint dst_idx )
 {
+   if (dst_idx == 1 && opcode == TGSI_OPCODE_DFRACEXP)
+      return TGSI_TYPE_SIGNED;
+
    return tgsi_opcode_infer_type(opcode);
 }
index f3ef46fb4a8e19a6f7ede79aecfc0782d6eb1958..8d32f4774be890ef0978301fb300c7b810a7886f 100644 (file)
@@ -114,7 +114,7 @@ enum tgsi_opcode_type
 tgsi_opcode_infer_src_type( uint opcode, uint src_idx );
 
 enum tgsi_opcode_type
-tgsi_opcode_infer_dst_type( uint opcode );
+tgsi_opcode_infer_dst_type( uint opcode, uint dst_idx );
 
 #if defined __cplusplus
 }
index f0c7803c99766dc29e7cb9b23162c0ed96204219..109ec1b5a3242cf7fbfeeca8a6d971e4d9f855a4 100644 (file)
@@ -890,7 +890,7 @@ void si_llvm_emit_store(struct lp_build_tgsi_context *bld_base,
        LLVMBuilderRef builder = ctx->gallivm.builder;
        LLVMValueRef temp_ptr, temp_ptr2 = NULL;
        bool is_vec_store = false;
-       enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode);
+       enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(inst->Instruction.Opcode, index);
 
        if (dst[0]) {
                LLVMTypeKind k = LLVMGetTypeKind(LLVMTypeOf(dst[0]));