RISC-V: If -m[no-]strict-align is not passed, assume its value from -mtune
authorAndrew Waterman <andrew@sifive.com>
Sun, 5 Nov 2017 00:39:01 +0000 (00:39 +0000)
committerPalmer Dabbelt <palmer@gcc.gnu.org>
Sun, 5 Nov 2017 00:39:01 +0000 (00:39 +0000)
2017-11-04  Andrew Waterman  <andrew@sifive.com>

* config/riscv/riscv.c (riscv_option_override): Conditionally set
TARGET_STRICT_ALIGN based upon -mtune argument.

From-SVN: r254417

gcc/ChangeLog
gcc/config/riscv/riscv.c

index 285ac2014df87e429d82beff5301a0888105c094..09b0cd7ca03ffb3c1689de399245886837aa486b 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-04  Andrew Waterman  <andrew@sifive.com>
+
+       * config/riscv/riscv.c (riscv_option_override): Conditionally set
+       TARGET_STRICT_ALIGN based upon -mtune argument.
+
 2017-11-04  Andrew Waterman  <andrew@sifive.com>
 
        * config/riscv/riscv.h (SLOW_BYTE_ACCESS): Change to 1.
index b81a2d29fbfdd5f2778b8cf1f9f8cb1848110371..52bbc25d0cce11aad2f89a13d2e504f63aaed56d 100644 (file)
@@ -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.  */