From: Julia Koval Date: Tue, 20 Jun 2017 18:20:51 +0000 (+0200) Subject: Fix rounding pattern similar to PR73350. X-Git-Tag: upstream/12.2.0~38675 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6837e0460c65804f78f3a43e430975d265cbae9;p=platform%2Fupstream%2Fgcc.git Fix rounding pattern similar to PR73350. gcc/ * config/i386/i386.c: Fix rounding expand for new pattern. * config/i386/subst.md: Fix pattern (parallel -> unspec). gcc/testsuite/ * gcc.target/i386/pr73350-2.c: New test. From-SVN: r249423 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b28620a..b438766 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-20 Julia Koval + + * config/i386/i386.c: Fix rounding expand for new pattern. + * config/i386/subst.md: Fix pattern (parallel -> unspec). + 2017-06-20 James Greenhalgh * config/aarch64/aarch64-option-extensions.def (rcpc): New. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d5c2d46..9f7290a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -36597,8 +36597,8 @@ ix86_expand_sse_comi_round (const struct builtin_description *d, } else { - gcc_assert (GET_CODE (XVECEXP (pat, 0, 0)) == SET); - set_dst = SET_DEST (XVECEXP (pat, 0, 0)); + gcc_assert (GET_CODE (pat) == SET); + set_dst = SET_DEST (pat); } emit_insn (pat); diff --git a/gcc/config/i386/subst.md b/gcc/config/i386/subst.md index 57fb0d4..4685db3 100644 --- a/gcc/config/i386/subst.md +++ b/gcc/config/i386/subst.md @@ -177,10 +177,11 @@ [(set (match_operand:SUBST_A 0) (match_operand:SUBST_A 1))] "TARGET_AVX512F" - [(parallel[ - (set (match_dup 0) - (match_dup 1)) - (unspec [(match_operand:SI 2 "const48_operand")] UNSPEC_EMBEDDED_ROUNDING)])]) + [(set (match_dup 0) + (unspec:SUBST_A [(match_dup 1) + (match_operand:SI 2 "const48_operand")] + UNSPEC_EMBEDDED_ROUNDING)) +]) (define_subst_attr "round_expand_name" "round_expand" "" "_round") (define_subst_attr "round_expand_nimm_predicate" "round_expand" "nonimmediate_operand" "register_operand") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e22ebf5..b277662 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-06-20 Julia Koval + + * gcc.target/i386/pr73350-2.c: New test. + 2017-06-20 Rainer Orth * c-c++-common/fold-masked-cmp-1.c: Allow for i?86-*-* target. diff --git a/gcc/testsuite/gcc.target/i386/pr73350-2.c b/gcc/testsuite/gcc.target/i386/pr73350-2.c new file mode 100644 index 0000000..c1faab4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr73350-2.c @@ -0,0 +1,35 @@ +/* { dg-do run { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-O2 -mavx512er" } */ +/* { dg-require-effective-target avx512er } */ + +#include "avx512er-check.h" + +#include +#include +#include + +static int counter; + +void handler (int i) +{ + exit (0); +} + +static void +avx512er_test (void) +{ + struct sigaction s; + sigemptyset (&s.sa_mask); + s.sa_handler = handler; + s.sa_flags = 0; + sigaction (SIGFPE, &s, NULL); + + __m512 a = _mm512_set1_ps (-1.f); + + _mm_setcsr ( _MM_MASK_MASK & ~_MM_MASK_INVALID ); + __m512 r1 = _mm512_rsqrt28_round_ps (a, _MM_FROUND_NO_EXC); + __m512 r2 = _mm512_rsqrt28_round_ps (a, _MM_FROUND_CUR_DIRECTION); + + if (r1[0] + r2[0]) + abort (); +}