https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81800

            Bug ID: 81800
           Summary: [8 regression] on aarch64 ilp32 lrint should not be
                    inlined as two instructions
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

recently lrint is inlined as frintx/fcvtzs on aarch64, but this
is not valid on ilp32 where a non-integer double may be out-of-bound
for a long and then the first instruction raises the inexact,
the second one raises invalid exception and only the invalid should
be raised in this case.

so the inlining is only valid with -fno-trapping-math i think.

gcc -O3 -mabi=ilp32 -S -fno-math-errno b.c

compiles to

f:
        frintx  d0, d0
        fcvtzs  w0, d0
        ret

(the patch for the equivalent bug in glibc is
https://sourceware.org/ml/libc-alpha/2017-08/msg00299.html
which saves and restores the fenv around the instructions.)

Reply via email to