From: Uros Bizjak Date: Sat, 11 Apr 2020 09:51:41 +0000 (+0200) Subject: i386: Fix REDUC_SSE_SMINMAX_MODE mode conditions. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f883c46b4877f637e0fa5025b4d6b5c9040ec566;p=gcc.git 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. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f1a9568d9c4..f3a226cc711 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-11 Uroš Bizjak + + PR target/94494 + * config/i386/sse.md (REDUC_SSE_SMINMAX_MODE): Use TARGET_SSE2 + condition for V4SI, V8HI and V16QI modes. + 2020-04-11 Jakub Jelinek PR debug/94495 diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index fef6065b687..90ced8599ca 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -2733,8 +2733,8 @@ ;; Modes handled by reduc_sm{in,ax}* patterns. (define_mode_iterator REDUC_SSE_SMINMAX_MODE [(V4SF "TARGET_SSE") (V2DF "TARGET_SSE") - (V2DI "TARGET_SSE4_2") (V4SI "TARGET_SSE") (V8HI "TARGET_SSE") - (V16QI "TARGET_SSE")]) + (V4SI "TARGET_SSE2") (V8HI "TARGET_SSE2") (V16QI "TARGET_SSE2") + (V2DI "TARGET_SSE4_2")]) (define_expand "reduc__scal_" [(smaxmin:REDUC_SSE_SMINMAX_MODE diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8f7ef8f6483..fa09a7d2877 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-11 Uroš Bizjak + + PR target/94494 + * gcc.target/i386/pr94494.c: New test. + 2020-04-11 Jakub Jelinek PR tree-optimization/94482 diff --git a/gcc/testsuite/gcc.target/i386/pr94494.c b/gcc/testsuite/gcc.target/i386/pr94494.c new file mode 100644 index 00000000000..ba0171e59f8 --- /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; + } + } +}