This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, rs6000] Use $ instead of . for PC


I see that David already proposed this same patch in PR83946.  Sorry, I've gotten behind on my email.

Two changes I need:  The scan-assembly should have \$ rather than $ in it, and I should add
PR83946 to the ChangeLog.

Sorry for the noise.

-- Bill

Bill Schmidt, Ph.D.
STSM, GCC Architect for Linux on POWER
Linux on Power Toolchain
IBM Linux Technology Center
wschmidt@linux.vnet.ibm.com

> On Jan 19, 2018, at 2:58 PM, Bill Schmidt <wschmidt@linux.vnet.ibm.com> wrote:
> 
> Hi,
> 
> My recent patches to trunk and gcc-7-branch for avoiding speculation of
> indirect branches has a flaw, pointed out by David.  Usage of "." to
> represent the program counter is not portable across all POWER
> assemblers, particularly not being accepted on AIX.  "$" is the 
> universally accepted alternative.  So change the code and the test
> cases to use $ instead of . for this purpose.
> 
> Regstrap is in progress on powerpc64-linux-gnu and powerpc64le-linux-gnu.
> Assuming no issues are found, is this okay for trunk and backport to 7?
> 
> Thanks,
> Bill
> 
> 
> [gcc]
> 
> 2018-01-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> 
> 	* config/rs6000/rs6000.md (*sibcall_nonlocal_sysv<mode>): Change
> 	assembly output from . to $.
> 	(*sibcall_value_nonlocal_sysv<mode>): Likewise.
> 	(indirect_jump<mode>_nospec): Likewise.
> 	(*tablejump<mode>_internal1_nospec): Likewise.
> 
> [gcc/testsuite]
> 
> 2018-01-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> 
> 	* gcc.target/powerpc/safe-indirect-jump-2.c: Change expected
> 	assembly output from . to $.
> 	* gcc.target/powerpc/safe-indirect-jump-3.c: Likewise.
> 	* gcc.target/powerpc/safe-indirect-jump-8.c: Likewise.
> 
> 
> Index: gcc/config/rs6000/rs6000.md
> ===================================================================
> --- gcc/config/rs6000/rs6000.md	(revision 256894)
> +++ gcc/config/rs6000/rs6000.md	(working copy)
> @@ -10987,7 +10987,7 @@
> 	return \"b%T0\";
>       else
> 	/* Can use CR0 since it is volatile across sibcalls.  */
> -	return \"crset eq\;beq%T0-\;b .\";
> +	return \"crset eq\;beq%T0-\;b $\";
>     }
>   else if (DEFAULT_ABI == ABI_V4 && flag_pic)
>     {
> @@ -11044,7 +11044,7 @@
> 	return \"b%T1\";
>       else
> 	/* Can use CR0 since it is volatile across sibcalls.  */
> -	return \"crset eq\;beq%T1-\;b .\";
> +	return \"crset eq\;beq%T1-\;b $\";
>     }
>   else if (DEFAULT_ABI == ABI_V4 && flag_pic)
>     {
> @@ -12566,7 +12566,7 @@
>   [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))
>    (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y"))]
>   "!rs6000_speculate_indirect_jumps"
> -  "crset %E1\;beq%T0- %1\;b ."
> +  "crset %E1\;beq%T0- %1\;b $"
>   [(set_attr "type" "jmpreg")
>    (set_attr "length" "12")])
> 
> @@ -12672,7 +12672,7 @@
>    (use (label_ref (match_operand 1)))
>    (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y"))]
>   "!rs6000_speculate_indirect_jumps"
> -  "crset %E2\;beq%T0- %2\;b ."
> +  "crset %E2\;beq%T0- %2\;b $"
>   [(set_attr "type" "jmpreg")
>    (set_attr "length" "12")])
> 
> Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c	(revision 256894)
> +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c	(working copy)
> @@ -30,4 +30,4 @@ int foo (int x)
> 
> /* { dg-final { scan-assembler "crset 30" } } */
> /* { dg-final { scan-assembler "beqctr- 7" } } */
> -/* { dg-final { scan-assembler "b ." } } */
> +/* { dg-final { scan-assembler "b $" } } */
> Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c	(revision 256894)
> +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c	(working copy)
> @@ -49,4 +49,4 @@ int foo (int x)
> 
> /* { dg-final { scan-assembler "crset 30" } } */
> /* { dg-final { scan-assembler "beqctr- 7" } } */
> -/* { dg-final { scan-assembler "b ." } } */
> +/* { dg-final { scan-assembler "b $" } } */
> Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c	(revision 256894)
> +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c	(working copy)
> @@ -12,4 +12,4 @@ int bar ()
> 
> /* { dg-final { scan-assembler "crset eq" } } */
> /* { dg-final { scan-assembler "beqctr-" } } */
> -/* { dg-final { scan-assembler "b ." } } */
> +/* { dg-final { scan-assembler "b $" } } */
> Index: gcc/config/rs6000/rs6000.md
> ===================================================================
> --- gcc/config/rs6000/rs6000.md	(revision 256894)
> +++ gcc/config/rs6000/rs6000.md	(working copy)
> @@ -10987,7 +10987,7 @@
> 	return \"b%T0\";
>       else
> 	/* Can use CR0 since it is volatile across sibcalls.  */
> -	return \"crset eq\;beq%T0-\;b .\";
> +	return \"crset eq\;beq%T0-\;b $\";
>     }
>   else if (DEFAULT_ABI == ABI_V4 && flag_pic)
>     {
> @@ -11044,7 +11044,7 @@
> 	return \"b%T1\";
>       else
> 	/* Can use CR0 since it is volatile across sibcalls.  */
> -	return \"crset eq\;beq%T1-\;b .\";
> +	return \"crset eq\;beq%T1-\;b $\";
>     }
>   else if (DEFAULT_ABI == ABI_V4 && flag_pic)
>     {
> @@ -12566,7 +12566,7 @@
>   [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))
>    (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y"))]
>   "!rs6000_speculate_indirect_jumps"
> -  "crset %E1\;beq%T0- %1\;b ."
> +  "crset %E1\;beq%T0- %1\;b $"
>   [(set_attr "type" "jmpreg")
>    (set_attr "length" "12")])
> 
> @@ -12672,7 +12672,7 @@
>    (use (label_ref (match_operand 1)))
>    (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y"))]
>   "!rs6000_speculate_indirect_jumps"
> -  "crset %E2\;beq%T0- %2\;b ."
> +  "crset %E2\;beq%T0- %2\;b $"
>   [(set_attr "type" "jmpreg")
>    (set_attr "length" "12")])
> 
> Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c	(revision 256894)
> +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c	(working copy)
> @@ -30,4 +30,4 @@ int foo (int x)
> 
> /* { dg-final { scan-assembler "crset 30" } } */
> /* { dg-final { scan-assembler "beqctr- 7" } } */
> -/* { dg-final { scan-assembler "b ." } } */
> +/* { dg-final { scan-assembler "b $" } } */
> Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c	(revision 256894)
> +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c	(working copy)
> @@ -49,4 +49,4 @@ int foo (int x)
> 
> /* { dg-final { scan-assembler "crset 30" } } */
> /* { dg-final { scan-assembler "beqctr- 7" } } */
> -/* { dg-final { scan-assembler "b ." } } */
> +/* { dg-final { scan-assembler "b $" } } */
> Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c
> ===================================================================
> --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c	(revision 256894)
> +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c	(working copy)
> @@ -12,4 +12,4 @@ int bar ()
> 
> /* { dg-final { scan-assembler "crset eq" } } */
> /* { dg-final { scan-assembler "beqctr-" } } */
> -/* { dg-final { scan-assembler "b ." } } */
> +/* { dg-final { scan-assembler "b $" } } */
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]