From 59eddd9769057ee094cdae09b15b257cc3db690f Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sat, 11 Apr 2020 13:22:52 +0200 Subject: [PATCH] i386: Fix REDUC_SSE_SMINMAX_MODE mode conditions. V4SI, V8HI and V16QI modes of redux__scal_ expander expand with SSE2 instructions (PSRLDQ and PCMPGTx) so use TARGET_SSE2 as relevant mode iterator codition. PR target/94494 * config/i386/sse.md (REDUC_SSE_SMINMAX_MODE): Use TARGET_SSE2 condition for V4SI, V8HI and V16QI modes. testsuite/ChangeLog: PR target/94494 * gcc.target/i386/pr94494.c: New test. --- gcc/testsuite/gcc.target/i386/pr94494.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr94494.c diff --git a/gcc/testsuite/gcc.target/i386/pr94494.c b/gcc/testsuite/gcc.target/i386/pr94494.c new file mode 100644 index 000000000000..ba0171e59f86 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr94494.c @@ -0,0 +1,23 @@ +/* PR target/94494 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -msse -mno-sse2" } */ + +void +foo (float *item, float *f, float *out, + int threshold, int wi, int lo, int hi, int value) +{ + for (int i = 0; i < wi; i++) { + if (item[i] > 0) { + int found = 0; + + for (int k = lo; k < hi; k++) + if (f[k] > 0) + found = 1; + + if (found > 0) + out[i] = threshold; + else if (out[i] > value) + out[i] -= 1; + } + } +} -- 2.47.3