From 932c8900e78aaaab59f67736c314beb39cbcef9d Mon Sep 17 00:00:00 2001
From: "demin.han" <demin.han@starfivetech.com>
Date: Wed, 15 Mar 2023 15:22:49 +0800
Subject: [PATCH 547/547] [RISCV] default enable align-functions=16 and
 align-loops=8

---
 gcc/config/riscv/riscv.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index dc0af17b715..8fd0b5d2164 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -5156,7 +5156,16 @@ riscv_option_override (void)
 
       riscv_stack_protector_guard_offset = offs;
     }
-
+  gcc_options *opts = &global_options;
+  if (!opts->x_optimize_size)
+    {
+      if (opts->x_flag_align_loops && !opts->x_str_align_loops)
+	opts->x_str_align_loops = "8";
+      if (opts->x_flag_align_jumps && !opts->x_str_align_jumps)
+	opts->x_str_align_jumps = "0";
+      if (opts->x_flag_align_functions && !opts->x_str_align_functions)
+	opts->x_str_align_functions = "16";
+    }
 }
 
 /* Implement TARGET_CONDITIONAL_REGISTER_USAGE.  */
-- 
2.25.1

