1764 Commits

Author SHA1 Message Date
Farzon Lotfi
82acec15af
[HLSL] Implementation of dot intrinsic (#81190)
This change implements https://github.com/llvm/llvm-project/issues/70073

HLSL has a dot intrinsic defined here:

https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-dot

The intrinsic itself is defined as a HLSL_LANG LangBuiltin in
Builtins.td.
This is used to associate all the dot product typdef defined
hlsl_intrinsics.h
with a single intrinsic check in CGBuiltin.cpp & SemaChecking.cpp.

In IntrinsicsDirectX.td we define the llvmIR for the dot product.
A few goals were in mind for this IR. First it should operate on only
vectors. Second the return type should be the vector element type. Third
the second parameter vector should be of the same size as the first
parameter. Finally `a dot b` should be the same as `b dot a`.

In CGBuiltin.cpp hlsl has built on top of existing clang intrinsics via
EmitBuiltinExpr. Dot
product though is language specific intrinsic and so is guarded behind
getLangOpts().HLSL.
The call chain looks like this: EmitBuiltinExpr -> EmitHLSLBuiltinExp

EmitHLSLBuiltinExp dot product intrinsics makes a destinction
between vectors and scalars. This is because HLSL supports dot product
on scalars which simplifies down to multiply.

Sema.h & SemaChecking.cpp saw the addition of
CheckHLSLBuiltinFunctionCall, a language specific semantic validation
that can be expanded for other hlsl specific intrinsics.

Fixes #70073
2024-02-26 10:08:59 -06:00
Vlad Serebrennikov
5c24c31649
[clang] Implement CWG2759 "[[no_unique_address] and common initial sequence" (#82607)
This patch implements said defect report resolution by adding additional
check to common initial sequence evaluation. Consequently, this fixes
CWG2759.
2024-02-22 22:30:31 +04:00
zhijian lin
5b8e5604c2
[AIX] Lower intrinsic __builtin_cpu_is into AIX platform-specific code. (#80069)
On AIX OS, __builtin_cpu_is() references the runtime external variable
_system_configuration from /usr/include/sys/systemcfg.h.

ref issue:  https://github.com/llvm/llvm-project/issues/80042
2024-02-22 08:46:08 -05:00
Vlad Serebrennikov
73185854a3
[clang] Implement CWG1719 "Layout compatibility and cv-qualification revisited" (#82358)
This patch updates our internal notion of `layout-compatible` to ignore cv-qualification,
which in turn fixes `__is_layout_compatible` intrinsic.
2024-02-21 19:02:20 +04:00
Vlad Serebrennikov
d5922cf72c
[clang] Implement __is_layout_compatible (#81506)
This patch implements `__is_layout_compatible` intrinsic, which supports
`std::is_layout_compatible` type trait introduced in C++20
([P0466R5](https://wg21.link/p0466r5) "Layout-compatibility and
Pointer-interconvertibility Traits"). Name matches GCC and MSVC
intrinsic.

Basically, this patch exposes our existing machinery for checking for
layout compatibility and figuring out common initial sequences. Said
machinery is a bit outdated, as it doesn't implement
[CWG1719](https://cplusplus.github.io/CWG/issues/1719.html) "Layout
compatibility and cv-qualification revisited" and
[CWG2759](https://cplusplus.github.io/CWG/issues/2759.html)
"`[[no_unique_address]` and common initial sequence". Those defect
reports are considered out of scope of of this PR, but will be
implemented in subsequent PRs.

Partially addresses #48204
2024-02-20 16:54:51 +04:00
Chris B
5c57fd717d
[HLSL] Vector standard conversions (#71098)
HLSL supports vector truncation and element conversions as part of
standard conversion sequences. The vector truncation conversion is a C++
second conversion in the conversion sequence. If a vector truncation is
in a conversion sequence an element conversion may occur after it before
the standard C++ third conversion.

Vector element conversions can be boolean conversions, floating point or
integral conversions or promotions.

[HLSL Draft
Specification](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf)

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-02-15 14:58:06 -06:00
Timm Bäder
f559c2efe1 [clang][Sema][NFC] Use auto for dyn_cast<> 2024-02-12 18:00:39 +01:00
Vlad Serebrennikov
6884657de8 [clang][NFC] Annotate SemaChecking.cpp with preferred_type
This helps debuggers to display values in bit-fields in a more helpful way.
2024-02-11 15:06:15 +03:00
Mariya Podchishchaeva
8697bbe2d4
[clang] Use CPlusPlus language option instead of Bool (#80975)
As it was pointed out in
https://github.com/llvm/llvm-project/pull/80724, we should not be
checking `getLangOpts().Bool` when determining something related to
logical operators, since it only indicates that bool keyword is present,
not which semantic logical operators have. As a side effect a missing
`-Wpointer-bool-conversion` in OpenCL C was restored since like C23,
OpenCL C has bool keyword but logical operators still return int.
2024-02-08 14:31:57 +01:00
Rageking8
351f94d981
[clang][NFC] resolve redundant predicates (#79701)
Fixes #79686
2024-02-08 06:05:53 +01:00
Sander de Smalen
319f4c03ba
[Clang][AArch64] Emit 'unimplemented' diagnostic for SME (#80295)
When a function F has ZA and ZT0 state, calls another function G that 
only shares ZT0 state with its caller, F will have to save ZA before
the call to G, and restore it afterwards (rather than setting up a
lazy-sve).

This is not yet implemented in LLVM and does not result in a 
compile-time error either. So instead of silently generating incorrect
code, it's better to emit an error saying this is not yet implemented.
2024-02-02 11:56:38 +00:00
Tianlan Zhou
ee01a2c399
[clang] static operators should evaluate object argument (reland) (#80108)
This re-applies 30155fc0 with a fix for clangd.

### Description

clang don't evaluate the object argument of `static operator()` and
`static operator[]` currently, for example:

```cpp
#include <iostream>

struct Foo {
    static int operator()(int x, int y) {
        std::cout << "Foo::operator()" << std::endl;
        return x + y;
    }
    static int operator[](int x, int y) {
        std::cout << "Foo::operator[]" << std::endl;
        return x + y;
    }
};
Foo getFoo() {
    std::cout << "getFoo()" << std::endl;
    return {};
}
int main() {
    std::cout << getFoo()(1, 2) << std::endl;
    std::cout << getFoo()[1, 2] << std::endl;
}
```

`getFoo()` is expected to be called, but clang don't call it currently
(17.0.6). This PR fixes this issue.

Fixes #67976, reland #68485.

### Walkthrough

- **clang/lib/Sema/SemaOverload.cpp**
- **`Sema::CreateOverloadedArraySubscriptExpr` &
`Sema::BuildCallToObjectOfClassType`**
Previously clang generate `CallExpr` for static operators, ignoring the
object argument. In this PR `CXXOperatorCallExpr` is generated for
static operators instead, with the object argument as the first
argument.
  - **`TryObjectArgumentInitialization`**
`const` / `volatile` objects are allowed for static methods, so that we
can call static operators on them.
- **clang/lib/CodeGen/CGExpr.cpp**
  - **`CodeGenFunction::EmitCall`**
CodeGen changes for `CXXOperatorCallExpr` with static operators: emit
and ignore the object argument first, then emit the operator call.
- **clang/lib/AST/ExprConstant.cpp**
  - **`‎ExprEvaluatorBase::handleCallExpr‎`**
Evaluation of static operators in constexpr also need some small changes
to work, so that the arguments won't be out of position.
- **clang/lib/Sema/SemaChecking.cpp**
  - **`Sema::CheckFunctionCall`**
Code for argument checking also need to be modify, or it will fail the
test `clang/test/SemaCXX/overloaded-operator-decl.cpp`.
- **clang-tools-extra/clangd/InlayHints.cpp**
  - **`InlayHintVisitor::VisitCallExpr`**
Now that the `CXXOperatorCallExpr` for static operators also have object
argument, we should also take care of this situation in clangd.

### Tests

- **Added:**
    - **clang/test/AST/ast-dump-static-operators.cpp**
      Verify the AST generated for static operators.
    - **clang/test/SemaCXX/cxx2b-static-operator.cpp**
Static operators should be able to be called on const / volatile
objects.
- **Modified:**
    - **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp**
    - **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp**
      Matching the new CodeGen.

### Documentation

- **clang/docs/ReleaseNotes.rst**
  Update release notes.

---------

Co-authored-by: Shafik Yaghmour <shafik@users.noreply.github.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-01-31 15:27:06 +08:00
Aaron Ballman
201eb2b577 Revert "[clang] static operators should evaluate object argument (#68485)"
This reverts commit 30155fc0ef4fbdce2d79434aaae8d58b2fabb20a.

It seems to have broken some tests in clangd:
http://45.33.8.238/linux/129484/step_9.txt
2024-01-30 13:38:18 -05:00
Pil Eghoff
dcc37e7970
[Sema] Fix c23 not checking CheckBoolLikeConversion (#79588)
Fixes issue #79435 

Checks for implicit conversion into boolean was previously triggered by
`CheckBoolLikeConversion` for C.
When `bool` as a keyword was introduced in C23,
`CheckBoolLikeConversion` would no longer trigger when using `-std=c23`,
but since logical operators and conditional statements still operate on
scalar values, the checks for implicit conversion into bool were never
triggered.

This fix changes `CheckBoolLikeConversion` to not return early for C23,
even though it has support for bools.
2024-01-30 13:20:15 -05:00
Tianlan Zhou
30155fc0ef
[clang] static operators should evaluate object argument (#68485)
### Description

clang don't evaluate the object argument of `static operator()` and
`static operator[]` currently, for example:

```cpp
#include <iostream>

struct Foo {
    static int operator()(int x, int y) {
        std::cout << "Foo::operator()" << std::endl;
        return x + y;
    }
    static int operator[](int x, int y) {
        std::cout << "Foo::operator[]" << std::endl;
        return x + y;
    }
};
Foo getFoo() {
    std::cout << "getFoo()" << std::endl;
    return {};
}
int main() {
    std::cout << getFoo()(1, 2) << std::endl;
    std::cout << getFoo()[1, 2] << std::endl;
}
```

`getFoo()` is expected to be called, but clang don't call it currently
(17.0.2). This PR fixes this issue.

Fixes #67976.

### Walkthrough

- **clang/lib/Sema/SemaOverload.cpp**
- **`Sema::CreateOverloadedArraySubscriptExpr` &
`Sema::BuildCallToObjectOfClassType`**
Previously clang generate `CallExpr` for static operators, ignoring the
object argument. In this PR `CXXOperatorCallExpr` is generated for
static operators instead, with the object argument as the first
argument.
  - **`TryObjectArgumentInitialization`**
`const` / `volatile` objects are allowed for static methods, so that we
can call static operators on them.
- **clang/lib/CodeGen/CGExpr.cpp**
  - **`CodeGenFunction::EmitCall`**
CodeGen changes for `CXXOperatorCallExpr` with static operators: emit
and ignore the object argument first, then emit the operator call.
- **clang/lib/AST/ExprConstant.cpp**
  - **`‎ExprEvaluatorBase::handleCallExpr‎`**
Evaluation of static operators in constexpr also need some small changes
to work, so that the arguments won't be out of position.
- **clang/lib/Sema/SemaChecking.cpp**
  - **`Sema::CheckFunctionCall`**
Code for argument checking also need to be modify, or it will fail the
test `clang/test/SemaCXX/overloaded-operator-decl.cpp`.

### Tests

- **Added:**
    - **clang/test/AST/ast-dump-static-operators.cpp**
      Verify the AST generated for static operators.
    - **clang/test/SemaCXX/cxx2b-static-operator.cpp**
Static operators should be able to be called on const / volatile
objects.
- **Modified:**
    - **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp**
    - **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp**
      Matching the new CodeGen.

### Documentation

- **clang/docs/ReleaseNotes.rst**
  Update release notes.

---------

Co-authored-by: Shafik Yaghmour <shafik@users.noreply.github.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-01-30 13:09:05 -05:00
Nemanja Ivanovic
67c1c1dbb6
[PowerPC][X86] Make cpu id builtins target independent and lower for PPC (#68919)
Make __builtin_cpu_{init|supports|is} target independent and provide an
opt-in query for targets that want to support it. Each target is still
responsible for their specific lowering/code-gen. Also provide code-gen
for PowerPC.

I originally proposed this in https://reviews.llvm.org/D152914 and this
addresses the comments I received there.

---------

Co-authored-by: Nemanja Ivanovic <nemanjaivanovic@nemanjas-air.kpn>
Co-authored-by: Nemanja Ivanovic <nemanja@synopsys.com>
2024-01-26 11:24:50 -05:00
Brandon Wu
fb94c6491a
[RISCV][SiFive] Reduce intrinsics of SiFive VCIX extension (#79407)
This patch models LMUL and SEW as inputs in sf_vc_x_se and sf_vc_i_se,
it reduces 42 intrinsics in the lookup table.
2024-01-26 11:15:53 +08:00
Nikolas Klauser
4a58284559
[clang] Refactor Builtins.def to be a tablegen file (#68324)
This makes the builtins list quite a bit more verbose, but IMO this is a
huge win in terms of readability.
2024-01-24 11:22:43 +01:00
Sander de Smalen
1f6f19935c
[Clang][AArch64] Add diagnostics for builtins that use ZT0. (#79140)
Similar to what we did for ZA, this patch adds diagnostics to flag when
using a ZT0 builtin in a function that does not have ZT0 state.
2024-01-23 17:41:12 +01:00
Sander de Smalen
1652d44d8d
[Clang] Amend SME attributes with support for ZT0. (#77941)
This patch builds on top of #76971 and implements support for:
* __arm_new("zt0")
* __arm_in("zt0")
* __arm_out("zt0")
* __arm_inout("zt0")
* __arm_preserves("zt0")
2024-01-23 12:35:16 +01:00
Zahira Ammarguellat
1e2a4ccb62
[CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (#76873)
Check for operations using INF or NaN when in ffast-math mode and
generate a warning.
2024-01-22 14:38:30 -05:00
Sander de Smalen
40a631f452
[Clang] Refactor diagnostics for SME builtins. (#78258)
The arm_sme.td file was still using `IsSharedZA` and `IsPreservesZA`,
which should be changed to match the new state attributes added in
#76971.

This patch adds `IsInZA`, `IsOutZA` and `IsInOutZA` as the state for the
Clang builtins and fixes up the code in SemaChecking and SveEmitter to
match.

Note that the code is written in such a way that it can be easily
extended with ZT0 state (to follow in a future patch).
2024-01-19 16:02:24 +00:00
Sander de Smalen
8e7f073eb4
[Clang][AArch64] Change SME attributes for shared/new/preserved state. (#76971)
This patch replaces the `__arm_new_za`, `__arm_shared_za` and
`__arm_preserves_za` attributes in favour of:
* `__arm_new("za")`
* `__arm_in("za")`
* `__arm_out("za")`
* `__arm_inout("za")`
* `__arm_preserves("za")`

As described in https://github.com/ARM-software/acle/pull/276.

One change is that `__arm_in/out/inout/preserves(S)` are all mutually
exclusive, whereas previously it was fine to write `__arm_shared_za
__arm_preserves_za`. This case is now represented with `__arm_in("za")`.

The current implementation uses the same LLVM attributes under the hood,
since `__arm_in/out/inout` are all variations of "shared ZA", so can use
the existing `aarch64_pstate_za_shared` attribute in LLVM.

#77941 will add support for the new "zt0" state as introduced
with SME2.
2024-01-15 09:41:32 +00:00
Kazu Hirata
c54a8ac35a [Sema] Use StringRef::ltrim (NFC) 2024-01-08 17:12:26 -08:00
Sam Tebbs
0eefcaf96d
[Clang][SME] Add IsStreamingOrSVE2p1 (#76975)
This patch adds IsStreamingOrSVE2p1 to the applicable builtins and a
warning for when those builtins are not used in a streaming or sve2p1
function.
2024-01-05 09:55:50 +00:00
Sam Tebbs
a7a78fd427
Revert "[Clang][SME] Add IsStreamingOrSVE2p1" (#76973)
Reverts llvm/llvm-project#75958

I mistakenly included a commit from my local main after rebasing.
2024-01-04 16:53:14 +00:00
Sam Tebbs
8f8152091c
[Clang][SME] Add IsStreamingOrSVE2p1 (#75958)
This patch adds IsStreamingOrSVE2p1 to the applicable builtins and a
warning for when those builtins are not used in a streaming or sve2p1
function.
2024-01-04 16:50:31 +00:00
Ilya Biryukov
55d5ba905d [NFC] Fix compilation in C++20 mode with GCC 12
I ran into the following compiler error when trying to build with GCC 12
and `-DCMAKE_CXX_STANDARD=20`:
```
llvm-project/clang/lib/Sema/SemaChecking.cpp:16690:16:   required from here
/usr/include/c++/12/type_traits:971:30: error: default member initializer for '{anonymous}::SequenceChecker::Usage::UsageExpr' required before the end of its enclosing class
```

The error seems correct, GCC just instantiates the `SmallDenseMap`
early and detects it. Clang does not, but that's an acceptable
implementation difference as far as the standard is concerned.

Move constructor outside the class to avoid this problem.
2024-01-03 17:02:00 +01:00
Craig Topper
8076ee9667 [RISCV] Use getBuiltinVectorTypeInfo instead of isRVVType.
I'm trying to remove all uses of isRVVType.

Fix diagnostic message to report an error for the builtin instead
of the type. Though I can't seem to get a test to hit it.
2023-12-28 11:15:14 -08:00
Craig Topper
471f8f50d0
[RISCV] Prevent checkRVVTypeSupport from issuing more than 1 diagnostic. (#74950)
If vector isn't enabled at all, we might hit one of the earlier
diagnostics and the requires Zve32x diagnostic. The Zve32x diagnostic
would be redundant.
2023-12-27 23:44:45 -08:00
Craig Topper
98073057ee
[RISCV] Refactor checkRVVTypeSupport to use BuiltinVectorTypeInfo. (#74949)
We can decompose the type into ElementType and MinSize and use those to
perform the checks. This is more efficient than using isRVVType.

This also fixes a bug that we didn't disallow vbool64_t on Zve32x.
2023-12-27 21:53:27 -08:00
Kazu Hirata
68f832f56d [clang] Use StringRef::consume_front (NFC) 2023-12-25 12:54:35 -08:00
Eric Biggers
09058654f6
[RISCV] Remove experimental from Vector Crypto extensions (#74213)
The RISC-V vector crypto extensions have been ratified. This patch
updates the Clang and LLVM support for these extensions to be
non-experimental, while leaving the C intrinsics as experimental since
the C intrinsics are not yet standardized.

Co-authored-by: Brandon Wu <brandon.wu@sifive.com>
2023-12-18 22:04:22 -08:00
Sam Tebbs
a0a3c793d2
[Clang][SME] Warn when a function doesn't have ZA state (#75805)
This patch adds a warning that's emitted when a builtin call uses ZA
state but the calling function doesn't provide any.

Patch by David Sherwood <david.sherwood@arm.com>.
2023-12-18 16:14:25 +00:00
Sam Tebbs
945c645acb
[AArch64][SME] Warn when using a streaming builtin from a non-streaming function (#75487)
This PR adds a warning that's emitted when a non-streaming or
non-streaming-compatible builtin is called in an unsuitable function.

Uses work by Kerry McLaughlin.

This is a re-upload of #74064 and fixes a compile time increase.
2023-12-18 09:32:34 +00:00
Craig Topper
73beefc5d7 [RISCV] Remove 'experimental-' from extension name in diagnostic message.
I'm not sure how to test this because the intrinsic availability
already seems to check this.
2023-12-14 21:54:15 -08:00
Fangrui Song
fed564432c
[Sema] atomic_compare_exchange: check failure memory order (#74959)
For

`__atomic_compare_exchange{,_n}/__c11_atomic_compare_exchange_{strong,weak}`,
GCC checks both the success memory order and the failure memory order
under the default -Winvalid-memory-model ("memory model" is confusing
here and "memory order" is much more common in the atomic context).

* The failure memory order, if a constant, must be one of
  relaxed/consume/acquire/seq_cst.

Clang checks just the success memory order under the default
-Watomic-memory-ordering. This patch checks the failure memory order.
2023-12-14 11:03:28 -08:00
Sam Tebbs
342384ca05
Revert "[AArch64][SME] Warn when using a streaming builtin from a non-streaming function" (#75449)
Reverts llvm/llvm-project#74064
2023-12-14 09:31:55 +00:00
Sam Tebbs
2e45326b08
[AArch64][SME] Warn when using a streaming builtin from a non-streaming function (#74064)
This PR adds a warning that's emitted when a non-streaming or
non-streaming-compatible builtin is called in an unsuitable function.

Uses work by Kerry McLaughlin.
2023-12-14 00:11:04 +00:00
Kazu Hirata
f3dcc2351c
[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-13 08:54:13 -08:00
Craig Topper
4a11222f50 [RISCV] Correct the SEW=64 MUL diagnostic to refer to V as an extension.
This makes it consistent with other builtins that require a specific
extension.
2023-12-11 12:45:27 -08:00
Craig Topper
13662211c3 [RISCV] Simplify checking whether SEW=64 multiply builtins require V. NFC
We only need to check the result type. Use getBuiltinVectorTypeInfo
to lookup the element size.
2023-12-11 12:21:09 -08:00
Craig Topper
1bbf7225c1 [RISCV] Use getBuiltinVectorTypeInfo to simplify code. NFC 2023-12-11 11:58:58 -08:00
Craig Topper
b88b480640 [RISCV] Remove Type::isRVVType() and replace with isRVVSizelessBuiltinType(). NFC
These both do the same thing, but some profiling on a
Releast+Asserts build suggests isRVVSizelessBuiltinType() is the
more efficient version so lets keep that one.
2023-12-08 18:44:26 -08:00
Joseph Huber
4e80bc7d71
[Clang] Introduce scoped variants of GNU atomic functions (#72280)
Summary:
The standard GNU atomic operations are a very common way to target
hardware atomics on the device. With more heterogenous devices being
introduced, the concept of memory scopes has been in the LLVM language
for awhile via the `syncscope` modifier. For targets, such as the GPU,
this can change code generation depending on whether or not we only need
to be consistent with the memory ordering with the entire system, the
single GPU device, or lower.

Previously these scopes were only exported via the `opencl` and `hip`
variants of these functions. However, this made it difficult to use
outside of those languages and the semantics were different from the
standard GNU versions. This patch introduces a `__scoped_atomic` variant
for the common functions. There was some discussion over whether or not
these should be overloads of the existing ones, or simply new variants.
I leant towards new variants to be less disruptive.

The scope here can be one of the following

```
__MEMORY_SCOPE_SYSTEM // All devices and systems
__MEMORY_SCOPE_DEVICE // Just this device
__MEMORY_SCOPE_WRKGRP // A 'work-group' AKA CUDA block
__MEMORY_SCOPE_WVFRNT // A 'wavefront' AKA CUDA warp
__MEMORY_SCOPE_SINGLE // A single thread.
```
Naming consistency was attempted, but it is difficult to capture to full
spectrum with no many names. Suggestions appreciated.
2023-12-07 13:40:25 -06:00
Samuel Tebbs
02c218c6fb [Clang][NFC] Refactor out code from CheckSVEBuiltinFunctionCall into ParseSVEImmChecks
This moves code from CheckSVEBuiltinFunctionCall into ParseSVEImmChecks
in preparation for #74064
2023-12-06 15:12:40 +00:00
Younan Zhang
b3392c447a
[clang] Reject incomplete type arguments for __builtin_dump_struct (#72749)
We used to assume that the CXXRecordDecl passed to the 1st argument
always had a definition. This is not true since a pointer to an
incomplete type was not excluded.

Fixes https://github.com/llvm/llvm-project/issues/63506
2023-12-05 09:59:42 +08:00
Sam Tebbs
5234fe3154
[AArch64] Warn when calling a NEON builtin in a streaming function (#73672)
This patch introduces a warning that is emitted when a Neon builtin is
called from a streaming function, as that situation is not supported.

Uses work by Kerry McLaughlin.
2023-11-30 14:58:34 +00:00
CarolineConcatto
c77d79b6fe
[SVE2.1][Clang][LLVM]Add 128bits builtin in Clang and LLVM intrinisc (#71930)
This patch implements the builtins in Clang
and the LLVM-IR intrinsic for the following:

EXTQ
// Variants are also available for:
// _s8, _s16, _u16, _s32, _u32, _s64, _u64
// _bf16, _f16, _f32, _f64
svuint8_t svextq_lane[_u8](svuint8_t zdn, svuint8_t zm, uint64_t imm);

TBLQ and TBXQ
// Variants are also available for:
// _u8, _u16, _s16, _u32, _s32, _u64, _s64
// _bf16, _f16, _f32, _f64
svint8_t svtblq[_s8](svint8_t zn, svuint8_t zm);
svint8_t svtbxq[_s8](svint8_t zn, svuint8_t zm);

UZPQ1, UZPQ2, ZIPQ1 and ZIPQ2
// Variants are also available for:
// _s8, _u16, _s16, _u32, _s32, _u64, _s64
// _bf16, _f16, _f32, _f64
svuint8_t svuzpq1[_u8](svuint8_t zn, svuint8_t zm); svuint8_t
svuzpq2[_u8](svuint8_t zn, svuint8_t zm); svuint8_t
svzipq1[_u8](svuint8_t zn, svuint8_t zm); svuint8_t
svzipq2[_u8](svuint8_t zn, svuint8_t zm);

PMOV
// Variants are available for:
// _s8, _u16, _s16, _s32, _u32, _s64, _u64
svbool_t svpmov_lane[_u8](svuint8_t zn, uint64_t imm); svbool_t
svpmov[_u8](svuint8_t zn); // The immediate is zero svuint8_t
svpmov_u8_z(svbool_t pn); // The immediate is zero

// Variants are available for:
// _s16, _s32, _u32, _s64, _u64
svuint16_t svpmov_lane[_u16]_m(svuint16_t zd, svbool_t pn, uint64_t
imm);

According to the PR#257[1]
[1]ARM-software/acle#257

Co-authored-by: Hassnaa Hamdi <hassnaa.hamdi@arm.com>
2023-11-21 10:08:57 +00:00
Shao-Ce SUN
fbdf6e2724
[RISCV] Introduce and use BF16 in Xsfvfwmaccqqq intrinsics (#71140)
BF16 implementation based on @joshua-arch1's
https://reviews.llvm.org/D152498
Fixed the incorrect f16 type introduced in
https://github.com/llvm/llvm-project/pull/68296

---------

Co-authored-by: Jun Sha (Joshua) <cooper.joshua@linux.alibaba.com>
2023-11-06 11:22:14 +08:00