public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
@ 2015-09-28 12:36 chrbr at gcc dot gnu.org
  2015-09-28 12:43 ` [Bug target/67745] " chrbr at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-09-28 12:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

            Bug ID: 67745
           Summary: [ARM] wrong alignments when __attribute__
                    ((optimize,target,align) is used
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chrbr at gcc dot gnu.org
  Target Milestone: ---

alignment directives emitted by the compiler are inconsistent for ARM when
attributes target are used.

for instance this code compiled with -Os -mthumb, 

void  __attribute__ ((target ("arm")))
c(void)
{
}

emits

        .text
        .align  1
        .global c
        .syntax divided
        .arm
        .type   c, %function

it should have the function 'c' aligned on 2^2 bytes, not 2^1


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
@ 2015-09-28 12:43 ` chrbr at gcc dot gnu.org
  2015-09-28 12:48 ` chrbr at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-09-28 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

--- Comment #1 from chrbr at gcc dot gnu.org ---
the problems are three folds:

- FUNCTION_BOUNDARY should not test optimize_size, that should be tested in
override_options_internal instead to be carried by
invoke_set_current_function_hook 

- FUNCTION_BOUNDARY depends on TARGET_THUMB that depends on the attribute
target. So it should be reevaluated at each function change, thus 
TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
  2015-09-28 12:43 ` [Bug target/67745] " chrbr at gcc dot gnu.org
@ 2015-09-28 12:48 ` chrbr at gcc dot gnu.org
  2015-09-28 13:37 ` chrbr at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-09-28 12:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

--- Comment #2 from chrbr at gcc dot gnu.org ---
and test check optimize_function_for_speed_p (cfun)) in assemble_start_function
put an unnecessary constraint on align_functions (either from -falign-functions
or __attribute__).
We should be able to decrease alignment between functions for a target switch
in -Os, for example.


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
  2015-09-28 12:43 ` [Bug target/67745] " chrbr at gcc dot gnu.org
  2015-09-28 12:48 ` chrbr at gcc dot gnu.org
@ 2015-09-28 13:37 ` chrbr at gcc dot gnu.org
  2015-09-29 13:33 ` chrbr at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-09-28 13:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

--- Comment #3 from chrbr at gcc dot gnu.org ---
another example that gives suboptimal alignment:

void
__attribute__ ((optimize("Os")))
foo()
{
}

compiled with -O2 -mthumb is aligned on 2^2 instead of 2^1. -Os should remove
padding here.


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-09-28 13:37 ` chrbr at gcc dot gnu.org
@ 2015-09-29 13:33 ` chrbr at gcc dot gnu.org
  2015-10-10 10:55 ` ramana at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-09-29 13:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

chrbr at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |arm
   Target Milestone|---                         |6.0


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-09-29 13:33 ` chrbr at gcc dot gnu.org
@ 2015-10-10 10:55 ` ramana at gcc dot gnu.org
  2015-10-15 19:36 ` ramana at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-10-10 10:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-10-10
                 CC|                            |ramana at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |chrbr at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Confirmed.


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-10-10 10:55 ` ramana at gcc dot gnu.org
@ 2015-10-15 19:36 ` ramana at gcc dot gnu.org
  2015-10-16 13:37 ` chrbr at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-10-15 19:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

--- Comment #5 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
*** Bug 67880 has been marked as a duplicate of this bug. ***


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-10-15 19:36 ` ramana at gcc dot gnu.org
@ 2015-10-16 13:37 ` chrbr at gcc dot gnu.org
  2015-10-16 13:53 ` chrbr at gcc dot gnu.org
  2015-10-16 14:15 ` chrbr at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-10-16 13:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

--- Comment #6 from chrbr at gcc dot gnu.org ---
Author: chrbr
Date: Fri Oct 16 13:37:14 2015
New Revision: 228904

URL: https://gcc.gnu.org/viewcvs?rev=228904&root=gcc&view=rev
Log:
2015-10-16  Christian Bruel  <christian.bruel@st.com>

        PR target/67745
        * config/arm/arm.h (FUNCTION_BOUNDARY): Move optimize_size condition
to:
        * config/arm/arm.c (arm_option_override_internal): Call
        arm_override_options_after_change_1.
        (arm_override_options_after_change): New function.
        (arm_override_options_after_change_1): Likewise.
        (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): Define hook.


Added:
    trunk/gcc/testsuite/gcc.target/arm/attr-align1.c
    trunk/gcc/testsuite/gcc.target/arm/attr-align2.c
    trunk/gcc/testsuite/gcc.target/arm/attr-align3.c
    trunk/gcc/testsuite/gcc.target/arm/no-align.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm.h
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-10-16 13:37 ` chrbr at gcc dot gnu.org
@ 2015-10-16 13:53 ` chrbr at gcc dot gnu.org
  2015-10-16 14:15 ` chrbr at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-10-16 13:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

--- Comment #7 from chrbr at gcc dot gnu.org ---
Author: chrbr
Date: Fri Oct 16 13:52:51 2015
New Revision: 228912

URL: https://gcc.gnu.org/viewcvs?rev=228912&root=gcc&view=rev
Log:
2015-10-16  Christian Bruel  <christian.bruel@st.com>

        PR target/67745
        * config/arm/arm.h (FUNCTION_BOUNDARY): Use FUNCTION_BOUNDARY_P.
        (FUNCTION_BOUNDARY_P): New macro:
        * config/arm/arm.c (TARGET_RELAYOUT_FUNCTION, arm_relayout_function): 
        New hook.
        * doc/tm.texi.in (TARGET_RELAYOUT_FUNCTION): Document.
        * doc/tm.texi (TARGET_RELAYOUT_FUNCTION): New hook.
        * gcc/target.def (TARGET_RELAYOUT_FUNCTION): Likewise.
        * gcc/function.c (allocate_struct_function): Call relayout_function
hook.
        * gcc/passes.c (rest_of_decl_compilation): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm.h
    trunk/gcc/doc/tm.texi
    trunk/gcc/doc/tm.texi.in
    trunk/gcc/function.c
    trunk/gcc/passes.c
    trunk/gcc/target.def


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

* [Bug target/67745] [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used
  2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-10-16 13:53 ` chrbr at gcc dot gnu.org
@ 2015-10-16 14:15 ` chrbr at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: chrbr at gcc dot gnu.org @ 2015-10-16 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67745

chrbr at gcc dot gnu.org changed:

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

--- Comment #8 from chrbr at gcc dot gnu.org ---
fixed at rev 228912


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

end of thread, other threads:[~2015-10-16 14:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 12:36 [Bug target/67745] New: [ARM] wrong alignments when __attribute__ ((optimize,target,align) is used chrbr at gcc dot gnu.org
2015-09-28 12:43 ` [Bug target/67745] " chrbr at gcc dot gnu.org
2015-09-28 12:48 ` chrbr at gcc dot gnu.org
2015-09-28 13:37 ` chrbr at gcc dot gnu.org
2015-09-29 13:33 ` chrbr at gcc dot gnu.org
2015-10-10 10:55 ` ramana at gcc dot gnu.org
2015-10-15 19:36 ` ramana at gcc dot gnu.org
2015-10-16 13:37 ` chrbr at gcc dot gnu.org
2015-10-16 13:53 ` chrbr at gcc dot gnu.org
2015-10-16 14:15 ` chrbr at gcc dot gnu.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).