}
else
return false;
+
+ /* Check if the beginning and end of the sequence corresponds
+ to OP0 and OP1 respectively */
+ if (!(known_eq (d->perm[0], vlen - slideup_cnt)
+ && known_eq (d->perm[vlen - 1], 2 * vlen - 1 - slideup_cnt)))
+ return false;
+
}
/* Check for a monotonic sequence with one or two pivots. */
if (i > 0 && i != pivot
&& maybe_ne (d->perm[i], d->perm[i - 1] + 1))
{
- /* A second pivot would indicate the vector length and is in OP0. */
- if (known_ge (d->perm[i], vec_len) || pivot == -1 || len != 0)
+ /* A second pivot would indicate the vector length and is in OP0.
+ Also a second pivot would indicate three or more monotonic
+ sequences in the given permutation which cannot be handled by
+ slideup function. */
+ if (known_ge (d->perm[i], vec_len)
+ || pivot == -1
+ || len != 0
+ || need_slideup_p)
return false;
len = i;
}
--- /dev/null
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-require-effective-target riscv_v_ok } */
+/* { dg-additional-options " -O0 " } */
+
+#include <stdint.h>
+
+typedef int8_t v4i8 __attribute__((vector_size(4)));
+v4i8 g2 = { 7, 0, 8, 70 }, g12;
+
+int main()
+{
+ g12 = __builtin_shufflevector(g2, g2, 7, 0, 7, 0);
+ if (g12[2] != 70)
+ __builtin_abort();
+ return 0;
+}