* Fix altivec vector return location
@ 2007-03-15 17:18 Andreas Schwab
2007-04-10 20:46 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2007-03-15 17:18 UTC (permalink / raw)
To: gdb-patches
powerpc-linux is not using -mabi=altivec by default, thus vector types are
returned in general registers instead of altivec registers.
Andreas.
2007-03-15 Andreas Schwab <schwab@suse.de>
* ppc-linux-tdep.c (ppc_linux_return_value): Vectors are returned
in general registers.
Index: gdb/ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.81
diff -u -a -p -u -p -a -r1.81 gdb/ppc-linux-tdep.c
--- gdb/ppc-linux-tdep.c 9 Jan 2007 17:58:55 -0000 1.81
+++ gdb/ppc-linux-tdep.c 15 Mar 2007 17:15:50 -0000
@@ -484,17 +484,47 @@ ppc_linux_memory_remove_breakpoint (stru
/* For historic reasons, PPC 32 GNU/Linux follows PowerOpen rather
than the 32 bit SYSV R4 ABI structure return convention - all
structures, no matter their size, are put in memory. Vectors,
- which were added later, do get returned in a register though. */
+ which were added later, do get returned in a register, although
+ not in an AltiVec register. */
static enum return_value_convention
ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf)
{
- if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION)
- && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
- && TYPE_VECTOR (valtype)))
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (TYPE_LENGTH (valtype) == 16
+ && TYPE_CODE (valtype) == TYPE_CODE_ARRAY
+ && TYPE_VECTOR (valtype))
+ {
+ /* Return value is in r3-r6. */
+ if (readbuf)
+ {
+ regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
+ readbuf + 0);
+ regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
+ readbuf + 4);
+ regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 5,
+ readbuf + 8);
+ regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 6,
+ readbuf + 12);
+ }
+ if (writebuf)
+ {
+ regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
+ writebuf + 0);
+ regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
+ writebuf + 4);
+ regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 5,
+ writebuf + 8);
+ regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 6,
+ writebuf + 12);
+ }
+ return RETURN_VALUE_REGISTER_CONVENTION;
+ }
+ else if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
+ || TYPE_CODE (valtype) == TYPE_CODE_UNION)
return RETURN_VALUE_STRUCT_CONVENTION;
else
return ppc_sysv_abi_return_value (gdbarch, valtype, regcache, readbuf,
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix altivec vector return location
2007-03-15 17:18 Fix altivec vector return location Andreas Schwab
@ 2007-04-10 20:46 ` Daniel Jacobowitz
2007-04-10 22:23 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-04-10 20:46 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
On Thu, Mar 15, 2007 at 06:17:51PM +0100, Andreas Schwab wrote:
> powerpc-linux is not using -mabi=altivec by default, thus vector types are
> returned in general registers instead of altivec registers.
>
> Andreas.
>
> 2007-03-15 Andreas Schwab <schwab@suse.de>
>
> * ppc-linux-tdep.c (ppc_linux_return_value): Vectors are returned
> in general registers.
Hmmm... but what about people who do use -mabi=altivec? IIRC you can
do that by configuring for powerpc-linux-gnualtivec. I know some
distributors patch GCC to do this too for their distributions.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix altivec vector return location
2007-04-10 20:46 ` Daniel Jacobowitz
@ 2007-04-10 22:23 ` Andreas Schwab
2007-04-10 22:34 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2007-04-10 22:23 UTC (permalink / raw)
To: gdb-patches
Daniel Jacobowitz <drow@false.org> writes:
> On Thu, Mar 15, 2007 at 06:17:51PM +0100, Andreas Schwab wrote:
>> powerpc-linux is not using -mabi=altivec by default, thus vector types are
>> returned in general registers instead of altivec registers.
>>
>> Andreas.
>>
>> 2007-03-15 Andreas Schwab <schwab@suse.de>
>>
>> * ppc-linux-tdep.c (ppc_linux_return_value): Vectors are returned
>> in general registers.
>
> Hmmm... but what about people who do use -mabi=altivec?
I have no idea how to detect that.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix altivec vector return location
2007-04-10 22:23 ` Andreas Schwab
@ 2007-04-10 22:34 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-04-10 22:34 UTC (permalink / raw)
To: gdb-patches
On Wed, Apr 11, 2007 at 12:23:31AM +0200, Andreas Schwab wrote:
> Daniel Jacobowitz <drow@false.org> writes:
>
> > On Thu, Mar 15, 2007 at 06:17:51PM +0100, Andreas Schwab wrote:
> >> powerpc-linux is not using -mabi=altivec by default, thus vector types are
> >> returned in general registers instead of altivec registers.
> >>
> >> Andreas.
> >>
> >> 2007-03-15 Andreas Schwab <schwab@suse.de>
> >>
> >> * ppc-linux-tdep.c (ppc_linux_return_value): Vectors are returned
> >> in general registers.
> >
> > Hmmm... but what about people who do use -mabi=altivec?
>
> I have no idea how to detect that.
I think it's a bad idea to trade off broken in one configuration for
broken in another, so let's not change it right now.
The only way I can think of to detect it would be to add something to
the linker, like other platforms do (including E500). I wonder if the
new Power ABI discussions will provide something useful...
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-10 22:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-15 17:18 Fix altivec vector return location Andreas Schwab
2007-04-10 20:46 ` Daniel Jacobowitz
2007-04-10 22:23 ` Andreas Schwab
2007-04-10 22:34 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox