powerpc: fix ifunc-sel.h fix asm constraints and clobber list

Message ID 1469113299-11997-1-git-send-email-aurelien@aurel32.net
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers

Commit Message

Aurelien Jarno July 21, 2016, 3:01 p.m. UTC
  As pointer out on the mailing list, the inline assembly code in
sysdeps/powerpc/ifunc-sel.h doesn't have a list of clobbered registers
and used wrong constraints.

This patch fixes that. I verified it doesn't introduce any change in the
generated code.

Changelog:
	* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the
	clobber list. Use "i" constraint instead of "X".
	(ifunc_one): Add "12" to the clobber list. Use "i" constraint instead
	of "X".
---
 ChangeLog                   | 4 ++++
 sysdeps/powerpc/ifunc-sel.h | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
  

Comments

Tulio Magno Quites Machado Filho July 22, 2016, 2:38 p.m. UTC | #1
Aurelien Jarno <aurelien@aurel32.net> writes:

> As pointer out on the mailing list, the inline assembly code in
> sysdeps/powerpc/ifunc-sel.h doesn't have a list of clobbered registers
> and used wrong constraints.
>
> This patch fixes that. I verified it doesn't introduce any change in the
> generated code.
>
> Changelog:
> 	* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the
> 	clobber list. Use "i" constraint instead of "X".
> 	(ifunc_one): Add "12" to the clobber list. Use "i" constraint instead
> 	of "X".

LGTM.
  

Patch

diff --git a/ChangeLog b/ChangeLog
index b18a8cd..035e4a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@ 
 
 	* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Replace beqlr instructions
 	by beq instructions jumping to the end of the function.
+	* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the
+	clobber list. Use "i" constraint instead of "X".
+	(ifunc_one): Add "12" to the clobber list. Use "i" constraint instead
+	of "X".
 
 2016-07-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
diff --git a/sysdeps/powerpc/ifunc-sel.h b/sysdeps/powerpc/ifunc-sel.h
index 79d110f..ac589bd 100644
--- a/sysdeps/powerpc/ifunc-sel.h
+++ b/sysdeps/powerpc/ifunc-sel.h
@@ -26,7 +26,8 @@  ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
 	   "addi %0,%0,%4-1b@l\n\t"
 	   "2:"
 	   : "=r" (ret)
-	   : "X" (&global), "X" (f1), "X" (f2), "X" (f3));
+	   : "i" (&global), "i" (f1), "i" (f2), "i" (f3)
+	   : "11", "12", "cr0");
   return ret;
 }
 
@@ -41,7 +42,8 @@  ifunc_one (int (*f1) (void))
 	   "addis %0,%0,%1-1b@ha\n\t"
 	   "addi %0,%0,%1-1b@l"
 	   : "=r" (ret)
-	   : "X" (f1));
+	   : "i" (f1)
+	   : "12");
   return ret;
 }
 #endif