public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Altivec conditional?
@ 2002-02-20  5:39 Daniel Egger
  2002-02-20 23:50 ` Aldy Hernandez
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Egger @ 2002-02-20  5:39 UTC (permalink / raw)
  To: GCC Developer Mailinglist

Hija,

I may probably find something in the source after hours of digging but
probably someone here knows it already. How can I distinguish between 
a GCC having the new altivec builtins and one that has not, i.e. is
there some preprocessor symbol defined? 

I'd really like to cease my C/__asm__ development and use the builtins
when possible. I also might create a GCC-Altivec-FAQ with the experience
gained from being one of the first ones trying to use it productively.
:)

-- 
Servus,
       Daniel

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

* Re: Altivec conditional?
  2002-02-20  5:39 Altivec conditional? Daniel Egger
@ 2002-02-20 23:50 ` Aldy Hernandez
  2002-02-21  3:17   ` Daniel Egger
  0 siblings, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2002-02-20 23:50 UTC (permalink / raw)
  To: Daniel Egger; +Cc: GCC Developer Mailinglist

>>>>> "Daniel" == Daniel Egger <degger@fhm.edu> writes:

 > Hija,
 > I may probably find something in the source after hours of digging but
 > probably someone here knows it already. How can I distinguish between 
 > a GCC having the new altivec builtins and one that has not, i.e. is
 > there some preprocessor symbol defined?

__ALTIVEC__

but you have to include <altivec.h>

 > I'd really like to cease my C/__asm__ development and use the builtins
 > when possible. I also might create a GCC-Altivec-FAQ with the
 > experience

the builtins are not supported.  Use the convenience macros (and
overloaded C++ functions) defined in <altivec.h>.

*DON'T* use the builtins.  The macros are prettier, and i hope to get
 rid of the builtins one day...

 > gained from being one of the first ones trying to use it productively.
 > :)

that would be much appreciated

 > -- 
 > Servus,
 >        Daniel

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

* Re: Altivec conditional?
  2002-02-20 23:50 ` Aldy Hernandez
@ 2002-02-21  3:17   ` Daniel Egger
  2002-02-21  9:56     ` Daniel Jacobowitz
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Daniel Egger @ 2002-02-21  3:17 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: GCC Developer Mailinglist

Am Don, 2002-02-21 um 08.49 schrieb Aldy Hernandez:

> __ALTIVEC__
 
> but you have to include <altivec.h>

But I can only include <altivec.h> if I have a capable compiler.
That's not going to work as it's a chicken egg problem.
 
> the builtins are not supported.  Use the convenience macros (and
> overloaded C++ functions) defined in <altivec.h>.
 
> *DON'T* use the builtins.  The macros are prettier, and i hope to get
>  rid of the builtins one day...

I've only seen cplusplus code in there. How do I utilize altivec from
C without using builtins?
 
-- 
Servus,
       Daniel

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

* Re: Altivec conditional?
  2002-02-21  3:17   ` Daniel Egger
@ 2002-02-21  9:56     ` Daniel Jacobowitz
  2002-02-21 16:12       ` Aldy Hernandez
  2002-02-22  4:57       ` Daniel Egger
  2002-02-21 15:47     ` Aldy Hernandez
  2002-02-22 18:36     ` Geoff Keating
  2 siblings, 2 replies; 13+ messages in thread
From: Daniel Jacobowitz @ 2002-02-21  9:56 UTC (permalink / raw)
  To: Daniel Egger; +Cc: Aldy Hernandez, GCC Developer Mailinglist

On Thu, Feb 21, 2002 at 10:52:29AM +0100, Daniel Egger wrote:
> Am Don, 2002-02-21 um 08.49 schrieb Aldy Hernandez:
> 
> > __ALTIVEC__
>  
> > but you have to include <altivec.h>
> 
> But I can only include <altivec.h> if I have a capable compiler.
> That's not going to work as it's a chicken egg problem.

Easier to autoconf for, though...

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: Altivec conditional?
  2002-02-21  3:17   ` Daniel Egger
  2002-02-21  9:56     ` Daniel Jacobowitz
@ 2002-02-21 15:47     ` Aldy Hernandez
  2002-02-22  5:01       ` Daniel Egger
  2002-02-22 18:36     ` Geoff Keating
  2 siblings, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2002-02-21 15:47 UTC (permalink / raw)
  To: Daniel Egger; +Cc: GCC Developer Mailinglist


On Thursday, February 21, 2002, at 08:52  PM, Daniel Egger wrote:

> Am Don, 2002-02-21 um 08.49 schrieb Aldy Hernandez:
>
>> __ALTIVEC__
>
>> but you have to include <altivec.h>
>
> But I can only include <altivec.h> if I have a capable compiler.
> That's not going to work as it's a chicken egg problem.

yeah, so download cvs gcc, build it and then use the resulting
compiler to compile your code (which should include <altivec.h>)

> I've only seen cplusplus code in there. How do I utilize altivec from
> C without using builtins?

same way.  include <altivec.h>.  there's magic there to know if
it's C or C++.

altivec builtins are evil.

>
> --
> Servus,
>        Daniel
>
>
--
Aldy Hernandez                                E-mail: aldyh@redhat.com
Professional Gypsy Lost in Australia
Red Hat, Inc.

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

* Re: Altivec conditional?
  2002-02-21  9:56     ` Daniel Jacobowitz
@ 2002-02-21 16:12       ` Aldy Hernandez
  2002-02-22  4:57       ` Daniel Egger
  1 sibling, 0 replies; 13+ messages in thread
From: Aldy Hernandez @ 2002-02-21 16:12 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Daniel Egger, GCC Developer Mailinglist


On Friday, February 22, 2002, at 03:37  AM, Daniel Jacobowitz wrote:

> On Thu, Feb 21, 2002 at 10:52:29AM +0100, Daniel Egger wrote:
>> Am Don, 2002-02-21 um 08.49 schrieb Aldy Hernandez:
>>
>>> __ALTIVEC__
>>
>>> but you have to include <altivec.h>
>>
>> But I can only include <altivec.h> if I have a capable compiler.
>> That's not going to work as it's a chicken egg problem.
>
> Easier to autoconf for, though...

doh!  i misread the message.  i see what you mean.

--
Aldy Hernandez                                E-mail: aldyh@redhat.com
Professional Gypsy Lost in Australia
Red Hat, Inc.

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

* Re: Altivec conditional?
  2002-02-21  9:56     ` Daniel Jacobowitz
  2002-02-21 16:12       ` Aldy Hernandez
@ 2002-02-22  4:57       ` Daniel Egger
  2002-02-22  6:25         ` Jakub Jelinek
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Egger @ 2002-02-22  4:57 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Aldy Hernandez, GCC Developer Mailinglist

Am Don, 2002-02-21 um 17.37 schrieb Daniel Jacobowitz:

> > But I can only include <altivec.h> if I have a capable compiler.
> > That's not going to work as it's a chicken egg problem.
 
> Easier to autoconf for, though...

Correct. But I prefer having a compiler defined symbol to autoconf
because it needs quite a bit additional work. 
 
-- 
Servus,
       Daniel

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

* Re: Altivec conditional?
  2002-02-21 15:47     ` Aldy Hernandez
@ 2002-02-22  5:01       ` Daniel Egger
  2002-02-22 14:35         ` Aldy Hernandez
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Egger @ 2002-02-22  5:01 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: GCC Developer Mailinglist

Am Fre, 2002-02-22 um 00.45 schrieb Aldy Hernandez:

> yeah, so download cvs gcc, build it and then use the resulting
> compiler to compile your code (which should include <altivec.h>)

When I don't have gcc-cvs with altivec.h I cannot include it
which would mean I have to add additional autoconf hacks to
every project I touch. I'd prefer something like

#ifdef __GCC_ALTIVEC
#include <altivec.h>

[some code]
#endif
 
> same way.  include <altivec.h>.  there's magic there to know if
> it's C or C++.
 
Oh yes, you're right. I haven't scanned it thorougly enough.... there's
an #else clause as well... thanks... :)

-- 
Servus,
       Daniel

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

* Re: Altivec conditional?
  2002-02-22  4:57       ` Daniel Egger
@ 2002-02-22  6:25         ` Jakub Jelinek
  2002-02-22  6:26           ` Daniel Egger
  0 siblings, 1 reply; 13+ messages in thread
From: Jakub Jelinek @ 2002-02-22  6:25 UTC (permalink / raw)
  To: Daniel Egger; +Cc: Daniel Jacobowitz, Aldy Hernandez, GCC Developer Mailinglist

On Fri, Feb 22, 2002 at 01:54:25PM +0100, Daniel Egger wrote:
> Am Don, 2002-02-21 um 17.37 schrieb Daniel Jacobowitz:
> 
> > > But I can only include <altivec.h> if I have a capable compiler.
> > > That's not going to work as it's a chicken egg problem.
>  
> > Easier to autoconf for, though...
> 
> Correct. But I prefer having a compiler defined symbol to autoconf
> because it needs quite a bit additional work. 

I don't think adding altivec.h to AC_CHECK_HEADERS is that much additional
work (or even inserting new AC_CHECK_HEADERS).
This is how you do check for all headers not shipped by the compiler, so I
don't see why this one should be handled any differently.

	Jakub

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

* Re: Altivec conditional?
  2002-02-22  6:25         ` Jakub Jelinek
@ 2002-02-22  6:26           ` Daniel Egger
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Egger @ 2002-02-22  6:26 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Aldy Hernandez, GCC Developer Mailinglist

Am Fre, 2002-02-22 um 13.58 schrieb Jakub Jelinek:

> I don't think adding altivec.h to AC_CHECK_HEADERS is that much additional
> work (or even inserting new AC_CHECK_HEADERS).
> This is how you do check for all headers not shipped by the compiler, so I
> don't see why this one should be handled any differently.

It's actually more than this:
- will only work for projects that actually use autoconf.
- one needs to define projectwide conditionals which are substituted in
  at least config.h (if it exists at all) and probably Makefiles
- one needs to recreate the whole Makefilery

This make be a bearable effort for projects one actually partipates in
and has the rights and chances to propagate the changes to the official
source but is a PITA for patch based development in local trees.

Don't get me wrong, I use autoconf very much and despite its sometimes
obscure problems I like it very much. But it causes quite an additional
overhead for me to add altivec support to a few projects because the
changes are quite intrusive and easy to break using anonymous CVS and
local development.
 
-- 
Servus,
       Daniel

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

* Re: Altivec conditional?
  2002-02-22  5:01       ` Daniel Egger
@ 2002-02-22 14:35         ` Aldy Hernandez
  0 siblings, 0 replies; 13+ messages in thread
From: Aldy Hernandez @ 2002-02-22 14:35 UTC (permalink / raw)
  To: Daniel Egger; +Cc: GCC Developer Mailinglist


On Saturday, February 23, 2002, at 12:00  AM, Daniel Egger wrote:

> Am Fre, 2002-02-22 um 00.45 schrieb Aldy Hernandez:
>
>> yeah, so download cvs gcc, build it and then use the resulting
>> compiler to compile your code (which should include <altivec.h>)
>
> When I don't have gcc-cvs with altivec.h I cannot include it
> which would mean I have to add additional autoconf hacks to
> every project I touch. I'd prefer something like

i guess i had forgotten to define __ALTIVEC__ from the driver
program-- with specs.  someone else mentioned that this week.

i will fix real soon, so you should be able to do:

	#ifdef __ALTIVEC__
	#include <altivec.h>
	#endif

aldy

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

* Re: Altivec conditional?
  2002-02-21  3:17   ` Daniel Egger
  2002-02-21  9:56     ` Daniel Jacobowitz
  2002-02-21 15:47     ` Aldy Hernandez
@ 2002-02-22 18:36     ` Geoff Keating
  2002-02-23 16:37       ` Daniel Egger
  2 siblings, 1 reply; 13+ messages in thread
From: Geoff Keating @ 2002-02-22 18:36 UTC (permalink / raw)
  To: Daniel Egger; +Cc: gcc

Daniel Egger <degger@fhm.edu> writes:

> Am Don, 2002-02-21 um 08.49 schrieb Aldy Hernandez:
> 
> > __ALTIVEC__
>  
> > but you have to include <altivec.h>
> 
> But I can only include <altivec.h> if I have a capable compiler.
> That's not going to work as it's a chicken egg problem.

If you don't want to use autoconf, the way to determine compiler
capabilities is to key off __GNUC__ and __GNUC_MINOR__ and so on.  Of
course, it's ugly, but presumably you already key off __aix__ and
__linux__ and __cygwin__ and so on, so what's one more?

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>

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

* Re: Altivec conditional?
  2002-02-22 18:36     ` Geoff Keating
@ 2002-02-23 16:37       ` Daniel Egger
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Egger @ 2002-02-23 16:37 UTC (permalink / raw)
  To: Geoff Keating; +Cc: GCC Developer Mailinglist

Am Sam, 2002-02-23 um 02.25 schrieb Geoff Keating:

> If you don't want to use autoconf, the way to determine compiler
> capabilities is to key off __GNUC__ and __GNUC_MINOR__ and so on.  Of
> course, it's ugly, but presumably you already key off __aix__ and
> __linux__ and __cygwin__ and so on, so what's one more?

No problem with me, I just want to know what to key for. :)
BTW: It's not as nasty as it seems as most of the code is portable, I
just need defines to overwrite generic functions with optimised ones
which means one or two #ifdefs in the whole code per optimised
architecture.
 
-- 
Servus,
       Daniel

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

end of thread, other threads:[~2002-02-24  0:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-20  5:39 Altivec conditional? Daniel Egger
2002-02-20 23:50 ` Aldy Hernandez
2002-02-21  3:17   ` Daniel Egger
2002-02-21  9:56     ` Daniel Jacobowitz
2002-02-21 16:12       ` Aldy Hernandez
2002-02-22  4:57       ` Daniel Egger
2002-02-22  6:25         ` Jakub Jelinek
2002-02-22  6:26           ` Daniel Egger
2002-02-21 15:47     ` Aldy Hernandez
2002-02-22  5:01       ` Daniel Egger
2002-02-22 14:35         ` Aldy Hernandez
2002-02-22 18:36     ` Geoff Keating
2002-02-23 16:37       ` Daniel Egger

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).