RISC-V: Make sure stack is always aligned during adjusting stack.
authorKito Cheng <kito.cheng@gmail.com>
Fri, 20 Apr 2018 19:03:19 +0000 (19:03 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 20 Apr 2018 19:03:19 +0000 (12:03 -0700)
gcc/
2018-04-20  Kito Cheng  <kito.cheng@gmail.com>
* config/riscv/riscv.c (riscv_first_stack_step): Round up min
step to make sure stack always aligned.

From-SVN: r259530

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

index 1702d9520235d90e0df2b13c62ad099a7fe51c3e..d25e3e30a68aa910ec9828c74ee53486f9bc86d4 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-20  Kito Cheng  <kito.cheng@gmail.com>
+
+       * config/riscv/riscv.c (riscv_first_stack_step): Round up min
+       step to make sure stack always aligned.
+
 2018-04-20  Carl Love  <cel@us.ibm.com>
 
         PR target/83402
index 2870177fa97e4561b3d60d53dffe2b17e1182510..2a8f87d1e9447402d5da1c709d52b84ebf306295 100644 (file)
@@ -3507,7 +3507,8 @@ riscv_first_stack_step (struct riscv_frame_info *frame)
   if (SMALL_OPERAND (frame->total_size))
     return frame->total_size;
 
-  HOST_WIDE_INT min_first_step = frame->total_size - frame->fp_sp_offset;
+  HOST_WIDE_INT min_first_step =
+    RISCV_STACK_ALIGN (frame->total_size - frame->fp_sp_offset);
   HOST_WIDE_INT max_first_step = IMM_REACH / 2 - PREFERRED_STACK_BOUNDARY / 8;
   HOST_WIDE_INT min_second_step = frame->total_size - max_first_step;
   gcc_assert (min_first_step <= max_first_step);