aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorKazushi (Jam) Marukawa <marukawa@nec.com>2020-07-25 16:31:07 +0900
committerKazushi (Jam) Marukawa <marukawa@nec.com>2020-08-04 08:07:05 +0900
commit045e79e77c252f2c73c640e820e977ef52836d50 (patch)
tree49ce099640705327e8c191609bce1ce74efdf5a0 /clang/lib/CodeGen/TargetInfo.cpp
parent3b92db4c846ef3c7295444fa0b554905de0774b2 (diff)
downloadllvm-045e79e77c252f2c73c640e820e977ef52836d50.zip
llvm-045e79e77c252f2c73c640e820e977ef52836d50.tar.gz
llvm-045e79e77c252f2c73c640e820e977ef52836d50.tar.bz2
[VE] Extend integer arguments and return values smaller than 64 bits
In order to follow NEC Aurora SX VE ABI correctly, change to sign/zero extend integer arguments and return values smaller than 64 bits in clang. Also update regression test. Reviewed By: simoll Differential Revision: https://reviews.llvm.org/D85071
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index f31d432..e011cfa 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -10743,21 +10743,24 @@ private:
} // end anonymous namespace
ABIArgInfo VEABIInfo::classifyReturnType(QualType Ty) const {
- if (Ty->isAnyComplexType()) {
+ if (Ty->isAnyComplexType())
return ABIArgInfo::getDirect();
- }
+ uint64_t Size = getContext().getTypeSize(Ty);
+ if (Size < 64 && Ty->isIntegerType())
+ return ABIArgInfo::getExtend(Ty);
return DefaultABIInfo::classifyReturnType(Ty);
}
ABIArgInfo VEABIInfo::classifyArgumentType(QualType Ty) const {
- if (Ty->isAnyComplexType()) {
+ if (Ty->isAnyComplexType())
return ABIArgInfo::getDirect();
- }
+ uint64_t Size = getContext().getTypeSize(Ty);
+ if (Size < 64 && Ty->isIntegerType())
+ return ABIArgInfo::getExtend(Ty);
return DefaultABIInfo::classifyArgumentType(Ty);
}
void VEABIInfo::computeInfo(CGFunctionInfo &FI) const {
-
FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
for (auto &Arg : FI.arguments())
Arg.info = classifyArgumentType(Arg.type);