diff mbox

[AArch64] Restrict lrint inlining on ILP32.

Message ID 20170811095756.GA23306@arm.com
State New
Headers show

Commit Message

Tamar Christina Aug. 11, 2017, 9:58 a.m. UTC
Hi All,

The inlining of lrint isn't valid in all cases on ILP32 when
-fno-math-errno is used because an inexact exception is raised in
certain circumstances.

For ILP32 I now restrict the inlining only when -fno-trapping-math
is also specified.

This fixed PR/81800.

Regtested on aarch64-none-linux-gnu and no regressions.

Ok for trunk?

Thanks,
Tamar

gcc/
2017-08-11  Tamar Christina  <tamar.christina@arm.com>

	PR target/81800
	* config/aarch64/aarch64.md (lrint<GPF:mode><GPI:mode>2): Add flag_trapping_math.

gcc/testsuite/
2017-08-11  Tamar Christina  <tamar.christina@arm.com>

	* gcc.target/aarch64/inline-lrint_2.c (dg-options): Add -fno-trapping-math.

--

Comments

Andrew Pinski Sept. 9, 2017, 6:57 a.m. UTC | #1
On Fri, Aug 11, 2017 at 2:58 AM, Tamar Christina
<tamar.christina@arm.com> wrote:
> Hi All,
>
> The inlining of lrint isn't valid in all cases on ILP32 when
> -fno-math-errno is used because an inexact exception is raised in
> certain circumstances.
>
> For ILP32 I now restrict the inlining only when -fno-trapping-math
> is also specified.
>
> This fixed PR/81800.
>
> Regtested on aarch64-none-linux-gnu and no regressions.
>
> Ok for trunk?

I can't approve this patch but it looks good except for your changelog
does not match what the code is doing.

Maybe:
Add check on !ilp32 or !flag_trapping_math.

Thanks,
Andrew

>
> Thanks,
> Tamar
>
> gcc/
> 2017-08-11  Tamar Christina  <tamar.christina@arm.com>
>
>         PR target/81800
>         * config/aarch64/aarch64.md (lrint<GPF:mode><GPI:mode>2): Add flag_trapping_math.
>
> gcc/testsuite/
> 2017-08-11  Tamar Christina  <tamar.christina@arm.com>
>
>         * gcc.target/aarch64/inline-lrint_2.c (dg-options): Add -fno-trapping-math.
>
> --
Tamar Christina Sept. 9, 2017, 7:01 a.m. UTC | #2
Hi Andrew,

Yes I noticed the changelog after I sent it.

But I have a new version of the patch on internal review
Which is why I didn't ping this one. I'll send it out after the Cauldron.

Thanks,
Tamar
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index b1ef0252c4b0b93d368abbd9bb88cb740115a829..6617ea0b95f71fd91534f63de9ddfd2f400bb787 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -5122,7 +5122,7 @@ 
 (define_expand "lrint<GPF:mode><GPI:mode>2"
   [(match_operand:GPI 0 "register_operand")
    (match_operand:GPF 1 "register_operand")]
-  "TARGET_FLOAT"
+  "TARGET_FLOAT && (!TARGET_ILP32 || !flag_trapping_math)"
 {
   rtx cvt = gen_reg_rtx (<GPF:MODE>mode);
   emit_insn (gen_rint<GPF:mode>2 (cvt, operands[1]));
diff --git a/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c b/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c
index 6080e186d8f0c6f5ede81c6438e059e8b976378f..bd0c73c8d34a2cb52d0a453a175bedd59bba5457 100644
--- a/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
-/* { dg-options "-O3 -fno-math-errno" } */
+/* { dg-options "-O3 -fno-math-errno -fno-trapping-math" } */
 
 #include "lrint-matherr.h"