On Mon, Aug 21, 2023 at 10:00:30PM +0200, FX Coudert wrote:
> >> I understand, I wanted to not just report the issue but propose an option. 
> >> It seems a bit heavy to design an effective target just for one test, 
> >> though, no?
> > 
> > It has the advantage of getting it right on all current and future targets.
> 
> Something like this? (not tested yet)

Yes (of course if it works on linux and is true there and on darwin and
expectedly is false there).

> --- a/libgomp/testsuite/lib/libgomp.exp
> +++ b/libgomp/testsuite/lib/libgomp.exp
> @@ -377,6 +377,24 @@ proc offload_target_to_openacc_device_type { 
> offload_target } {
>      }
>  }
>   +# Return 1 if certain nonstandard math functions are available
> +# on the target.
> +proc libgomp_check_effective_target_nonstandard_math_functions { } {
> +    return [check_no_compiler_messages nonstandard_math_functions executable 
> {
> +#include <math.h>
> +int main() {
> +  float x = 42;
> +  double y = 42;
> +  x = gammaf (x);
> +  x = __builtin_scalbf (x, 2.f);
> +  x =__builtin_significandf (x);
> +  y = gamma (y);
> +  y = __builtin_scalb (y, 2.);
> +  y =__builtin_significand (y);
> +  return 0;
> +} } "-lm" ]
> +}
> +
>  # Return 1 if compiling for the specified offload target
>  # Takes -foffload=... into account by checking OFFLOAD_TARGET_NAMES=
>  # in the -v compiler output.

        Jakub

Reply via email to