Fixed riscv regressions introduced in r17-4413-g3b99fd4bdc7005.

Restores previous behaviour by only overriding autovec mode if it is one
of the available autovec modes.

gcc/ChangeLog:

        PR target/127494

        * config/riscv/riscv-v.cc (autovectorize_vector_modes):
        Restore previous behaviour.

-- >8 --

Hi,

Appologies for this breakage. I eventually got my riscv regression
setup working again but should have spent the time before sending the
initial patch.

This was causeed by a fairly subtle behaviour change where
before my change, if you entered a valid mode, but not one which riscv
supported, then it would fallback to previous behaviour.

Whereas after my change, it would try use the given mode no matter
what.

This restores the previous behaviour.

Built and regression tested on riscv-linux-gnu.

Okay for master?

KR,
Alfie

P.S. Additionally, for future reference, would this be okay for pushed
as obvious?

---
 gcc/config/riscv/riscv-v.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index 1cf53c7841c..faa43f4bf64 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -3069,7 +3069,8 @@ autovectorize_vector_modes (vector_modes *modes, bool)
       modes->truncate (0);
 
       machine_mode mode;
-      if (parse_machine_mode (riscv_autovec_mode, &mode))
+      if (parse_machine_mode (riscv_autovec_mode, &mode)
+         && ms.contains (mode))
        {
          modes->safe_push (mode);
          return 0;
-- 
2.43.0

Reply via email to