public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH roland/arm-setjmp-vfp] ARM: don't always conditionalize VFP in setjmp/longjmp and getcontext/setcontext
@ 2012-08-09 19:52 Roland McGrath
  2012-08-09 20:40 ` Joseph S. Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Roland McGrath @ 2012-08-09 19:52 UTC (permalink / raw)
  To: libc-ports

This is meant to be another step towards avoiding HWCAP_ARM_* use in
OS-independent code, but it doesn't actually move the use of those
Linuxisms out of the OS-independent code.  Instead, it just eliminates
some uses when they are superfluous.

While I was touching the assembly code, I changed it to use the
canonicalize .Lxxx convention for local labels rather than Lxxx.
This means those labels don't show up in disassembly and the like.

I've only given this the basic compile test and eyeballed the disassembly.


Thanks,
Roland


ports/ChangeLog.arm
	* sysdeps/arm/__longjmp.S: Use .Lxxx rather than Lxxx for local labels.
	[__SOFTFP__]: Conditionalize HWCAP_ARM_VFP check on this.
	* sysdeps/arm/setjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/arm/getcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/arm/setcontext.S: Likewise.


diff --git a/ports/sysdeps/arm/__longjmp.S b/ports/sysdeps/arm/__longjmp.S
index cc802c1..aa5cf74 100644
--- a/ports/sysdeps/arm/__longjmp.S
+++ b/ports/sysdeps/arm/__longjmp.S
@@ -1,6 +1,5 @@
 /* longjmp for ARM.
-   Copyright (C) 1997, 1998, 2005, 2006, 2009, 2010
-     Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -49,25 +48,27 @@ ENTRY (__longjmp)
 
 #ifdef IS_IN_rtld
   	ldr	a2, 1f
-	ldr	a3, Lrtld_local_ro
+	ldr	a3, .Lrtld_local_ro
 0:	add	a2, pc, a2
 	add	a2, a2, a3
 	ldr	a2, [a2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
 #else
 #ifdef PIC
   	ldr	a2, 1f
-	ldr	a3, Lrtld_global_ro
+	ldr	a3, .Lrtld_global_ro
 0:	add	a2, pc, a2
 	ldr	a2, [a2, a3]
 	ldr	a2, [a2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
 #else
-	ldr	a2, Lhwcap
+	ldr	a2, .Lhwcap
 	ldr	a2, [a2, #0]
 #endif
 #endif
 
+#ifdef __SOFTFP__
 	tst	a2, #HWCAP_ARM_VFP
-	beq	Lno_vfp
+	beq	.Lno_vfp
+#endif
 
 	/* Restore the VFP registers.  */
 	/* Following instruction is vldmia ip!, {d8-d15}.  */
@@ -76,10 +77,10 @@ ENTRY (__longjmp)
 	ldr     a3, [ip], #4
 	/* Following instruction is fmxr fpscr, a3.  */
 	mcr	p10, 7, a3, cr1, cr0, 0
-Lno_vfp:
+.Lno_vfp:
 
 	tst	a2, #HWCAP_ARM_IWMMXT
-	beq	Lno_iwmmxt
+	beq	.Lno_iwmmxt
 
 	/* Restore the call-preserved iWMMXt registers.  */
 	/* Following instructions are wldrd wr10, [ip], #8 (etc.)  */
@@ -89,21 +90,21 @@ Lno_vfp:
 	ldcl	p1, cr13, [r12], #8
 	ldcl	p1, cr14, [r12], #8
 	ldcl	p1, cr15, [r12], #8
-Lno_iwmmxt:
+.Lno_iwmmxt:
 
 	DO_RET(lr)
 
 #ifdef IS_IN_rtld
 1:	.long	_GLOBAL_OFFSET_TABLE_ - 0b - 8
-Lrtld_local_ro:
+.Lrtld_local_ro:
 	.long	C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF)
 #else
 #ifdef PIC
 1:	.long	_GLOBAL_OFFSET_TABLE_ - 0b - 8
-Lrtld_global_ro:
+.Lrtld_global_ro:
 	.long	C_SYMBOL_NAME(_rtld_global_ro)(GOT)
 #else
-Lhwcap:
+.Lhwcap:
 	.long	C_SYMBOL_NAME(_dl_hwcap)
 #endif
 #endif
diff --git a/ports/sysdeps/arm/setjmp.S b/ports/sysdeps/arm/setjmp.S
index 5e3f39c..9bfacc1 100644
--- a/ports/sysdeps/arm/setjmp.S
+++ b/ports/sysdeps/arm/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for ARM.
-   Copyright (C) 1997, 1998, 2005, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,25 +31,27 @@ ENTRY (__sigsetjmp)
 	/* Check if we have a VFP unit.  */
 #ifdef IS_IN_rtld
 	ldr	a3, 1f
-	ldr	a4, Lrtld_local_ro
+	ldr	a4, .Lrtld_local_ro
 0:	add	a3, pc, a3
 	add	a3, a3, a4
 	ldr	a3, [a3, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
 #else
 #ifdef PIC
 	ldr	a3, 1f
-	ldr	a4, Lrtld_global_ro
+	ldr	a4, .Lrtld_global_ro
 0:	add	a3, pc, a3
 	ldr	a3, [a3, a4]
 	ldr	a3, [a3, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
 #else
-	ldr	a3, Lhwcap
+	ldr	a3, .Lhwcap
 	ldr	a3, [a3, #0]
 #endif
 #endif
 
+#ifdef __SOFTFP__
 	tst	a3, #HWCAP_ARM_VFP
-	beq	Lno_vfp
+	beq	.Lno_vfp
+#endif
 
 	/* Store the VFP registers.
 	   Don't use VFP instructions directly because this code
@@ -60,10 +62,10 @@ ENTRY (__sigsetjmp)
 	/* Following instruction is vmrs a4, fpscr.  */
 	mrc	p10, 7, a4, cr1, cr0, 0
 	str	a4, [ip], #4
-Lno_vfp:
+.Lno_vfp:
 
 	tst	a3, #HWCAP_ARM_IWMMXT
-	beq	Lno_iwmmxt
+	beq	.Lno_iwmmxt
 
 	/* Save the call-preserved iWMMXt registers.  */
 	/* Following instructions are wstrd wr10, [ip], #8 (etc.)  */
@@ -73,22 +75,22 @@ Lno_vfp:
 	stcl	p1, cr13, [r12], #8
 	stcl	p1, cr14, [r12], #8
 	stcl	p1, cr15, [r12], #8
-Lno_iwmmxt:
+.Lno_iwmmxt:
 
 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
 	B	PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
 
 #ifdef IS_IN_rtld
 1:	.long	_GLOBAL_OFFSET_TABLE_ - 0b - 8
-Lrtld_local_ro:
+.Lrtld_local_ro:
 	.long	C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF)
 #else
 #ifdef PIC
 1:	.long	_GLOBAL_OFFSET_TABLE_ - 0b - 8
-Lrtld_global_ro:
+.Lrtld_global_ro:
 	.long	C_SYMBOL_NAME(_rtld_global_ro)(GOT)
 #else
-Lhwcap:
+.Lhwcap:
 	.long	C_SYMBOL_NAME(_dl_hwcap)
 #endif
 #endif
diff --git a/ports/sysdeps/unix/sysv/linux/arm/getcontext.S b/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
index 116d6e8..2281c9e 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
@@ -52,19 +52,21 @@ ENTRY(__getcontext)
 
 #ifdef PIC
         ldr     r2, 1f
-        ldr     r1, Lrtld_global_ro
+	ldr     r1, .Lrtld_global_ro
 0:      add     r2, pc, r2
         ldr     r2, [r2, r1]
         ldr     r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
 #else
-        ldr     r2, Lhwcap
+	ldr     r2, .Lhwcap
         ldr     r2, [r2, #0]
 #endif
 
 	add	r0, r4, #UCONTEXT_REGSPACE
 
+#ifdef __SOFTFP__
         tst     r2, #HWCAP_ARM_VFP
-        beq     Lno_vfp
+	beq     .Lno_vfp
+#endif
 
         /* Store the VFP registers.
            Don't use VFP instructions directly because this code
@@ -75,10 +77,10 @@ ENTRY(__getcontext)
         /* Following instruction is vmrs r1, fpscr.  */
         mrc     p10, 7, r1, cr1, cr0, 0
         str     r1, [r0], #4
-Lno_vfp:
+.Lno_vfp:
 
         tst     r2, #HWCAP_ARM_IWMMXT
-        beq     Lno_iwmmxt
+	beq     .Lno_iwmmxt
 
         /* Save the call-preserved iWMMXt registers.  */
         /* Following instructions are wstrd wr10, [r0], #8 (etc.)  */
@@ -88,7 +90,7 @@ Lno_vfp:
         stcl    p1, cr13, [r0], #8
         stcl    p1, cr14, [r0], #8
         stcl    p1, cr15, [r0], #8
-Lno_iwmmxt:
+.Lno_iwmmxt:
 
 	/* Restore the clobbered R4 and LR.  */
 	ldr	r14, [r4, #MCONTEXT_ARM_LR]
@@ -102,10 +104,10 @@ END(__getcontext)
 
 #ifdef PIC
 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - 8
-Lrtld_global_ro:
+.Lrtld_global_ro:
         .long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
 #else
-Lhwcap:
+.Lhwcap:
         .long   C_SYMBOL_NAME(_dl_hwcap)
 #endif
 
diff --git a/ports/sysdeps/unix/sysv/linux/arm/setcontext.S b/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
index d163fc4..6436770 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
@@ -32,17 +32,19 @@ ENTRY(__setcontext)
         /* Restore the VFP registers.  Copied from arm/__longjmp.S.  */
 #ifdef PIC
         ldr     r2, 1f
-        ldr     r1, Lrtld_global_ro
+	ldr     r1, .Lrtld_global_ro
 0:      add     r2, pc, r2
         ldr     r2, [r2, r1]
         ldr     r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
 #else
-        ldr     r2, Lhwcap
+	ldr     r2, .Lhwcap
         ldr     r2, [r2, #0]
 #endif
 
+#ifdef __SOFTFP__
         tst     r2, #HWCAP_ARM_VFP
-        beq     Lno_vfp_sc
+	beq     .Lno_vfp_sc
+#endif
 
         /* Following instruction is vldmia r0!, {d8-d15}.  */
         ldc     p11, cr8, [r0], #64
@@ -50,9 +52,9 @@ ENTRY(__setcontext)
         ldr     r1, [r0], #4
         /* Following instruction is fmxr fpscr, r1.  */
         mcr     p10, 7, r1, cr1, cr0, 0
-Lno_vfp_sc:
+.Lno_vfp_sc:
         tst     r2, #HWCAP_ARM_IWMMXT
-        beq     Lno_iwmmxt_sc
+	beq     .Lno_iwmmxt_sc
 
         /* Restore the call-preserved iWMMXt registers.  */
         /* Following instructions are wldrd wr10, [r0], #8 (etc.)  */
@@ -62,7 +64,7 @@ Lno_vfp_sc:
         ldcl    p1, cr13, [r0], #8
         ldcl    p1, cr14, [r0], #8
         ldcl    p1, cr15, [r0], #8
-Lno_iwmmxt_sc:
+.Lno_iwmmxt_sc:
 
 	/* Now bring back the signal status.  */
 	mov	r0, #SIG_SETMASK
@@ -92,10 +94,9 @@ END(__startcontext)
 
 #ifdef PIC
 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - 8
-Lrtld_global_ro:
+.Lrtld_global_ro:
         .long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
 #else
-Lhwcap:
+.Lhwcap:
         .long   C_SYMBOL_NAME(_dl_hwcap)
 #endif
-

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH roland/arm-setjmp-vfp] ARM: don't always conditionalize VFP in setjmp/longjmp and getcontext/setcontext
  2012-08-09 19:52 [PATCH roland/arm-setjmp-vfp] ARM: don't always conditionalize VFP in setjmp/longjmp and getcontext/setcontext Roland McGrath
@ 2012-08-09 20:40 ` Joseph S. Myers
  2012-08-09 20:47   ` Roland McGrath
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2012-08-09 20:40 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-ports

On Thu, 9 Aug 2012, Roland McGrath wrote:

> 	* sysdeps/arm/__longjmp.S: Use .Lxxx rather than Lxxx for local labels.
> 	[__SOFTFP__]: Conditionalize HWCAP_ARM_VFP check on this.
> 	* sysdeps/arm/setjmp.S: Likewise.
> 	* sysdeps/unix/sysv/linux/arm/getcontext.S: Likewise.
> 	* sysdeps/unix/sysv/linux/arm/setcontext.S: Likewise.

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH roland/arm-setjmp-vfp] ARM: don't always conditionalize VFP in setjmp/longjmp and getcontext/setcontext
  2012-08-09 20:40 ` Joseph S. Myers
@ 2012-08-09 20:47   ` Roland McGrath
  0 siblings, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2012-08-09 20:47 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-ports

Committed.

Thanks,
Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-09 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-09 19:52 [PATCH roland/arm-setjmp-vfp] ARM: don't always conditionalize VFP in setjmp/longjmp and getcontext/setcontext Roland McGrath
2012-08-09 20:40 ` Joseph S. Myers
2012-08-09 20:47   ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).