From 86a21121ace5a75de9d57b4b9bd691388e0367bc Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Thu, 17 Nov 2016 16:16:38 +0000 Subject: [PATCH] re PR rtl-optimization/78355 (LRA generates unaligned accesses when SLOW_UNALIGNED_ACCESS is 1) PR rtl-optimization/78355 * doc/tm.texi.in (SLOW_UNALIGNED_ACCESS): Document that the macro only needs to deal with unaligned accesses. * doc/tm.texi: Regenerate. * lra-constraints.c (simplify_operand_subreg): Only invoke SLOW_UNALIGNED_ACCESS on innermode if the MEM is not aligned enough. Co-Authored-By: Eric Botcazou From-SVN: r242554 --- gcc/ChangeLog | 10 ++++++++++ gcc/doc/tm.texi | 3 ++- gcc/doc/tm.texi.in | 3 ++- gcc/lra-constraints.c | 7 ++++--- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1bb29c0ab03..bc2b86c5070 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-11-17 Pip Cet + Eric Botcazou + + PR rtl-optimization/78355 + * doc/tm.texi.in (SLOW_UNALIGNED_ACCESS): Document that the macro only + needs to deal with unaligned accesses. + * doc/tm.texi: Regenerate. + * lra-constraints.c (simplify_operand_subreg): Only invoke + SLOW_UNALIGNED_ACCESS on innermode if the MEM is not aligned enough. + 2016-11-17 David Malcolm * input.c (selftest::test_lexer_string_locations_long_line): New diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 84bba07de27..7bf09d1544f 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6368,7 +6368,8 @@ other fields in the same word of the structure, but to different bytes. Define this macro to be the value 1 if memory accesses described by the @var{mode} and @var{alignment} parameters have a cost many times greater than aligned accesses, for example if they are emulated in a trap -handler. +handler. This macro is invoked only for unaligned accesses, i.e. when +@code{@var{alignment} < GET_MODE_ALIGNMENT (@var{mode})}. When this macro is nonzero, the compiler will act as if @code{STRICT_ALIGNMENT} were nonzero when generating code for block diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 9afd5daa65b..58d1e638aff 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4656,7 +4656,8 @@ other fields in the same word of the structure, but to different bytes. Define this macro to be the value 1 if memory accesses described by the @var{mode} and @var{alignment} parameters have a cost many times greater than aligned accesses, for example if they are emulated in a trap -handler. +handler. This macro is invoked only for unaligned accesses, i.e. when +@code{@var{alignment} < GET_MODE_ALIGNMENT (@var{mode})}. When this macro is nonzero, the compiler will act as if @code{STRICT_ALIGNMENT} were nonzero when generating code for block diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index b592168f001..56b65ef81af 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -1486,9 +1486,10 @@ simplify_operand_subreg (int nop, machine_mode reg_mode) equivalences in function lra_constraints) and because for spilled pseudos we allocate stack memory enough for the biggest corresponding paradoxical subreg. */ - if (!SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg)) - || SLOW_UNALIGNED_ACCESS (innermode, MEM_ALIGN (reg)) - || MEM_ALIGN (reg) >= GET_MODE_ALIGNMENT (mode)) + if (!(MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (mode) + && SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg))) + || (MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (innermode) + && SLOW_UNALIGNED_ACCESS (innermode, MEM_ALIGN (reg)))) return true; /* INNERMODE is fast, MODE slow. Reload the mem in INNERMODE. */ -- 2.30.2