Skip to content

add -Zforce-intrinsic-fallback flag#158377

Open
folkertdev wants to merge 1 commit into
rust-lang:mainfrom
folkertdev:force-intrinsic-fallback
Open

add -Zforce-intrinsic-fallback flag#158377
folkertdev wants to merge 1 commit into
rust-lang:mainfrom
folkertdev:force-intrinsic-fallback

Conversation

@folkertdev

@folkertdev folkertdev commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Add a flag that forces the use of the fallback body (if one exists), so that we can test that these fallback implementations actually work.

cc #150946
cc #t-compiler > testing intrinsic fallback bodies
cc #t-infra > CI for -Zforce-intrinsic-fallback

@rustbot

rustbot commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

@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. labels Jun 24, 2026
@rustbot

rustbot commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

r? @adwinwhite

rustbot has assigned @adwinwhite.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates

@folkertdev folkertdev changed the title add -Zforce_intrinsic_fallback flag add -Zforce-intrinsic-fallback flag Jun 24, 2026
@folkertdev folkertdev force-pushed the force-intrinsic-fallback branch from 5c1f7b7 to c9f5a33 Compare June 24, 2026 19:52
Comment thread compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs Outdated
@adwinwhite

Copy link
Copy Markdown
Contributor

r? codegen

@rustbot rustbot assigned saethlin and unassigned adwinwhite Jun 27, 2026
@folkertdev folkertdev force-pushed the force-intrinsic-fallback branch from c9f5a33 to 5da2144 Compare June 28, 2026 19:55
@rustbot

rustbot commented Jun 28, 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.

@@ -0,0 +1,71 @@
//@ add-minicore
//@ assembly-output: emit-asm

@scottmcm scottmcm Jun 28, 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'm kinda puzzled here: why does this need assembly output? If it wants to be checking assembly should it be in assembly-llvm instead? For that matter, why does it need minicore?

Could this just be a normal codegen test that calls std::intrinsics::sqrtf32? Looking at llvm-ir should be pretty portable for it, no? (Especially with -C no-prepopulate-passes so it just sees what we emit, not post-optimization IR.)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, this was an assembly test originally, but LLVM made more sense.

I've made it generic now, with -C no-prepopulate-passes -Copt-level=3 so hopefully the IR should be stable enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also given that you've now looked at this code a bunch, maybe you can review it?

@folkertdev folkertdev force-pushed the force-intrinsic-fallback branch 2 times, most recently from fb0a1e2 to 76314f6 Compare June 28, 2026 21:04
@folkertdev folkertdev force-pushed the force-intrinsic-fallback branch from 76314f6 to 69d7670 Compare June 28, 2026 21:05
@saethlin

saethlin commented Jul 3, 2026

Copy link
Copy Markdown
Member

I got here eventually!

@bors r+

@rust-bors

rust-bors Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 69d7670 has been approved by saethlin

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

@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 Jul 3, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 3, 2026
…k, r=saethlin

add `-Zforce-intrinsic-fallback` flag

Add a flag that forces the use of the fallback body (if one exists), so that we can test that these fallback implementations actually work.

cc rust-lang#150946
cc [#t-compiler > testing intrinsic fallback bodies](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/testing.20intrinsic.20fallback.20bodies/with/606299558)
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants