public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49832] New: too many memory references for `lea'
@ 2011-07-25  1:42 hjl.tools at gmail dot com
  2011-07-25  6:55 ` [Bug target/49832] " ubizjak at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2011-07-25  1:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49832

           Summary: too many memory references for `lea'
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com
                CC: ubizjak@gmail.com
            Target: x32


[hjl@gnu-6 ilp32-8]$ cat x.i
struct iovec
{
 void *iov_base;
 unsigned int iov_len;
};
void foo (struct iovec *);

void
bar (char *p, unsigned int lp)
{
   struct iovec iov[3];
   iov[0].iov_base = "execvp: ";
   iov[0].iov_len = 8;
   iov[1].iov_base = ": path too long\n";
   iov[1].iov_len = 16;
   iov[2].iov_base = p;
   iov[2].iov_len = lp;
   foo (iov);
}
[hjl@gnu-6 ilp32-8]$ make x.o
/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o x.s -mx32 -O2 -fPIC
-dp  x.i
/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -mx32 -O2 -fPIC -dp  -c -o
x.o x.s
x.s: Assembler messages:
x.s:18: Error: too many memory references for `lea'
x.s:20: Error: too many memory references for `lea'
make: *** [x.o] Error 1
[hjl@gnu-6 ilp32-8]$


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

* [Bug target/49832] too many memory references for `lea'
  2011-07-25  1:42 [Bug target/49832] New: too many memory references for `lea' hjl.tools at gmail dot com
@ 2011-07-25  6:55 ` ubizjak at gmail dot com
  2011-07-26 12:02 ` [Bug target/49832] [x32] " uros at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2011-07-25  6:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49832

--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> 2011-07-25 06:55:23 UTC ---
Please mark x32 bugs with [x32].

(In reply to comment #0)

> [hjl@gnu-6 ilp32-8]$ make x.o
> /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
> -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o x.s -mx32 -O2 -fPIC
> -dp  x.i
> /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
> -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -mx32 -O2 -fPIC -dp  -c -o
> x.o x.s
> x.s: Assembler messages:
> x.s:18: Error: too many memory references for `lea'
> x.s:20: Error: too many memory references for `lea'

Works for me with current mainline + patch [1].

~/gcc-build/gcc/cc1 -O2 -fPIC -mx32 pr49832.c

bar:
.LFB0:
    .cfi_startproc
    subq    $40, %rsp
    .cfi_def_cfa_offset 48
    movl    %edi, 16(%rsp)
    movq    %rsp, %rdi
    movl    $.LC0, (%rsp)
    movl    $8, 4(%rsp)
    movl    $.LC1, 8(%rsp)
    movl    $16, 12(%rsp)
    movl    %esi, 20(%rsp)
    call    foo@PLT
    addq    $40, %rsp
    .cfi_def_cfa_offset 8
    ret
    .cfi_endproc
.LFE0:

Please rewrite PIC handling on top of patch [1].

[1] http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02089.html


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

* [Bug target/49832] [x32] too many memory references for `lea'
  2011-07-25  1:42 [Bug target/49832] New: too many memory references for `lea' hjl.tools at gmail dot com
  2011-07-25  6:55 ` [Bug target/49832] " ubizjak at gmail dot com
@ 2011-07-26 12:02 ` uros at gcc dot gnu.org
  2011-07-26 12:10 ` ubizjak at gmail dot com
  2011-07-29 16:01 ` hjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: uros at gcc dot gnu.org @ 2011-07-26 12:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49832

--- Comment #2 from uros at gcc dot gnu.org 2011-07-26 12:00:37 UTC ---
Author: uros
Date: Tue Jul 26 12:00:33 2011
New Revision: 176788

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176788
Log:
    PR target/47381
    PR target/49832
    PR target/49833
    * config/i386/i386.md (i): Change SImode attribute to "e".
    (g): Change SImode attribute to "rme".
    (di): Change SImode attribute to "nF".
    (general_operand): Change SImode attribute to x86_64_general_operand.
    (general_szext_operand): Change SImode attribute to
    x86_64_szext_general_operand.
    (immediate_operand): Change SImode attribute to
    x86_64_immediate_operand.
    (nonmemory_operand): Change SImode attribute to
    x86_64_nonmemory_operand.
    (*movdi_internal_rex64): Remove mode from pic_32bit_operand check.
    (*movsi_internal): Ditto.  Use "e" constraint in alternative 2.
    (*lea_1): Use SWI48 mode iterator.
    (*lea_1_zext): New insn pattern.
    (testsi_ccno_1): Use x86_64_nonmemory_operand predicate for operand 2.
    (*bt<mode>): Ditto.
    (*add<mode>1): Use x86_64_general_operand predicate for operand 2.
    Update operand constraints.
    (addsi_1_zext): Ditto.
    (*add<mode>2): Ditto.
    (*addsi_3_zext): Ditto.
    (*subsi_1_zext): Ditto.
    (*subsi_2_zext): Ditto.
    (*subsi_3_zext): Ditto.
    (*addsi3_carry_zext): Ditto.
    (*<plusminus_insn>si3_zext_cc_overflow): Ditto.
    (*mulsi3_1_zext): Ditto.
    (*andsi_1): Ditto.
    (*andsi_1_zext): Ditto.
    (*andsi_2_zext): Ditto.
    (*<any_or:code>si_1_zext): Ditto.
    (*<any_or:code>si_2_zext): Ditto.
    (*test<mode>_1): Use <general_operand> predicate for operand 1.
    (*and<mode>_2): Ditto.
    (mov<mode>cc): Use  <general_operand> predicate for operands 1 and 2.
    (add->lea splitter): Check operand modes in insn constraint.  Extend
    operands less than SImode wide to SImode.
    (add->lea zext splitter): Do not extend input operands to DImode.
    (*lea_general_1): Handle only QImode and HImode operands.
    (*lea_general_2): Ditto.
    (*lea_general_3): Ditto.
    (*lea_general_1_zext): Remove.
    (*lea_general_2_zext): Ditto.
    (*lea_general_3_zext): Ditto.
    (*lea_general_4): Check operand modes in insn constraint.  Extend
    operands less than SImode wide to SImode.
    (ashift->lea splitter): Ditto.
    * config/i386/i386.c (ix86_print_operand_address): Print address
    registers with 'q' modifier on 64bit targets.
    * config/i386/predicates.md (pic_32bit_opreand): Define as special
    predicate.  Reject non-SI and non-DI modes.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
    trunk/gcc/config/i386/predicates.md


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

* [Bug target/49832] [x32] too many memory references for `lea'
  2011-07-25  1:42 [Bug target/49832] New: too many memory references for `lea' hjl.tools at gmail dot com
  2011-07-25  6:55 ` [Bug target/49832] " ubizjak at gmail dot com
  2011-07-26 12:02 ` [Bug target/49832] [x32] " uros at gcc dot gnu.org
@ 2011-07-26 12:10 ` ubizjak at gmail dot com
  2011-07-29 16:01 ` hjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2011-07-26 12:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49832

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2011-07-26 12:10:01 UTC ---
Fixed by changing *movsi_internal operand 1 alt 1 constraint from "i" to "e".


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

* [Bug target/49832] [x32] too many memory references for `lea'
  2011-07-25  1:42 [Bug target/49832] New: too many memory references for `lea' hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2011-07-26 12:10 ` ubizjak at gmail dot com
@ 2011-07-29 16:01 ` hjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hjl at gcc dot gnu.org @ 2011-07-29 16:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49832

--- Comment #4 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2011-07-29 16:00:48 UTC ---
Author: hjl
Date: Fri Jul 29 16:00:41 2011
New Revision: 176932

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176932
Log:
Rewrite x86 lea support for x32.

2011-07-26  Uros Bizjak  <ubizjak@gmail.com>
       H.J. Lu  <hongjiu.lu@intel.com>

    PR target/47381
    PR target/49832
    PR target/49833
    * config/i386/i386.md (i): Change SImode attribute to "e".
    (g): Change SImode attribute to "rme".
    (di): Change SImode attribute to "nF".
    (general_operand): Change SImode attribute to x86_64_general_operand.
    (general_szext_operand): Change SImode attribute to
    x86_64_szext_general_operand.
    (immediate_operand): Change SImode attribute to
    x86_64_immediate_operand.
    (nonmemory_operand): Change SImode attribute to
    x86_64_nonmemory_operand.
    (*movdi_internal_rex64): Remove mode from pic_32bit_operand check.
    (*movsi_internal): Ditto.  Use "e" constraint in alternative 2.
    (*lea_1): Use SWI48 mode iterator.
    (*lea_1_zext): New insn pattern.
    (testsi_ccno_1): Use x86_64_nonmemory_operand predicate for operand 2.
    (*bt<mode>): Ditto.
    (*add<mode>1): Use x86_64_general_operand predicate for operand 2.
    Update operand constraints.
    (addsi_1_zext): Ditto.
    (*add<mode>2): Ditto.
    (*addsi_3_zext): Ditto.
    (*subsi_1_zext): Ditto.
    (*subsi_2_zext): Ditto.
    (*subsi_3_zext): Ditto.
    (*addsi3_carry_zext): Ditto.
    (*<plusminus_insn>si3_zext_cc_overflow): Ditto.
    (*mulsi3_1_zext): Ditto.
    (*andsi_1): Ditto.
    (*andsi_1_zext): Ditto.
    (*andsi_2_zext): Ditto.
    (*<any_or:code>si_1_zext): Ditto.
    (*<any_or:code>si_2_zext): Ditto.
    (*test<mode>_1): Use <general_operand> predicate for operand 1.
    (*and<mode>_2): Ditto.
    (mov<mode>cc): Use  <general_operand> predicate for operands 1 and 2.
    (add->lea splitter): Check operand modes in insn constraint.  Extend
    operands less than SImode wide to SImode.
    (add->lea zext splitter): Do not extend input operands to DImode.
    (*lea_general_1): Handle only QImode and HImode operands.
    (*lea_general_2): Ditto.
    (*lea_general_3): Ditto.
    (*lea_general_1_zext): Remove.
    (*lea_general_2_zext): Ditto.
    (*lea_general_3_zext): Ditto.
    (*lea_general_4): Check operand modes in insn constraint.  Extend
    operands less than SImode wide to SImode.
    (ashift->lea splitter): Ditto.
    * config/i386/i386.c (ix86_print_operand_address): Print address
    registers with 'q' modifier on 64bit targets.
    * config/i386/predicates.md (pic_32bit_opreand): Define as special
    predicate.  Reject non-SI and non-DI modes.

Modified:
    branches/x32/gcc/ChangeLog.x32
    branches/x32/gcc/config/i386/i386.c
    branches/x32/gcc/config/i386/i386.md
    branches/x32/gcc/config/i386/predicates.md


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

end of thread, other threads:[~2011-07-29 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25  1:42 [Bug target/49832] New: too many memory references for `lea' hjl.tools at gmail dot com
2011-07-25  6:55 ` [Bug target/49832] " ubizjak at gmail dot com
2011-07-26 12:02 ` [Bug target/49832] [x32] " uros at gcc dot gnu.org
2011-07-26 12:10 ` ubizjak at gmail dot com
2011-07-29 16:01 ` hjl at gcc dot gnu.org

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).