This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/68743] [6 Regression] FAIL: gfortran.dg/aint_anint_1.f90 -O0 execution test
- From: "danglin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Dec 2015 20:58:23 +0000
- Subject: [Bug libfortran/68743] [6 Regression] FAIL: gfortran.dg/aint_anint_1.f90 -O0 execution test
- Auto-submitted: auto-generated
- References: <bug-68743-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68743
--- Comment #20 from John David Anglin <danglin at gcc dot gnu.org> ---
In the ccp1 pass, we had:
;; Function floorf (floorf, funcdef_no=22, decl_uid=167, cgraph_uid=114,
symbol_order=114)
__attribute__((nothrow, leaf, const))
floorf (float x)
{
double _2;
double _3;
float _4;
<bb 2>:
_2 = (double) x_1(D);
_3 = floor (_2);
_4 = (float) _3;
return _4;
}
Using c11 doesn't work. "floor" is still transformed to "floorf" and
it also results in a number of implicit prototype warnings.
The -fno-builtin option works and gives the best code:
stw %r2,-20(%r30)
ldo 64(%r30),%r30
.CALL ARGW0=FR,ARGW1=FU
bl floor,%r2
fcnvff,sgl,dbl %fr4L,%fr5
fcnvff,dbl,sgl %fr4,%fr4L
ldw -84(%r30),%r2
bv %r0(%r2)
ldo -64(%r30),%r30
The first approach in #16 can be made to work but one needs to assign
x to a volatile double instead of retval. The code isn't too bad but
it introduces an unnecessary store/load pair:
float
floorf (float x)
{
volatile double y = x;
return (float) floor(y);
}
gives
stw %r2,-20(%r30)
fcnvff,sgl,dbl %fr4L,%fr4
ldo 64(%r30),%r30
ldo -64(%r30),%r28
fstds %fr4,8(%r28)
fldds 8(%r28),%fr5
.CALL ARGW0=FR,ARGW1=FU
bl floor,%r2
nop
The code using the second approach is pretty bad but it works.
The third approach works but it introduces an extra call.