* [PATCH] RISC-V: If -m[no-]strict-align is not passed, assume its value from -mtune
@ 2017-11-03 16:16 Palmer Dabbelt
2017-11-05 0:38 ` Palmer Dabbelt
0 siblings, 1 reply; 2+ messages in thread
From: Palmer Dabbelt @ 2017-11-03 16:16 UTC (permalink / raw)
To: gcc-patches; +Cc: patches, Andrew Waterman
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. */
--
2.13.6
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] RISC-V: If -m[no-]strict-align is not passed, assume its value from -mtune
2017-11-03 16:16 [PATCH] RISC-V: If -m[no-]strict-align is not passed, assume its value from -mtune Palmer Dabbelt
@ 2017-11-05 0:38 ` Palmer Dabbelt
0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2017-11-05 0:38 UTC (permalink / raw)
To: gcc-patches; +Cc: patches, Andrew Waterman
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. */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-05 0:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 16:16 [PATCH] RISC-V: If -m[no-]strict-align is not passed, assume its value from -mtune Palmer Dabbelt
2017-11-05 0:38 ` Palmer Dabbelt
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).