Re: [PATCH] D14205: [x86] Front-end part of MCU psABI support
andreybokhanko added a comment. Michael, Thanks for the review! As for your comment, I will investigate and fix (if needed). Andrey Comment at: lib/Basic/Targets.cpp:2327 @@ -2325,3 +2326,3 @@ // X87 evaluates with 80 bits "long double" precision. return SSELevel == NoSSE ? 2 : 0; } mkuper wrote: > Do you know if we should also change this to be 0? Good catch. Let me investigate and change (if needed) in another patch. Repository: rL LLVM http://reviews.llvm.org/D14205 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14205: [x86] Front-end part of MCU psABI support
This revision was automatically updated to reflect the committed changes. Closed by commit rL251786: [x86] Front-end part of MCU psABI support (authored by asbokhan). Changed prior to commit: http://reviews.llvm.org/D14205?vs=38814&id=38878#toc Repository: rL LLVM http://reviews.llvm.org/D14205 Files: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c cfe/trunk/test/Preprocessor/elfiamcu-predefines.c Index: cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c === --- cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c +++ cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c @@ -56,3 +56,7 @@ // 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; } + Index: cfe/trunk/test/Preprocessor/elfiamcu-predefines.c === --- cfe/trunk/test/Preprocessor/elfiamcu-predefines.c +++ cfe/trunk/test/Preprocessor/elfiamcu-predefines.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -E -dM -triple i586-intel-elfiamcu | FileCheck %s + +// CHECK: #define __iamcu +// CHECK: #define __iamcu__ + Index: cfe/trunk/lib/Basic/Targets.cpp === --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -2335,7 +2335,8 @@ 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 @@ } 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 { Index: cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c === --- cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c +++ cfe/trunk/test/CodeGen/x86_32-arguments-iamcu.c @@ -56,3 +56,7 @@ // 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; } + Index: cfe/trunk/test/Preprocessor/elfiamcu-predefines.c === --- cfe/trunk/test/Preprocessor/elfiamcu-predefines.c +++ cfe/trunk/test/Preprocessor/elfiamcu-predefines.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -E -dM -triple i586-intel-elfiamcu | FileCheck %s + +// CHECK: #define __iamcu +// CHECK: #define __iamcu__ + Index: cfe/trunk/lib/Basic/Targets.cpp === --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -2335,7 +2335,8 @@ 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 @@ } 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 { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14205: [x86] Front-end part of MCU psABI support
mkuper accepted this revision. mkuper added a comment. This revision is now accepted and ready to land. LGTM Comment at: lib/Basic/Targets.cpp:2327 @@ -2325,3 +2326,3 @@ // X87 evaluates with 80 bits "long double" precision. return SSELevel == NoSSE ? 2 : 0; } Do you know if we should also change this to be 0? http://reviews.llvm.org/D14205 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D14205: [x86] Front-end part of MCU psABI support
andreybokhanko created this revision. andreybokhanko added reviewers: rnk, DavidKreitzer, mkuper. andreybokhanko added a subscriber: cfe-commits. This patch implements front-end parts of MCU psABI (https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnx4MzJhYml8Z3g6NzFhMGYzMjUzZDQzODllMw) support: 1) "long double type is the same as double." 2) "New predefined C/C++ pre-processor symbols: __iamcu and __iamcu__. http://reviews.llvm.org/D14205 Files: lib/Basic/Targets.cpp test/CodeGen/x86_32-arguments-iamcu.c test/Preprocessor/elfiamcu-predefines.c Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2319,7 +2319,8 @@ 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. @@ -3354,6 +3355,11 @@ } 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 { Index: test/CodeGen/x86_32-arguments-iamcu.c === --- test/CodeGen/x86_32-arguments-iamcu.c +++ test/CodeGen/x86_32-arguments-iamcu.c @@ -56,3 +56,7 @@ // 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; } + Index: test/Preprocessor/elfiamcu-predefines.c === --- test/Preprocessor/elfiamcu-predefines.c +++ test/Preprocessor/elfiamcu-predefines.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -E -dM -triple i586-intel-elfiamcu | FileCheck %s + +// CHECK: #define __iamcu +// CHECK: #define __iamcu__ + Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2319,7 +2319,8 @@ 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. @@ -3354,6 +3355,11 @@ } 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 { Index: test/CodeGen/x86_32-arguments-iamcu.c === --- test/CodeGen/x86_32-arguments-iamcu.c +++ test/CodeGen/x86_32-arguments-iamcu.c @@ -56,3 +56,7 @@ // 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; } + Index: test/Preprocessor/elfiamcu-predefines.c === --- test/Preprocessor/elfiamcu-predefines.c +++ test/Preprocessor/elfiamcu-predefines.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -E -dM -triple i586-intel-elfiamcu | FileCheck %s + +// CHECK: #define __iamcu +// CHECK: #define __iamcu__ + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits