This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][X86] Fix rounding pattern similar to PR73350
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Koval, Julia" <julia dot koval at intel dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Mon, 12 Jun 2017 06:42:36 -0700
- Subject: Re: [PATCH][X86] Fix rounding pattern similar to PR73350
- Authentication-results: sourceware.org; auth=none
- References: <4E89A029A0F8D443B436A5167BA3C53F19956843@IRSMSX101.ger.corp.intel.com>
On Mon, Jun 12, 2017 at 6:21 AM, Koval, Julia <julia.koval@intel.com> wrote:
> This is the same issue as PR73350 and PR80862 for disabling FP exceptions.
>
> gcc -O0 -mavx512f -mavx512er returns exception
> gcc -O2 -mavx512f -mavx512er returns nan
>
> For this code:
>
> #include <stdio.h>
> #include <math.h>
> #include <x86intrin.h>
> #include <limits.h>
> #include <float.h>
>
> int main(int argc, char *argv[]) {
> __m512 a = _mm512_set1_ps((float) -1);
> __m512 b = _mm512_set1_ps((float) -1);
> _mm_setcsr( _MM_MASK_MASK &~
> (_MM_MASK_OVERFLOW|_MM_MASK_INVALID|_MM_MASK_DIV_ZERO) );
> __m512 result1 = _mm512_rsqrt28_round_ps(a, _MM_FROUND_NO_EXC );
> printf("%d %d\n", _MM_FROUND_CUR_DIRECTION, _MM_FROUND_NO_EXC);
> __m512 result2 = _mm512_rsqrt28_round_ps(a, _MM_FROUND_CUR_DIRECTION);
>
> printf("%g\n", result1[0] - result2[0]);
>
> return 0;
> }
>
> This patch fixes the issue.
>
> gcc/
> * config/i386/i386.c: Fix rounding expand for new pattern
> * config/i386/subst.md: Fix pattern (parallel -> unspec)
>
> Ok for trunk?
>
Please include the testcase.
Thanks.
--
H.J.