[v3,38/42] intel/compiler: fix cmod propagation for non 32-bit types

Submitted by Iago Toral Quiroga on Jan. 15, 2019, 1:54 p.m.

Details

Message ID 20190115135414.2313-39-itoral@igalia.com
State New
Headers show
Series "intel: VK_KHR_shader_float16_int8 implementation" ( rev: 5 4 ) in Mesa

Not browsing as part of any series.

Commit Message

Iago Toral Quiroga Jan. 15, 2019, 1:54 p.m.
v2:
 - Do not propagate if the bit-size changes
---
 src/intel/compiler/brw_fs_cmod_propagation.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/intel/compiler/brw_fs_cmod_propagation.cpp b/src/intel/compiler/brw_fs_cmod_propagation.cpp
index 7bb5c9afbc9..57d4e645c05 100644
--- a/src/intel/compiler/brw_fs_cmod_propagation.cpp
+++ b/src/intel/compiler/brw_fs_cmod_propagation.cpp
@@ -244,8 +244,7 @@  opt_cmod_propagation_local(const gen_device_info *devinfo,
             /* CMP's result is the same regardless of dest type. */
             if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
                 scan_inst->opcode == BRW_OPCODE_CMP &&
-                (inst->dst.type == BRW_REGISTER_TYPE_D ||
-                 inst->dst.type == BRW_REGISTER_TYPE_UD)) {
+                brw_reg_type_is_integer(inst->dst.type)) {
                inst->remove(block);
                progress = true;
                break;
@@ -258,9 +257,14 @@  opt_cmod_propagation_local(const gen_device_info *devinfo,
                break;
 
             /* Comparisons operate differently for ints and floats */
-            if (scan_inst->dst.type != inst->dst.type &&
-                (scan_inst->dst.type == BRW_REGISTER_TYPE_F ||
-                 inst->dst.type == BRW_REGISTER_TYPE_F))
+            if (brw_reg_type_is_floating_point(scan_inst->dst.type) !=
+                brw_reg_type_is_floating_point(inst->dst.type))
+               break;
+
+            /* Comparison result may be altered if the bit-size changes
+             * since that affects range, denorms, etc
+             */
+            if (type_sz(scan_inst->dst.type) != type_sz(inst->dst.type))
                break;
 
             /* If the instruction generating inst's source also wrote the

Comments

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

On Tue, Jan 15, 2019 at 7:55 AM Iago Toral Quiroga <itoral@igalia.com>
wrote:

> v2:
>  - Do not propagate if the bit-size changes
> ---
>  src/intel/compiler/brw_fs_cmod_propagation.cpp | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/src/intel/compiler/brw_fs_cmod_propagation.cpp
> b/src/intel/compiler/brw_fs_cmod_propagation.cpp
> index 7bb5c9afbc9..57d4e645c05 100644
> --- a/src/intel/compiler/brw_fs_cmod_propagation.cpp
> +++ b/src/intel/compiler/brw_fs_cmod_propagation.cpp
> @@ -244,8 +244,7 @@ opt_cmod_propagation_local(const gen_device_info
> *devinfo,
>              /* CMP's result is the same regardless of dest type. */
>              if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
>                  scan_inst->opcode == BRW_OPCODE_CMP &&
> -                (inst->dst.type == BRW_REGISTER_TYPE_D ||
> -                 inst->dst.type == BRW_REGISTER_TYPE_UD)) {
> +                brw_reg_type_is_integer(inst->dst.type)) {
>                 inst->remove(block);
>                 progress = true;
>                 break;
> @@ -258,9 +257,14 @@ opt_cmod_propagation_local(const gen_device_info
> *devinfo,
>                 break;
>
>              /* Comparisons operate differently for ints and floats */
> -            if (scan_inst->dst.type != inst->dst.type &&
> -                (scan_inst->dst.type == BRW_REGISTER_TYPE_F ||
> -                 inst->dst.type == BRW_REGISTER_TYPE_F))
> +            if (brw_reg_type_is_floating_point(scan_inst->dst.type) !=
> +                brw_reg_type_is_floating_point(inst->dst.type))
> +               break;
> +
> +            /* Comparison result may be altered if the bit-size changes
> +             * since that affects range, denorms, etc
> +             */
> +            if (type_sz(scan_inst->dst.type) != type_sz(inst->dst.type))
>                 break;
>
>              /* If the instruction generating inst's source also wrote the
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>