Skip to content

Commit d6bcae1

Browse files
committed
Merge from 'main' to 'sycl-web' (56 commits)
CONFLICT (content): Merge conflict in libclc/CMakeLists.txt CONFLICT (rename/rename): libclc/amdgcn-amdhsa/lib/SOURCES renamed to libclc/libspirv/lib/amdgcn/SOURCES in HEAD and to libclc/opencl/lib/amdgcn-amdhsa/SOURCES in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn-amdhsa/lib/workitem/get_global_size.cl renamed to libclc/libspirv/lib/amdgcn-amdhsa/workitem/get_global_size.cl in HEAD and to libclc/opencl/lib/amdgcn-amdhsa/workitem/get_global_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn-amdhsa/lib/workitem/get_local_size.cl renamed to libclc/libspirv/lib/amdgcn-amdhsa/workitem/get_local_size.cl in HEAD and to libclc/opencl/lib/amdgcn-amdhsa/workitem/get_local_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn-amdhsa/lib/workitem/get_num_groups.cl renamed to libclc/libspirv/lib/ptx-nvidiacl/math/native_powr.cl in HEAD and to libclc/opencl/lib/amdgcn-amdhsa/workitem/get_num_groups.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn/lib/workitem/get_global_size.cl renamed to libclc/libspirv/lib/amdgcn/workitem/get_global_size.cl in HEAD and to libclc/opencl/lib/amdgcn/workitem/get_global_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn/lib/workitem/get_group_id.cl renamed to libclc/libspirv/lib/amdgcn/workitem/get_group_id.cl in HEAD and to libclc/opencl/lib/amdgcn/workitem/get_group_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn/lib/workitem/get_local_id.cl renamed to libclc/libspirv/lib/amdgcn/workitem/get_local_id.cl in HEAD and to libclc/opencl/lib/amdgcn/workitem/get_local_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn/lib/workitem/get_local_size.cl renamed to libclc/libspirv/lib/amdgcn/workitem/get_local_size.cl in HEAD and to libclc/opencl/lib/amdgcn/workitem/get_local_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn/lib/workitem/get_num_groups.cl renamed to libclc/libspirv/lib/amdgcn/workitem/get_num_groups.cl in HEAD and to libclc/opencl/lib/amdgcn/workitem/get_num_groups.cl in 32cf55a. CONFLICT (rename/rename): libclc/amdgcn/lib/workitem/get_work_dim.cl renamed to libclc/libspirv/lib/amdgcn/workitem/get_work_dim.cl in HEAD and to libclc/opencl/lib/amdgcn/workitem/get_work_dim.cl in 32cf55a. CONFLICT (content): Merge conflict in libclc/cmake/modules/AddLibclc.cmake CONFLICT (rename/rename): libclc/generic/include/clc/as_type.h renamed to libclc/generic/include/as_type.h in HEAD and to libclc/opencl/include/clc/opencl/as_type.h in 32cf55a. CONFLICT (modify/delete): libclc/generic/include/clc/clc.h deleted in 32cf55a and modified in HEAD. Version HEAD of libclc/generic/include/clc/clc.h left in tree. CONFLICT (modify/delete): libclc/generic/include/clc/math/frexp.inc deleted in 32cf55a and modified in HEAD. Version HEAD of libclc/generic/include/clc/math/frexp.inc left in tree. CONFLICT (rename/rename): libclc/generic/lib/subnormal_config.cl renamed to libclc/libspirv/lib/generic/subnormal_config.cl in HEAD and to libclc/opencl/lib/generic/subnormal_config.cl in 32cf55a. CONFLICT (rename/rename): libclc/generic/lib/subnormal_disable.ll renamed to libclc/libspirv/lib/generic/subnormal_disable.ll in HEAD and to libclc/opencl/lib/generic/subnormal_disable.ll in 32cf55a. CONFLICT (rename/rename): libclc/generic/lib/subnormal_helper_func.ll renamed to libclc/libspirv/lib/generic/subnormal_helper_func.ll in HEAD and to libclc/opencl/lib/generic/subnormal_helper_func.ll in 32cf55a. CONFLICT (file location): libclc/generic/include/clc/async/common.h added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/include/clc/opencl/async/common.h. CONFLICT (content): Merge conflict in libclc/opencl/lib/amdgcn/mem_fence/fence.cl CONFLICT (rename/delete): libclc/amdgcn/lib/workitem/get_global_offset.cl renamed to libclc/opencl/lib/amdgcn/workitem/get_global_offset.cl in 32cf55a, but deleted in HEAD. CONFLICT (modify/delete): libclc/opencl/lib/amdgcn/workitem/get_global_offset.cl deleted in HEAD and modified in 32cf55a. Version 32cf55a of libclc/opencl/lib/amdgcn/workitem/get_global_offset.cl left in tree. CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/async/async_work_group_strided_copy.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/async/async_work_group_strided_copy.inc CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/async/prefetch.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/async/prefetch.inc CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/async/wait_group_events.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_add.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_and.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_cmpxchg.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_dec.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_inc.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_max.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_min.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_or.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_sub.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_xchg.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/atomic/atomic_xor.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/common/step.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/math/cos.cl CONFLICT (file location): libclc/generic/lib/math/fma.inc added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/math/fma.inc. CONFLICT (file location): libclc/generic/lib/math/fract.inc added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/math/fract.inc. CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/math/logb.cl CONFLICT (file location): libclc/generic/lib/math/native_builtin.inc added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/math/native_builtin.inc. CONFLICT (file location): libclc/generic/lib/math/pow.inc added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/math/pow.inc. CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/math/sin.cl CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/math/sincos.cl CONFLICT (file location): libclc/generic/lib/synchronization/barrier.cl added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/synchronization/barrier.cl. CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/workitem/get_global_id.cl CONFLICT (file location): libclc/generic/lib/workitem/get_global_offset.cl added in HEAD inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/workitem/get_global_offset.cl. CONFLICT (content): Merge conflict in libclc/opencl/lib/generic/workitem/get_global_size.cl CONFLICT (file location): libclc/ptx-nvidiacl/lib/workitem/get_group_id.cl renamed to libclc/generic/lib/workitem/get_group_id.cl in HEAD, inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/workitem/get_group_id.cl. CONFLICT (file location): libclc/ptx-nvidiacl/lib/workitem/get_local_id.cl renamed to libclc/generic/lib/workitem/get_local_id.cl in HEAD, inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/workitem/get_local_id.cl. CONFLICT (file location): libclc/ptx-nvidiacl/lib/workitem/get_local_size.cl renamed to libclc/generic/lib/workitem/get_local_size.cl in HEAD, inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/workitem/get_local_size.cl. CONFLICT (file location): libclc/ptx-nvidiacl/lib/workitem/get_num_groups.cl renamed to libclc/generic/lib/workitem/get_num_groups.cl in HEAD, inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/workitem/get_num_groups.cl. CONFLICT (file location): libclc/ptx-nvidiacl/lib/synchronization/barrier.cl renamed to libclc/generic/lib/workitem/get_work_dim.cl in HEAD, inside a directory that was renamed in 32cf55a, suggesting it should perhaps be moved to libclc/opencl/lib/generic/workitem/get_work_dim.cl. CONFLICT (rename/rename): libclc/ptx-nvidiacl/lib/synchronization/barrier.cl renamed to libclc/opencl/lib/generic/workitem/get_work_dim.cl in HEAD and to libclc/opencl/lib/ptx-nvidiacl/synchronization/barrier.cl in 32cf55a. CONFLICT (rename/rename): libclc/ptx-nvidiacl/lib/workitem/get_global_id.cl renamed to libclc/libspirv/lib/ptx-nvidiacl/workitem/get_sub_group_local_id.cl in HEAD and to libclc/opencl/lib/ptx-nvidiacl/workitem/get_global_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/ptx-nvidiacl/lib/workitem/get_group_id.cl renamed to libclc/opencl/lib/generic/workitem/get_group_id.cl in HEAD and to libclc/opencl/lib/ptx-nvidiacl/workitem/get_group_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/ptx-nvidiacl/lib/workitem/get_local_id.cl renamed to libclc/opencl/lib/generic/workitem/get_local_id.cl in HEAD and to libclc/opencl/lib/ptx-nvidiacl/workitem/get_local_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/ptx-nvidiacl/lib/workitem/get_local_size.cl renamed to libclc/opencl/lib/generic/workitem/get_local_size.cl in HEAD and to libclc/opencl/lib/ptx-nvidiacl/workitem/get_local_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/ptx-nvidiacl/lib/workitem/get_num_groups.cl renamed to libclc/opencl/lib/generic/workitem/get_num_groups.cl in HEAD and to libclc/opencl/lib/ptx-nvidiacl/workitem/get_num_groups.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_global_offset.cl renamed to libclc/libspirv/lib/generic/math/ceil.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_global_offset.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_global_size.cl renamed to libclc/libspirv/lib/r600/workitem/get_global_size.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_global_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_group_id.cl renamed to libclc/libspirv/lib/r600/workitem/get_group_id.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_group_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_local_id.cl renamed to libclc/libspirv/lib/r600/workitem/get_local_id.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_local_id.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_local_size.cl renamed to libclc/libspirv/lib/r600/workitem/get_local_size.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_local_size.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_num_groups.cl renamed to libclc/libspirv/lib/r600/workitem/get_num_groups.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_num_groups.cl in 32cf55a. CONFLICT (rename/rename): libclc/r600/lib/workitem/get_work_dim.cl renamed to libclc/libspirv/lib/r600/workitem/get_work_dim.cl in HEAD and to libclc/opencl/lib/r600/workitem/get_work_dim.cl in 32cf55a.
2 parents 611aa00 + 32cf55a commit d6bcae1

File tree

810 files changed

+16325
-3571
lines changed

Some content is hidden

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

810 files changed

+16325
-3571
lines changed

clang/docs/BoundsSafety.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ In C, arrays on function prototypes are promoted (or "decayed") to a pointer to
664664
its first element (e.g., ``&arr[0]``). In ``-fbounds-safety``, arrays are also
665665
decayed to pointers, but with the addition of an implicit bounds annotation,
666666
which includes variable-length arrays (VLAs). As shown in the following example,
667-
arrays on function prototypes are decalyed to corresponding ``__counted_by``
667+
arrays on function prototypes are decayed to corresponding ``__counted_by``
668668
pointers.
669669

670670
.. code-block:: c

clang/docs/BoundsSafetyAdoptionGuide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Annotate pointers on struct fields and function parameters if they are pointing
3939
to an array of object, with appropriate bounds annotations. Please see
4040
:doc:`BoundsSafety` to learn what kind of bounds annotations are available and
4141
their semantics. Note that local pointer variables typically don't need bounds
42-
annotations because they are implicitely a wide pointer (``__bidi_indexable``)
42+
annotations because they are implicitly a wide pointer (``__bidi_indexable``)
4343
that automatically carries the bounds information.
4444

4545
Address compiler diagnostics

clang/docs/HIPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ In other scenarios, calling virtual functions is not allowed.
259259
Explanation
260260
-----------
261261

262-
An object constructed on the device side contains a pointer to the virtual function table on the device side, which is not accessible in host code, and vice versa. Thus, trying to invoke virtual functions from a context different from where the object was constructed will be disallowed because the appropriate virtual table cannot be accessed. The virtual function tables for offloading devices with different architecures are different, therefore trying to invoke virtual functions from an offloading device with a different architecture than where the object is constructed is also disallowed.
262+
An object constructed on the device side contains a pointer to the virtual function table on the device side, which is not accessible in host code, and vice versa. Thus, trying to invoke virtual functions from a context different from where the object was constructed will be disallowed because the appropriate virtual table cannot be accessed. The virtual function tables for offloading devices with different architectures are different, therefore trying to invoke virtual functions from an offloading device with a different architecture than where the object is constructed is also disallowed.
263263

264264
Example Usage
265265
-------------

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ Bug Fixes to Compiler Builtins
647647
- ``__is_trivially_relocatable`` has been deprecated, and uses should be replaced by
648648
``__builtin_is_cpp_trivially_relocatable``.
649649
Note that, it is generally unsafe to ``memcpy`` non-trivially copyable types that
650-
are ``__builtin_is_cpp_trivially_relocatable``. It is recommanded to use
650+
are ``__builtin_is_cpp_trivially_relocatable``. It is recommended to use
651651
``__builtin_trivially_relocate`` instead.
652652

653653
Bug Fixes to Attribute Support
@@ -703,7 +703,7 @@ Bug Fixes to C++ Support
703703
- Fix crash when evaluating the trailing requires clause of generic lambdas which are part of
704704
a pack expansion.
705705
- Fixes matching of nested template template parameters. (#GH130362)
706-
- Correctly diagnoses template template paramters which have a pack parameter
706+
- Correctly diagnoses template template parameters which have a pack parameter
707707
not in the last position.
708708
- Disallow overloading on struct vs class on dependent types, which is IFNDR, as
709709
this makes the problem diagnosable.
@@ -712,7 +712,7 @@ Bug Fixes to C++ Support
712712
- Clang now correctly parses ``if constexpr`` expressions in immediate function context. (#GH123524)
713713
- Fixed an assertion failure affecting code that uses C++23 "deducing this". (#GH130272)
714714
- Clang now properly instantiates destructors for initialized members within non-delegating constructors. (#GH93251)
715-
- Correctly diagnoses if unresolved using declarations shadows template paramters (#GH129411)
715+
- Correctly diagnoses if unresolved using declarations shadows template parameters (#GH129411)
716716
- Fixed C++20 aggregate initialization rules being incorrectly applied in certain contexts. (#GH131320)
717717
- Clang was previously coalescing volatile writes to members of volatile base class subobjects.
718718
The issue has been addressed by propagating qualifiers during derived-to-base conversions in the AST. (#GH127824)
@@ -741,11 +741,11 @@ Bug Fixes to C++ Support
741741
- Fixed the handling of pack indexing types in the constraints of a member function redeclaration. (#GH138255)
742742
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
743743
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
744-
- Fixed a function declaration mismatch that caused inconsistencies between concepts and variable template declarations. (#GH139476)
745744
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
746745
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.
747746
- Fixed bug in constant evaluation that would allow using the value of a
748747
reference in its own initializer in C++23 mode (#GH131330).
748+
- Clang could incorrectly instantiate functions in discarded contexts (#GH140449)
749749

750750
Bug Fixes to AST Handling
751751
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -820,7 +820,7 @@ Windows Support
820820
which makes ``offsetof`` provided by Microsoft's ``<stddef.h>`` to be defined
821821
correctly. (#GH59689)
822822

823-
- Clang now can process the `i128` and `ui128` integeral suffixes when MSVC
823+
- Clang now can process the `i128` and `ui128` integral suffixes when MSVC
824824
extensions are enabled. This allows for properly processing ``intsafe.h`` in
825825
the Windows SDK.
826826

clang/docs/UsersManual.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,7 +3650,7 @@ below. If multiple flags are present, the last one is used.
36503650
By default, Clang does not emit type information for types that are defined
36513651
but not used in a program. To retain the debug info for these unused types,
36523652
the negation **-fno-eliminate-unused-debug-types** can be used.
3653-
This can be particulary useful on Windows, when using NATVIS files that
3653+
This can be particularly useful on Windows, when using NATVIS files that
36543654
can reference const symbols that would otherwise be stripped, even in full
36553655
debug or standalone debug modes.
36563656

@@ -4267,7 +4267,7 @@ nosvm
42674267
^^^^^
42684268

42694269
Clang supports this attribute to comply to OpenCL v2.0 conformance, but it
4270-
does not have any effect on the IR. For more details reffer to the specification
4270+
does not have any effect on the IR. For more details refer to the specification
42714271
`section 6.7.2
42724272
<https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#49>`_
42734273

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,12 @@ clang_tablegen(riscv_sifive_vector_builtin_cg.inc -gen-riscv-sifive-vector-built
201201
clang_tablegen(riscv_sifive_vector_builtin_sema.inc -gen-riscv-sifive-vector-builtin-sema
202202
SOURCE riscv_sifive_vector.td
203203
TARGET ClangRISCVSiFiveVectorBuiltinSema)
204+
clang_tablegen(riscv_andes_vector_builtins.inc -gen-riscv-andes-vector-builtins
205+
SOURCE riscv_andes_vector.td
206+
TARGET ClangRISCVAndesVectorBuiltins)
207+
clang_tablegen(riscv_andes_vector_builtin_cg.inc -gen-riscv-andes-vector-builtin-codegen
208+
SOURCE riscv_andes_vector.td
209+
TARGET ClangRISCVAndesVectorBuiltinCG)
210+
clang_tablegen(riscv_andes_vector_builtin_sema.inc -gen-riscv-andes-vector-builtin-sema
211+
SOURCE riscv_andes_vector.td
212+
TARGET ClangRISCVAndesVectorBuiltinSema)

clang/include/clang/Basic/TargetBuiltins.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ namespace clang {
197197
FirstSiFiveBuiltin,
198198
LastRVVBuiltin = FirstSiFiveBuiltin - 1,
199199
#include "clang/Basic/riscv_sifive_vector_builtins.inc"
200+
FirstAndesBuiltin,
201+
LastSiFiveBuiltin = FirstAndesBuiltin - 1,
202+
#include "clang/Basic/riscv_andes_vector_builtins.inc"
200203
#undef GET_RISCVV_BUILTIN_ENUMERATORS
201204
FirstTSBuiltin,
202205
};
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//==--- riscv_andes_vector.td - RISC-V Andes Builtin function list --------===//
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+
// This file defines the builtins for RISC-V Andes Vector Extension. See:
10+
//
11+
// https://github.com/andestech/andes-vector-intrinsic-doc
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
include "riscv_vector_common.td"
16+
17+
//===----------------------------------------------------------------------===//
18+
// Instruction definitions
19+
//===----------------------------------------------------------------------===//
20+
21+
// Andes Vector Packed FP16 Extension (XAndesVPackFPH)
22+
23+
multiclass RVVFPMAD {
24+
let Log2LMUL = [-2, -1, 0, 1, 2, 3],
25+
OverloadedName = NAME in {
26+
defm NAME : RVVOutOp1BuiltinSet<NAME, "x", [["vf", "v", "vvf"]]>;
27+
28+
let HasFRMRoundModeOp = true in
29+
defm NAME : RVVOutOp1BuiltinSet<NAME, "x", [["vf", "v", "vvfu"]]>;
30+
}
31+
}
32+
33+
let RequiredFeatures = ["Xandesvpackfph"],
34+
UnMaskedPolicyScheme = HasPassthruOperand in {
35+
let ManualCodegen = [{
36+
{
37+
// LLVM intrinsic
38+
// Unmasked: (passthru, op0, op1, round_mode, vl)
39+
// Masked: (passthru, vector_in, vector_in/scalar_in, mask, frm, vl, policy)
40+
41+
SmallVector<llvm::Value*, 7> Operands;
42+
bool HasMaskedOff = !(
43+
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
44+
(!IsMasked && PolicyAttrs & RVV_VTA));
45+
bool HasRoundModeOp = IsMasked ?
46+
(HasMaskedOff ? Ops.size() == 6 : Ops.size() == 5) :
47+
(HasMaskedOff ? Ops.size() == 5 : Ops.size() == 4);
48+
49+
unsigned Offset = IsMasked ?
50+
(HasMaskedOff ? 2 : 1) : (HasMaskedOff ? 1 : 0);
51+
52+
if (!HasMaskedOff)
53+
Operands.push_back(llvm::PoisonValue::get(ResultType));
54+
else
55+
Operands.push_back(Ops[IsMasked ? 1 : 0]);
56+
57+
Operands.push_back(Ops[Offset]); // op0
58+
Operands.push_back(Ops[Offset + 1]); // op1
59+
60+
if (IsMasked)
61+
Operands.push_back(Ops[0]); // mask
62+
63+
if (HasRoundModeOp) {
64+
Operands.push_back(Ops[Offset + 2]); // frm
65+
Operands.push_back(Ops[Offset + 3]); // vl
66+
} else {
67+
Operands.push_back(ConstantInt::get(Ops[Offset + 2]->getType(), 7)); // frm
68+
Operands.push_back(Ops[Offset + 2]); // vl
69+
}
70+
71+
if (IsMasked)
72+
Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
73+
74+
IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
75+
Operands.back()->getType()};
76+
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
77+
return Builder.CreateCall(F, Operands, "");
78+
}
79+
}] in {
80+
defm nds_vfpmadt : RVVFPMAD;
81+
defm nds_vfpmadb : RVVFPMAD;
82+
}
83+
}

clang/include/clang/Sema/EnterExpressionEvaluationContext.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ class EnterExpressionEvaluationContext {
6464
}
6565
};
6666

67+
/// RAII object that enters a new function expression evaluation context.
68+
class EnterExpressionEvaluationContextForFunction {
69+
Sema &Actions;
70+
71+
public:
72+
EnterExpressionEvaluationContextForFunction(
73+
Sema &Actions, Sema::ExpressionEvaluationContext NewContext,
74+
FunctionDecl *FD = nullptr)
75+
: Actions(Actions) {
76+
Actions.PushExpressionEvaluationContextForFunction(NewContext, FD);
77+
}
78+
~EnterExpressionEvaluationContextForFunction() {
79+
Actions.PopExpressionEvaluationContext();
80+
}
81+
};
82+
6783
} // namespace clang
6884

6985
#endif

clang/include/clang/Sema/RISCVIntrinsicManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Preprocessor;
2424
namespace sema {
2525
class RISCVIntrinsicManager {
2626
public:
27-
enum class IntrinsicKind : uint8_t { RVV, SIFIVE_VECTOR };
27+
enum class IntrinsicKind : uint8_t { RVV, SIFIVE_VECTOR, ANDES_VECTOR };
2828

2929
virtual ~RISCVIntrinsicManager() = default;
3030

clang/include/clang/Sema/Sema.h

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6846,8 +6846,9 @@ class Sema final : public SemaBase {
68466846

68476847
bool isDiscardedStatementContext() const {
68486848
return Context == ExpressionEvaluationContext::DiscardedStatement ||
6849-
(Context ==
6850-
ExpressionEvaluationContext::ImmediateFunctionContext &&
6849+
((Context ==
6850+
ExpressionEvaluationContext::ImmediateFunctionContext ||
6851+
isPotentiallyEvaluated()) &&
68516852
InDiscardedStatement);
68526853
}
68536854
};
@@ -6936,6 +6937,10 @@ class Sema final : public SemaBase {
69366937
ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr,
69376938
ExpressionEvaluationContextRecord::ExpressionKind Type =
69386939
ExpressionEvaluationContextRecord::EK_Other);
6940+
6941+
void PushExpressionEvaluationContextForFunction(
6942+
ExpressionEvaluationContext NewContext, FunctionDecl *FD);
6943+
69396944
enum ReuseLambdaContextDecl_t { ReuseLambdaContextDecl };
69406945
void PushExpressionEvaluationContext(
69416946
ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t,
@@ -13416,23 +13421,11 @@ class Sema final : public SemaBase {
1341613421
: S(S), SavedContext(S, DC) {
1341713422
auto *FD = dyn_cast<FunctionDecl>(DC);
1341813423
S.PushFunctionScope();
13419-
S.PushExpressionEvaluationContext(
13420-
(FD && FD->isImmediateFunction())
13421-
? ExpressionEvaluationContext::ImmediateFunctionContext
13422-
: ExpressionEvaluationContext::PotentiallyEvaluated);
13423-
if (FD) {
13424-
auto &Current = S.currentEvaluationContext();
13425-
const auto &Parent = S.parentEvaluationContext();
13426-
13424+
S.PushExpressionEvaluationContextForFunction(
13425+
ExpressionEvaluationContext::PotentiallyEvaluated, FD);
13426+
if (FD)
1342713427
FD->setWillHaveBody(true);
13428-
Current.InImmediateFunctionContext =
13429-
FD->isImmediateFunction() ||
13430-
(isLambdaMethod(FD) && (Parent.isConstantEvaluated() ||
13431-
Parent.isImmediateFunctionContext()));
13432-
13433-
Current.InImmediateEscalatingFunctionContext =
13434-
S.getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
13435-
} else
13428+
else
1343613429
assert(isa<ObjCMethodDecl>(DC));
1343713430
}
1343813431

clang/include/clang/Sema/SemaRISCV.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class SemaRISCV : public SemaBase {
5151
/// Indicate RISC-V SiFive vector builtin functions enabled or not.
5252
bool DeclareSiFiveVectorBuiltins = false;
5353

54+
/// Indicate RISC-V Andes vector builtin functions enabled or not.
55+
bool DeclareAndesVectorBuiltins = false;
56+
5457
std::unique_ptr<sema::RISCVIntrinsicManager> IntrinsicManager;
5558
};
5659

clang/include/clang/Support/RISCVVIntrinsicUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ class RVVIntrinsic {
489489
enum RVVRequire {
490490
RVV_REQ_RV64,
491491
RVV_REQ_Zvfhmin,
492+
RVV_REQ_Xandesvpackfph,
492493
RVV_REQ_Xsfvcp,
493494
RVV_REQ_Xsfvfnrclipxfqf,
494495
RVV_REQ_Xsfvfwmaccqqq,

clang/lib/AST/ByteCode/Record.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Record::Record(const RecordDecl *Decl, BaseList &&SrcBases,
2929
VirtualBaseMap[V.Decl] = &V;
3030
}
3131

32-
const std::string Record::getName() const {
32+
std::string Record::getName() const {
3333
std::string Ret;
3434
llvm::raw_string_ostream OS(Ret);
3535
Decl->getNameForDiagnostic(OS, Decl->getASTContext().getPrintingPolicy(),

clang/lib/AST/ByteCode/Record.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Record final {
5252
/// Returns the underlying declaration.
5353
const RecordDecl *getDecl() const { return Decl; }
5454
/// Returns the name of the underlying declaration.
55-
const std::string getName() const;
55+
std::string getName() const;
5656
/// Checks if the record is a union.
5757
bool isUnion() const { return IsUnion; }
5858
/// Checks if the record is an anonymous union.

clang/lib/AST/StmtProfile.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,10 +2216,7 @@ StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
22162216

22172217
void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
22182218
VisitExpr(S);
2219-
if (S->getNumDecls() == 1)
2220-
VisitDecl(*S->decls_begin());
2221-
else
2222-
VisitNestedNameSpecifier(S->getQualifier());
2219+
VisitNestedNameSpecifier(S->getQualifier());
22232220
VisitName(S->getName(), /*TreatAsDecl*/ true);
22242221
ID.AddBoolean(S->hasExplicitTemplateArgs());
22252222
if (S->hasExplicitTemplateArgs())

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ static const char *const DataLayoutStringR600 =
3333

3434
static const char *const DataLayoutStringAMDGCN =
3535
"e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32"
36-
"-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:"
37-
"32-v48:64-v96:128"
38-
"-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1"
39-
"-ni:7:8:9";
36+
"-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-"
37+
"v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-"
38+
"v2048:2048-n32:64-S32-A5-G1-ni:7:8:9";
4039

4140
const LangASMap AMDGPUTargetInfo::AMDGPUDefIsGenMap = {
4241
llvm::AMDGPUAS::FLAT_ADDRESS, // Default

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
265265
static constexpr int NumRVVBuiltins =
266266
RISCVVector::FirstSiFiveBuiltin - Builtin::FirstTSBuiltin;
267267
static constexpr int NumRVVSiFiveBuiltins =
268-
RISCVVector::FirstTSBuiltin - RISCVVector::FirstSiFiveBuiltin;
268+
RISCVVector::FirstAndesBuiltin - RISCVVector::FirstSiFiveBuiltin;
269+
static constexpr int NumRVVAndesBuiltins =
270+
RISCVVector::FirstTSBuiltin - RISCVVector::FirstAndesBuiltin;
269271
static constexpr int NumRISCVBuiltins =
270272
RISCV::LastTSBuiltin - RISCVVector::FirstTSBuiltin;
271273
static constexpr int NumBuiltins =
272274
RISCV::LastTSBuiltin - Builtin::FirstTSBuiltin;
273-
static_assert(NumBuiltins ==
274-
(NumRVVBuiltins + NumRVVSiFiveBuiltins + NumRISCVBuiltins));
275+
static_assert(NumBuiltins == (NumRVVBuiltins + NumRVVSiFiveBuiltins +
276+
NumRVVAndesBuiltins + NumRISCVBuiltins));
275277

276278
namespace RVV {
277279
#define GET_RISCVV_BUILTIN_STR_TABLE
@@ -299,6 +301,19 @@ static constexpr std::array<Builtin::Info, NumRVVSiFiveBuiltins> BuiltinInfos =
299301
};
300302
} // namespace RVVSiFive
301303

304+
namespace RVVAndes {
305+
#define GET_RISCVV_BUILTIN_STR_TABLE
306+
#include "clang/Basic/riscv_andes_vector_builtins.inc"
307+
#undef GET_RISCVV_BUILTIN_STR_TABLE
308+
309+
static constexpr std::array<Builtin::Info, NumRVVAndesBuiltins> BuiltinInfos =
310+
{
311+
#define GET_RISCVV_BUILTIN_INFOS
312+
#include "clang/Basic/riscv_andes_vector_builtins.inc"
313+
#undef GET_RISCVV_BUILTIN_INFOS
314+
};
315+
} // namespace RVVAndes
316+
302317
#define GET_BUILTIN_STR_TABLE
303318
#include "clang/Basic/BuiltinsRISCV.inc"
304319
#undef GET_BUILTIN_STR_TABLE
@@ -315,6 +330,7 @@ RISCVTargetInfo::getTargetBuiltins() const {
315330
return {
316331
{&RVV::BuiltinStrings, RVV::BuiltinInfos, "__builtin_rvv_"},
317332
{&RVVSiFive::BuiltinStrings, RVVSiFive::BuiltinInfos, "__builtin_rvv_"},
333+
{&RVVAndes::BuiltinStrings, RVVAndes::BuiltinInfos, "__builtin_rvv_"},
318334
{&BuiltinStrings, BuiltinInfos},
319335
};
320336
}

0 commit comments

Comments
 (0)