33#![ crate_type = "lib" ]
44#![ feature( core_intrinsics) ]
55
6- use std:: intrinsics:: { fadd_fast, fdiv_fast, fmul_fast, frem_fast, fsub_fast} ;
6+ use std:: intrinsics:: {
7+ fadd_algebraic, fadd_fast, fdiv_algebraic, fdiv_fast, fmul_algebraic, fmul_fast,
8+ frem_algebraic, frem_fast, fsub_algebraic, fsub_fast,
9+ } ;
710
811// CHECK-LABEL: @add
912#[ no_mangle]
@@ -13,30 +16,72 @@ pub fn add(x: f32, y: f32) -> f32 {
1316 x + y
1417}
1518
16- // CHECK-LABEL: @addition
19+ // CHECK-LABEL: @test_fadd_algebraic
1720#[ no_mangle]
18- pub fn addition ( x : f32 , y : f32 ) -> f32 {
19- // CHECK: fadd fast float
21+ pub fn test_fadd_algebraic ( x : f32 , y : f32 ) -> f32 {
22+ // CHECK: fadd reassoc nsz arcp contract float %x, %y
23+ fadd_algebraic ( x, y)
24+ }
25+
26+ // CHECK-LABEL: @test_fsub_algebraic
27+ #[ no_mangle]
28+ pub fn test_fsub_algebraic ( x : f32 , y : f32 ) -> f32 {
29+ // CHECK: fsub reassoc nsz arcp contract float %x, %y
30+ fsub_algebraic ( x, y)
31+ }
32+
33+ // CHECK-LABEL: @test_fmul_algebraic
34+ #[ no_mangle]
35+ pub fn test_fmul_algebraic ( x : f32 , y : f32 ) -> f32 {
36+ // CHECK: fmul reassoc nsz arcp contract float %x, %y
37+ fmul_algebraic ( x, y)
38+ }
39+
40+ // CHECK-LABEL: @test_fdiv_algebraic
41+ #[ no_mangle]
42+ pub fn test_fdiv_algebraic ( x : f32 , y : f32 ) -> f32 {
43+ // CHECK: fdiv reassoc nsz arcp contract float %x, %y
44+ fdiv_algebraic ( x, y)
45+ }
46+
47+ // CHECK-LABEL: @test_frem_algebraic
48+ #[ no_mangle]
49+ pub fn test_frem_algebraic ( x : f32 , y : f32 ) -> f32 {
50+ // CHECK: frem reassoc nsz arcp contract float %x, %y
51+ frem_algebraic ( x, y)
52+ }
53+
54+ // CHECK-LABEL: @test_fadd_fast
55+ #[ no_mangle]
56+ pub fn test_fadd_fast ( x : f32 , y : f32 ) -> f32 {
57+ // CHECK: fadd fast float %x, %y
2058 unsafe { fadd_fast ( x, y) }
2159}
2260
23- // CHECK-LABEL: @subtraction
61+ // CHECK-LABEL: @test_fsub_fast
2462#[ no_mangle]
25- pub fn subtraction ( x : f32 , y : f32 ) -> f32 {
26- // CHECK: fsub fast float
63+ pub fn test_fsub_fast ( x : f32 , y : f32 ) -> f32 {
64+ // CHECK: fsub fast float %x, %y
2765 unsafe { fsub_fast ( x, y) }
2866}
2967
30- // CHECK-LABEL: @multiplication
68+ // CHECK-LABEL: @test_fmul_fast
3169#[ no_mangle]
32- pub fn multiplication ( x : f32 , y : f32 ) -> f32 {
33- // CHECK: fmul fast float
70+ pub fn test_fmul_fast ( x : f32 , y : f32 ) -> f32 {
71+ // CHECK: fmul fast float %x, %y
3472 unsafe { fmul_fast ( x, y) }
3573}
3674
37- // CHECK-LABEL: @division
75+ // CHECK-LABEL: @test_fdiv_fast
3876#[ no_mangle]
39- pub fn division ( x : f32 , y : f32 ) -> f32 {
40- // CHECK: fdiv fast float
77+ pub fn test_fdiv_fast ( x : f32 , y : f32 ) -> f32 {
78+ // CHECK: fdiv fast float %x, %y
4179 unsafe { fdiv_fast ( x, y) }
4280}
81+
82+ // CHECK-LABEL: @test_frem_fast
83+ #[ no_mangle]
84+ pub fn test_frem_fast ( x : f32 , y : f32 ) -> f32 {
85+ // CHECK: frem fast float %x, %y
86+ unsafe { frem_fast ( x, y) }
87+ }
0 commit comments