From: John Baldwin Date: Fri, 11 Aug 2017 22:07:56 +0000 (+0000) Subject: [MIPS] Use ABI to determine stack alignment. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f722db8b0a2886951b1d0da6bf001e3d0c82f2e7;p=llvm [MIPS] Use ABI to determine stack alignment. Summary: The stack alignment depends on the ABI (16 bytes for N32 and N64 and 8 bytes for O32), not the CPU type. Reviewers: sdardis Reviewed By: sdardis Subscribers: atanasyan, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D36326 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310768 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h index cce3b8c4c8d..ef04c931138 100644 --- a/lib/Target/Mips/MipsSubtarget.h +++ b/lib/Target/Mips/MipsSubtarget.h @@ -295,7 +295,9 @@ public: // really use them if in addition we are in mips16 mode static bool useConstantIslands(); - unsigned stackAlignment() const { return hasMips64() ? 16 : 8; } + unsigned stackAlignment() const { + return isABI_N32() || isABI_N64() ? 16 : 8; + } // Grab relocation model Reloc::Model getRelocationModel() const; diff --git a/test/CodeGen/Mips/stack-alignment.ll b/test/CodeGen/Mips/stack-alignment.ll index b18f96695ff..619550fa75b 100644 --- a/test/CodeGen/Mips/stack-alignment.ll +++ b/test/CodeGen/Mips/stack-alignment.ll @@ -1,9 +1,11 @@ ; RUN: llc -march=mipsel < %s | FileCheck %s -check-prefix=32 ; RUN: llc -march=mipsel -mattr=+fp64 < %s | FileCheck %s -check-prefix=32 +; RUN: llc -march=mips64el -mcpu=mips3 < %s | FileCheck %s -check-prefix=64 +; RUN: llc -march=mips64el -mcpu=mips4 < %s | FileCheck %s -check-prefix=64 ; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s -check-prefix=64 ; 32: addiu $sp, $sp, -8 -; 64: addiu $sp, $sp, -16 +; 64: daddiu $sp, $sp, -16 define i32 @foo1() #0 { entry: