mirror of git://gcc.gnu.org/git/gcc.git
[PATCH] RISC-V: Fix slide pattern recognition [PR122124]
Ensure the second pivot is really a pivot and it's not in OP1. PR target/122124 gcc/ChangeLog: * config/riscv/riscv-v.cc (shuffle_slide_patterns): Check if the second pivot is in OP1 and improve comments. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr122124.c: New test.
This commit is contained in:
parent
05d3dd6010
commit
34ef2eec90
|
@ -3779,14 +3779,15 @@ shuffle_slide_patterns (struct expand_vec_perm_d *d)
|
||||||
int pivot = -1;
|
int pivot = -1;
|
||||||
for (int i = 0; i < vlen; i++)
|
for (int i = 0; i < vlen; i++)
|
||||||
{
|
{
|
||||||
|
/* The first pivot is in OP1. */
|
||||||
if (pivot == -1 && known_ge (d->perm[i], vec_len))
|
if (pivot == -1 && known_ge (d->perm[i], vec_len))
|
||||||
pivot = i;
|
pivot = i;
|
||||||
if (i > 0 && i != pivot
|
if (i > 0 && i != pivot
|
||||||
&& maybe_ne (d->perm[i], d->perm[i - 1] + 1))
|
&& maybe_ne (d->perm[i], d->perm[i - 1] + 1))
|
||||||
{
|
{
|
||||||
if (pivot == -1 || len != 0)
|
/* A second pivot would indicate the vector length and is in OP0. */
|
||||||
|
if (known_ge (d->perm[i], vec_len) || pivot == -1 || len != 0)
|
||||||
return false;
|
return false;
|
||||||
/* A second pivot would indicate the vector length. */
|
|
||||||
len = i;
|
len = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-require-effective-target riscv_v_ok } */
|
||||||
|
/* { dg-add-options riscv_v } */
|
||||||
|
/* { dg-additional-options "-O0 -std=gnu99" } */
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
|
||||||
|
uint16_t func_24() {
|
||||||
|
BS_VEC(uint32_t, 4) zero = {0};
|
||||||
|
BS_VEC(uint8_t, 2)
|
||||||
|
BS_VAR_1 = __builtin_shufflevector(
|
||||||
|
(BS_VEC(uint8_t, 4))5,
|
||||||
|
__builtin_convertvector(zero, BS_VEC(uint8_t, 4)), 5, 0);
|
||||||
|
return BS_VAR_1[1];
|
||||||
|
}
|
||||||
|
int main() {
|
||||||
|
printf("%u\n", func_24());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* { dg-output "5" } */
|
Loading…
Reference in New Issue