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

View all comments

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

This comment has been minimized.

@@ -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 3 times, most recently 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)
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
Rollup of 18 pull requests

Successful merges:

 - #158692 (Add release notes for 1.96.1)
 - #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
 - #152860 (Port the `without_debuginfo` test from `backtrace-rs` to the testsuite)
 - #155932 (MIR Call terminator: evaluate destination place before arguments)
 - #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
 - #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
 - #157835 (expand free alias types in the auto-trait orphan check)
 - #158377 (add `-Zforce-intrinsic-fallback` flag)
 - #158434 (delegation: refactor AST -> HIR lowering)
 - #158552 (make some tidy errors around python easier to understand)
 - #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
 - #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
 - #158711 (library: Comment on libtest's dicey internal soundness)
 - #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
 - #158659 (refactor the normalization in `coerce_shared_info`)
 - #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
 - #158698 (Update TypeVisitable implementation)
 - #158706 (Tweaks to MIR building scope API)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 5, 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)
cc [#t-infra > CI for -Zforce-intrinsic-fallback](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/CI.20for.20-Zforce-intrinsic-fallback/with/608129693)
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #158692 (Add release notes for 1.96.1)
 - #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
 - #155932 (MIR Call terminator: evaluate destination place before arguments)
 - #155989 (Update `transmute_copy` to ub_checks and `?Sized`)
 - #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
 - #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
 - #157835 (expand free alias types in the auto-trait orphan check)
 - #157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`))
 - #158377 (add `-Zforce-intrinsic-fallback` flag)
 - #158434 (delegation: refactor AST -> HIR lowering)
 - #158552 (make some tidy errors around python easier to understand)
 - #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
 - #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
 - #158711 (library: Comment on libtest's dicey internal soundness)
 - #158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes)
 - #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
 - #158659 (refactor the normalization in `coerce_shared_info`)
 - #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
 - #158698 (Update TypeVisitable implementation)
 - #158706 (Tweaks to MIR building scope API)
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #158798 (comment)

@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 Jul 5, 2026
@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

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

View changes since this unapproval

@folkertdev folkertdev force-pushed the force-intrinsic-fallback branch from 69d7670 to 6810f13 Compare July 5, 2026 13:33
@rustbot

rustbot commented Jul 5, 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.

@folkertdev

Copy link
Copy Markdown
Contributor Author

@bors try jobs=dist-i586-gnu-i586-i686-musl

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
add `-Zforce-intrinsic-fallback` flag


try-job: dist-i586-gnu-i586-i686-musl
@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 65a628b (65a628b17e22314b8c2a6b1d1667246001df89a8)
Base parent: 4eb6253 (4eb62535fc12dd1a63fd43a4173e224e79313c4d)

@folkertdev

Copy link
Copy Markdown
Contributor Author

My LLVM checks were a bit too strict apparently

@bors r=saethlin

@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6810f13 has been approved by saethlin

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 2. 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 5, 2026
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.

6 participants