]> git.proxmox.com Git - rustc.git/blame - src/test/codegen/unchecked-float-casts.rs
New upstream version 1.33.0+dfsg1
[rustc.git] / src / test / codegen / unchecked-float-casts.rs
CommitLineData
abe05a73
XL
1// compile-flags: -C no-prepopulate-passes
2
3// This file tests that we don't generate any code for saturation if
4// -Z saturating-float-casts is not enabled.
5
6#![crate_type = "lib"]
abe05a73
XL
7
8// CHECK-LABEL: @f32_to_u32
9#[no_mangle]
10pub fn f32_to_u32(x: f32) -> u32 {
11 // CHECK: fptoui
12 // CHECK-NOT: fcmp
13 // CHECK-NOT: icmp
14 // CHECK-NOT: select
15 x as u32
16}
17
18// CHECK-LABEL: @f32_to_i32
19#[no_mangle]
20pub fn f32_to_i32(x: f32) -> i32 {
21 // CHECK: fptosi
22 // CHECK-NOT: fcmp
23 // CHECK-NOT: icmp
24 // CHECK-NOT: select
25 x as i32
26}
27
28#[no_mangle]
29pub fn f64_to_u16(x: f64) -> u16 {
30 // CHECK: fptoui
31 // CHECK-NOT: fcmp
32 // CHECK-NOT: icmp
33 // CHECK-NOT: select
34 x as u16
35}