public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43766]  New: x86 prefetch doesn't use complex memory addressing
@ 2010-04-16  7:52 astrange at ithinksw dot com
  2010-04-16 11:37 ` [Bug target/43766] " ubizjak at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: astrange at ithinksw dot com @ 2010-04-16  7:52 UTC (permalink / raw)
  To: gcc-bugs

Source:
void p(int *a, int i)
{
    __builtin_prefetch(&a[i]);
}

> gcc -O3 -fomit-frame-pointer -S prefetch.c
_p:
        movslq  %esi, %rsi
        leaq    (%rdi,%rsi,4), %rax
        prefetcht0      (%rax)
        ret

leaq and prefetch should be merged.


-- 
           Summary: x86 prefetch doesn't use complex memory addressing
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: astrange at ithinksw dot com


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


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

* [Bug target/43766] x86 prefetch doesn't use complex memory addressing
  2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
@ 2010-04-16 11:37 ` ubizjak at gmail dot com
  2010-04-16 18:07 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2010-04-16 11:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2010-04-16 11:37 -------
Currently we fail to recognize address_operand in the form of:

(prefetch (plus:DI (ashift:DI (reg:DI 60 [ i ])
            (const_int 2 [0x2]))
        (reg/v/f:DI 58 [ a ]))
    (const_int 0 [0x0])
    (const_int 3 [0x3]))

This form should be added to the parser in ix86_decompose_address.

I'll look into it.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-04-16 11:37:34
               date|                            |


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


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

* [Bug target/43766] x86 prefetch doesn't use complex memory addressing
  2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
  2010-04-16 11:37 ` [Bug target/43766] " ubizjak at gmail dot com
@ 2010-04-16 18:07 ` ubizjak at gmail dot com
  2010-04-16 21:19 ` astrange at ithinksw dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2010-04-16 18:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ubizjak at gmail dot com  2010-04-16 18:06 -------
Created an attachment (id=20402)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20402&action=view)
Proposed patch.

Proposed patch generates:

p:
        movslq  %esi, %rsi
        prefetcht0      (%rdi,%rsi,4)
        ret


-- 


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


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

* [Bug target/43766] x86 prefetch doesn't use complex memory addressing
  2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
  2010-04-16 11:37 ` [Bug target/43766] " ubizjak at gmail dot com
  2010-04-16 18:07 ` ubizjak at gmail dot com
@ 2010-04-16 21:19 ` astrange at ithinksw dot com
  2010-04-17 15:11 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: astrange at ithinksw dot com @ 2010-04-16 21:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from astrange at ithinksw dot com  2010-04-16 21:19 -------
Works with x86-64.

Checking -m32, the same thing happens with or without the patch:
_p:
        subl    $12, %esp
        movl    20(%esp), %eax
        sall    $2, %eax
        addl    16(%esp), %eax
        addl    $12, %esp
        prefetcht0      (%eax)
        ret


-- 


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


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

* [Bug target/43766] x86 prefetch doesn't use complex memory addressing
  2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
                   ` (2 preceding siblings ...)
  2010-04-16 21:19 ` astrange at ithinksw dot com
@ 2010-04-17 15:11 ` ubizjak at gmail dot com
  2010-04-19 12:37 ` uros at gcc dot gnu dot org
  2010-04-19 12:38 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2010-04-17 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2010-04-17 15:11 -------
(In reply to comment #3)
> Works with x86-64.
> 
> Checking -m32, the same thing happens with or without the patch:

This happens because combine pulls memory references into the combined address
operand. Since ix86_decompose_address expects registers everywhere, it fails.

The same happens with:

int * p(int *a, int i)
{
    return &a[i];
}

So, this particular case is unfixable on -m32. Try with -mregparm=3.


-- 


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


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

* [Bug target/43766] x86 prefetch doesn't use complex memory addressing
  2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
                   ` (3 preceding siblings ...)
  2010-04-17 15:11 ` ubizjak at gmail dot com
@ 2010-04-19 12:37 ` uros at gcc dot gnu dot org
  2010-04-19 12:38 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: uros at gcc dot gnu dot org @ 2010-04-19 12:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from uros at gcc dot gnu dot org  2010-04-19 12:37 -------
Subject: Bug 43766

Author: uros
Date: Mon Apr 19 12:37:16 2010
New Revision: 158515

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158515
Log:
        PR target/43766
        * config/i386/i386.c (ix86_decompose_address): Handle ASHIFT addends.

testsuite/ChangeLog:

        PR target/43766
        * gcc.target/i386/pr43766.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr43766.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/43766] x86 prefetch doesn't use complex memory addressing
  2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
                   ` (4 preceding siblings ...)
  2010-04-19 12:37 ` uros at gcc dot gnu dot org
@ 2010-04-19 12:38 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2010-04-19 12:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ubizjak at gmail dot com  2010-04-19 12:38 -------
Fixed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0


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


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

end of thread, other threads:[~2010-04-19 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-16  7:52 [Bug target/43766] New: x86 prefetch doesn't use complex memory addressing astrange at ithinksw dot com
2010-04-16 11:37 ` [Bug target/43766] " ubizjak at gmail dot com
2010-04-16 18:07 ` ubizjak at gmail dot com
2010-04-16 21:19 ` astrange at ithinksw dot com
2010-04-17 15:11 ` ubizjak at gmail dot com
2010-04-19 12:37 ` uros at gcc dot gnu dot org
2010-04-19 12:38 ` ubizjak at gmail dot com

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