-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PowerPC] fix register alignment for long double type
This patch fixes register alignment for long double type in soft float mode. Before this patch alignment was 8 and this patch changes it to 4. Differential Revision: http://reviews.llvm.org/D18034 llvm-svn: 268909
- Loading branch information
Strahinja Petrovic
committed
May 9, 2016
1 parent
e3b8645
commit e682b80
Showing
7 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//===---- PPCCCState.cpp - CCState with PowerPC specific extensions ---------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "PPCCCState.h" | ||
#include "PPCSubtarget.h" | ||
#include "llvm/IR/Module.h" | ||
using namespace llvm; | ||
|
||
// Identify lowered values that originated from ppcf128 arguments and record | ||
// this. | ||
void PPCCCState::PreAnalyzeCallOperands( | ||
const SmallVectorImpl<ISD::OutputArg> &Outs) { | ||
for (const auto &I : Outs) { | ||
if (I.ArgVT == llvm::MVT::ppcf128) | ||
OriginalArgWasPPCF128.push_back(true); | ||
else | ||
OriginalArgWasPPCF128.push_back(false); | ||
} | ||
} | ||
|
||
void PPCCCState::PreAnalyzeFormalArguments( | ||
const SmallVectorImpl<ISD::InputArg> &Ins) { | ||
for (const auto &I : Ins) { | ||
if (I.ArgVT == llvm::MVT::ppcf128) { | ||
OriginalArgWasPPCF128.push_back(true); | ||
} else { | ||
OriginalArgWasPPCF128.push_back(false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===---- PPCCCState.h - CCState with PowerPC specific extensions -----------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef PPCCCSTATE_H | ||
#define PPCCCSTATE_H | ||
|
||
#include "PPCISelLowering.h" | ||
#include "llvm/ADT/SmallVector.h" | ||
#include "llvm/CodeGen/CallingConvLower.h" | ||
|
||
namespace llvm { | ||
|
||
class PPCCCState : public CCState { | ||
public: | ||
|
||
void | ||
PreAnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs); | ||
void | ||
PreAnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins); | ||
|
||
private: | ||
|
||
// Records whether the value has been lowered from an ppcf128. | ||
SmallVector<bool, 4> OriginalArgWasPPCF128; | ||
|
||
public: | ||
PPCCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF, | ||
SmallVectorImpl<CCValAssign> &locs, LLVMContext &C) | ||
: CCState(CC, isVarArg, MF, locs, C) {} | ||
|
||
bool WasOriginalArgPPCF128(unsigned ValNo) { return OriginalArgWasPPCF128[ValNo]; } | ||
void clearWasPPCF128() { OriginalArgWasPPCF128.clear(); } | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; RUN: llc -O2 -mtriple=powerpc-unknown-linux-gnu < %s | FileCheck %s | ||
|
||
@x = global ppc_fp128 0xM405EDA5E353F7CEE0000000000000000, align 16 | ||
@.str = private unnamed_addr constant [5 x i8] c"%Lf\0A\00", align 1 | ||
|
||
|
||
define void @foo() #0 { | ||
entry: | ||
%0 = load ppc_fp128, ppc_fp128* @x, align 16 | ||
%call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), ppc_fp128 %0) | ||
ret void | ||
} | ||
; Do not skip register r4 because of register alignment in soft float mode. Instead skipping | ||
; put in r4 part of first argument for printf function (long double). | ||
; CHECK: lwzu 4, x@l({{[0-9]+}}) | ||
|
||
declare i32 @printf(i8* nocapture readonly, ...) #0 | ||
|
||
attributes #0 = { "use-soft-float"="true" } | ||
|
||
|