public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/26134]  New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
@ 2006-02-06 16:58 pinskia at gcc dot gnu dot org
  2006-02-06 16:58 ` [Bug middle-end/26134] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-06 16:58 UTC (permalink / raw)
  To: gcc-bugs

I was looking at some code which is mentioned to be in SPEC 2006 (I forgot
where I found the mentioning)
but anyways it has the following in it:

typedef _Complex float COMPLEX_FLOAT;
float real_part(COMPLEX_FLOAT a)
{
  return *(float*)(&a);
}

This should be converted to:

float real_part(COMPLEX_FLOAT a)
{
  return __real__ a;
}

So that the tree optimizers can work on it easier.


-- 
           Summary: fold *(float*)(&complex_float_var) into
                    REALPART_EXPR<complex_float_var>
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
@ 2006-02-06 16:58 ` pinskia at gcc dot gnu dot org
  2006-02-06 17:45 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-06 16:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-02-06 16:58 -------
I am taking care of this one and the __imag__ part too.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-06 16:58:53
               date|                            |


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
  2006-02-06 16:58 ` [Bug middle-end/26134] " pinskia at gcc dot gnu dot org
@ 2006-02-06 17:45 ` pinskia at gcc dot gnu dot org
  2006-02-07 15:49 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-06 17:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-02-06 17:45 -------
This actually does not help the benchmark right away because we have:
static inline float
quantum_real(float _Complex a)
{
  float *p = (float *) &a;
  return p[0];
}
static inline float
quantum_imag(float _Complex a)
{
  float *p = (float *) &a;
  return p[1];
}

in the benchmark (this is GPL sofware by the way):
http://www.enyo.de/libquantum/


-- 


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
  2006-02-06 16:58 ` [Bug middle-end/26134] " pinskia at gcc dot gnu dot org
  2006-02-06 17:45 ` pinskia at gcc dot gnu dot org
@ 2006-02-07 15:49 ` pinskia at gcc dot gnu dot org
  2006-02-07 18:47 ` pluto at agmk dot net
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-07 15:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-02-07 15:49 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00560.html


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2006-
                   |                            |02/msg00560.html
           Keywords|                            |patch


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-02-07 15:49 ` pinskia at gcc dot gnu dot org
@ 2006-02-07 18:47 ` pluto at agmk dot net
  2006-02-07 18:52 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pluto at agmk dot net @ 2006-02-07 18:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pluto at agmk dot net  2006-02-07 18:47 -------
I see here another missed optimization on x86-64.

float re(float _Complex a) { return __real__ a; }

# gcc-4.1:

re: movq    %xmm0, -8(%rsp)
    movss   -8(%rsp), %xmm0
    ret


we can use `movss %xmm0, %xmm0` here.


-- 


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-02-07 18:47 ` pluto at agmk dot net
@ 2006-02-07 18:52 ` pinskia at gcc dot gnu dot org
  2006-02-07 18:56 ` falk at debian dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-07 18:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-02-07 18:52 -------
(In reply to comment #4)
> I see here another missed optimization on x86-64.
> 
> float re(float _Complex a) { return __real__ a; }

That is a totally different issue and should filed as a different bug.


-- 


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-02-07 18:52 ` pinskia at gcc dot gnu dot org
@ 2006-02-07 18:56 ` falk at debian dot org
  2006-02-09 14:14 ` pinskia at gcc dot gnu dot org
  2006-02-09 14:15 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: falk at debian dot org @ 2006-02-07 18:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from falk at debian dot org  2006-02-07 18:55 -------
(In reply to comment #5)
> (In reply to comment #4)
> > I see here another missed optimization on x86-64.
> > 
> > float re(float _Complex a) { return __real__ a; }
> 
> That is a totally different issue and should filed as a different bug.

Probably related to PR 7061.


-- 


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-02-07 18:56 ` falk at debian dot org
@ 2006-02-09 14:14 ` pinskia at gcc dot gnu dot org
  2006-02-09 14:15 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09 14:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-02-09 14:14 -------
Subject: Bug 26134

Author: pinskia
Date: Thu Feb  9 14:13:57 2006
New Revision: 110800

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110800
Log:
2006-02-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/26134
        * fold-const.c (fold_indirect_ref_1): Fold
        "*(foo *)&complexfoo" to "__real__ complexfoo"
        and "((foo*)&complexfoo)[1]" to "__imag__ complexfoo".
2006-02-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/26134
        * gcc.dg/tree-ssa/complex-3.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
  2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-02-09 14:14 ` pinskia at gcc dot gnu dot org
@ 2006-02-09 14:15 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09 14:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-02-09 14:15 -------
The orginal problem as I reported is fixed.  The next problem just requires a
tree combiner or forward-prop to handle this case also.

Closing as fix, if someone wants to open a new bug for the problem comment #1,
fine with me.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/26134] fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>
       [not found] <bug-26134-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-16 13:57 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-16 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-16 13:53:17 UTC ---
Author: rguenth
Date: Wed Mar 16 13:53:09 2011
New Revision: 171046

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171046
Log:
2011-03-16  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/26134
    * tree-ssa.c (maybe_rewrite_mem_ref_base): Handle rewriting
    complex part accesses to REALPART_EXPR and IMAGPART_EXPR.
    (non_rewritable_mem_ref_base): Handle complex type component
    accesses, constrain offsets for vector and complex extracts
    more properly.

    * gcc.dg/tree-ssa/complex-6.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/complex-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa.c


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

end of thread, other threads:[~2011-03-16 13:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-06 16:58 [Bug middle-end/26134] New: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> pinskia at gcc dot gnu dot org
2006-02-06 16:58 ` [Bug middle-end/26134] " pinskia at gcc dot gnu dot org
2006-02-06 17:45 ` pinskia at gcc dot gnu dot org
2006-02-07 15:49 ` pinskia at gcc dot gnu dot org
2006-02-07 18:47 ` pluto at agmk dot net
2006-02-07 18:52 ` pinskia at gcc dot gnu dot org
2006-02-07 18:56 ` falk at debian dot org
2006-02-09 14:14 ` pinskia at gcc dot gnu dot org
2006-02-09 14:15 ` pinskia at gcc dot gnu dot org
     [not found] <bug-26134-4@http.gcc.gnu.org/bugzilla/>
2011-03-16 13:57 ` rguenth 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).