11// makes configuration easier
22#![ allow( unused_macros) ]
3+ #![ feature( f128) ]
34
45use testcrate:: * ;
56
@@ -238,12 +239,15 @@ macro_rules! pow {
238239 b < $tolerance
239240 } else {
240241 let quo = b / a;
241- ( quo < ( 1. + $tolerance) ) && ( quo > ( 1. - $tolerance) )
242+ // FIXME(f16_f128): we do this to block const eval which currently
243+ // ICEs on f128. Change this once it works correctly.
244+ ( quo < ( 1. + black_box( $tolerance) ) )
245+ && ( quo > ( 1. - black_box( $tolerance) ) )
242246 }
243247 } ;
244248 if !good {
245249 panic!(
246- "{}({}, {}): std: {}, builtins: {}" ,
250+ "{}({:? }, {:? }): std: {:? }, builtins: {:? }" ,
247251 stringify!( $fn) , x, n, tmp0, tmp1
248252 ) ;
249253 }
@@ -258,8 +262,32 @@ macro_rules! pow {
258262mod float_pow {
259263 use super :: * ;
260264
265+ fn black_box < T > ( val : T ) -> T {
266+ val
267+ }
268+
261269 pow ! {
262270 f32 , 1e-4 , __powisf2;
263271 f64 , 1e-12 , __powidf2;
264272 }
265273}
274+
275+ #[ cfg( not( all( target_arch = "x86" , not( target_feature = "sse" ) ) ) ) ]
276+ #[ cfg( not( any( feature = "no-f16-f128" , feature = "no-sys-f128" ) ) ) ]
277+ mod float_pow_f128 {
278+ use super :: * ;
279+ use core:: hint:: black_box;
280+
281+ // Windows can't link the required arithmetic functions. See
282+ // <https://github.com/rust-lang/compiler-builtins/pull/614#issuecomment-2118636613>
283+ #[ cfg( not( target_family = "windows" ) ) ]
284+ #[ cfg( not( any( target_arch = "powerpc" , target_arch = "powerpc64" ) ) ) ]
285+ pow ! {
286+ f128, 1e-36 , __powitf2;
287+ }
288+
289+ #[ cfg( any( target_arch = "powerpc" , target_arch = "powerpc64" ) ) ]
290+ pow ! {
291+ f128, 1e-36 , __powikf2;
292+ }
293+ }
0 commit comments