aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/riscv/riscv-vsetvl.cc11
-rw-r--r--gcc/testsuite/gcc.target/riscv/pr117483.c20
2 files changed, 29 insertions, 2 deletions
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 0b53b20..35c69a9 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1480,8 +1480,15 @@ private:
max_sew_overlap_and_next_ratio_valid_for_prev_sew_p (const vsetvl_info &prev,
const vsetvl_info &next)
{
- return next_ratio_valid_for_prev_sew_p (prev, next)
- && max_sew_overlap_p (prev, next);
+ if (next_ratio_valid_for_prev_sew_p (prev, next)
+ && max_sew_overlap_p (prev, next))
+ {
+ if (next.get_sew () < prev.get_sew ()
+ && (!next.get_ta () || !next.get_ma ()))
+ return false;
+ return true;
+ }
+ return false;
}
inline bool
sew_le_and_next_sew_le_prev_max_sew_and_ratio_eq_p (const vsetvl_info &prev,
diff --git a/gcc/testsuite/gcc.target/riscv/pr117483.c b/gcc/testsuite/gcc.target/riscv/pr117483.c
new file mode 100644
index 0000000..3e00986
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/pr117483.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fsigned-char -fno-strict-aliasing -fwrapv -march=rv64gcv_zvl256b -mabi=lp64d -O3" } */
+
+char a, b, f;
+short c, h;
+int d[5];
+int e;
+long *g;
+short (*i)[4];
+int main() {
+ e = 906784;
+ char *j = &f;
+ short *k = &h;
+ for (short l = 0; l < 23; l += 740314495218734 - 29738)
+ for (unsigned char m = ~!g[l] - 255; m < 24; m += 3) {
+ a = k[m];
+ b += j[1] ?: d[6];
+ c ^= i[010][l];
+ }
+}