i386: Use fldt instead of fld on e_logl.S

Message ID 20220804210016.2613403-1-adhemerval.zanella@linaro.org
State Committed
Headers
Series i386: Use fldt instead of fld on e_logl.S |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Adhemerval Zanella Aug. 4, 2022, 9 p.m. UTC
  Clang cannot assemble fldt in the AT&T dialect mode.
---
 sysdeps/i386/i686/fpu/e_logl.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

H.J. Lu Aug. 4, 2022, 9:23 p.m. UTC | #1
On Thu, Aug 4, 2022 at 2:00 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Clang cannot assemble fldt in the AT&T dialect mode.
> ---
>  sysdeps/i386/i686/fpu/e_logl.S | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S
> index 63183ac544..5d53f3bb22 100644
> --- a/sysdeps/i386/i686/fpu/e_logl.S
> +++ b/sysdeps/i386/i686/fpu/e_logl.S
> @@ -43,7 +43,7 @@ ENTRY(__ieee754_logl)
>         fsubl   MO(one)         // x-1 : x : log(2)
>  5:     fld     %st             // x-1 : x-1 : x : log(2)
>         fabs                    // |x-1| : x-1 : x : log(2)
> -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
>         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
>         fstp    %st(0)          // x-1 : x : log(2)
>         jc      2f
> @@ -76,7 +76,7 @@ ENTRY(__logl_finite)
>         fsubl   MO(one)         // x-1 : x : log(2)
>         fld     %st             // x-1 : x-1 : x : log(2)
>         fabs                    // |x-1| : x-1 : x : log(2)
> -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
>         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
>         fstp    %st(0)          // x-1 : x : log(2)
>         jc      2b
> --
> 2.34.1
>

I don't think this is correct since there are

        .type limit,@object
limit:  .double 0.29

It should be fldl.
  
Fangrui Song Aug. 4, 2022, 9:31 p.m. UTC | #2
On Thu, Aug 4, 2022 at 2:24 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Aug 4, 2022 at 2:00 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
> >
> > Clang cannot assemble fldt in the AT&T dialect mode.
> > ---
> >  sysdeps/i386/i686/fpu/e_logl.S | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S
> > index 63183ac544..5d53f3bb22 100644
> > --- a/sysdeps/i386/i686/fpu/e_logl.S
> > +++ b/sysdeps/i386/i686/fpu/e_logl.S
> > @@ -43,7 +43,7 @@ ENTRY(__ieee754_logl)
> >         fsubl   MO(one)         // x-1 : x : log(2)
> >  5:     fld     %st             // x-1 : x-1 : x : log(2)
> >         fabs                    // |x-1| : x-1 : x : log(2)
> > -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> > +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> >         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
> >         fstp    %st(0)          // x-1 : x : log(2)
> >         jc      2f
> > @@ -76,7 +76,7 @@ ENTRY(__logl_finite)
> >         fsubl   MO(one)         // x-1 : x : log(2)
> >         fld     %st             // x-1 : x-1 : x : log(2)
> >         fabs                    // |x-1| : x-1 : x : log(2)
> > -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> > +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> >         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
> >         fstp    %st(0)          // x-1 : x : log(2)
> >         jc      2b
> > --
> > 2.34.1
> >
>
> I don't think this is correct since there are
>
>         .type limit,@object
> limit:  .double 0.29
>
> It should be fldl.
>
> --
> H.J.

If I am not mistaken, the existing fld has a bug as it is treated as flds

fld limit@GOTOFF(%edx)    # treated as flds
flds limit@GOTOFF(%edx)
fldl limit@GOTOFF(%edx)
fldt limit@GOTOFF(%edx)

.section .rodata.cst8,"aM",@progbits,8
.p2align 3
limit: .double 0.29
  
H.J. Lu Aug. 4, 2022, 9:35 p.m. UTC | #3
On Thu, Aug 4, 2022 at 2:31 PM Fangrui Song <maskray@google.com> wrote:
>
> On Thu, Aug 4, 2022 at 2:24 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Thu, Aug 4, 2022 at 2:00 PM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> > >
> > > Clang cannot assemble fldt in the AT&T dialect mode.
> > > ---
> > >  sysdeps/i386/i686/fpu/e_logl.S | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S
> > > index 63183ac544..5d53f3bb22 100644
> > > --- a/sysdeps/i386/i686/fpu/e_logl.S
> > > +++ b/sysdeps/i386/i686/fpu/e_logl.S
> > > @@ -43,7 +43,7 @@ ENTRY(__ieee754_logl)
> > >         fsubl   MO(one)         // x-1 : x : log(2)
> > >  5:     fld     %st             // x-1 : x-1 : x : log(2)
> > >         fabs                    // |x-1| : x-1 : x : log(2)
> > > -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> > > +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> > >         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
> > >         fstp    %st(0)          // x-1 : x : log(2)
> > >         jc      2f
> > > @@ -76,7 +76,7 @@ ENTRY(__logl_finite)
> > >         fsubl   MO(one)         // x-1 : x : log(2)
> > >         fld     %st             // x-1 : x-1 : x : log(2)
> > >         fabs                    // |x-1| : x-1 : x : log(2)
> > > -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> > > +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> > >         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
> > >         fstp    %st(0)          // x-1 : x : log(2)
> > >         jc      2b
> > > --
> > > 2.34.1
> > >
> >
> > I don't think this is correct since there are
> >
> >         .type limit,@object
> > limit:  .double 0.29
> >
> > It should be fldl.
> >
> > --
> > H.J.
>
> If I am not mistaken, the existing fld has a bug as it is treated as flds

True.  It doesn't seem to cause any issue.

> fld limit@GOTOFF(%edx)    # treated as flds
> flds limit@GOTOFF(%edx)
> fldl limit@GOTOFF(%edx)
> fldt limit@GOTOFF(%edx)
>
> .section .rodata.cst8,"aM",@progbits,8
> .p2align 3
> limit: .double 0.29
  
Adhemerval Zanella Aug. 5, 2022, 12:28 p.m. UTC | #4
On 04/08/22 18:35, H.J. Lu wrote:
> On Thu, Aug 4, 2022 at 2:31 PM Fangrui Song <maskray@google.com> wrote:
>>
>> On Thu, Aug 4, 2022 at 2:24 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>>
>>> On Thu, Aug 4, 2022 at 2:00 PM Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>>
>>>> Clang cannot assemble fldt in the AT&T dialect mode.
>>>> ---
>>>>  sysdeps/i386/i686/fpu/e_logl.S | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S
>>>> index 63183ac544..5d53f3bb22 100644
>>>> --- a/sysdeps/i386/i686/fpu/e_logl.S
>>>> +++ b/sysdeps/i386/i686/fpu/e_logl.S
>>>> @@ -43,7 +43,7 @@ ENTRY(__ieee754_logl)
>>>>         fsubl   MO(one)         // x-1 : x : log(2)
>>>>  5:     fld     %st             // x-1 : x-1 : x : log(2)
>>>>         fabs                    // |x-1| : x-1 : x : log(2)
>>>> -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
>>>> +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
>>>>         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
>>>>         fstp    %st(0)          // x-1 : x : log(2)
>>>>         jc      2f
>>>> @@ -76,7 +76,7 @@ ENTRY(__logl_finite)
>>>>         fsubl   MO(one)         // x-1 : x : log(2)
>>>>         fld     %st             // x-1 : x-1 : x : log(2)
>>>>         fabs                    // |x-1| : x-1 : x : log(2)
>>>> -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
>>>> +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
>>>>         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
>>>>         fstp    %st(0)          // x-1 : x : log(2)
>>>>         jc      2b
>>>> --
>>>> 2.34.1
>>>>
>>>
>>> I don't think this is correct since there are
>>>
>>>         .type limit,@object
>>> limit:  .double 0.29
>>>
>>> It should be fldl.
>>>
>>> --
>>> H.J.
>>
>> If I am not mistaken, the existing fld has a bug as it is treated as flds
> 
> True.  It doesn't seem to cause any issue.
> 
>> fld limit@GOTOFF(%edx)    # treated as flds
>> flds limit@GOTOFF(%edx)
>> fldl limit@GOTOFF(%edx)
>> fldt limit@GOTOFF(%edx)
>>
>> .section .rodata.cst8,"aM",@progbits,8
>> .p2align 3
>> limit: .double 0.29

fldl works and it see the best option.  Ok with this change?
  
H.J. Lu Aug. 5, 2022, 4:55 p.m. UTC | #5
On Fri, Aug 5, 2022 at 5:28 AM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 04/08/22 18:35, H.J. Lu wrote:
> > On Thu, Aug 4, 2022 at 2:31 PM Fangrui Song <maskray@google.com> wrote:
> >>
> >> On Thu, Aug 4, 2022 at 2:24 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >>>
> >>> On Thu, Aug 4, 2022 at 2:00 PM Adhemerval Zanella
> >>> <adhemerval.zanella@linaro.org> wrote:
> >>>>
> >>>> Clang cannot assemble fldt in the AT&T dialect mode.
> >>>> ---
> >>>>  sysdeps/i386/i686/fpu/e_logl.S | 4 ++--
> >>>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S
> >>>> index 63183ac544..5d53f3bb22 100644
> >>>> --- a/sysdeps/i386/i686/fpu/e_logl.S
> >>>> +++ b/sysdeps/i386/i686/fpu/e_logl.S
> >>>> @@ -43,7 +43,7 @@ ENTRY(__ieee754_logl)
> >>>>         fsubl   MO(one)         // x-1 : x : log(2)
> >>>>  5:     fld     %st             // x-1 : x-1 : x : log(2)
> >>>>         fabs                    // |x-1| : x-1 : x : log(2)
> >>>> -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> >>>> +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> >>>>         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
> >>>>         fstp    %st(0)          // x-1 : x : log(2)
> >>>>         jc      2f
> >>>> @@ -76,7 +76,7 @@ ENTRY(__logl_finite)
> >>>>         fsubl   MO(one)         // x-1 : x : log(2)
> >>>>         fld     %st             // x-1 : x-1 : x : log(2)
> >>>>         fabs                    // |x-1| : x-1 : x : log(2)
> >>>> -       fld     MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> >>>> +       fldt    MO(limit)       // 0.29 : |x-1| : x-1 : x : log(2)
> >>>>         fcomip  %st(1)          // |x-1| : x-1 : x : log(2)
> >>>>         fstp    %st(0)          // x-1 : x : log(2)
> >>>>         jc      2b
> >>>> --
> >>>> 2.34.1
> >>>>
> >>>
> >>> I don't think this is correct since there are
> >>>
> >>>         .type limit,@object
> >>> limit:  .double 0.29
> >>>
> >>> It should be fldl.
> >>>
> >>> --
> >>> H.J.
> >>
> >> If I am not mistaken, the existing fld has a bug as it is treated as flds
> >
> > True.  It doesn't seem to cause any issue.
> >
> >> fld limit@GOTOFF(%edx)    # treated as flds
> >> flds limit@GOTOFF(%edx)
> >> fldl limit@GOTOFF(%edx)
> >> fldt limit@GOTOFF(%edx)
> >>
> >> .section .rodata.cst8,"aM",@progbits,8
> >> .p2align 3
> >> limit: .double 0.29
>
> fldl works and it see the best option.  Ok with this change?

Yes.

Thanks.
  
Andreas Schwab Aug. 5, 2022, 5:23 p.m. UTC | #6
On Aug 04 2022, Adhemerval Zanella via Libc-alpha wrote:

> Clang cannot assemble fldt in the AT&T dialect mode.

s/fldt/fld/
  

Patch

diff --git a/sysdeps/i386/i686/fpu/e_logl.S b/sysdeps/i386/i686/fpu/e_logl.S
index 63183ac544..5d53f3bb22 100644
--- a/sysdeps/i386/i686/fpu/e_logl.S
+++ b/sysdeps/i386/i686/fpu/e_logl.S
@@ -43,7 +43,7 @@  ENTRY(__ieee754_logl)
 	fsubl	MO(one)		// x-1 : x : log(2)
 5:	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
-	fld	MO(limit)	// 0.29 : |x-1| : x-1 : x : log(2)
+	fldt	MO(limit)	// 0.29 : |x-1| : x-1 : x : log(2)
 	fcomip	%st(1)		// |x-1| : x-1 : x : log(2)
 	fstp	%st(0)		// x-1 : x : log(2)
 	jc	2f
@@ -76,7 +76,7 @@  ENTRY(__logl_finite)
 	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
-	fld	MO(limit)	// 0.29 : |x-1| : x-1 : x : log(2)
+	fldt	MO(limit)	// 0.29 : |x-1| : x-1 : x : log(2)
 	fcomip	%st(1)		// |x-1| : x-1 : x : log(2)
 	fstp	%st(0)		// x-1 : x : log(2)
 	jc	2b