Skip to content

Commit 92c419c

Browse files
committed
Merge remote-tracking branch 'origin/main' into kashapov-va_args_32bit
2 parents 9e108b0 + 2aa6ced commit 92c419c

File tree

185 files changed

+3625
-770
lines changed

Some content is hidden

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

185 files changed

+3625
-770
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi)
329329
foreach(lang C;CXX;ASM)
330330
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
331331
# These should be addressed and removed over time.
332-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
332+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dtimeval=struct timeval{int tv_sec; int tv_usec;}\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
333333
if(${target} STREQUAL "armv8m.main-none-eabi")
334334
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
335335
endif()
@@ -340,6 +340,7 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi)
340340
endforeach()
341341
set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
342342
set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
343+
set(RUNTIMES_${target}_LIBC_USE_NEW_HEADER_GEN OFF CACHE BOOL "")
343344
set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
344345
set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
345346
set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
@@ -384,13 +385,14 @@ foreach(target riscv32-unknown-elf)
384385
foreach(lang C;CXX;ASM)
385386
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
386387
# These should be addressed and removed over time.
387-
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
388+
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dtimeval=struct timeval{int tv_sec; int tv_usec;}\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
388389
endforeach()
389390
foreach(type SHARED;MODULE;EXE)
390391
set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
391392
endforeach()
392393
set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
393394
set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
395+
set(RUNTIMES_${target}_LIBC_USE_NEW_HEADER_GEN OFF CACHE BOOL "")
394396
set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
395397
set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
396398
set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")

clang/include/clang/Basic/BuiltinsX86_64.def

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1rs_internal, "vUsUsUsV256i*V256i*vC*z",
139139
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1t1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-transpose")
140140
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1rst1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-movrs,amx-transpose")
141141
TARGET_BUILTIN(__builtin_ia32_ttransposed_internal, "V256iUsUsV256i", "n", "amx-transpose")
142+
TARGET_BUILTIN(__builtin_ia32_ttdpbf16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-bf16,amx-transpose")
143+
TARGET_BUILTIN(__builtin_ia32_ttdpfp16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-fp16,amx-transpose")
144+
TARGET_BUILTIN(__builtin_ia32_ttcmmimfp16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-complex,amx-transpose")
145+
TARGET_BUILTIN(__builtin_ia32_ttcmmrlfp16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-complex,amx-transpose")
146+
TARGET_BUILTIN(__builtin_ia32_tconjtcmmimfp16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-complex,amx-transpose")
147+
TARGET_BUILTIN(__builtin_ia32_tconjtfp16_internal, "V256iUsUsV256i", "n", "amx-complex,amx-transpose")
142148

143149
TARGET_BUILTIN(__builtin_ia32_tcvtrowd2ps_internal, "V16fUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
144150
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2pbf16h_internal, "V32yUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
@@ -185,6 +191,12 @@ TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0t1, "vIUcvC*z", "n","amx-transpose")
185191
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1, "vIUcvC*z", "n", "amx-transpose")
186192
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1t1, "vIUcvC*z", "n","amx-transpose")
187193
TARGET_BUILTIN(__builtin_ia32_ttransposed, "vIUcIUc", "n", "amx-transpose")
194+
TARGET_BUILTIN(__builtin_ia32_ttdpbf16ps, "vIUcIUcIUc", "n", "amx-bf16,amx-transpose")
195+
TARGET_BUILTIN(__builtin_ia32_ttdpfp16ps, "vIUcIUcIUc", "n", "amx-fp16,amx-transpose")
196+
TARGET_BUILTIN(__builtin_ia32_ttcmmimfp16ps, "vIUcIUcIUc", "n", "amx-complex,amx-transpose")
197+
TARGET_BUILTIN(__builtin_ia32_ttcmmrlfp16ps, "vIUcIUcIUc", "n", "amx-complex,amx-transpose")
198+
TARGET_BUILTIN(__builtin_ia32_tconjtcmmimfp16ps, "vIUcIUcIUc", "n", "amx-complex,amx-transpose")
199+
TARGET_BUILTIN(__builtin_ia32_tconjtfp16, "vIUcIUc", "n", "amx-complex,amx-transpose")
188200

189201
TARGET_BUILTIN(__builtin_ia32_tcvtrowd2ps, "V16fIUcUi", "n", "amx-avx512,avx10.2-512")
190202
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2pbf16h, "V32yIUcUi", "n", "amx-avx512,avx10.2-512")

clang/lib/Driver/ToolChains/Arch/LoongArch.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,15 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
135135
Features.push_back("+lsx");
136136

137137
std::string ArchName;
138-
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
139-
ArchName = A->getValue();
138+
const Arg *MArch = Args.getLastArg(options::OPT_march_EQ);
139+
if (MArch)
140+
ArchName = MArch->getValue();
140141
ArchName = postProcessTargetCPUString(ArchName, Triple);
141142
llvm::LoongArch::getArchFeatures(ArchName, Features);
143+
if (MArch && StringRef(MArch->getValue()) == "native")
144+
for (auto &F : llvm::sys::getHostCPUFeatures())
145+
Features.push_back(
146+
Args.MakeArgString((F.second ? "+" : "-") + F.first()));
142147

143148
// Select floating-point features determined by -mdouble-float,
144149
// -msingle-float, -msoft-float and -mfpu.

clang/lib/Headers/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ set(x86_files
147147
adxintrin.h
148148
ammintrin.h
149149
amxavx512intrin.h
150+
amxbf16transposeintrin.h
150151
amxcomplexintrin.h
152+
amxcomplextransposeintrin.h
151153
amxfp16intrin.h
154+
amxfp16transposeintrin.h
152155
amxfp8intrin.h
153156
amxintrin.h
154157
amxmovrsintrin.h
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*===----- amxbf16transposeintrin.h - AMX-BF16 and AMX-TRANSPOSE ------------===
2+
*
3+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
* See https://llvm.org/LICENSE.txt for license information.
5+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
*
7+
*===------------------------------------------------------------------------===
8+
*/
9+
10+
#ifndef __IMMINTRIN_H
11+
#error \
12+
"Never use <amxbf16transposeintrin.h> directly; use <immintrin.h> instead."
13+
#endif /* __IMMINTRIN_H */
14+
15+
#ifndef __AMX_BF16TRANSPOSEINTRIN_H
16+
#define __AMX_BF16TRANSPOSEINTRIN_H
17+
#ifdef __x86_64__
18+
19+
/* Define the default attributes for the functions in this file. */
20+
#define __DEFAULT_FN_ATTRS \
21+
__attribute__((__always_inline__, __nodebug__, \
22+
__target__("amx-bf16,amx-transpose")))
23+
24+
/// Compute transpose and dot-product of BF16 (16-bit) floating-point pairs in
25+
/// tiles \a a and \a b, accumulating the intermediate single-precision
26+
/// (32-bit) floating-point elements with elements in \a dst, and store the
27+
/// 32-bit result back to tile \a dst.
28+
///
29+
/// \headerfile <immintrin.h>
30+
///
31+
/// \code
32+
/// void _tile_tdpbf16ps (__tile dst, __tile a, __tile b)
33+
/// \endcode
34+
///
35+
/// \code{.operation}
36+
/// FOR m := 0 TO dst.rows - 1
37+
/// tmp := dst.row[m]
38+
/// FOR k := 0 TO (a.colsb / 4) - 1
39+
/// FOR n := 0 TO (dst.colsb / 4) - 1
40+
/// tmp.bf32[n] += FP32(a.row[m].bf16[2*k+0]) *
41+
/// FP32(b.row[k].bf16[2*n+0])
42+
/// tmp.bf32[n] += FP32(a.row[m].bf16[2*k+1]) *
43+
/// FP32(b.row[k].bf16[2*n+1])
44+
/// ENDFOR
45+
/// ENDFOR
46+
/// write_row_and_zero(dst, m, tmp, dst.colsb)
47+
/// ENDFOR
48+
/// zero_upper_rows(dst, dst.rows)
49+
/// zero_tileconfig_start()
50+
/// \endcode
51+
///
52+
/// This intrinsic corresponds to the \c TTDPBF16PS instruction.
53+
///
54+
/// \param dst
55+
/// The destination tile. Max size is 1024 Bytes.
56+
/// \param a
57+
/// The 1st source tile. Max size is 1024 Bytes.
58+
/// \param b
59+
/// The 2nd source tile. Max size is 1024 Bytes.
60+
#define _tile_tdpbf16ps(dst, a, b) __builtin_ia32_ttdpbf16ps((dst), (a), (b))
61+
62+
/// This is internal intrinsic. C/C++ user should avoid calling it directly.
63+
static __inline__ _tile1024i __DEFAULT_FN_ATTRS
64+
_tile_tdpbf16ps_internal(unsigned short m, unsigned short n, unsigned short k,
65+
_tile1024i dst, _tile1024i src1, _tile1024i src2) {
66+
return __builtin_ia32_ttdpbf16ps_internal(m, n, k, dst, src1, src2);
67+
}
68+
69+
/// Compute transpose and dot-product of BF16 (16-bit) floating-point pairs in
70+
/// tiles src0 and src1, accumulating the intermediate single-precision
71+
/// (32-bit) floating-point elements with elements in "dst", and store the
72+
/// 32-bit result back to tile "dst".
73+
///
74+
/// \headerfile <immintrin.h>
75+
///
76+
/// This intrinsic corresponds to the <c> TTDPBF16PS </c> instruction.
77+
///
78+
/// \param dst
79+
/// The destination tile. Max size is 1024 Bytes.
80+
/// \param src0
81+
/// The 1st source tile. Max size is 1024 Bytes.
82+
/// \param src1
83+
/// The 2nd source tile. Max size is 1024 Bytes.
84+
__DEFAULT_FN_ATTRS
85+
static __inline__ void __tile_tdpbf16ps(__tile1024i *dst, __tile1024i src0,
86+
__tile1024i src1) {
87+
dst->tile = _tile_tdpbf16ps_internal(src0.row, src1.col, src0.col, dst->tile,
88+
src0.tile, src1.tile);
89+
}
90+
91+
#undef __DEFAULT_FN_ATTRS
92+
93+
#endif /* __x86_64__ */
94+
#endif /* __AMX_BF16TRANSPOSEINTRIN_H */

0 commit comments

Comments
 (0)