Quantcast

Optimize cerror on arm64

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Optimize cerror on arm64

Mark Kettenis
Just like we did on other architectures.

ok?


Index: lib/libc/arch/aarch64/sys/cerror.S
===================================================================
RCS file: /cvs/src/lib/libc/arch/aarch64/sys/cerror.S,v
retrieving revision 1.2
diff -u -p -r1.2 cerror.S
--- lib/libc/arch/aarch64/sys/cerror.S 25 Jan 2017 10:43:37 -0000 1.2
+++ lib/libc/arch/aarch64/sys/cerror.S 18 Mar 2017 14:45:58 -0000
@@ -28,17 +28,13 @@
 
 #include "SYS.h"
 
+/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */
+#define TCB_OFFSET_ERRNO (-12)
+
 _ENTRY(CERROR)
- stp x0, x30, [sp,#-16]!
- bl _C_LABEL(__errno)
- ldp x1, x30, [sp],#16
- str w1, [x0]
+ mrs x1, tpidr_el0
+ str w0, [x1, #TCB_OFFSET_ERRNO]
  movn x0, #0
  movn x1, #0
  ret
 END(CERROR)
-
-#if !defined(__PIC__)
-.Lerrno:
- .word errno
-#endif

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimize cerror on arm64

Patrick Wildt-3
On Sat, Mar 18, 2017 at 03:47:18PM +0100, Mark Kettenis wrote:
> Just like we did on other architectures.
>
> ok?

guenther@ had the same diff (but he also removed the movn x1), which
looked good to me as well.  Basically still ok patrick@. ;)

>
>
> Index: lib/libc/arch/aarch64/sys/cerror.S
> ===================================================================
> RCS file: /cvs/src/lib/libc/arch/aarch64/sys/cerror.S,v
> retrieving revision 1.2
> diff -u -p -r1.2 cerror.S
> --- lib/libc/arch/aarch64/sys/cerror.S 25 Jan 2017 10:43:37 -0000 1.2
> +++ lib/libc/arch/aarch64/sys/cerror.S 18 Mar 2017 14:45:58 -0000
> @@ -28,17 +28,13 @@
>  
>  #include "SYS.h"
>  
> +/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */
> +#define TCB_OFFSET_ERRNO (-12)
> +
>  _ENTRY(CERROR)
> - stp x0, x30, [sp,#-16]!
> - bl _C_LABEL(__errno)
> - ldp x1, x30, [sp],#16
> - str w1, [x0]
> + mrs x1, tpidr_el0
> + str w0, [x1, #TCB_OFFSET_ERRNO]
>   movn x0, #0
>   movn x1, #0
>   ret
>  END(CERROR)
> -
> -#if !defined(__PIC__)
> -.Lerrno:
> - .word errno
> -#endif
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimize cerror on arm64

Mark Kettenis
> Date: Sat, 18 Mar 2017 17:20:21 +0100
> From: Patrick Wildt <[hidden email]>
>
> On Sat, Mar 18, 2017 at 03:47:18PM +0100, Mark Kettenis wrote:
> > Just like we did on other architectures.
> >
> > ok?
>
> guenther@ had the same diff (but he also removed the movn x1), which
> looked good to me as well.  Basically still ok patrick@. ;)

Hmm, the arm version still has the equivalent movn r1.  I'll let
guenther@ deal with that.

> > Index: lib/libc/arch/aarch64/sys/cerror.S
> > ===================================================================
> > RCS file: /cvs/src/lib/libc/arch/aarch64/sys/cerror.S,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 cerror.S
> > --- lib/libc/arch/aarch64/sys/cerror.S 25 Jan 2017 10:43:37 -0000 1.2
> > +++ lib/libc/arch/aarch64/sys/cerror.S 18 Mar 2017 14:45:58 -0000
> > @@ -28,17 +28,13 @@
> >  
> >  #include "SYS.h"
> >  
> > +/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */
> > +#define TCB_OFFSET_ERRNO (-12)
> > +
> >  _ENTRY(CERROR)
> > - stp x0, x30, [sp,#-16]!
> > - bl _C_LABEL(__errno)
> > - ldp x1, x30, [sp],#16
> > - str w1, [x0]
> > + mrs x1, tpidr_el0
> > + str w0, [x1, #TCB_OFFSET_ERRNO]
> >   movn x0, #0
> >   movn x1, #0
> >   ret
> >  END(CERROR)
> > -
> > -#if !defined(__PIC__)
> > -.Lerrno:
> > - .word errno
> > -#endif
> >
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimize cerror on arm64

Philip Guenther-2
On Sat, 18 Mar 2017, Mark Kettenis wrote:

> > Date: Sat, 18 Mar 2017 17:20:21 +0100
> > From: Patrick Wildt <[hidden email]>
> >
> > On Sat, Mar 18, 2017 at 03:47:18PM +0100, Mark Kettenis wrote:
> > > Just like we did on other architectures.
> > >
> > > ok?
> >
> > guenther@ had the same diff (but he also removed the movn x1), which
> > looked good to me as well.  Basically still ok patrick@. ;)

iirc you hadn't had a chance to actually run it and I was waiting for
someone who actually has the hardware to confirm I didn't miss something
dumb...

So obviously ok guenther@


> Hmm, the arm version still has the equivalent movn r1.  I'll let
> guenther@ deal with that.

Ah, but it's necessary there...for correct error return from lseek().
64bit archs never need the second return register...and I've already
removed it from the equivalent of cerror on all the other 64bit archs.


Philip

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Optimize cerror on arm64

Mark Kettenis
> Date: Sat, 18 Mar 2017 14:58:36 -0700
> From: Philip Guenther <[hidden email]>
>
> > Hmm, the arm version still has the equivalent movn r1.  I'll let
> > guenther@ deal with that.
>
> Ah, but it's necessary there...for correct error return from lseek().
> 64bit archs never need the second return register...and I've already
> removed it from the equivalent of cerror on all the other 64bit archs.

Right.  Works fine here, so please commit that bit as well then.

Loading...