[X86][clang] Lift _BitInt() supported max width.

Reviewed By: mgehre-amd

Differential Revision: https://reviews.llvm.org/D139170
This commit is contained in:
Freddy Ye 2022-12-06 10:19:12 +08:00
parent e6d2665df3
commit def720726b
7 changed files with 30 additions and 23 deletions

View File

@ -763,6 +763,7 @@ X86 Support in Clang
* Support intrinsic of ``_mm(256)_cvtneps_avx_pbh``.
- ``-march=raptorlake`` and ``-march=meteorlake`` are now supported.
- ``-march=sierraforest``, ``-march=graniterapids`` and ``-march=grandridge`` are now supported.
- Lift _BitInt() supported max width from 128 to 8388608.
WebAssembly Support in Clang
----------------------------

View File

@ -492,6 +492,9 @@ public:
ArrayRef<Builtin::Info> 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 @@ public:
ArrayRef<Builtin::Info> getTargetBuiltins() const override;
bool hasBitIntType() const override { return true; }
size_t getMaxBitIntWidth() const override {
return llvm::IntegerType::MAX_INT_BITS;
}
};
// x86-64 Windows target

View File

@ -131,10 +131,10 @@ void ParamPassing3(_BitInt(15) a, _BitInt(31) b) {}
// 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 @@ _BitInt(128) ReturnPassing4(void){}
#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(

View File

@ -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

View File

@ -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

View File

@ -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.");

View File

@ -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<int Bounds>
struct HasExtInt {