* Altivec and binary compatibility
@ 2000-02-04 10:29 Adrian Cox
2000-02-07 15:11 ` Giuliano Pochini
0 siblings, 1 reply; 7+ messages in thread
From: Adrian Cox @ 2000-02-04 10:29 UTC (permalink / raw)
To: LinuxPPC-Dev, Debian PowerPC
Altivec raises an interesting question of binary compatibility, in the
area of C++ exceptions and \x03C setjmp/longjmp.
As the jmp_buf is a different size in Altivec and non-Altivec code, it
is not possible to jump or pass exceptions between the two. This is a
problem, because:
1) Now would not be a good time to change the size of a jmp_buf.
2) We do not need two incompatible 32-bit PowerPC ABIs under Linux.
2a) Most libraries installed by a distribution will be non-Altivec code,
to avoid having both G[123] and G4 binary variants of the distribution.
To add to the problem, throwing exceptions on an error is just what a
modern C++ library is supposed to do. Throwing or catching an exception
in Altivec code will produce sequences that cannot execute on a G3
(which is precisely what got me considering this).
Does anybody have any bright ideas, beyond ensuring that everybody
restricts the use of Altivec compilation to routines which only call
safe functions? As long as Altivec code requires the vector keyword,
that's probably a reasonable assumption.
- Adrian Cox, AG Electronics
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Altivec and binary compatibility
2000-02-04 10:29 Altivec and binary compatibility Adrian Cox
@ 2000-02-07 15:11 ` Giuliano Pochini
2000-02-07 18:06 ` Adrian Cox
0 siblings, 1 reply; 7+ messages in thread
From: Giuliano Pochini @ 2000-02-07 15:11 UTC (permalink / raw)
To: Adrian Cox; +Cc: LinuxPPC-Dev, Debian PowerPC
> Altivec raises an interesting question of binary compatibility, in the
> area of C++ exceptions and \x03C setjmp/longjmp.
>
> As the jmp_buf is a different size in Altivec and non-Altivec code
Because with Altivec we need to save V registers, right ? Well, I suppose
intel developers had the same problem with P-III "vector" unit. How did they
solve the problem ?
> it is not possible to jump or pass exceptions between the two.
> This is a problem, because:
> 1) Now would not be a good time to change the size of a jmp_buf.
> 2) We do not need two incompatible 32-bit PowerPC ABIs under Linux.
> 2a) Most libraries installed by a distribution will be non-Altivec code,
> to avoid having both G[123] and G4 binary variants of the distribution.
I agree.
> To add to the problem, throwing exceptions on an error is just what a
> modern C++ library is supposed to do. Throwing or catching an exception
> in Altivec code will produce sequences that cannot execute on a G3
Why ?? (sorry for my ignorance...)
Bye.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Altivec and binary compatibility
2000-02-07 15:11 ` Giuliano Pochini
@ 2000-02-07 18:06 ` Adrian Cox
2000-02-08 20:11 ` Giuliano Pochini
[not found] ` <v03010d02b4cce4346bac@[192.168.1.16]>
0 siblings, 2 replies; 7+ messages in thread
From: Adrian Cox @ 2000-02-07 18:06 UTC (permalink / raw)
To: Giuliano Pochini; +Cc: LinuxPPC-Dev, Debian PowerPC
Giuliano Pochini wrote:
Giuliano Pochini wrote:
> > As the jmp_buf is a different size in Altivec and non-Altivec code
>
> Because with Altivec we need to save V registers, right ? Well, I suppose
> intel developers had the same problem with P-III "vector" unit. How did they
> solve the problem ?
As far as I can tell, by ignoring it, and making the assumption that
only low-level libraries will use the vector registers. I plan to take
a similar approach, and warn users not to mix Altivec and exceptions.
> > To add to the problem, throwing exceptions on an error is just what a
> > modern C++ library is supposed to do. Throwing or catching an exception
> > in Altivec code will produce sequences that cannot execute on a G3
>
> Why ?? (sorry for my ignorance...)
I haven't studied GCC's implementation of exceptions in great detail.
The compiler saves and restores all the non-transient registers as part
of the exception sequence. When generating Altivec code this produces
stvx and lvx instructions, which will cause an illegal instruction
exception on G3 processors.
- Adrian Cox
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Altivec and binary compatibility
2000-02-07 18:06 ` Adrian Cox
@ 2000-02-08 20:11 ` Giuliano Pochini
2000-02-11 9:41 ` Adrian Cox
[not found] ` <v03010d02b4cce4346bac@[192.168.1.16]>
1 sibling, 1 reply; 7+ messages in thread
From: Giuliano Pochini @ 2000-02-08 20:11 UTC (permalink / raw)
To: Adrian Cox; +Cc: LinuxPPC-Dev, Debian PowerPC
> > Because with Altivec we need to save V registers, right ? Well, I suppose
> > intel developers had the same problem with P-III "vector" unit. How did they
> > solve the problem ?
>
> As far as I can tell, by ignoring it, and making the assumption that
> only low-level libraries will use the vector registers.
mm :-/
> I plan to take
> a similar approach, and warn users not to mix Altivec and exceptions.
>From altivec p. e. m.: "1.2.6 - The AltiVec vector unit never generates an
exception"
I just started to read the book, but I think AltiVec tells nothing even on
things like divisions by 0, etc.
> > > To add to the problem, throwing exceptions on an error is just what a
> > > modern C++ library is supposed to do. Throwing or catching an exception
> > > in Altivec code will produce sequences that cannot execute on a G3
> >
> > Why ?? (sorry for my ignorance...)
>
> I haven't studied GCC's implementation of exceptions in great detail.
> The compiler saves and restores all the non-transient registers as part
> of the exception sequence. When generating Altivec code this produces
> stvx and lvx instructions, which will cause an illegal instruction
> exception on G3 processors.
Ok, the programmmer will have to check for AltiVec at the beginning of the
program. What's really important is that programs compiled for 603, 604, G3,
will work fine on G4.
Bye.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <v03010d02b4cce4346bac@[192.168.1.16]>]
end of thread, other threads:[~2000-02-20 16:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-02-04 10:29 Altivec and binary compatibility Adrian Cox
2000-02-07 15:11 ` Giuliano Pochini
2000-02-07 18:06 ` Adrian Cox
2000-02-08 20:11 ` Giuliano Pochini
2000-02-11 9:41 ` Adrian Cox
[not found] ` <v03010d02b4cce4346bac@[192.168.1.16]>
[not found] ` <38A7D0FD.D6A7E95D@agelectronics.co.uk>
2000-02-20 1:18 ` Giuliano Pochini
2000-02-20 16:00 ` Giuliano Pochini
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 NNTP newsgroup(s).