Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] LLVM 19 #21183

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f04d2c1
cmake: Update to LLVM 19.
alexrp Aug 22, 2024
adfd150
compiler: Update LLVM/Clang driver files to LLVM/Clang 19.
alexrp Aug 22, 2024
c3140e2
zig_llvm: Update to LLVM 19.
alexrp Aug 23, 2024
9a7cc0d
zig_clang: Update to Clang 19.
alexrp Aug 23, 2024
707b521
clang: Update options data to Clang 19.
alexrp Aug 23, 2024
fb06671
clang: Update compiler-provided C headers to Clang 19.
alexrp Aug 22, 2024
83c7126
libunwind: Update to LLVM 19.
alexrp Aug 23, 2024
e10dd31
libunwind: Synchronize some CFLAGS/CXXFLAGS with upstream.
alexrp Aug 23, 2024
9d88e00
libcxxabi: Update to LLVM 19.
alexrp Aug 23, 2024
8504e23
libcxx: Update to LLVM 19.
alexrp Aug 23, 2024
989132f
libcxx: Synchronize some CXXFLAGS with upstream.
alexrp Aug 23, 2024
eaf10b0
update_cpu_features: Update for LLVM 19.
alexrp Aug 22, 2024
6264734
update_cpu_features: Fix feature_overrides logic and replace an omit_…
alexrp Aug 30, 2024
d5ee409
std.Target: Update CPU models/features for LLVM 19.
alexrp Aug 23, 2024
b932583
llvm: Stop emitting shl/xor ops for constant packed structs.
alexrp Aug 23, 2024
3587fa6
test: Disable `@bitCast of packed struct containing pointer` temporar…
alexrp Aug 23, 2024
e0923af
std.Target: Add bridgeos tag to Os.
alexrp Aug 25, 2024
e5cb569
Compilation: Synchronize some libcxx CXXFLAGS with upstream.
alexrp Aug 25, 2024
d6abf47
link.Wasm.Feature: Update to mirror std.Target.wasm.
Luukdegram Aug 30, 2024
0f183ba
test: Update `wasm/infer-features` based on what LLVM produces.
alexrp Aug 30, 2024
3ba200b
std.zig.system.darwin.macos: Enable Apple M4 CPU detection.
alexrp Aug 30, 2024
c1bed62
test: Re-enable LLVM riscv64 module tests.
alexrp Aug 30, 2024
6f4fbf5
test: Re-enable `store vector with memset` for LLVM.
alexrp Aug 31, 2024
73f46ca
Revert "tests: skip native CPU std tests on Windows"
alexrp Aug 31, 2024
3704ad0
Partially revert "LLVM: work around `@floatFromInt` bug"
alexrp Aug 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ else()
set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig")
endif()

find_package(llvm 18)
find_package(clang 18)
find_package(lld 18)
find_package(llvm 19)
find_package(clang 19)
find_package(lld 19)

if(ZIG_STATIC_ZLIB)
if (MSVC)
Expand Down
9 changes: 5 additions & 4 deletions cmake/Findclang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
if(${LLVM_LINK_MODE} STREQUAL "shared")
find_library(CLANG_LIBRARIES
NAMES
libclang-cpp.so.18
libclang-cpp.so.18.1
clang-cpp-18.0
clang-cpp180
libclang-cpp.so.19
libclang-cpp.so.19.1
clang-cpp-19.0
clang-cpp190
clang-cpp
NAMES_PER_DIR
HINTS "${LLVM_LIBDIRS}"
Expand Down Expand Up @@ -68,6 +68,7 @@ else()
FIND_AND_ADD_CLANG_LIB(clangToolingCore)
FIND_AND_ADD_CLANG_LIB(clangExtractAPI)
FIND_AND_ADD_CLANG_LIB(clangSupport)
FIND_AND_ADD_CLANG_LIB(clangInstallAPI)
endif()

if (MSVC)
Expand Down
32 changes: 16 additions & 16 deletions cmake/Findlld.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
HINTS ${LLVM_INCLUDE_DIRS}
PATHS
/usr/lib/llvm-18/include
/usr/local/llvm180/include
/usr/local/llvm18/include
/usr/local/opt/llvm@18/include
/opt/homebrew/opt/llvm@18/include
/usr/lib/llvm-19/include
/usr/local/llvm190/include
/usr/local/llvm19/include
/usr/local/opt/llvm@19/include
/opt/homebrew/opt/llvm@19/include
/mingw64/include)

find_library(LLD_LIBRARY NAMES lld-18.0 lld180 lld NAMES_PER_DIR
find_library(LLD_LIBRARY NAMES lld-19.0 lld190 lld NAMES_PER_DIR
HINTS ${LLVM_LIBDIRS}
PATHS
/usr/lib/llvm-18/lib
/usr/local/llvm180/lib
/usr/local/llvm18/lib
/usr/local/opt/llvm@18/lib
/opt/homebrew/opt/llvm@18/lib
/usr/lib/llvm-19/lib
/usr/local/llvm190/lib
/usr/local/llvm19/lib
/usr/local/opt/llvm@19/lib
/opt/homebrew/opt/llvm@19/lib
)
if(EXISTS ${LLD_LIBRARY})
set(LLD_LIBRARIES ${LLD_LIBRARY})
Expand All @@ -34,11 +34,11 @@ else()
HINTS ${LLVM_LIBDIRS}
PATHS
${LLD_LIBDIRS}
/usr/lib/llvm-18/lib
/usr/local/llvm180/lib
/usr/local/llvm18/lib
/usr/local/opt/llvm@18/lib
/opt/homebrew/opt/llvm@18/lib
/usr/lib/llvm-19/lib
/usr/local/llvm190/lib
/usr/local/llvm19/lib
/usr/local/opt/llvm@19/lib
/opt/homebrew/opt/llvm@19/lib
/mingw64/lib
/c/msys64/mingw64/lib
c:/msys64/mingw64/lib)
Expand Down
14 changes: 7 additions & 7 deletions cmake/Findllvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ if(ZIG_USE_LLVM_CONFIG)
# terminate when the right LLVM version is not found.
unset(LLVM_CONFIG_EXE CACHE)
find_program(LLVM_CONFIG_EXE
NAMES llvm-config-18 llvm-config-18.0 llvm-config180 llvm-config18 llvm-config NAMES_PER_DIR
NAMES llvm-config-19 llvm-config-19.0 llvm-config190 llvm-config19 llvm-config NAMES_PER_DIR
PATHS
"/mingw64/bin"
"/c/msys64/mingw64/bin"
"c:/msys64/mingw64/bin"
"C:/Libraries/llvm-18.0.0/bin")
"C:/Libraries/llvm-19.0.0/bin")

if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "")
Expand All @@ -40,9 +40,9 @@ if(ZIG_USE_LLVM_CONFIG)
OUTPUT_STRIP_TRAILING_WHITESPACE)

get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY)
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 18 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 19 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 19)
if("${LLVM_CONFIG_VERSION}" VERSION_LESS 19 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 20 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 20)
# Save the error message, in case this is the last llvm-config we find
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 18.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 19.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")

# Ignore this directory and try the search again
list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
Expand All @@ -63,12 +63,12 @@ if(ZIG_USE_LLVM_CONFIG)
ERROR_VARIABLE LLVM_CONFIG_ERROR
ERROR_STRIP_TRAILING_WHITESPACE)

if (LLVM_CONFIG_ERROR)
if (LLVM_CONFIG_ERROR)
# Save the error message, in case this is the last llvm-config we find
if (ZIG_SHARED_LLVM)
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 18.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 19.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
else()
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 18.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 19.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
endif()

# Ignore this directory and try the search again
Expand Down
1 change: 1 addition & 0 deletions lib/compiler/aro/aro/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
.visionos => "xros",
.driverkit => "driverkit",
.shadermodel => "shadermodel",
.bridgeos => "bridgeos",
.opencl,
.opengl,
.vulkan,
Expand Down
4 changes: 1 addition & 3 deletions lib/include/__clang_cuda_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ inline __device__ unsigned int __activemask() {
#if CUDA_VERSION < 9020
return __nvvm_vote_ballot(1);
#else
unsigned int mask;
asm volatile("activemask.b32 %0;" : "=r"(mask));
return mask;
return __nvvm_activemask();
#endif
}

Expand Down
12 changes: 12 additions & 0 deletions lib/include/__stdarg_header_macro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*===---- __stdarg_header_macro.h ------------------------------------------===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===-----------------------------------------------------------------------===
*/

#ifndef __STDARG_H
#define __STDARG_H
#endif
12 changes: 12 additions & 0 deletions lib/include/__stddef_header_macro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*===---- __stddef_header_macro.h ------------------------------------------===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===-----------------------------------------------------------------------===
*/

#ifndef __STDDEF_H
#define __STDDEF_H
#endif
36 changes: 31 additions & 5 deletions lib/include/arm_acle.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(v
#define __dbg(t) __builtin_arm_dbg(t)
#endif

#if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
#define _CHKFEAT_GCS 1
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__chkfeat(uint64_t __features) {
return __builtin_arm_chkfeat(__features) ^ __features;
}
#endif

/* 7.5 Swap */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__swp(uint32_t __x, volatile uint32_t *__p) {
Expand Down Expand Up @@ -109,7 +117,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
#endif

/* 7.7 NOP */
#if !defined(_MSC_VER) || !defined(__aarch64__)
#if !defined(_MSC_VER) || (!defined(__aarch64__) && !defined(__arm64ec__))
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) {
__builtin_arm_nop();
}
Expand Down Expand Up @@ -313,7 +321,7 @@ __qdbl(int32_t __t) {
}
#endif

/* 8.4.3 Accumultating multiplications */
/* 8.4.3 Accumulating multiplications */
#if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlabb(int32_t __a, int32_t __b, int32_t __c) {
Expand Down Expand Up @@ -545,7 +553,7 @@ __usub16(uint16x2_t __a, uint16x2_t __b) {
}
#endif

/* 8.5.10 Parallel 16-bit multiplications */
/* 8.5.10 Parallel 16-bit multiplication */
#if defined(__ARM_FEATURE_SIMD32) && __ARM_FEATURE_SIMD32
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__smlad(int16x2_t __a, int16x2_t __b, int32_t __c) {
Expand Down Expand Up @@ -748,7 +756,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
#define __arm_wsrf(sysreg, v) __arm_wsr(sysreg, __builtin_bit_cast(uint32_t, v))
#define __arm_wsrf64(sysreg, v) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v))

/* 10.3 Memory Tagging Extensions (MTE) Intrinsics */
/* 10.3 MTE intrinsics */
#if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
#define __arm_mte_create_random_tag(__ptr, __mask) __builtin_arm_irg(__ptr, __mask)
#define __arm_mte_increment_tag(__ptr, __tag_offset) __builtin_arm_addg(__ptr, __tag_offset)
Expand All @@ -757,7 +765,7 @@ __arm_st64bv0(void *__addr, data512_t __value) {
#define __arm_mte_set_tag(__ptr) __builtin_arm_stg(__ptr)
#define __arm_mte_ptrdiff(__ptra, __ptrb) __builtin_arm_subp(__ptra, __ptrb)

/* 18 Memory Operations Intrinsics */
/* 18 memcpy family of operations intrinsics - MOPS */
#define __arm_mops_memset_tag(__tagged_address, __value, __size) \
__builtin_arm_mops_memset_tag(__tagged_address, __value, __size)
#endif
Expand Down Expand Up @@ -855,6 +863,24 @@ __rndrrs(uint64_t *__p) {
}
#endif

/* 11.2 Guarded Control Stack intrinsics */
#if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
static __inline__ void * __attribute__((__always_inline__, __nodebug__))
__gcspr() {
return (void *)__builtin_arm_rsr64("gcspr_el0");
}

static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__, target("gcs")))
__gcspopm() {
return __builtin_arm_gcspopm(0);
}

static __inline__ const void * __attribute__((__always_inline__, __nodebug__, target("gcs")))
__gcsss(const void *__stack) {
return __builtin_arm_gcsss(__stack);
}
#endif

#if defined(__cplusplus)
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/include/arm_fp16.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
typedef __fp16 float16_t;
#define __ai static __inline__ __attribute__((__always_inline__, __nodebug__))

#if defined(__aarch64__)
#if defined(__aarch64__) || defined(__arm64ec__)
#define vabdh_f16(__p0, __p1) __extension__ ({ \
float16_t __ret; \
float16_t __s0 = __p0; \
Expand Down
Loading
Loading