Skip to content

Commit 15a7d02

Browse files
authored
Merge branch 'main' into clang-cuda-nan
2 parents 100645e + ed1f1b8 commit 15a7d02

File tree

88 files changed

+3080
-667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3080
-667
lines changed

clang/cmake/modules/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ include(FindPrefixFromConfig)
88
# the usual CMake convention seems to be ${Project}Targets.cmake.
99
set(CLANG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/clang" CACHE STRING
1010
"Path for CMake subdirectory for Clang (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/clang')")
11-
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
12-
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
1311

1412
# Keep this in sync with llvm/cmake/CMakeLists.txt!
1513
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
1614
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
1715
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
18-
string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}")
19-
set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm")
16+
string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_builddir "${LLVM_LIBRARY_DIR}")
17+
set(llvm_cmake_builddir "${llvm_builddir}/cmake/llvm")
18+
set(clang_cmake_builddir "${llvm_builddir}/cmake/clang")
2019

2120
get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
2221
export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)

clang/include/clang/Interpreter/Interpreter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ class Interpreter {
135135
std::string OrcRuntimePath = "";
136136
/// PID of the out-of-process JIT executor.
137137
uint32_t ExecutorPID = 0;
138+
/// An optional code model to provide to the JITTargetMachineBuilder
139+
std::optional<llvm::CodeModel::Model> CM = std::nullopt;
138140

139141
JITConfig()
140142
: IsOutOfProcess(false), OOPExecutor(""), OOPExecutorConnect(""),
141143
UseSharedMemory(false), SlabAllocateSize(0), OrcRuntimePath(""),
142-
ExecutorPID(0) {}
144+
ExecutorPID(0), CM(std::nullopt) {}
143145
};
144146

145147
protected:

clang/lib/Headers/f16cintrin.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
#define __DEFAULT_FN_ATTRS256 \
2121
__attribute__((__always_inline__, __nodebug__, __target__("f16c"), __min_vector_width__(256)))
2222

23+
#if defined(__cplusplus) && (__cplusplus >= 201103L)
24+
#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
25+
#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
26+
#else
27+
#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
28+
#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
29+
#endif
30+
2331
/* NOTE: Intel documents the 128-bit versions of these as being in emmintrin.h,
2432
* but that's because icc can emulate these without f16c using a library call.
2533
* Since we don't do that let's leave these in f16cintrin.h.
@@ -35,7 +43,7 @@
3543
/// \param __a
3644
/// A 16-bit half-precision float value.
3745
/// \returns The converted 32-bit float value.
38-
static __inline float __DEFAULT_FN_ATTRS128
46+
static __inline float __DEFAULT_FN_ATTRS128_CONSTEXPR
3947
_cvtsh_ss(unsigned short __a)
4048
{
4149
return (float)__builtin_bit_cast(__fp16, __a);
@@ -104,7 +112,7 @@ _cvtsh_ss(unsigned short __a)
104112
/// A 128-bit vector containing 16-bit half-precision float values. The lower
105113
/// 64 bits are used in the conversion.
106114
/// \returns A 128-bit vector of [4 x float] containing converted float values.
107-
static __inline __m128 __DEFAULT_FN_ATTRS128
115+
static __inline __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
108116
_mm_cvtph_ps(__m128i __a)
109117
{
110118
typedef __fp16 __v4fp16 __attribute__((__vector_size__(8)));
@@ -151,7 +159,7 @@ _mm_cvtph_ps(__m128i __a)
151159
/// converted to 32-bit single-precision float values.
152160
/// \returns A vector of [8 x float] containing the converted 32-bit
153161
/// single-precision float values.
154-
static __inline __m256 __DEFAULT_FN_ATTRS256
162+
static __inline __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
155163
_mm256_cvtph_ps(__m128i __a)
156164
{
157165
typedef __fp16 __v8fp16 __attribute__((__vector_size__(16), __aligned__(16)));
@@ -161,5 +169,7 @@ _mm256_cvtph_ps(__m128i __a)
161169

162170
#undef __DEFAULT_FN_ATTRS128
163171
#undef __DEFAULT_FN_ATTRS256
172+
#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
173+
#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
164174

165175
#endif /* __F16CINTRIN_H */

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ llvm::Error Interpreter::CreateExecutor(JITConfig Config) {
647647
auto JTMB = createJITTargetMachineBuilder(TT);
648648
if (!JTMB)
649649
return JTMB.takeError();
650+
if (Config.CM)
651+
JTMB->setCodeModel(Config.CM);
650652
auto JB = IncrementalExecutor::createDefaultJITBuilder(std::move(*JTMB));
651653
if (!JB)
652654
return JB.takeError();

clang/lib/Sema/HeuristicResolver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "clang/AST/ExprCXX.h"
1414
#include "clang/AST/TemplateBase.h"
1515
#include "clang/AST/Type.h"
16-
#include "llvm/ADT/identity.h"
1716

1817
namespace clang {
1918

@@ -562,7 +561,7 @@ HeuristicResolverImpl::getFunctionProtoTypeLoc(const Expr *Fn) {
562561
// In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
563562
// which has null parameters. Avoid these as they don't contain useful
564563
// information.
565-
if (llvm::all_of(F.getParams(), llvm::identity<ParmVarDecl *>()))
564+
if (!llvm::is_contained(F.getParams(), nullptr))
566565
return F;
567566
}
568567

clang/test/CodeGen/X86/f16c-builtins.c

100644100755
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
#include <immintrin.h>
13+
#include "builtin_test_helpers.h"
1314

1415
float test_cvtsh_ss(unsigned short a) {
1516
// CHECK-LABEL: test_cvtsh_ss
@@ -18,6 +19,10 @@ float test_cvtsh_ss(unsigned short a) {
1819
return _cvtsh_ss(a);
1920
}
2021

22+
TEST_CONSTEXPR(_cvtsh_ss(0x0000) == 0.0f);
23+
TEST_CONSTEXPR(_cvtsh_ss(0x4500) == 5.0f);
24+
TEST_CONSTEXPR(_cvtsh_ss(0xC000) == -2.0f);
25+
2126
unsigned short test_cvtss_sh(float a) {
2227
// CHECK-LABEL: test_cvtss_sh
2328
// CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 0
@@ -29,6 +34,11 @@ unsigned short test_cvtss_sh(float a) {
2934
return _cvtss_sh(a, 0);
3035
}
3136

37+
TEST_CONSTEXPR(match_m128(
38+
_mm_cvtph_ps(_mm_setr_epi16(0x3C00, 0x4000, 0x4200, 0x4400, 0, 0, 0, 0)),
39+
1.0f, 2.0f, 3.0f, 4.0f
40+
));
41+
3242
__m128 test_mm_cvtph_ps(__m128i a) {
3343
// CHECK-LABEL: test_mm_cvtph_ps
3444
// CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
@@ -41,6 +51,10 @@ __m256 test_mm256_cvtph_ps(__m128i a) {
4151
// CHECK: fpext <8 x half> %{{.*}} to <8 x float>
4252
return _mm256_cvtph_ps(a);
4353
}
54+
TEST_CONSTEXPR(match_m256(
55+
_mm256_cvtph_ps(_mm_setr_epi16(0x3C00, 0x4000, 0x4200, 0x4400, 0x4500, 0x3800, 0xC000, 0x0000)),
56+
1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 0.5f, -2.0f, 0.0f
57+
));
4458

4559
__m128i test_mm_cvtps_ph(__m128 a) {
4660
// CHECK-LABEL: test_mm_cvtps_ph

compiler-rt/lib/builtins/aarch64/sme-abi.S

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,17 +280,17 @@ DEFINE_COMPILERRT_FUNCTION(__arm_sme_save)
280280
mov w16, #1
281281
str x16, [x0]
282282

283-
add x18, x0, #32
283+
add x16, x0, #32
284284
tbz x17, #FEAT_SME2_BIT, 1f
285285

286286
// Store ZT0
287-
str zt0, [x18]
288-
add x18, x18, #64
287+
str zt0, [x16]
288+
add x16, x16, #64
289289

290290
1:
291-
// Set up lazy-save (x18 = pointer to buffer)
291+
// Set up lazy-save (x16 = pointer to buffer)
292292
rdsvl x17, #1
293-
str x18, [x0, #16]!
293+
str x16, [x0, #16]!
294294
strh w17, [x0, #8]
295295
strh wzr, [x0, #10]
296296
str wzr, [x0, #12]

flang/include/flang/Lower/AbstractConverter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ class AbstractConverter {
271271
virtual const Fortran::lower::pft::FunctionLikeUnit *
272272
getCurrentFunctionUnit() const = 0;
273273

274+
/// Check support of Multi-image features if -fcoarray is provided
275+
virtual void checkCoarrayEnabled() = 0;
276+
274277
//===--------------------------------------------------------------------===//
275278
// Types
276279
//===--------------------------------------------------------------------===//

flang/include/flang/Lower/OpenMP/Clauses.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ using Read = tomp::clause::ReadT<TypeTy, IdTy, ExprTy>;
277277
using Reduction = tomp::clause::ReductionT<TypeTy, IdTy, ExprTy>;
278278
using Relaxed = tomp::clause::RelaxedT<TypeTy, IdTy, ExprTy>;
279279
using Release = tomp::clause::ReleaseT<TypeTy, IdTy, ExprTy>;
280+
using Replayable = tomp::clause::ReplayableT<TypeTy, IdTy, ExprTy>;
280281
using ReverseOffload = tomp::clause::ReverseOffloadT<TypeTy, IdTy, ExprTy>;
281282
using Safelen = tomp::clause::SafelenT<TypeTy, IdTy, ExprTy>;
282283
using Schedule = tomp::clause::ScheduleT<TypeTy, IdTy, ExprTy>;
@@ -290,6 +291,7 @@ using Permutation = tomp::clause::PermutationT<TypeTy, IdTy, ExprTy>;
290291
using TaskReduction = tomp::clause::TaskReductionT<TypeTy, IdTy, ExprTy>;
291292
using ThreadLimit = tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy>;
292293
using Threads = tomp::clause::ThreadsT<TypeTy, IdTy, ExprTy>;
294+
using Transparent = tomp::clause::TransparentT<TypeTy, IdTy, ExprTy>;
293295
using To = tomp::clause::ToT<TypeTy, IdTy, ExprTy>;
294296
using UnifiedAddress = tomp::clause::UnifiedAddressT<TypeTy, IdTy, ExprTy>;
295297
using UnifiedSharedMemory =

flang/include/flang/Optimizer/Builder/IntrinsicCall.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,15 +573,6 @@ struct IntrinsicLibrary {
573573

574574
void setResultMustBeFreed() { resultMustBeFreed = true; }
575575

576-
// Check support of coarray features
577-
void checkCoarrayEnabled() {
578-
if (converter &&
579-
!converter->getFoldingContext().languageFeatures().IsEnabled(
580-
Fortran::common::LanguageFeature::Coarray))
581-
fir::emitFatalError(loc, "Coarrays disabled, use '-fcoarray' to enable.",
582-
false);
583-
}
584-
585576
fir::FirOpBuilder &builder;
586577
mlir::Location loc;
587578
bool resultMustBeFreed = false;

0 commit comments

Comments
 (0)