[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2018-07-04 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Martin Liška  ---
Implemented in trunk now.

[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2018-07-04 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

--- Comment #9 from Martin Liška  ---
Author: marxin
Date: Wed Jul  4 07:51:08 2018
New Revision: 262375

URL: https://gcc.gnu.org/viewcvs?rev=262375=gcc=rev
Log:


2018-07-04  Denys Vlasenko  
Martin Liska  

PR middle-end/66240
PR target/45996
PR c/84100
* common.opt: Rename align options with 'str_' prefix.
* common/config/i386/i386-common.c (set_malign_value): New
function.
(ix86_handle_option): Use it to set -falign-* options/
* config/aarch64/aarch64-protos.h (struct tune_params): Change
type from int to string.
* config/aarch64/aarch64.c: Update default values from int
to string.
* config/alpha/alpha.c (alpha_override_options_after_change):
Likewise.
* config/arm/arm.c (arm_override_options_after_change_1): Likewise.
* config/i386/dragonfly.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Print
max skip conditionally.
* config/i386/freebsd.h (SUBALIGN_LOG): New.
(ASM_OUTPUT_MAX_SKIP_ALIGN): Print
max skip conditionally.
* config/i386/gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Print
max skip conditionally.
* config/i386/gnu-user.h (SUBALIGN_LOG): New.
(ASM_OUTPUT_MAX_SKIP_ALIGN): Print
max skip conditionally.
* config/i386/i386.c (struct ptt): Change type from int to
string.
(ix86_default_align): Set default values.
* config/i386/i386.h (ASM_OUTPUT_MAX_SKIP_PAD): Print
max skip conditionally.
* config/i386/iamcu.h (SUBALIGN_LOG): New.
(ASM_OUTPUT_MAX_SKIP_ALIGN):
* config/i386/lynx.h (ASM_OUTPUT_MAX_SKIP_ALIGN):
* config/i386/netbsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Print
max skip conditionally.
* config/i386/openbsdelf.h (SUBALIGN_LOG): New.
(ASM_OUTPUT_MAX_SKIP_ALIGN) Print max skip conditionally.:
* config/i386/x86-64.h (SUBALIGN_LOG): New.
(ASM_OUTPUT_MAX_SKIP_ALIGN): Print
max skip conditionally.
(ASM_OUTPUT_MAX_SKIP_PAD): Likewise.
* config/ia64/ia64.c (ia64_option_override): Set default values
for alignment options.
* config/m68k/m68k.c: Handle new str_align_* options.
* config/mips/mips.c (mips_set_compression_mode): Change
type of constants.
(mips_option_override): Set default values for options.
* config/powerpcspe/powerpcspe.c (rs6000_option_override_internal):
Likewise.
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Likewise.
* config/rx/rx.c (rx_option_override): Likewise.
* config/rx/rx.h (JUMP_ALIGN): Use align_jumps_log.
(LABEL_ALIGN): Use align_labels_log.
(LOOP_ALIGN): Use align_loops_align.
* config/s390/s390.c (s390_asm_output_function_label): Use new
macros.
* config/sh/sh.c (sh_override_options_after_change):
Change type of constants.
* config/spu/spu.c (spu_sched_init): Likewise.
* config/sparc/sparc.c (sparc_option_override): Set default
values for options.
* config/visium/visium.c (visium_option_override): Likewise.
* config/visium/visium.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Do not
emit p2align format with last argument if it's not needed.
* doc/invoke.texi: Document extended format of -falign-*.
* final.c: Use align_labels alignment.
* flags.h (struct target_flag_state): Change type to use
align_flags.
(struct align_flags_tuple): New.
(struct align_flags): Likewise.
(align_loops_log): Redefine macro to use new types.
(align_loops_max_skip): Redefine macro to use new types.
(align_jumps_log): Redefine macro to use new types.
(align_jumps_max_skip): Redefine macro to use new types.
(align_labels_log): Redefine macro to use new types.
(align_labels_max_skip): Redefine macro to use new types.
(align_functions_log): Redefine macro to use new types.
(align_loops): Redefine macro to use new types.
(align_jumps): Redefine macro to use new types.
(align_labels): Redefine macro to use new types.
(align_functions): Redefine macro to use new types.
(align_functions_max_skip): Redefine macro to use new types.
(align_loops_value): New macro.
(align_jumps_value): New macro.
(align_labels_value): New macro.
(align_functions_value): New macro.
* function.c (invoke_set_current_function_hook): Propagate
alignment values from flags to global variables default in
topleev.h.
* ipa-icf.c (sem_function::equals_wpa): Use
cl_optimization_option_eq instead of memcmp.
* lto-streamer.h (cl_optimization_stream_out): Support streaming
of string types.
(cl_optimization_stream_in): Likewise.
* optc-save-gen.awk: 

[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2018-06-12 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #8 from Jeffrey A. Law  ---
In response to c#2 and c#3, you're more likely to get that kind of "ideal"
solution by hacking the linker rather than the compiler or assembler.  The
linker is in an ideal position to make these kinds of decisions.

You can even use the linker to fill in padding at the end of a function with a
nearby teeny-tiny function.  You don't want to do that too aggressively though
because often functions in the same CU often call each other and you can easily
muck up locality if you move a teeny-tiny function too far from its parents or
children in the call graph/chain.

If you want to get really smart, you start collecting data about the call
graph, chains and frequencies, icache and itlb behavior and use that to drive
general code layout to improve icache/itlb behavior as well as smart alignments
of functions.  Been there, done that :-)

[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2018-05-21 Thread vda.linux at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

--- Comment #7 from Denis Vlasenko  ---
Patch v8

https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00792.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00793.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00794.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00795.html

[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2017-04-17 Thread vda.linux at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

--- Comment #6 from Denis Vlasenko  ---
Patches v7 are posted:

https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00720.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00721.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00722.html
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00723.html

[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2016-08-30 Thread vda.linux at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

--- Comment #5 from Denis Vlasenko  ---
Patches v3 posted to the mailing list:

https://gcc.gnu.org/ml/gcc-patches/2016-08/msg02073.html
https://gcc.gnu.org/ml/gcc-patches/2016-08/msg02074.html

[Bug middle-end/66240] RFE: extend -falign-xyz syntax

2016-04-16 Thread vda.linux at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

--- Comment #4 from Denis Vlasenko  ---
Created attachment 38293
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38293=edit
Proposed patch

This patch implements -falign-functions=N[,M] for now, with the eye for easy
extension to other -falign options.

I tested that with -falign-functions=N (tried 8, 15, 16, 17...) the alignment
directives are the same before and after the patch:

-falign-functions=8  generates ".p2align 3,,7" before and after.
-falign-functions=17 generates ".p2align 5,,16" before and after.

I tested that -falign-functions=N,N (two equal paramenters) works exactly like
-falign-functions=N.

Patch drops currently performed forced alignment to 8 if requested alignment is
higher than 8: before the patch, -falign-functions=9 was generating

.p2align 4,,8
.p2align 3

which means "Align to 16 if the skip is 8 bytes or less; else align to 8".
After the patch, "p2align 3" is not emitted.

I drop that because I ultimately want to do something like
-falign-functions=64,8 - IOW, I want to align functions by 64 bytes, but only
if that entails a skip of less than 8 bytes - otherwise I want **no alignment
at all**. The forced ".p2align 3" interferes with that intention.

This is an RFC-patch, IOW: I don't insist on removal of ".p2align 3"
generation. I imagine that it should be retained for compat, and yet another
option should be added to suppress it if desired (how about
"-mno-8byte-code-subalign"? Argh...)