r251786 - [x86] Front-end part of MCU psABI support
Andrey Bokhanko via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 2 01:54:17 PST 2015
Author: asbokhan
Date: Mon Nov 2 03:54:17 2015
New Revision: 251786
URL: http://llvm.org/viewvc/llvm-project?rev=251786&view=rev
Log:
[x86] Front-end part of MCU psABI support
This patch implements two things in front-end for MCU psABI support:
1) "long double type is the same as double."
2) "New predefined C/C++ pre-processor symbols: iamcu and iamcu__.
Differential Revision: http://reviews.llvm.org/D14205
Added:
cfe/trunk/test/Preprocessor/elfiamcu-predefines.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=251786&r1=251785&r2=251786&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Nov 2 03:54:17 2015
@@ -2335,7 +2335,8 @@ class X86TargetInfo : public TargetInfo
public:
X86TargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) {
BigEndian = false;
- LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
+ LongDoubleFormat = Triple.isOSIAMCU() ? &llvm::APFloat::IEEEdouble
+ : &llvm::APFloat::x87DoubleExtended;
}
unsigned getFloatEvalMethod() const override {
// X87 evaluates with 80 bits "long double" precision.
@@ -3370,6 +3371,11 @@ void X86TargetInfo::getTargetDefines(con
}
if (CPU >= CK_i586)
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+
+ if (getTriple().isOSIAMCU()) {
+ Builder.defineMacro("__iamcu");
+ Builder.defineMacro("__iamcu__");
+ }
}
bool X86TargetInfo::hasFeature(StringRef Feature) const {
Modified: cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c?rev=251786&r1=251785&r2=251786&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c Mon Nov 2 03:54:17 2015
@@ -56,3 +56,7 @@ st12_t retLargeStruct(int i1, st12_t r)
// insane.
// CHECK-LABEL: define i32 @varArgs(i32 inreg %i1, ...)
int varArgs(int i1, ...) { return i1; }
+
+// CHECK-LABEL: define double @longDoubleArg(double %ld1)
+long double longDoubleArg(long double ld1) { return ld1; }
+
Added: cfe/trunk/test/Preprocessor/elfiamcu-predefines.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/elfiamcu-predefines.c?rev=251786&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/elfiamcu-predefines.c (added)
+++ cfe/trunk/test/Preprocessor/elfiamcu-predefines.c Mon Nov 2 03:54:17 2015
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -E -dM -triple i586-intel-elfiamcu | FileCheck %s
+
+// CHECK: #define __iamcu
+// CHECK: #define __iamcu__
+
More information about the cfe-commits
mailing list