public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/67413] New: Complex NOP expanded to several operations
@ 2015-08-31 14:43 glisse at gcc dot gnu.org
  2015-09-01  8:36 ` [Bug rtl-optimization/67413] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-08-31 14:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67413

            Bug ID: 67413
           Summary: Complex NOP expanded to several operations
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
  Target Milestone: ---

_Complex unsigned f(_Complex int i){return i;}

yields

        movl    %edi, %eax
        shrq    $32, %rdi
        salq    $32, %rdi
        orq     %rdi, %rax
        ret

I read somewhere that complex integers are a deprecated gcc extension, but gcc
only warns in pedantic mode, and it should not be too hard to improve the
generated code.

Note that tree optimizers currently also fail to optimize the corresponding
code:

long f(long x){
  long y = x >> 32;
  y <<= 32;
  int z = x;
  return z | y;
}

(using & CST instead of >> and << does not help)


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

* [Bug rtl-optimization/67413] Complex NOP expanded to several operations
  2015-08-31 14:43 [Bug rtl-optimization/67413] New: Complex NOP expanded to several operations glisse at gcc dot gnu.org
@ 2015-09-01  8:36 ` rguenth at gcc dot gnu.org
  2021-12-15 22:08 ` [Bug tree-optimization/67413] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-09-01  8:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67413

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-01
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
My idea was always that the bswap pass would handle this kind of stuff...


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

* [Bug tree-optimization/67413] Complex NOP expanded to several operations
  2015-08-31 14:43 [Bug rtl-optimization/67413] New: Complex NOP expanded to several operations glisse at gcc dot gnu.org
  2015-09-01  8:36 ` [Bug rtl-optimization/67413] " rguenth at gcc dot gnu.org
@ 2021-12-15 22:08 ` pinskia at gcc dot gnu.org
  2021-12-15 22:12 ` pinskia at gcc dot gnu.org
  2021-12-15 22:14 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 22:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67413

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Blocks|                            |101926

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe for:
  _1 = REALPART_EXPR <i_5(D)>;
  _2 = (long long unsigned intD.23) _1;
  _3 = IMAGPART_EXPR <i_5(D)>;
  _4 = (long long unsigned intD.23) _3;
  _6 = COMPLEX_EXPR <_2, _4>;

We should just create a VCE, I don't know if that is a good idea or not,
complex int in cases like this are not used that much anyways so ....


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101926
[Bug 101926] [meta-bug] struct/complex argument passing and return should be
improved

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

* [Bug tree-optimization/67413] Complex NOP expanded to several operations
  2015-08-31 14:43 [Bug rtl-optimization/67413] New: Complex NOP expanded to several operations glisse at gcc dot gnu.org
  2015-09-01  8:36 ` [Bug rtl-optimization/67413] " rguenth at gcc dot gnu.org
  2021-12-15 22:08 ` [Bug tree-optimization/67413] " pinskia at gcc dot gnu.org
@ 2021-12-15 22:12 ` pinskia at gcc dot gnu.org
  2021-12-15 22:14 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 22:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67413

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
As for the other testcase:
  y_3 = x_2(D) & -4294967296;
  z_4 = (intD.9) x_2(D);
  _1 = (long intD.12) z_4;
  _5 = _1 | y_3;

If we could optimize:
  z_4 = (intD.9) x_2(D);
  _1 = (long intD.12) z_4;

Into:
_1 = x_2(D) & 4294967295;

It would just work.

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

* [Bug tree-optimization/67413] Complex NOP expanded to several operations
  2015-08-31 14:43 [Bug rtl-optimization/67413] New: Complex NOP expanded to several operations glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-12-15 22:12 ` pinskia at gcc dot gnu.org
@ 2021-12-15 22:14 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 22:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67413

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> It would just work.

Except the two casts are not the same in the case of negative as I mentioned in
comment #2 :).

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

end of thread, other threads:[~2021-12-15 22:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-31 14:43 [Bug rtl-optimization/67413] New: Complex NOP expanded to several operations glisse at gcc dot gnu.org
2015-09-01  8:36 ` [Bug rtl-optimization/67413] " rguenth at gcc dot gnu.org
2021-12-15 22:08 ` [Bug tree-optimization/67413] " pinskia at gcc dot gnu.org
2021-12-15 22:12 ` pinskia at gcc dot gnu.org
2021-12-15 22:14 ` pinskia 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).