public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36212]  New: Vector alignment overides Target alignment
@ 2008-05-11 19:31 hutchinsonandy at gcc dot gnu dot org
  2008-05-11 19:39 ` [Bug middle-end/36212] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2008-05-11 19:31 UTC (permalink / raw)
  To: gcc-bugs

For avr we have multiple failures of testcases due to alignment warnings such
as:

gcc/gcc/testsuite/gcc.dg/debug/const-1.c:3: warning: alignment of 'Foo' is     
 greater than maximum object file alignment.  Using 1

Which in this example occurs due to:

    typedef float FloatVect __attribute__((__vector_size__(16)));
    FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };

While trying to fix this I have discovered several issues which make the
"correct" fix somewhat unclear and perhaps indicating more than one bug.

The warning occurs because alignment of the vector is 16 bytes regardless of
all target alignment controls. In particular:

#define BIGGEST_ALIGNMENT 8


By default this also determines MAX_OFILE_ALIGNMENT which is used by the
alignment check in varasm.c (if (16>1) Warning)

Problem 1) varasm.c - is the only place MAX_OFILE_ALIGNMENT is used. Here it
immediately tries to increase or decrease alignment AFTER it does check - which
suggests the check is misplaced or not useful in the first place.


To get around the test failure target MAX_OFILE_ALIGNMENT can be increased.
(and logically should be to permit user defined alignments)


Problem 2) Without hard limit imposed by MAX_OFILE_ALIGNMENT vectors are
aligned at 16 bytes - which break the supposed limit of BIGGEST_ALIGNMENT (1
byte).

Vector size is set in stor-layout.c :

        /* Always naturally align vectors.  This prevents ABI changes
           depending on whether or not native vector modes are supported.  */
        TYPE_ALIGN (type) = tree_low_cst (TYPE_SIZE (type), 0);
        break;

There is no way for target to override this alignment. It does not seem correct
to assume a specific vector alignment independent of target. Perhaps there
should be:

#ifdef  TARGET_VECTOR_ALIGN (..)
...
...
#else


Some may say that vectors are relevant only targets that support hardware
vector operations and thus alignment choice is currently moot. But..

Problem 3) gcc provide no hooks for  the target or testsuite to elegantly
disable vector extensions (that I can find anyway).


-- 
           Summary: Vector alignment overides Target alignment
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hutchinsonandy at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: avr-unknown-none


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


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

* [Bug middle-end/36212] Vector alignment overides Target alignment
  2008-05-11 19:31 [Bug c/36212] New: Vector alignment overides Target alignment hutchinsonandy at gcc dot gnu dot org
@ 2008-05-11 19:39 ` pinskia at gcc dot gnu dot org
  2008-05-11 19:54 ` hutchinsonandy at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-11 19:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-05-11 19:38 -------
>Problem 3) gcc provide no hooks for  the target or testsuite to elegantly
> disable vector extensions (that I can find anyway).

Problem 3 is bogus as vector extensions are generic and use what ever exist for
your target.  Now the alignment should also be constraint by BIGGEST_ALIGNMENT
.

I am in the process of rewriting the vector extension documentation so it
should become more clear that it is a generic extension and has nothing to do
with the target at all except for the fact they become faster.


-- 


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


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

* [Bug middle-end/36212] Vector alignment overides Target alignment
  2008-05-11 19:31 [Bug c/36212] New: Vector alignment overides Target alignment hutchinsonandy at gcc dot gnu dot org
  2008-05-11 19:39 ` [Bug middle-end/36212] " pinskia at gcc dot gnu dot org
@ 2008-05-11 19:54 ` hutchinsonandy at gcc dot gnu dot org
  2008-05-28  0:45 ` hutchinsonandy at gcc dot gnu dot org
  2008-06-02 17:11 ` eric dot weddington at atmel dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2008-05-11 19:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hutchinsonandy at gcc dot gnu dot org  2008-05-11 19:53 -------
I was just covering bases with 3. I'll be quite content if the vectors could
obey BIGGEST_ALIGNMENT.


-- 


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


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

* [Bug middle-end/36212] Vector alignment overides Target alignment
  2008-05-11 19:31 [Bug c/36212] New: Vector alignment overides Target alignment hutchinsonandy at gcc dot gnu dot org
  2008-05-11 19:39 ` [Bug middle-end/36212] " pinskia at gcc dot gnu dot org
  2008-05-11 19:54 ` hutchinsonandy at gcc dot gnu dot org
@ 2008-05-28  0:45 ` hutchinsonandy at gcc dot gnu dot org
  2008-06-02 17:11 ` eric dot weddington at atmel dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2008-05-28  0:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hutchinsonandy at gcc dot gnu dot org  2008-05-28 00:44 -------
Committed.

Will do 4.3 latter.

2008-05-12 Andy Hutchinson <hutchinsonandy@aim.com>

* config/avr/avr.h (MAX_OFILE_ALIGNMENT): Define.


-- 

hutchinsonandy at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug middle-end/36212] Vector alignment overides Target alignment
  2008-05-11 19:31 [Bug c/36212] New: Vector alignment overides Target alignment hutchinsonandy at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-05-28  0:45 ` hutchinsonandy at gcc dot gnu dot org
@ 2008-06-02 17:11 ` eric dot weddington at atmel dot com
  3 siblings, 0 replies; 5+ messages in thread
From: eric dot weddington at atmel dot com @ 2008-06-02 17:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

eric dot weddington at atmel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.0


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


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

end of thread, other threads:[~2008-06-02 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-11 19:31 [Bug c/36212] New: Vector alignment overides Target alignment hutchinsonandy at gcc dot gnu dot org
2008-05-11 19:39 ` [Bug middle-end/36212] " pinskia at gcc dot gnu dot org
2008-05-11 19:54 ` hutchinsonandy at gcc dot gnu dot org
2008-05-28  0:45 ` hutchinsonandy at gcc dot gnu dot org
2008-06-02 17:11 ` eric dot weddington at atmel 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).