diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -492,6 +492,9 @@ ArrayRef getTargetBuiltins() const override; bool hasBitIntType() const override { return true; } + size_t getMaxBitIntWidth() const override { + return llvm::IntegerType::MAX_INT_BITS; + } }; class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo @@ -799,6 +802,9 @@ ArrayRef getTargetBuiltins() const override; bool hasBitIntType() const override { return true; } + size_t getMaxBitIntWidth() const override { + return llvm::IntegerType::MAX_INT_BITS; + } }; // x86-64 Windows target diff --git a/clang/test/CodeGen/ext-int-cc.c b/clang/test/CodeGen/ext-int-cc.c --- a/clang/test/CodeGen/ext-int-cc.c +++ b/clang/test/CodeGen/ext-int-cc.c @@ -131,10 +131,10 @@ // are negated. This will give an error when a target does support larger // _BitInt widths to alert us to enable the test. void ParamPassing4(_BitInt(129) a) {} -// LIN64-NOT: define{{.*}} void @ParamPassing4(ptr byval(i129) align 8 %{{.+}}) -// WIN64-NOT: define dso_local void @ParamPassing4(ptr %{{.+}}) -// LIN32-NOT: define{{.*}} void @ParamPassing4(ptr %{{.+}}) -// WIN32-NOT: define dso_local void @ParamPassing4(ptr %{{.+}}) +// LIN64: define{{.*}} void @ParamPassing4(ptr byval(i129) align 8 %{{.+}}) +// WIN64: define dso_local void @ParamPassing4(ptr %{{.+}}) +// LIN32: define{{.*}} void @ParamPassing4(ptr %{{.+}}) +// WIN32: define dso_local void @ParamPassing4(ptr %{{.+}}) // NACL-NOT: define{{.*}} void @ParamPassing4(ptr byval(i129) align 8 %{{.+}}) // NVPTX64-NOT: define{{.*}} void @ParamPassing4(ptr byval(i129) align 8 %{{.+}}) // NVPTX-NOT: define{{.*}} void @ParamPassing4(ptr byval(i129) align 8 %{{.+}}) @@ -290,10 +290,10 @@ #if __BITINT_MAXWIDTH__ > 128 _BitInt(129) ReturnPassing5(void){} -// LIN64-NOT: define{{.*}} void @ReturnPassing5(ptr noalias sret -// WIN64-NOT: define dso_local void @ReturnPassing5(ptr noalias sret -// LIN32-NOT: define{{.*}} void @ReturnPassing5(ptr noalias sret -// WIN32-NOT: define dso_local void @ReturnPassing5(ptr noalias sret +// LIN64: define{{.*}} void @ReturnPassing5(ptr noalias sret +// WIN64: define dso_local void @ReturnPassing5(ptr noalias sret +// LIN32: define{{.*}} void @ReturnPassing5(ptr noalias sret +// WIN32: define dso_local void @ReturnPassing5(ptr noalias sret // NACL-NOT: define{{.*}} void @ReturnPassing5(ptr noalias sret // NVPTX64-NOT: define{{.*}} i129 @ReturnPassing5( // NVPTX-NOT: define{{.*}} i129 @ReturnPassing5( diff --git a/clang/test/Lexer/bitint-constants.c b/clang/test/Lexer/bitint-constants.c --- a/clang/test/Lexer/bitint-constants.c +++ b/clang/test/Lexer/bitint-constants.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify -Wno-unused %s +// RUN: %clang_cc1 -triple aarch64-unknown-unknown -std=c2x -fsyntax-only -verify -Wno-unused %s // Test that the preprocessor behavior makes sense. #if 1wb != 1 diff --git a/clang/test/Preprocessor/cuda-types.cu b/clang/test/Preprocessor/cuda-types.cu --- a/clang/test/Preprocessor/cuda-types.cu +++ b/clang/test/Preprocessor/cuda-types.cu @@ -1,6 +1,6 @@ // Check that types, widths, __CLANG_ATOMIC* macros, etc. match on the host and -// device sides of CUDA compilations. Note that we filter out long double, as -// this is intentionally different on host and device. +// device sides of CUDA compilations. Note that we filter out long double and +// maxwidth of _BitInt(), as this is intentionally different on host and device. // // Also ignore __CLANG_ATOMIC_LLONG_LOCK_FREE on i386. The default host CPU for // an i386 triple is typically at least an i586, which has cmpxchg8b (Clang @@ -14,40 +14,40 @@ // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-host-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-device-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-device-defines-filtered // RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH' > %t/x86_64-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH' > %t/x86_64-device-defines-filtered // RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH' > %t/powerpc64-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/powerpc64-device-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH' > %t/powerpc64-device-defines-filtered // RUN: diff %t/powerpc64-host-defines-filtered %t/powerpc64-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-host-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-device-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH|_ATOMIC_LLONG_LOCK_FREE' > %t/i386-msvc-device-defines-filtered // RUN: diff %t/i386-msvc-host-defines-filtered %t/i386-msvc-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-msvc-host-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH' > %t/x86_64-msvc-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define __CLANG_ATOMIC' \ -// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-msvc-device-defines-filtered +// RUN: | grep -Ev '__LDBL|_LONG_DOUBLE|BITINT_MAXWIDTH' > %t/x86_64-msvc-device-defines-filtered // RUN: diff %t/x86_64-msvc-host-defines-filtered %t/x86_64-msvc-device-defines-filtered diff --git a/clang/test/Sema/large-bit-int.c b/clang/test/Sema/large-bit-int.c --- a/clang/test/Sema/large-bit-int.c +++ b/clang/test/Sema/large-bit-int.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fexperimental-max-bitint-width=1024 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple aarch64-unknown-unknown -fexperimental-max-bitint-width=1024 -fsyntax-only -verify %s void f() { _Static_assert(__BITINT_MAXWIDTH__ == 1024, "Macro value is unexpected."); diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp --- a/clang/test/SemaCXX/ext-int.cpp +++ b/clang/test/SemaCXX/ext-int.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -Wimplicit-int-conversion -Wno-unused -Wunevaluated-expression -triple x86_64-gnu-linux +// RUN: %clang_cc1 -fsyntax-only -verify %s -Wimplicit-int-conversion -Wno-unused -Wunevaluated-expression -triple aarch64-unknown-unknown template struct HasExtInt {