Re: PATCH: PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-12-22 Thread Uros Bizjak
On Thu, Dec 17, 2015 at 9:33 PM, H.J. Lu wrote: > On Thu, Dec 17, 2015 at 8:49 AM, H.J. Lu wrote: >> Since Pmode is 64-bit with -maddress-mode=long for x32, indirect call >> via GOT slot doesn't need zero_extend. This patch limits *call_got_x32 >> and

PATCH: PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-12-17 Thread H.J. Lu
Since Pmode is 64-bit with -maddress-mode=long for x32, indirect call via GOT slot doesn't need zero_extend. This patch limits *call_got_x32 and *call_value_got_x32 patterns to 32-bit Pmode, adds *call_got_x32_long and *call_value_got_x32_long for 64-bit Pmode. OK for trunk if there is no

Re: PATCH: PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-12-17 Thread H.J. Lu
On Thu, Dec 17, 2015 at 8:49 AM, H.J. Lu wrote: > Since Pmode is 64-bit with -maddress-mode=long for x32, indirect call > via GOT slot doesn't need zero_extend. This patch limits *call_got_x32 > and *call_value_got_x32 patterns to 32-bit Pmode, adds *call_got_x32_long > and

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-25 Thread Alexander Monakov
On Thu, 21 May 2015, H.J. Lu wrote: On Thu, May 21, 2015 at 12:32 PM, Alexander Monakov amona...@ispras.ru wrote: On Thu, 21 May 2015, H.J. Lu wrote: On Thu, May 21, 2015 at 12:06 PM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 12:01 PM, H.J. Lu wrote: +++

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Uros Bizjak
On Thu, May 21, 2015 at 8:36 PM, H.J. Lu hjl.to...@gmail.com wrote: I am testing this now. I will check it in if there is no regression. OK. Maybe just : ;; Return true if OP is a GOT memory operand. (define_predicate GOT_memory_operand (match_operand 0 memory_operand) { return

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 11:41 AM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 05:59 AM, H.J. Lu wrote: +(define_predicate x32_sibcall_memory_operand + (and (match_operand 0 memory_operand) + (match_test CONSTANT_P (XEXP (op, 0))) + (match_test GET_CODE (XEXP (XEXP (op,

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Richard Henderson
On 05/21/2015 05:59 AM, H.J. Lu wrote: +(define_predicate x32_sibcall_memory_operand + (and (match_operand 0 memory_operand) + (match_test CONSTANT_P (XEXP (op, 0))) + (match_test GET_CODE (XEXP (XEXP (op, 0), 0)) == UNSPEC) + (match_test XINT (XEXP (XEXP (op, 0), 0), 1) ==

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Uros Bizjak
On Thu, May 21, 2015 at 2:59 PM, H.J. Lu hjl.to...@gmail.com wrote: X32 doesn't support indirect branch via 32-bit memory slot since indirect branch will load 64-bit address from 64-bit memory slot. Since x32 GOT slot is 64-bit, we should allow indirect branch via GOT slot for x32. I am

[PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
X32 doesn't support indirect branch via 32-bit memory slot since indirect branch will load 64-bit address from 64-bit memory slot. Since x32 GOT slot is 64-bit, we should allow indirect branch via GOT slot for x32. I am testing it on x32. OK for master if there is no regression? Thanks. H.J.

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 6:11 AM, Uros Bizjak ubiz...@gmail.com wrote: On Thu, May 21, 2015 at 2:59 PM, H.J. Lu hjl.to...@gmail.com wrote: X32 doesn't support indirect branch via 32-bit memory slot since indirect branch will load 64-bit address from 64-bit memory slot. Since x32 GOT slot is

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 12:01 PM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 21, 2015 at 11:41 AM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 05:59 AM, H.J. Lu wrote: +(define_predicate x32_sibcall_memory_operand + (and (match_operand 0 memory_operand) + (match_test

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Alexander Monakov
On Thu, 21 May 2015, H.J. Lu wrote: On Thu, May 21, 2015 at 12:32 PM, Alexander Monakov amona...@ispras.ru wrote: On Thu, 21 May 2015, H.J. Lu wrote: On Thu, May 21, 2015 at 12:06 PM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 12:01 PM, H.J. Lu wrote: +++

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Richard Henderson
On 05/21/2015 12:01 PM, H.J. Lu wrote: +++ b/gcc/testsuite/gcc.target/i386/pr66232-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options -O2 -fpic -fno-plt } */ + +extern void bar (void); + +void +foo (void) +{ + bar (); +} + +/* { dg-final {

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 12:06 PM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 12:01 PM, H.J. Lu wrote: +++ b/gcc/testsuite/gcc.target/i386/pr66232-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options -O2 -fpic -fno-plt } */ + +extern void bar

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Uros Bizjak
On Thu, May 21, 2015 at 7:01 PM, H.J. Lu hjl.to...@gmail.com wrote: Here is the updated patch. It limited memory operand to GOT slot only. It used a single pattern to cover both call and sibcall since only GOT slot is allowed. OK for master if there is no regression? Thanks. -- H.J.

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 11:19 AM, Uros Bizjak ubiz...@gmail.com wrote: On Thu, May 21, 2015 at 7:01 PM, H.J. Lu hjl.to...@gmail.com wrote: Here is the updated patch. It limited memory operand to GOT slot only. It used a single pattern to cover both call and sibcall since only GOT slot is

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread Alexander Monakov
On Thu, 21 May 2015, H.J. Lu wrote: On Thu, May 21, 2015 at 12:06 PM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 12:01 PM, H.J. Lu wrote: +++ b/gcc/testsuite/gcc.target/i386/pr66232-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options -O2

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 12:32 PM, Alexander Monakov amona...@ispras.ru wrote: On Thu, 21 May 2015, H.J. Lu wrote: On Thu, May 21, 2015 at 12:06 PM, Richard Henderson r...@redhat.com wrote: On 05/21/2015 12:01 PM, H.J. Lu wrote: +++ b/gcc/testsuite/gcc.target/i386/pr66232-1.c @@ -0,0 +1,13

Re: [PATCH] PR target/66232: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT

2015-05-21 Thread H.J. Lu
On Thu, May 21, 2015 at 6:33 AM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 21, 2015 at 6:11 AM, Uros Bizjak ubiz...@gmail.com wrote: On Thu, May 21, 2015 at 2:59 PM, H.J. Lu hjl.to...@gmail.com wrote: X32 doesn't support indirect branch via 32-bit memory slot since indirect branch will