Skip to content

Commit e5c7d7e

Browse files
authored
merge main into amd-staging (llvm#2176)
2 parents f4201b7 + c429fd7 commit e5c7d7e

File tree

123 files changed

+3017
-909
lines changed

Some content is hidden

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

123 files changed

+3017
-909
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,6 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
474474
return false;
475475
return this->emitDecayPtr(*FromT, *ToT, CE);
476476
}
477-
478-
case CK_LValueToRValueBitCast:
479-
return this->emitBuiltinBitCast(CE);
480-
481477
case CK_IntegralToBoolean:
482478
case CK_FixedPointToBoolean: {
483479
// HLSL uses this to cast to one-element vectors.
@@ -735,6 +731,11 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
735731
llvm_unreachable("Unhandled clang::CastKind enum");
736732
}
737733

734+
template <class Emitter>
735+
bool Compiler<Emitter>::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *E) {
736+
return this->emitBuiltinBitCast(E);
737+
}
738+
738739
template <class Emitter>
739740
bool Compiler<Emitter>::VisitIntegerLiteral(const IntegerLiteral *LE) {
740741
if (DiscardResult)

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
126126

127127
// Expressions.
128128
bool VisitCastExpr(const CastExpr *E);
129+
bool VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *E);
129130
bool VisitIntegerLiteral(const IntegerLiteral *E);
130131
bool VisitFloatingLiteral(const FloatingLiteral *E);
131132
bool VisitImaginaryLiteral(const ImaginaryLiteral *E);

clang/lib/Headers/__clang_hip_cmath.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,13 @@ class __promote : public __promote_imp<_A1, _A2, _A3> {};
466466
#if __cplusplus >= 201103L
467467
#define __HIP_OVERLOAD2(__retty, __fn) \
468468
template <typename __T1, typename __T2> \
469-
__DEVICE__ __CONSTEXPR__ typename __hip_enable_if< \
470-
__hip::is_arithmetic<__T1>::value && __hip::is_arithmetic<__T2>::value, \
471-
typename __hip::__promote<__T1, __T2>::type>::type \
472-
__fn(__T1 __x, __T2 __y) { \
473-
typedef typename __hip::__promote<__T1, __T2>::type __result_type; \
474-
return __fn((__result_type)__x, (__result_type)__y); \
469+
__DEVICE__ __CONSTEXPR__ \
470+
typename __hip_enable_if<__hip::is_arithmetic<__T1>::value && \
471+
__hip::is_arithmetic<__T2>::value, \
472+
__retty>::type \
473+
__fn(__T1 __x, __T2 __y) { \
474+
typedef typename __hip::__promote<__T1, __T2>::type __arg_type; \
475+
return __fn((__arg_type)__x, (__arg_type)__y); \
475476
}
476477
#else
477478
#define __HIP_OVERLOAD2(__retty, __fn) \

clang/test/AST/ByteCode/builtin-bit-cast.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,16 @@ namespace OversizedBitField {
503503
#endif
504504
}
505505

506+
namespace Discarded {
507+
enum my_byte : unsigned char {};
508+
struct pad {
509+
char a;
510+
int b;
511+
};
512+
constexpr int bad_my_byte = (__builtin_bit_cast(my_byte[8], pad{1, 2}), 0); // both-error {{must be initialized by a constant expression}} \
513+
// both-note {{indeterminate value can only initialize an object of type 'unsigned char' or 'std::byte';}}
514+
}
515+
506516
typedef bool bool9 __attribute__((ext_vector_type(9)));
507517
// both-error@+2 {{constexpr variable 'bad_bool9_to_short' must be initialized by a constant expression}}
508518
// both-note@+1 {{bit_cast involving type 'bool __attribute__((ext_vector_type(9)))' (vector of 9 'bool' values) is not allowed in a constant expression; element size 1 * element count 9 is not a multiple of the byte size 8}}

clang/test/CodeGen/AArch64/struct-coerce-using-ptr.cpp

Lines changed: 622 additions & 0 deletions
Large diffs are not rendered by default.

clang/test/Headers/__clang_hip_cmath-return_types.hip

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -376,19 +376,19 @@ __device__ void test_isnormal()
376376
__device__ void test_isgreater()
377377
{
378378
static_assert(is_same<decltype(isgreater((float)0, (float)0)), bool>::value, "");
379-
static_assert(is_same<decltype(isgreater((float)0, (double)0)), double>::value, "");
380-
static_assert(is_same<decltype(isgreater((double)0, (float)0)), double>::value, "");
379+
static_assert(is_same<decltype(isgreater((float)0, (double)0)), bool>::value, "");
380+
static_assert(is_same<decltype(isgreater((double)0, (float)0)), bool>::value, "");
381381
static_assert(is_same<decltype(isgreater((double)0, (double)0)), bool>::value, "");
382-
static_assert(is_same<decltype(isgreater(0, (double)0)), double>::value, "");
382+
static_assert(is_same<decltype(isgreater(0, (double)0)), bool>::value, "");
383383
}
384384

385385
__device__ void test_isgreaterequal()
386386
{
387387
static_assert(is_same<decltype(isgreaterequal((float)0, (float)0)), bool>::value, "");
388-
static_assert(is_same<decltype(isgreaterequal((float)0, (double)0)), double>::value, "");
389-
static_assert(is_same<decltype(isgreaterequal((double)0, (float)0)), double>::value, "");
388+
static_assert(is_same<decltype(isgreaterequal((float)0, (double)0)), bool>::value, "");
389+
static_assert(is_same<decltype(isgreaterequal((double)0, (float)0)), bool>::value, "");
390390
static_assert(is_same<decltype(isgreaterequal((double)0, (double)0)), bool>::value, "");
391-
static_assert(is_same<decltype(isgreaterequal(0, (double)0)), double>::value, "");
391+
static_assert(is_same<decltype(isgreaterequal(0, (double)0)), bool>::value, "");
392392
}
393393

394394
__device__ void test_isinf()
@@ -400,28 +400,28 @@ __device__ void test_isinf()
400400
__device__ void test_isless()
401401
{
402402
static_assert(is_same<decltype(isless((float)0, (float)0)), bool>::value, "");
403-
static_assert(is_same<decltype(isless((float)0, (double)0)), double>::value, "");
404-
static_assert(is_same<decltype(isless((double)0, (float)0)), double>::value, "");
403+
static_assert(is_same<decltype(isless((float)0, (double)0)), bool>::value, "");
404+
static_assert(is_same<decltype(isless((double)0, (float)0)), bool>::value, "");
405405
static_assert(is_same<decltype(isless((double)0, (double)0)), bool>::value, "");
406-
static_assert(is_same<decltype(isless(0, (double)0)), double>::value, "");
406+
static_assert(is_same<decltype(isless(0, (double)0)), bool>::value, "");
407407
}
408408

409409
__device__ void test_islessequal()
410410
{
411411
static_assert(is_same<decltype(islessequal((float)0, (float)0)), bool>::value, "");
412-
static_assert(is_same<decltype(islessequal((float)0, (double)0)), double>::value, "");
413-
static_assert(is_same<decltype(islessequal((double)0, (float)0)), double>::value, "");
412+
static_assert(is_same<decltype(islessequal((float)0, (double)0)), bool>::value, "");
413+
static_assert(is_same<decltype(islessequal((double)0, (float)0)), bool>::value, "");
414414
static_assert(is_same<decltype(islessequal((double)0, (double)0)), bool>::value, "");
415-
static_assert(is_same<decltype(islessequal(0, (double)0)), double>::value, "");
415+
static_assert(is_same<decltype(islessequal(0, (double)0)), bool>::value, "");
416416
}
417417

418418
__device__ void test_islessgreater()
419419
{
420420
static_assert(is_same<decltype(islessgreater((float)0, (float)0)), bool>::value, "");
421-
static_assert(is_same<decltype(islessgreater((float)0, (double)0)), double>::value, "");
422-
static_assert(is_same<decltype(islessgreater((double)0, (float)0)), double>::value, "");
421+
static_assert(is_same<decltype(islessgreater((float)0, (double)0)), bool>::value, "");
422+
static_assert(is_same<decltype(islessgreater((double)0, (float)0)), bool>::value, "");
423423
static_assert(is_same<decltype(islessgreater((double)0, (double)0)), bool>::value, "");
424-
static_assert(is_same<decltype(islessgreater(0, (double)0)), double>::value, "");
424+
static_assert(is_same<decltype(islessgreater(0, (double)0)), bool>::value, "");
425425
}
426426

427427
__device__ void test_isnan()
@@ -433,10 +433,10 @@ __device__ void test_isnan()
433433
__device__ void test_isunordered()
434434
{
435435
static_assert(is_same<decltype(isunordered((float)0, (float)0)), bool>::value, "");
436-
static_assert(is_same<decltype(isunordered((float)0, (double)0)), double>::value, "");
437-
static_assert(is_same<decltype(isunordered((double)0, (float)0)), double>::value, "");
436+
static_assert(is_same<decltype(isunordered((float)0, (double)0)), bool>::value, "");
437+
static_assert(is_same<decltype(isunordered((double)0, (float)0)), bool>::value, "");
438438
static_assert(is_same<decltype(isunordered((double)0, (double)0)), bool>::value, "");
439-
static_assert(is_same<decltype(isunordered(0, (double)0)), double>::value, "");
439+
static_assert(is_same<decltype(isunordered(0, (double)0)), bool>::value, "");
440440
}
441441

442442
__device__ void test_acosh()

compiler-rt/cmake/Modules/AddCompilerRT.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ macro(set_output_name output name arch)
123123
else()
124124
if(ANDROID AND ${arch} STREQUAL "i386")
125125
set(${output} "${name}-i686${COMPILER_RT_OS_SUFFIX}")
126-
elseif("${arch}" MATCHES "^arm")
126+
elseif(NOT "${arch}" MATCHES "^arm64" AND "${arch}" MATCHES "^arm")
127127
if(COMPILER_RT_DEFAULT_TARGET_ONLY)
128128
set(triple "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}")
129129
else()

compiler-rt/cmake/builtin-config-ix.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ else()
5959
endif()
6060

6161
set(AMDGPU amdgcn)
62-
set(ARM64 aarch64)
62+
set(ARM64 aarch64 arm64ec)
6363
set(ARM32 arm armhf armv4t armv5te armv6 armv6m armv7m armv7em armv7 armv7s armv7k armv8m.base armv8m.main armv8.1m.main)
6464
set(AVR avr)
6565
set(HEXAGON hexagon)

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ set(armv7k_SOURCES ${arm_SOURCES})
668668
set(arm64_SOURCES ${aarch64_SOURCES})
669669
set(arm64e_SOURCES ${aarch64_SOURCES})
670670
set(arm64_32_SOURCES ${aarch64_SOURCES})
671+
set(arm64ec_SOURCES ${aarch64_SOURCES})
671672

672673
# macho_embedded archs
673674
set(armv6m_SOURCES ${thumb1_SOURCES})

compiler-rt/lib/builtins/aarch64/chkstk.S

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515
// bl __chkstk
1616
// sub sp, sp, x15, lsl #4
1717

18-
#ifdef __aarch64__
18+
#if defined(__aarch64__) || defined(__arm64ec__)
19+
20+
#ifdef __arm64ec__
21+
#define CHKSTK_FUNC __chkstk_arm64ec
22+
#else
23+
#define CHKSTK_FUNC __chkstk
24+
#endif
1925

2026
#define PAGE_SIZE 4096
2127

2228
.p2align 2
23-
DEFINE_COMPILERRT_FUNCTION(__chkstk)
29+
DEFINE_COMPILERRT_FUNCTION(CHKSTK_FUNC)
2430
lsl x16, x15, #4
2531
mov x17, sp
2632
1:
@@ -30,6 +36,6 @@ DEFINE_COMPILERRT_FUNCTION(__chkstk)
3036
b.gt 1b
3137

3238
ret
33-
END_COMPILERRT_FUNCTION(__chkstk)
39+
END_COMPILERRT_FUNCTION(CHKSTK_FUNC)
3440

35-
#endif // __aarch64__
41+
#endif // defined(__aarch64__) || defined(__arm64ec__)

0 commit comments

Comments
 (0)