public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30254]  New: Need method to determine if AltiVec PIM is available
@ 2006-12-18 19:59 iano at apple dot com
  2006-12-18 20:05 ` [Bug c/30254] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: iano at apple dot com @ 2006-12-18 19:59 UTC (permalink / raw)
  To: gcc-bugs

It is possible with most compilers use the __VEC__ symbol to indicate that the
AltiVec C Programming Interface is available. GCC has taken a different track.
It is possible to have __VEC__ defined (-maltivec) without the C Programming
Interface operational (altivec.h has not been included.)  

It is difficult to deal with this problem in places like system headers, where
the current compilation environment is not known. On a vector ISA like SSE this
is not a problem. Such system headers can safely include things like
xmmintrin.h as needed to get the types/interfaces they need. Not so with
AltiVec!  The addition of several new keywords like vector and bool may cause
ordinary C and C++ programs to fail to compile. We need to know if the user has
turned on the PIM so we know if should use the interface in library/system
headers, where we have no control over the compilation environment.

The current situation is a bit tangly because of -faltivec:

 -faltivec:    defines __VEC__, defines __APPLE_ALTIVEC__, 
                   does not include altivec.h (on Apple compiler at least)
                   does not define _AltiVec_H

-maltivec:   defines __VEC__,  may or may not define __APPLE_ALTIVEC__
depending on GCC version
                   PIM active status dependent on whether altivec.h is
included. 
                   We don't know if the symbol _AltiVec_H

I'm asking for one of several solutions:

1) Attempt to conform to behavior of other compilers -- only define __VEC__ if
the PIM is on.
         I think this would mean that -maltivec does not define __VEC__,
-faltivec does and altivec.h
         defines it too 

2) Provide a new symbol such as __ALTIVEC__PIM__ that we can test against

3) Fix __APPLE_ALTIVEC__ so that is is defined in some predicable manner that
can be used for this purpose.  Perhaps all you need here is a verification test
case. The problem case appears to be the Cell / Linux GNU tool chain, which
defines __APPLE__ALTIVEC__ without -faltivec or include "altivec.h"

Maybe some other way?


-- 
           Summary: Need method to determine if AltiVec PIM is available
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: iano at apple dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug c/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
@ 2006-12-18 20:05 ` pinskia at gcc dot gnu dot org
  2006-12-18 20:06 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-18 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-18 20:04 -------
-faltivec does not exist on any PPC target except for darwin.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug c/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
  2006-12-18 20:05 ` [Bug c/30254] " pinskia at gcc dot gnu dot org
@ 2006-12-18 20:06 ` pinskia at gcc dot gnu dot org
  2006-12-18 20:07 ` [Bug target/30254] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-18 20:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-12-18 20:06 -------
> 3) Fix __APPLE_ALTIVEC__ so that is is defined in some predicable manner that
> can be used for this purpose.  Perhaps all you need here is a verification test
> case. The problem case appears to be the Cell / Linux GNU tool chain, which
> defines __APPLE__ALTIVEC__ without -faltivec or include "altivec.h"

This bug really should be reported to IBM rather than the FSF since they
release the Cell GNU/Linux toolchains and they are modified versions of GCC.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug target/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
  2006-12-18 20:05 ` [Bug c/30254] " pinskia at gcc dot gnu dot org
  2006-12-18 20:06 ` pinskia at gcc dot gnu dot org
@ 2006-12-18 20:07 ` pinskia at gcc dot gnu dot org
  2006-12-18 20:24 ` iano at apple dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-18 20:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-12-18 20:07 -------
One more point to all this issues if you do configure GCC with --with-cpu=cell
or --with-cpu=970, etc. or use -mcpu=cell, -mcpu=970, -maltivec is enabled by
default.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug target/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
                   ` (2 preceding siblings ...)
  2006-12-18 20:07 ` [Bug target/30254] " pinskia at gcc dot gnu dot org
@ 2006-12-18 20:24 ` iano at apple dot com
  2006-12-18 20:53 ` iano at apple dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: iano at apple dot com @ 2006-12-18 20:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from iano at apple dot com  2006-12-18 20:24 -------

A gcc test case that verfies behavior in this area would drive conformance by
external vendors like IBM. 

Unfortunately, it is not clear that GCC even has an approved method for
determining if the PIM is active. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug target/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
                   ` (3 preceding siblings ...)
  2006-12-18 20:24 ` iano at apple dot com
@ 2006-12-18 20:53 ` iano at apple dot com
  2007-01-07  0:51 ` pinskia at gcc dot gnu dot org
  2010-07-20 14:08 ` steven at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: iano at apple dot com @ 2006-12-18 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from iano at apple dot com  2006-12-18 20:52 -------

I will nominate the following as a test case.  It should compile without
errors:

for each affected arch:

gcc test_case.c
gcc test_case.c -maltivec
gcc test_case.c -faltivec
gcc test_case.c -maltivec -DINCLUDE_HEADER

test_case.c:

#include <stdio.h>
#if defined( INCLUDE_HEADER )
   #include <altivec.h>
#endif

/* The approved method for detecting PIM availability on GCC */
#if defined( __VEC__ )
     #if defined( __GNUC__ ) && ! defined __APPLE_ALTIVEC__
            #if defined _ALTIVEC_H      /* defined by altivec.h */
                 #define __ALTIVEC_PIM__
            #endif
     #else
            #define __ALTIVEC_PIM__
     #endif  /* __GNUC__ */
#endif /* __VEC__ */


int main( void )
{
        #if defined( __ALTIVEC_PIM__ )
                vector unsigned char v = (vector unsigned char) (
'A','l','t','i','V','e','c',' ','i','s',' ','o','n', 0, 0, 0 );               
v = vec_or( v, v );
                printf( "%vc\n", v );    //note, some operating systems don't
support %v format specifiers, which is a separate problem
        #else
                printf( "AltiVec is off\n" );
        #endif

        return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug target/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
                   ` (4 preceding siblings ...)
  2006-12-18 20:53 ` iano at apple dot com
@ 2007-01-07  0:51 ` pinskia at gcc dot gnu dot org
  2010-07-20 14:08 ` steven at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-07  0:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-01-07 00:50 -------
Confirmed, I did not have time over the winter break to look at this bug, maybe
on the 15th or next weekend while I am in Tahoe.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-01-07 00:50:46
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

* [Bug target/30254] Need method to determine if AltiVec PIM is available
  2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
                   ` (5 preceding siblings ...)
  2007-01-07  0:51 ` pinskia at gcc dot gnu dot org
@ 2010-07-20 14:08 ` steven at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-07-20 14:08 UTC (permalink / raw)
  To: gcc-bugs



-- 

steven at gcc dot gnu dot org changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30254


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

end of thread, other threads:[~2010-07-20 14:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-18 19:59 [Bug c/30254] New: Need method to determine if AltiVec PIM is available iano at apple dot com
2006-12-18 20:05 ` [Bug c/30254] " pinskia at gcc dot gnu dot org
2006-12-18 20:06 ` pinskia at gcc dot gnu dot org
2006-12-18 20:07 ` [Bug target/30254] " pinskia at gcc dot gnu dot org
2006-12-18 20:24 ` iano at apple dot com
2006-12-18 20:53 ` iano at apple dot com
2007-01-07  0:51 ` pinskia at gcc dot gnu dot org
2010-07-20 14:08 ` steven at gcc dot gnu dot 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).