Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions tests/codegen/bool-select-unpredictable.rs

This file was deleted.

34 changes: 33 additions & 1 deletion tests/codegen/intrinsics/select_unpredictable.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
//@ compile-flags: -O
//@ compile-flags: -O -Zmerge-functions=disabled

#![feature(core_intrinsics)]
#![feature(select_unpredictable)]
#![crate_type = "lib"]

/* Test the intrinsic */

#[no_mangle]
pub fn test_int(p: bool, a: u64, b: u64) -> u64 {
// CHECK-LABEL: define{{.*}} @test_int
Expand Down Expand Up @@ -33,3 +36,32 @@ pub fn test_zst(p: bool, a: (), b: ()) -> () {
// CHECK-LABEL: define{{.*}} @test_zst
core::intrinsics::select_unpredictable(p, a, b)
}

/* Test the user-facing version */

#[no_mangle]
pub fn test_int2(p: bool, a: u64, b: u64) -> u64 {
// CHECK-LABEL: define{{.*}} @test_int2
// CHECK: select i1 %p, i64 %a, i64 %b, !unpredictable
p.select_unpredictable(a, b)
}

#[no_mangle]
pub fn test_pair2(p: bool, a: (u64, u64), b: (u64, u64)) -> (u64, u64) {
// CHECK-LABEL: define{{.*}} @test_pair2
// CHECK: select i1 %p, {{.*}}, !unpredictable
p.select_unpredictable(a, b)
}

#[no_mangle]
pub fn test_struct2(p: bool, a: Large, b: Large) -> Large {
// CHECK-LABEL: define{{.*}} @test_struct2
// CHECK: select i1 %p, {{.*}}, !unpredictable
p.select_unpredictable(a, b)
}

#[no_mangle]
pub fn test_zst2(p: bool, a: (), b: ()) -> () {
// CHECK-LABEL: define{{.*}} @test_zst2
p.select_unpredictable(a, b)
}
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't seem to test anything, just that the function exists, not what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume this was just intended to verify that no select is emitted, so I added a commit to assert the function body is empty.

Loading