This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] RISC-V: If -m[no-]strict-align is not passed, assume its value from -mtune


On Fri, 03 Nov 2017 09:14:10 PDT (-0700), Palmer Dabbelt wrote:
> From: Andrew Waterman <andrew@sifive.com>
>
> 2017-11-03  Andrew Waterman  <andrew@sifive.com>
>
> 	* config/riscv/riscv.c (riscv_option_override): Conditionally set
> 	TARGET_STRICT_ALIGN based upon -mtune argument.
> ---
>  gcc/config/riscv/riscv.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
> index b81a2d29fbfd..f0b05d7eaeda 100644
> --- a/gcc/config/riscv/riscv.c
> +++ b/gcc/config/riscv/riscv.c
> @@ -3772,9 +3772,13 @@ riscv_option_override (void)
>
>    /* Use -mtune's setting for slow_unaligned_access, even when optimizing
>       for size.  For architectures that trap and emulate unaligned accesses,
> -     the performance cost is too great, even for -Os.  */
> -  riscv_slow_unaligned_access_p = (cpu->tune_info->slow_unaligned_access
> -				   || TARGET_STRICT_ALIGN);
> +     the performance cost is too great, even for -Os.  Similarly, if
> +     -m[no-]strict-align is left unspecified, heed -mtune's advice.  */
> +  riscv_slow_unaligned_access = (cpu->tune_info->slow_unaligned_access
> +				 || TARGET_STRICT_ALIGN);
> +  if ((target_flags_explicit & MASK_STRICT_ALIGN) == 0
> +      && cpu->tune_info->slow_unaligned_access)
> +    target_flags |= MASK_STRICT_ALIGN;
>
>    /* If the user hasn't specified a branch cost, use the processor's
>       default.  */

This was a bit broken, we missed a cleanup patch.  I committed the following

diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index b81a2d29fbfd..52bbc25d0cce 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -3772,9 +3772,13 @@ riscv_option_override (void)

   /* Use -mtune's setting for slow_unaligned_access, even when optimizing
      for size.  For architectures that trap and emulate unaligned accesses,
-     the performance cost is too great, even for -Os.  */
+     the performance cost is too great, even for -Os.  Similarly, if
+     -m[no-]strict-align is left unspecified, heed -mtune's advice.  */
   riscv_slow_unaligned_access_p = (cpu->tune_info->slow_unaligned_access
                                   || TARGET_STRICT_ALIGN);
+  if ((target_flags_explicit & MASK_STRICT_ALIGN) == 0
+      && cpu->tune_info->slow_unaligned_access)
+    target_flags |= MASK_STRICT_ALIGN;

   /* If the user hasn't specified a branch cost, use the processor's
      default.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]