11// makes configuration easier
22#![ allow( unused_macros) ]
3+ #![ feature( f128) ]
34
45use testcrate:: * ;
56
@@ -122,12 +123,15 @@ macro_rules! pow {
122123 b < $tolerance
123124 } else {
124125 let quo = b / a;
125- ( quo < ( 1. + $tolerance) ) && ( quo > ( 1. - $tolerance) )
126+ // FIXME(f16_f128): we do this to block const eval which currently
127+ // ICEs on f128. Change this once it works correctly.
128+ ( quo < ( 1. + black_box( $tolerance) ) )
129+ && ( quo > ( 1. - black_box( $tolerance) ) )
126130 }
127131 } ;
128132 if !good {
129133 panic!(
130- "{}({}, {}): std: {}, builtins: {}" ,
134+ "{}({:? }, {:? }): std: {:? }, builtins: {:? }" ,
131135 stringify!( $fn) , x, n, tmp0, tmp1
132136 ) ;
133137 }
@@ -142,8 +146,32 @@ macro_rules! pow {
142146mod float_pow {
143147 use super :: * ;
144148
149+ fn black_box < T > ( val : T ) -> T {
150+ val
151+ }
152+
145153 pow ! {
146154 f32 , 1e-4 , __powisf2;
147155 f64 , 1e-12 , __powidf2;
148156 }
149157}
158+
159+ #[ cfg( not( all( target_arch = "x86" , not( target_feature = "sse" ) ) ) ) ]
160+ #[ cfg( not( any( feature = "no-f16-f128" , feature = "no-sys-f128" ) ) ) ]
161+ mod float_pow_f128 {
162+ use super :: * ;
163+ use core:: hint:: black_box;
164+
165+ // Windows can't link the required arithmetic functions. See
166+ // <https://github.com/rust-lang/compiler-builtins/pull/614#issuecomment-2118636613>
167+ #[ cfg( not( target_family = "windows" ) ) ]
168+ #[ cfg( not( any( target_arch = "powerpc" , target_arch = "powerpc64" ) ) ) ]
169+ pow ! {
170+ f128, 1e-36 , __powitf2;
171+ }
172+
173+ #[ cfg( any( target_arch = "powerpc" , target_arch = "powerpc64" ) ) ]
174+ pow ! {
175+ f128, 1e-36 , __powikf2;
176+ }
177+ }
0 commit comments