RISC-V: Fix bugs of available condition.

Message ID 20230103073030.163679-1-juzhe.zhong@rivai.ai
State Accepted
Headers
Series RISC-V: Fix bugs of available condition. |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

juzhe.zhong@rivai.ai Jan. 3, 2023, 7:30 a.m. UTC
  From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

Suppose there are 2 demand infos:

Demand 1: demand TAIL.
Demand 2: not demand TAIL.

If a block is demand 1, we should adjust this block is available both for demand 1 && 2.
However, if a block is demand 2, we should only adjust this block is available for demand 2 only.

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (vector_insn_info::operator>=): Fix available condition.

---
 gcc/config/riscv/riscv-vsetvl.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Kito Cheng Jan. 26, 2023, 7:13 p.m. UTC | #1
committed, thanks.

On Tue, Jan 3, 2023 at 3:31 PM <juzhe.zhong@rivai.ai> wrote:

> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> Suppose there are 2 demand infos:
>
> Demand 1: demand TAIL.
> Demand 2: not demand TAIL.
>
> If a block is demand 1, we should adjust this block is available both for
> demand 1 && 2.
> However, if a block is demand 2, we should only adjust this block is
> available for demand 2 only.
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc (vector_insn_info::operator>=): Fix
> available condition.
>
> ---
>  gcc/config/riscv/riscv-vsetvl.cc | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc
> b/gcc/config/riscv/riscv-vsetvl.cc
> index 6dbaea32b03..52f0195980a 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -1048,12 +1048,10 @@ vector_insn_info::operator>= (const
> vector_insn_info &other) const
>         }
>      }
>
> -  if (demand_p (DEMAND_TAIL_POLICY) && !other.demand_p
> (DEMAND_TAIL_POLICY)
> -      && get_ta () != other.get_ta ())
> +  if (!demand_p (DEMAND_TAIL_POLICY) && other.demand_p
> (DEMAND_TAIL_POLICY))
>      return false;
>
> -  if (demand_p (DEMAND_MASK_POLICY) && !other.demand_p
> (DEMAND_MASK_POLICY)
> -      && get_ma () != other.get_ma ())
> +  if (!demand_p (DEMAND_MASK_POLICY) && other.demand_p
> (DEMAND_MASK_POLICY))
>      return false;
>
>    return true;
> --
> 2.36.3
>
>
  

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 6dbaea32b03..52f0195980a 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1048,12 +1048,10 @@  vector_insn_info::operator>= (const vector_insn_info &other) const
 	}
     }
 
-  if (demand_p (DEMAND_TAIL_POLICY) && !other.demand_p (DEMAND_TAIL_POLICY)
-      && get_ta () != other.get_ta ())
+  if (!demand_p (DEMAND_TAIL_POLICY) && other.demand_p (DEMAND_TAIL_POLICY))
     return false;
 
-  if (demand_p (DEMAND_MASK_POLICY) && !other.demand_p (DEMAND_MASK_POLICY)
-      && get_ma () != other.get_ma ())
+  if (!demand_p (DEMAND_MASK_POLICY) && other.demand_p (DEMAND_MASK_POLICY))
     return false;
 
   return true;