public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
@ 2015-07-03 10:47 julia.koval at intel dot com
  2015-07-03 12:52 ` [Bug target/66750] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: julia.koval at intel dot com @ 2015-07-03 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66750
           Summary: [4.9/5/6] Aggregate return not generated with -m32
                    -mregparm=3 or with -miamcu
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: julia.koval at intel dot com
  Target Milestone: ---

Reproduce:
./gcc -Bgcc gcc.target/i386/aggregate-ret2.c -m32 -mregparm=3 -S

Generated code:
 .cfi_def_cfa 4, 4
 ret
 .cfi_endproc

Without mregparm:
 .cfi_def_cfa 4, 4
 ret     $4
 .cfi_endproc

Issue is also reproduced with mregparm=1/2 or -miamcu.

The problem is most likely in expand pass.


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

* [Bug target/66750] [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
  2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
@ 2015-07-03 12:52 ` hjl.tools at gmail dot com
  2015-07-03 14:40 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-03 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com
            Version|4.9.3                       |6.0
   Target Milestone|---                         |6.0


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

* [Bug target/66750] [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
  2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
  2015-07-03 12:52 ` [Bug target/66750] " hjl.tools at gmail dot com
@ 2015-07-03 14:40 ` hjl.tools at gmail dot com
  2015-07-03 14:46 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-03 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-03
     Ever confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
We have

'callee_pop_aggregate_return (NUMBER)'

     On x86-32 targets, you can use this attribute to control how
     aggregates are returned in memory.  If the caller is responsible
     for popping the hidden pointer together with the rest of the
     arguments, specify NUMBER equal to zero.  If callee is responsible
     for popping the hidden pointer, specify NUMBER equal to one.

     The default x86-32 ABI assumes that the callee pops the stack for
     hidden pointer.  However, on x86-32 Microsoft Windows targets, the
     compiler assumes that the caller pops the stack for hidden pointer.

and

static int
ix86_return_pops_args (tree fundecl, tree funtype, int size)
{
...
 /* Lose any fake structure return argument if it is passed on the stack.  */
  if (aggregate_value_p (TREE_TYPE (funtype), fundecl)
      && !ix86_keep_aggregate_return_pointer (funtype))
    {
      int nregs = ix86_function_regparm (funtype, fundecl);
      if (nregs == 0) 
        return GET_MODE_SIZE (Pmode);
    }

  return 0;
}

For -miamcu and -m64, ix86_return_pops_args always returns 0 since they
pass parameters in registers.  We have 2 choices:

1. Update IA MCU psABI to follow x86-64 psABI such that callee doesn't
pop the stack.
2. Update GCC to always pop stack for -m32.

I prefer #1.


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

* [Bug target/66750] [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
  2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
  2015-07-03 12:52 ` [Bug target/66750] " hjl.tools at gmail dot com
  2015-07-03 14:40 ` hjl.tools at gmail dot com
@ 2015-07-03 14:46 ` hjl.tools at gmail dot com
  2015-07-03 15:09 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-03 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
IA MCU psABI is wrong since the implicit pointer argument isn't passed
on stack.  I will fix it.


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

* [Bug target/66750] [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
  2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
                   ` (2 preceding siblings ...)
  2015-07-03 14:46 ` hjl.tools at gmail dot com
@ 2015-07-03 15:09 ` hjl.tools at gmail dot com
  2015-07-03 16:20 ` julia.koval at intel dot com
  2015-07-03 16:32 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-03 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
I fixed IA MCU psABI:

https://groups.google.com/forum/#!topic/ia32-abi/cn7TM6J_TIg

This bug can be closed.


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

* [Bug target/66750] [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
  2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
                   ` (3 preceding siblings ...)
  2015-07-03 15:09 ` hjl.tools at gmail dot com
@ 2015-07-03 16:20 ` julia.koval at intel dot com
  2015-07-03 16:32 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: julia.koval at intel dot com @ 2015-07-03 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Yulia Koval <julia.koval at intel dot com> ---
Well, it fixes issue for -miamcu, but not for "-m32 -mregparm=3", am i right?


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

* [Bug target/66750] [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu
  2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
                   ` (4 preceding siblings ...)
  2015-07-03 16:20 ` julia.koval at intel dot com
@ 2015-07-03 16:32 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-03 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Yulia Koval from comment #4)
> Well, it fixes issue for -miamcu, but not for "-m32 -mregparm=3", am i right?

callee_pop_aggregate_return isn't applicable to -mregparm since
there is nothing on stack to pop.


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

end of thread, other threads:[~2015-07-03 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03 10:47 [Bug target/66750] New: [4.9/5/6] Aggregate return not generated with -m32 -mregparm=3 or with -miamcu julia.koval at intel dot com
2015-07-03 12:52 ` [Bug target/66750] " hjl.tools at gmail dot com
2015-07-03 14:40 ` hjl.tools at gmail dot com
2015-07-03 14:46 ` hjl.tools at gmail dot com
2015-07-03 15:09 ` hjl.tools at gmail dot com
2015-07-03 16:20 ` julia.koval at intel dot com
2015-07-03 16:32 ` hjl.tools 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).