]> git.lizzy.rs Git - rust.git/blob - tests/codegen/float_math.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / codegen / float_math.rs
1 // compile-flags: -C no-prepopulate-passes
2
3 #![crate_type = "lib"]
4 #![feature(core_intrinsics)]
5
6 use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast};
7
8 // CHECK-LABEL: @add
9 #[no_mangle]
10 pub fn add(x: f32, y: f32) -> f32 {
11 // CHECK: fadd float
12 // CHECK-NOT: fast
13     x + y
14 }
15
16 // CHECK-LABEL: @addition
17 #[no_mangle]
18 pub fn addition(x: f32, y: f32) -> f32 {
19 // CHECK: fadd fast float
20     unsafe {
21         fadd_fast(x, y)
22     }
23 }
24
25 // CHECK-LABEL: @subtraction
26 #[no_mangle]
27 pub fn subtraction(x: f32, y: f32) -> f32 {
28 // CHECK: fsub fast float
29     unsafe {
30         fsub_fast(x, y)
31     }
32 }
33
34 // CHECK-LABEL: @multiplication
35 #[no_mangle]
36 pub fn multiplication(x: f32, y: f32) -> f32 {
37 // CHECK: fmul fast float
38     unsafe {
39         fmul_fast(x, y)
40     }
41 }
42
43 // CHECK-LABEL: @division
44 #[no_mangle]
45 pub fn division(x: f32, y: f32) -> f32 {
46 // CHECK: fdiv fast float
47     unsafe {
48         fdiv_fast(x, y)
49     }
50 }