Skip to content

Codegen Overloaded LLVM intrinsics based on their name - #157145

Open
sayantn wants to merge 5 commits into
rust-lang:mainfrom
sayantn:overloaded-intrinsics
Open

sayantn wants to merge 5 commits into
rust-lang:mainfrom
sayantn:overloaded-intrinsics

Conversation

@sayantn

@sayantn sayantn commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

This is a continuation of #140763 - now codegenning overloaded LLVM intrinsics based on their name too. This PR parses the link_name of LLVM intrinsics for their type parameters, partially inverting getMangledTypeStr and getIntrinsicNameImpl from LLVM.

There is the concern that @nikic's work on LLVM intrinsics might remove name mangling, but we can retain it on the Rust side: even if LLVM IR drops the mangling, we can continue requiring the Rust link_name to contain it. This shouldn't break anything, as existing code already includes the name mangling.

There is also the concern that this cannot parse TargetExt types or non-literal struct types, since their mangling contains their name. If needed in the future, we can hardcode known TargetExt types, but we don't support them right now (which is fine, since Rust cannot currently represent TargetExt types anyway). Non-literal structs aren't a major issue either, because courtesy of #140763 we can already repack structs.

I have not added support for the LLVM byte type because it is only available in LLVM 23+, and our minimum supported LLVM version is 22.

The major focus of this PR is making sure an LLVM intrinsic is actually valid. For example, llvm.sqrt.i32 is invalid because llvm.sqrt demands float operands. The code puts a lot of effort into ensuring LLVM never asserts or aborts (which strips away useful diagnostics), so we validate in stages:

  • Target-architecture check: Verify the intrinsic's target prefix matches the current target architecture up front (independent of demangling/AutoUpgrade, while allowing Arch::Other).
  • Demangling & type invariants: During parsing we check standard LLVM invariants (e.g., vectors are only made of integers, floats, and pointers). If anything fails—whether a format error or a type error—we bail straight to AutoUpgrade (since what looks like invalid mangling might be a deprecated intrinsic). If it is AutoUpgrade-able, we retain the Rust signature and emit a lint; otherwise, we emit an UnknownIntrinsic error (which covers typos, bogus inputs like i10000000000000, or an incompatible LLVM version).
  • Pre-Intrinsic::getType checks: After demangling succeeds, we still can't pass the types straight to Intrinsic::getType, since it has internal asserts. We run those checks ourselves first, and only then ask LLVM for the FunctionType.
  • Signature validation: Intrinsic::getType is basically a copy-paste machine—intrinsics like llvm.sqrt.i32 will pass right through it. To catch those before polluting the module via Intrinsic::getOrInsertDeclaration, we run Intrinsic::isSignatureValid (falling back to matchIntrinsicSignature + matchIntrinsicVarArg on LLVM 22).
  • Rust signature comparison: Only after all of the above succeeds do we compare against the declared Rust signature to catch signature mismatches.

In summary, the goal is to avoid LLVM asserts (which make debugging much harder) and prevent rustc from generating invalid IR as much as possible.

Things not implemented yet

  • byte type demangling (blocked on min-LLVM 23)
  • Default parameters in intrinsics (not in LLVM 22; easy to add in a follow-up)

The large diff size is mainly due to the number of new UI tests.

One important change: the parser doesn't account for LLVM typed pointers, which were deprecated in LLVM 15 and removed in LLVM 17, so I didn't add support for them and removed all remaining uses of typed pointers from the tree.

r? @dianqk as you have the most context on this from reviewing the last 2 PRs
cc @nikic

@rustbot

rustbot commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

The Rustfmt subtree was changed

cc @rust-lang/rustfmt

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels May 30, 2026
@rust-log-analyzer

This comment has been minimized.

@sayantn
sayantn force-pushed the overloaded-intrinsics branch 2 times, most recently from a399a07 to c55c137 Compare May 30, 2026 13:05
@rust-bors

This comment has been minimized.

@sayantn
sayantn force-pushed the overloaded-intrinsics branch from c55c137 to 36e3bbc Compare July 8, 2026 20:34
@rustbot

This comment has been minimized.

@apiraino

Copy link
Copy Markdown
Contributor

cc @rust-lang/wg-llvm could you have a look here - when you have some time? thanks

@dianqk

dianqk commented Aug 24, 2026

Copy link
Copy Markdown
Member

cc @rust-lang/wg-llvm could you have a look here - when you have some time? thanks

I will review this PR this week.

@dianqk dianqk left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dianqk

dianqk commented Aug 27, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 36e3bbc has been approved by dianqk

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 27, 2026
…ianqk

Codegen Overloaded LLVM intrinsics based on their name

This is a continuation of rust-lang#140763 - now codegenning overloaded LLVM intrinsics based on their name too. This PR parses the `link_name` of the LLVM intrinsics for the type parameters, partially inverting [`getMangledTypeStr`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00076) and [`getIntrinsicNameImpl`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00165) from LLVM.

There is the concern that @nikic's work on LLVM intrinsics might remove the name mangling, but we can just retain that from the Rust side. I mean even though the LLVM IR wouldn't have the mangling, but we can require that the Rust `link_name` argument contain the mangling. This shouldn't break anything, as existing code already has the name mangling.

There is also the concern that this cannot parse `TargetExt` types and non-literal struct types, as their mangling contains their name. If needed in future, we can maybe hardcode some known `TargetExt` types, but currently we don't support it. It also kinda helps that Rust currently cannot handle `TargetExt` types. The named struct one is not that big of a problem because courtesy of rust-lang#140763 we can already repack structs.

I have not added support of LLVM `byte` type because it is only available in LLVM22, and we support min-LLVM version 20 afaik.

I prefer this approach over the `IITDesc` approach highlighted in rust-lang#140763 because this approach allows code like
```rust
#[link_name = "llvm.sqrt.v8bf16"]
fn foo(a: u16x8) -> u16x8;
```
which pairs up with the autocasts of rust-lang#140763 to give a nice way to call overloaded intrinsics on `bf16`. Also this approach is a lot less work and more resilient to LLVM changes than the `IITDesc` approach.

One important change - the parsing doesn't account for LLVM typed pointers, which were deprecated in LLVM15 and removed in LLVM17, so I didn't bother putting support for them. So, I also removed all uses of typed pointers from the tree.

r? @dianqk as you might have more of a context on this due to reviewing the last 2 PRs
cc @nikic
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 27, 2026
…ianqk

Codegen Overloaded LLVM intrinsics based on their name

This is a continuation of rust-lang#140763 - now codegenning overloaded LLVM intrinsics based on their name too. This PR parses the `link_name` of the LLVM intrinsics for the type parameters, partially inverting [`getMangledTypeStr`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00076) and [`getIntrinsicNameImpl`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00165) from LLVM.

There is the concern that @nikic's work on LLVM intrinsics might remove the name mangling, but we can just retain that from the Rust side. I mean even though the LLVM IR wouldn't have the mangling, but we can require that the Rust `link_name` argument contain the mangling. This shouldn't break anything, as existing code already has the name mangling.

There is also the concern that this cannot parse `TargetExt` types and non-literal struct types, as their mangling contains their name. If needed in future, we can maybe hardcode some known `TargetExt` types, but currently we don't support it. It also kinda helps that Rust currently cannot handle `TargetExt` types. The named struct one is not that big of a problem because courtesy of rust-lang#140763 we can already repack structs.

I have not added support of LLVM `byte` type because it is only available in LLVM22, and we support min-LLVM version 20 afaik.

I prefer this approach over the `IITDesc` approach highlighted in rust-lang#140763 because this approach allows code like
```rust
#[link_name = "llvm.sqrt.v8bf16"]
fn foo(a: u16x8) -> u16x8;
```
which pairs up with the autocasts of rust-lang#140763 to give a nice way to call overloaded intrinsics on `bf16`. Also this approach is a lot less work and more resilient to LLVM changes than the `IITDesc` approach.

One important change - the parsing doesn't account for LLVM typed pointers, which were deprecated in LLVM15 and removed in LLVM17, so I didn't bother putting support for them. So, I also removed all uses of typed pointers from the tree.

r? @dianqk as you might have more of a context on this due to reviewing the last 2 PRs
cc @nikic
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 27, 2026
…ianqk

Codegen Overloaded LLVM intrinsics based on their name

This is a continuation of rust-lang#140763 - now codegenning overloaded LLVM intrinsics based on their name too. This PR parses the `link_name` of the LLVM intrinsics for the type parameters, partially inverting [`getMangledTypeStr`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00076) and [`getIntrinsicNameImpl`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00165) from LLVM.

There is the concern that @nikic's work on LLVM intrinsics might remove the name mangling, but we can just retain that from the Rust side. I mean even though the LLVM IR wouldn't have the mangling, but we can require that the Rust `link_name` argument contain the mangling. This shouldn't break anything, as existing code already has the name mangling.

There is also the concern that this cannot parse `TargetExt` types and non-literal struct types, as their mangling contains their name. If needed in future, we can maybe hardcode some known `TargetExt` types, but currently we don't support it. It also kinda helps that Rust currently cannot handle `TargetExt` types. The named struct one is not that big of a problem because courtesy of rust-lang#140763 we can already repack structs.

I have not added support of LLVM `byte` type because it is only available in LLVM22, and we support min-LLVM version 20 afaik.

I prefer this approach over the `IITDesc` approach highlighted in rust-lang#140763 because this approach allows code like
```rust
#[link_name = "llvm.sqrt.v8bf16"]
fn foo(a: u16x8) -> u16x8;
```
which pairs up with the autocasts of rust-lang#140763 to give a nice way to call overloaded intrinsics on `bf16`. Also this approach is a lot less work and more resilient to LLVM changes than the `IITDesc` approach.

One important change - the parsing doesn't account for LLVM typed pointers, which were deprecated in LLVM15 and removed in LLVM17, so I didn't bother putting support for them. So, I also removed all uses of typed pointers from the tree.

r? @dianqk as you might have more of a context on this due to reviewing the last 2 PRs
cc @nikic
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 27, 2026
…ianqk

Codegen Overloaded LLVM intrinsics based on their name

This is a continuation of rust-lang#140763 - now codegenning overloaded LLVM intrinsics based on their name too. This PR parses the `link_name` of the LLVM intrinsics for the type parameters, partially inverting [`getMangledTypeStr`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00076) and [`getIntrinsicNameImpl`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00165) from LLVM.

There is the concern that @nikic's work on LLVM intrinsics might remove the name mangling, but we can just retain that from the Rust side. I mean even though the LLVM IR wouldn't have the mangling, but we can require that the Rust `link_name` argument contain the mangling. This shouldn't break anything, as existing code already has the name mangling.

There is also the concern that this cannot parse `TargetExt` types and non-literal struct types, as their mangling contains their name. If needed in future, we can maybe hardcode some known `TargetExt` types, but currently we don't support it. It also kinda helps that Rust currently cannot handle `TargetExt` types. The named struct one is not that big of a problem because courtesy of rust-lang#140763 we can already repack structs.

I have not added support of LLVM `byte` type because it is only available in LLVM22, and we support min-LLVM version 20 afaik.

I prefer this approach over the `IITDesc` approach highlighted in rust-lang#140763 because this approach allows code like
```rust
#[link_name = "llvm.sqrt.v8bf16"]
fn foo(a: u16x8) -> u16x8;
```
which pairs up with the autocasts of rust-lang#140763 to give a nice way to call overloaded intrinsics on `bf16`. Also this approach is a lot less work and more resilient to LLVM changes than the `IITDesc` approach.

One important change - the parsing doesn't account for LLVM typed pointers, which were deprecated in LLVM15 and removed in LLVM17, so I didn't bother putting support for them. So, I also removed all uses of typed pointers from the tree.

r? @dianqk as you might have more of a context on this due to reviewing the last 2 PRs
cc @nikic
pub unsafe fn overloaded_bf16_autocast(a: i16x8) -> i16x8 {
extern "unadjusted" {
#[link_name = "llvm.sqrt.v8bf16"]
fn foo(a: i16x8) -> i16x8;

@RalfJung RalfJung Aug 27, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this extremely confusing. What is going on here? The intrinsic actually has type <8 x bfloat> but we pass it an i16x8? Why should we allow such code...?

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main motivation for this entire approach was ability to insert magic type casts for types that Rust does not support.

Of course, this is kind of moot with f16b being introduced in #160859.

(FWIW, I don't think what this PR does is a good idea, but I don't have time to fight it.)

@RalfJung RalfJung Aug 27, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, this is kind of moot with f16b being introduced in #160859.

Yeah that seems to remove this part of the motivation. OTOH the old referenced PR also mentions

LLVM intrinsics that have types in their signature that can't be accessed from Rust (notable examples are the AMX intrinsics that have the x86amx type, and (almost) all intrinsics that have vectors of i1 types) can't be linked to at all. This is a (major?) roadblock in the AMX and AVX512 support in stdarch.

So the question is, will we have native types for those as well? We might have to, if they are relevant for ABIs we need to implement. But if they are only used for LLVM intrinsics, not for extern "C", then this PR may save us from adding that type. I don't know anything about x86amx, or whether there's a better way to deal with vectors of i1.

Another motivation seems to be dealing with LLVM intrinsics that change their signature -- how is stdarch supposed to import these? But this does works today so it seems the LLVM auto-upgrade for this is enough?

And then there's "finding signatures that are just wrong". But it seems that already landed in #140763.

On the list of downsides we have "keeping the long mangled LLVM names even after LLVM itself doesn't use them any more", if I understood correctly the plan for how to deal with @nikic's work on getting rid of the name mangling in LLVM. That seems like a silly end state and is clearly path-dependent -- if LLVM had removed the mangling 5 years ago, I doubt we'd accept a PR like this to add magic name mangling in the link_name string to indicate the "real" signature. So likewise I don't think we want to be in a state where we are keeping the name mangling alive long after LLVM dropped it.

I also couldn't find an MCP for this change. Should it have one? It's very backend-internal, but OTOH one of our main backend experts disagrees so it may be good to have a bit of a wider discussion. @dianqk seems fine with it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intrinsics name mangling has been in Rust for a long time, before #140763. IMO, this PR just helps handwriting intrinsics for people. This is fine with me.
I think we may want to find an approach to get rid of the name mangling after LLVM changed, even if we are not going to merge the PR.

But I'm curious about alternative implementation. Can we write a cargo out-of-tree plugin for the intrinsics name mangling? IIUC, since this is mostly used for stdarch, a standalone checking tool would be great.

@RalfJung RalfJung Aug 30, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intrinsics name mangling has been in Rust for a long time, before #140763

demangle_type_str is new in this PR, so I am not sure what you mean. So far these mangled names are just forwarded opaquely to LLVM.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify my position on this: I consider name mangling to be something of an implementation detail of LLVM, that Rust would ideally not need to expose. Instead of declaring something like #[link_name = "llvm.sqrt.v8bf16"], it is sufficient to use #[link_name = "llvm.sqrt"] and infer the mangled name from the function signature. This is how intrinsics are written in textual LLVM IR nowadays, you don't actually write out the mangling suffix, the parser infers it.

The motivation for inverting this, and instead make the mangling suffix (rather than the function signature) the source of truth is ability to insert automatic casts for types that Rust does not support. This is no longer relevant for bfloat, but still relevant for x86_amx. IMHO the proper way to handle that is to represent this as a special type in Rust, which has special ABI rules when passed to LLVM intrinsics. This does not have to be full support for the type like what is happening with f16b right now, but just the minimum to adjust its ABI (which I assume is something like a lang item?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the proper way to handle that is to represent this as a special type in Rust, which has special ABI rules when passed to LLVM intrinsics. This does not have to be full support for the type like what is happening with f16b right now, but just the minimum to adjust its ABI (which I assume is something like a lang item?)

rust-lang/rfcs#4003 does this for two more types.

For types that don't get publicly exposed but only used internally, I think this doesn't need an RFC. Just a t-compiler MCP.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intrinsics name mangling has been in Rust for a long time, before #140763

demangle_type_str is new in this PR, so I am not sure what you mean. So far these mangled names are just forwarded opaquely to LLVM.

I misunderstood something. Yes, you are right.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @nikic if we can define several special types in Rust for LLVM. Sometimes I am only thinking about how to implement it in rustc without changing other parts.

rust-bors Bot pushed a commit that referenced this pull request Aug 27, 2026
Rollup of 7 pull requests

Successful merges:

 - #150075 (Implement clamp_to)
 - #157145 (Codegen Overloaded LLVM intrinsics based on their name)
 - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations)
 - #161456 (reduce perf impact of scalar size checks)
 - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers)
 - #161828 (Never type after-stabilization cleanup)
 - #161860 (atomicptr.rs test: remove unused import)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 27, 2026
…ianqk

Codegen Overloaded LLVM intrinsics based on their name

This is a continuation of rust-lang#140763 - now codegenning overloaded LLVM intrinsics based on their name too. This PR parses the `link_name` of the LLVM intrinsics for the type parameters, partially inverting [`getMangledTypeStr`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00076) and [`getIntrinsicNameImpl`](https://llvm.org/doxygen/Intrinsics_8cpp_source.html#l00165) from LLVM.

There is the concern that @nikic's work on LLVM intrinsics might remove the name mangling, but we can just retain that from the Rust side. I mean even though the LLVM IR wouldn't have the mangling, but we can require that the Rust `link_name` argument contain the mangling. This shouldn't break anything, as existing code already has the name mangling.

There is also the concern that this cannot parse `TargetExt` types and non-literal struct types, as their mangling contains their name. If needed in future, we can maybe hardcode some known `TargetExt` types, but currently we don't support it. It also kinda helps that Rust currently cannot handle `TargetExt` types. The named struct one is not that big of a problem because courtesy of rust-lang#140763 we can already repack structs.

I have not added support of LLVM `byte` type because it is only available in LLVM22, and we support min-LLVM version 20 afaik.

I prefer this approach over the `IITDesc` approach highlighted in rust-lang#140763 because this approach allows code like
```rust
#[link_name = "llvm.sqrt.v8bf16"]
fn foo(a: u16x8) -> u16x8;
```
which pairs up with the autocasts of rust-lang#140763 to give a nice way to call overloaded intrinsics on `bf16`. Also this approach is a lot less work and more resilient to LLVM changes than the `IITDesc` approach.

One important change - the parsing doesn't account for LLVM typed pointers, which were deprecated in LLVM15 and removed in LLVM17, so I didn't bother putting support for them. So, I also removed all uses of typed pointers from the tree.

r? @dianqk as you might have more of a context on this due to reviewing the last 2 PRs
cc @nikic
@RalfJung

RalfJung commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

@bors try jobs=aarch64-gnu
(I think this may have failed the rollup.)

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 27, 2026
Codegen Overloaded LLVM intrinsics based on their name


try-job: aarch64-gnu
@RalfJung

Copy link
Copy Markdown
Member

@bors r-

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 27, 2026
@rust-bors

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#161874), which was unapproved.

View changes since this unapproval

@rust-bors

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 052f00a failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@sayantn
sayantn force-pushed the overloaded-intrinsics branch from f82ed80 to 1eef917 Compare November 20, 2026 21:10
@rust-log-analyzer

This comment has been minimized.

@sayantn
sayantn force-pushed the overloaded-intrinsics branch from 1eef917 to 67104aa Compare November 20, 2026 21:42
@rust-log-analyzer

This comment has been minimized.

@sayantn
sayantn force-pushed the overloaded-intrinsics branch from 67104aa to 0d649c9 Compare November 20, 2026 22:50
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-22-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/codegen/issue-99551.rs ... ok
test [ui] tests/ui/codegen/issue-97708.rs ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#bitcast_not_vec ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/deprecated.rs ... FAILED
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#bitcast_ptr ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#extend_not_int ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#num_params_too_few ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#extend_too_wide ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#num_params_zero ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#num_params_too_many ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#sub2_not_vec ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#sig_valid_fail ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#one_nth_not_vec ... FAILED
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#one_nth_not_div ... FAILED
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#sub2_ptr ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#sub2_odd ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#sub4_not_div ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#trunc_i1 ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/incorrect-arch.rs#deprecated ... ignored, ignored when the architecture is aarch64
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#trunc_not_int ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/incorrect-signature.rs#arg_type ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/incorrect-arch.rs#normal ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/incorrect-signature.rs#arity ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#trunc_odd ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#array_fn ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#vec_element ... ok
---
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#int_overflow ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#int_too_wide ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#int_zero ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#missing_dot ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#non_overloaded_suffix ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#nxv_too_long ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#nxv_void ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#nonexistent ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#ptr_addrspace_too_large ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#struct_fn ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#nxv_zero ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#struct_void ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#trailing_dot ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#unknown_type ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#struct_unclosed ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#vec_nested ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#vec_struct ... ok
test [ui] tests/ui/codegen/llvm-intrinsics/parse-failure.rs#vec_too_long ... ok
---

10 LL |     #[deny(deprecated_llvm_intrinsic)]
11    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
12 
- error: using deprecated intrinsic `llvm.aarch64.neon.vcvthf2fp`
+ error: intrinsic signature mismatch for `llvm.aarch64.neon.vcvthf2fp`: expected signature `<4 x float> (<4 x i16>)`, found `float (i32)`
14   --> $DIR/deprecated.rs:23:5
15    |
16 LL |     fn vcvthf2fp(a: u32) -> f32;

17    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    |
- note: the lint level is defined here
-   --> $DIR/deprecated.rs:21:12
---
To only update this specific test, also pass `--test-args codegen/llvm-intrinsics/deprecated.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/codegen/llvm-intrinsics/deprecated.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--check-cfg" "cfg(test,FALSE)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codegen/llvm-intrinsics/deprecated" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "--edition=2015" "--target" "aarch64-unknown-linux-gnu" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codegen/llvm-intrinsics/deprecated/libminicore.rlib"
stdout: none
--- stderr -------------------------------
error: using deprecated intrinsic `llvm.aarch64.neon.rbit.v8i8`, `llvm.bitreverse.v8i8` can be used instead
##[error]  --> /checkout/tests/ui/codegen/llvm-intrinsics/deprecated.rs:18:5
   |
LL |     fn rbit(a: i8x8) -> i8x8;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/codegen/llvm-intrinsics/deprecated.rs:16:12
   |
LL |     #[deny(deprecated_llvm_intrinsic)]
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^

error: intrinsic signature mismatch for `llvm.aarch64.neon.vcvthf2fp`: expected signature `<4 x float> (<4 x i16>)`, found `float (i32)`
##[error]  --> /checkout/tests/ui/codegen/llvm-intrinsics/deprecated.rs:23:5
   |
LL |     fn vcvthf2fp(a: u32) -> f32;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
------------------------------------------

---- [ui] tests/ui/codegen/llvm-intrinsics/deprecated.rs stdout end ----
---- [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#one_nth_not_vec stdout ----

error in revision `one_nth_not_vec`: Error: expected failure status (Some(1)) but received status None.
status: signal: 6 (SIGABRT) (core dumped)
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/codegen/llvm-intrinsics/early-check.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--cfg" "one_nth_not_vec" "--check-cfg" "cfg(test,FALSE,num_params_too_few,num_params_zero,num_params_too_many,vec_element,one_nth_not_vec,one_nth_not_div,extend_not_int,extend_too_wide,trunc_not_int,trunc_i1,trunc_odd,sub2_not_vec,sub2_ptr,sub2_odd,sub4_not_div,bitcast_not_vec,bitcast_ptr,sig_valid_fail)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codegen/llvm-intrinsics/early-check.one_nth_not_vec" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "--edition=2015" "--target" "aarch64-unknown-linux-gnu" "--crate-type" "lib" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codegen/llvm-intrinsics/early-check.one_nth_not_vec/libminicore.rlib"
stdout: none
--- stderr -------------------------------
rustc: /usr/lib/llvm-22/include/llvm/IR/Intrinsics.h:203: unsigned int llvm::Intrinsic::IITDescriptor::getArgumentNumber() const: Assertion `Kind == Argument || Kind == ExtendArgument || Kind == TruncArgument || Kind == SameVecWidthArgument || Kind == VecElementArgument || Kind == Subdivide2Argument || Kind == Subdivide4Argument || Kind == VecOfBitcastsToInt' failed.
------------------------------------------

---- [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#one_nth_not_vec stdout end ----
---- [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#one_nth_not_div stdout ----

error in revision `one_nth_not_div`: Error: expected failure status (Some(1)) but received status None.
status: signal: 6 (SIGABRT) (core dumped)
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/codegen/llvm-intrinsics/early-check.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--cfg" "one_nth_not_div" "--check-cfg" "cfg(test,FALSE,num_params_too_few,num_params_zero,num_params_too_many,vec_element,one_nth_not_vec,one_nth_not_div,extend_not_int,extend_too_wide,trunc_not_int,trunc_i1,trunc_odd,sub2_not_vec,sub2_ptr,sub2_odd,sub4_not_div,bitcast_not_vec,bitcast_ptr,sig_valid_fail)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codegen/llvm-intrinsics/early-check.one_nth_not_div" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "--edition=2015" "--target" "aarch64-unknown-linux-gnu" "--crate-type" "lib" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/codegen/llvm-intrinsics/early-check.one_nth_not_div/libminicore.rlib"
stdout: none
--- stderr -------------------------------
rustc: /usr/lib/llvm-22/include/llvm/IR/Intrinsics.h:203: unsigned int llvm::Intrinsic::IITDescriptor::getArgumentNumber() const: Assertion `Kind == Argument || Kind == ExtendArgument || Kind == TruncArgument || Kind == SameVecWidthArgument || Kind == VecElementArgument || Kind == Subdivide2Argument || Kind == Subdivide4Argument || Kind == VecOfBitcastsToInt' failed.
------------------------------------------

---- [ui] tests/ui/codegen/llvm-intrinsics/early-check.rs#one_nth_not_div stdout end ----
---- [ui] tests/ui/scalable-vectors/debuginfo-no-opt-llvm-ice.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/scalable-vectors/debuginfo-no-opt-llvm-ice.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/scalable-vectors/debuginfo-no-opt-llvm-ice" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021" "-Ctarget-feature=+sve,+sve2" "-Copt-level=0" "-g"
stdout: none
--- stderr -------------------------------
error: incorrect number of type parameters in intrinsic `llvm.aarch64.sve.ld1.nxv16i8.p0`: expected 1, found 2
##[error]  --> /rustc/FAKE_PREFIX/library/core/src/../../stdarch/crates/core_arch/src/aarch64/sve/generated.rs:11881:8

error: aborting due to 1 previous error
------------------------------------------

---- [ui] tests/ui/scalable-vectors/debuginfo-no-opt-llvm-ice.rs stdout end ----
---- [ui] tests/ui/scalable-vectors/transmute.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/scalable-vectors/transmute.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/scalable-vectors/transmute" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Copt-level=3"
stdout: none
--- stderr -------------------------------
error: incorrect number of type parameters in intrinsic `llvm.aarch64.sve.ld2.sret.nxv16i8.p0`: expected 1, found 2
##[error]  --> /checkout/tests/ui/scalable-vectors/transmute.rs:33:9
   |
LL |         fn _svld2_s8(pg: svbool_t, base: *const i8) -> svint8x2_t;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
------------------------------------------

---- [ui] tests/ui/scalable-vectors/transmute.rs stdout end ----
---- [ui] tests/ui/scalable-vectors/transparent-wrappers.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/scalable-vectors/transparent-wrappers.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-Zthreads=1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/scalable-vectors/transparent-wrappers" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021" "--emit=obj" "-Ctarget-feature=+sve"
stdout: none
--- stderr -------------------------------
error: incorrect number of type parameters in intrinsic `llvm.aarch64.sve.ld1.nxv8i16.p0`: expected 1, found 2
##[error]  --> /rustc/FAKE_PREFIX/library/core/src/../../stdarch/crates/core_arch/src/aarch64/sve/generated.rs:11897:8

error: aborting due to 1 previous error
------------------------------------------

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants