[PATCH] D34859: [COFF, ARM64] Set the data type widths and the data layout string for COFF ARM64
efriedma added inline comments. Comment at: lib/Basic/Targets.cpp:6662 +DoubleAlign = LongLongAlign = 64; +LongDoubleWidth = LongDoubleAlign = 64; +IntMaxType = SignedLongLong; If you're changing LongDoubleWidth and LongDoubleAlign, you also have to change LongDoubleFormat. https://reviews.llvm.org/D34859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34859: [COFF, ARM64] Set the data type widths and the data layout string for COFF ARM64
mgrang updated this revision to Diff 106811. mgrang added a comment. Herald added a subscriber: javed.absar. Fixed typo. Added size for long double. Added test cases. https://reviews.llvm.org/D34859 Files: lib/Basic/Targets.cpp test/CodeGen/coff-aarch64-type-sizes.c Index: test/CodeGen/coff-aarch64-type-sizes.c === --- /dev/null +++ test/CodeGen/coff-aarch64-type-sizes.c @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -triple aarch64-windows -emit-llvm -w -o - %s | FileCheck %s + +// CHECK: target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" +// CHECK: target triple = "aarch64--windows-msvc" + +int check_short() { + return sizeof(short); +// CHECK: ret i32 2 +} + +int check_int() { + return sizeof(int); +// CHECK: ret i32 4 +} + +int check_long() { + return sizeof(long); +// CHECK: ret i32 4 +} + +int check_longlong() { + return sizeof(long long); +// CHECK: ret i32 8 +} + +int check_int128() { + return sizeof(__int128); +// CHECK: ret i32 16 +} + +int check_fp16() { + return sizeof(__fp16); +// CHECK: ret i32 2 +} + +int check_float() { + return sizeof(float); +// CHECK: ret i32 4 +} + +int check_double() { + return sizeof(double); +// CHECK: ret i32 8 +} + +int check_longdouble() { + return sizeof(long double); +// CHECK: ret i32 8 +} + +int check_floatComplex() { + return sizeof(float _Complex); +// CHECK: ret i32 8 +} + +int check_doubleComplex() { + return sizeof(double _Complex); +// CHECK: ret i32 16 +} + +int check_longdoubleComplex() { + return sizeof(long double _Complex); +// CHECK: ret i32 16 +} + +int check_bool() { + return sizeof(_Bool); +// CHECK: ret i32 1 +} + +int check_wchar() { + return sizeof(__WCHAR_TYPE__); +// CHECK: ret i32 2 +} + +int check_wchar_unsigned() { + return (__WCHAR_TYPE__)-1 > (__WCHAR_TYPE__)0; +// CHECK: ret i32 1 +} + +enum Small { + Item +}; + +int foo() { + return sizeof(enum Small); +// CHECK: ret i32 4 +} Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6652,13 +6652,25 @@ MicrosoftARM64TargetInfo(const llvm::Triple , const TargetOptions ) : WindowsTargetInfo(Triple, Opts), Triple(Triple) { + +// This is an LLP64 platform. +// int:4, long:4, long long:8, long double:8. WCharType = UnsignedShort; +IntWidth = IntAlign = 32; +LongWidth = LongAlign = 32; +DoubleAlign = LongLongAlign = 64; +LongDoubleWidth = LongDoubleAlign = 64; +IntMaxType = SignedLongLong; +Int64Type = SignedLongLong; SizeType = UnsignedLongLong; +PtrDiffType = SignedLongLong; +IntPtrType = SignedLongLong; + TheCXXABI.set(TargetCXXABI::Microsoft); } void setDataLayout() override { -resetDataLayout("e-m:w-i64:64-i128:128-n32:64-S128"); +resetDataLayout("e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"); } void getVisualStudioDefines(const LangOptions , ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34859: [COFF, ARM64] Set the data type widths and the data layout string for COFF ARM64
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. Can you please double check the type of `long double` as well? Comment at: lib/Basic/Targets.cpp:6583 + +// This is an LLP64 paltform. +// int:4, long:4, long long:8. Typo: `platform`. https://reviews.llvm.org/D34859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34859: [COFF, ARM64] Set the data type widths and the data layout string for COFF ARM64
mgrang created this revision. Herald added subscribers: kristof.beyls, aemerson. COFF ARM64 is LLP64 platform. So int is 4 bytes, long is 4 bytes and long long is 8 bytes. https://reviews.llvm.org/D34859 Files: lib/Basic/Targets.cpp Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6579,13 +6579,24 @@ MicrosoftARM64TargetInfo(const llvm::Triple , const TargetOptions ) : WindowsTargetInfo(Triple, Opts), Triple(Triple) { + +// This is an LLP64 paltform. +// int:4, long:4, long long:8. WCharType = UnsignedShort; +IntWidth = IntAlign = 32; +LongWidth = LongAlign = 32; +DoubleAlign = LongLongAlign = 64; +IntMaxType = SignedLongLong; +Int64Type = SignedLongLong; SizeType = UnsignedLongLong; +PtrDiffType = SignedLongLong; +IntPtrType = SignedLongLong; + TheCXXABI.set(TargetCXXABI::Microsoft); } void setDataLayout() override { -resetDataLayout("e-m:w-i64:64-i128:128-n32:64-S128"); +resetDataLayout("e-m:w-p:64:64-i32:32-i64:64-i128:128:128"); } void getVisualStudioDefines(const LangOptions , Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6579,13 +6579,24 @@ MicrosoftARM64TargetInfo(const llvm::Triple , const TargetOptions ) : WindowsTargetInfo(Triple, Opts), Triple(Triple) { + +// This is an LLP64 paltform. +// int:4, long:4, long long:8. WCharType = UnsignedShort; +IntWidth = IntAlign = 32; +LongWidth = LongAlign = 32; +DoubleAlign = LongLongAlign = 64; +IntMaxType = SignedLongLong; +Int64Type = SignedLongLong; SizeType = UnsignedLongLong; +PtrDiffType = SignedLongLong; +IntPtrType = SignedLongLong; + TheCXXABI.set(TargetCXXABI::Microsoft); } void setDataLayout() override { -resetDataLayout("e-m:w-i64:64-i128:128-n32:64-S128"); +resetDataLayout("e-m:w-p:64:64-i32:32-i64:64-i128:128:128"); } void getVisualStudioDefines(const LangOptions , ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits