On 11/13/06, Richard Guenther <richard.guenther@gmail.com> wrote:
> On 11/13/06, Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:
> > Richard,
> >
> > > I bet we are missing an inline x86_64 variant. But it should be not too
> > > hard to implement.
> >
> > 'tis what I thought.
> >
> > My view is that Steve is right about right and slow; however it is a
> > very visible right and slow. Which is the right button to press to
> > have the inline version crafted for us?
>
> I can do expanders for fmod and remainder.
I sort of take that back ;) But at least for the fortran MODULO you should
be able to emit A - FLOOR (A / P) * P as in the definition. Currently
it seems at least FMOD is called in the expansion. With the above
definition used for expansion you'd get
cvtss2sd %xmm0, %xmm3
movsd (%rsi), %xmm2
movapd %xmm3, %xmm0
divsd %xmm2, %xmm0
cvttsd2si %xmm0, %eax
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jae .L2
subl $1, %eax
cvtsi2sd %eax, %xmm1
.L2:
mulsd %xmm2, %xmm1
movapd %xmm3, %xmm0
subsd %xmm1, %xmm0
exact IEC 60559 semantics for remainder will probably not be suitable
for inlining. But I can try...