Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing tests for intrinsics. #71669

Closed
7 of 8 tasks
lcnr opened this issue Apr 29, 2020 · 5 comments
Closed
7 of 8 tasks

Missing tests for intrinsics. #71669

lcnr opened this issue Apr 29, 2020 · 5 comments
Assignees
Labels
A-intrinsics Area: intrinsics C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Apr 29, 2020

There are a few intrinsics which are not tested.

We also don't test the emitted IR for most intrinsics, e.g. ctlz_nonzero could use ctlz without being noticed.

  • pref_align_of: never used
  • volatile_copy_nonoverlapping_memory: used in a test for write_volatile causes ICE with zero-sized types. #39827 without checking its output or IR
  • volatile_copy_memory: ^
  • volatile_set_memory: ^^
  • unaligned_volatile_load: both IR and use with unaligned addr never checked
  • unaligned_volatile_store: ^
  • nearbyintf32: never used
  • nearbyintf64: ^
@Alexendoo Alexendoo added A-intrinsics Area: intrinsics C-enhancement Category: An issue proposing an enhancement or a PR with one. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 29, 2020
@lcnr lcnr added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Jul 9, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Jul 9, 2020

If someone wants to work on this feel free to ask here or on zulip.

See

#![crate_type = "lib"]
#![feature(core_intrinsics)]
use std::intrinsics::*;
// CHECK-LABEL: @unchecked_add_signed
#[no_mangle]
pub unsafe fn unchecked_add_signed(a: i32, b: i32) -> i32 {
// CHECK: add nsw
unchecked_add(a, b)
}
for how to test an intrinsic.

@theo-lw
Copy link
Contributor

theo-lw commented Jul 12, 2020

I'd like to take a stab at this (if no one else is working on this issue yet).

@lcnr
Copy link
Contributor Author

lcnr commented Jul 12, 2020

Doesn't seem like someone else is already looking at this.

@rust-lang rust-lang deleted a comment from rustbot Jul 12, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics

Added some tests for intrinsics. See rust-lang#71669.
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 14, 2020
…arth

Rollup of 8 pull requests

Successful merges:

 - rust-lang#73354 (Update RELEASES.md for 1.45.0)
 - rust-lang#73852 (rustdoc: insert newlines between attributes)
 - rust-lang#73867 (Document the union keyword)
 - rust-lang#74046 (Fix caching issue when building tools.)
 - rust-lang#74123 (clean up E0718 explanation)
 - rust-lang#74147 (rustdoc: Allow linking from private items to private types)
 - rust-lang#74285 (rust-lang#71669: add ui, codegen tests for volatile + nearby int intrinsics)
 - rust-lang#74286 (Added detailed error code explanation for issue E0688 in Rust compiler.)

Failed merges:

r? @ghost
@good-praxis
Copy link

#74285 has been merged, so this issue could be closed methinks

@lcnr
Copy link
Contributor Author

lcnr commented Aug 31, 2020

We are still missing codegen tests for many intrinsics, but I am not sure how useful this issue is to track that, so I will just go ahead and close this.

@good-praxis in case you were interested in working on this issue, that might be something you can look into

@lcnr lcnr closed this as completed Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intrinsics Area: intrinsics C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants