https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126049

--- Comment #6 from Robin Dapp <rdapp at gcc dot gnu.org> ---
(In reply to Icenowy Zheng from comment #4)
> I don't know how to write the test... Add expectation for `.word  
> 2143289344` (float canonical nan) and `.word   2146959360` (upper half of
> double canonical nan) to
> gcc/testsuite/gcc.target/riscv/rvv/autovec/reduc/reduc-10.c (which tests the
> vectorization of __builtin_f{max,min}{,f} )?

A run test would be fairly simple, just taking your test as base:

#include <math.h>
#include <stddef.h>

__attribute__ ((noipa))
float maxx (float *arr, size_t sz)
{
  float val = NAN;
  size_t i;

  for (i = 0; i < sz; i++)
    val = fmaxf (val, arr[i]);

  return val;
}

int main ()
{
  float arr[] = { NAN, NAN, NAN, NAN };
  float res = maxx (arr, 4);
  if (res != NAN)
    __builtin_abort ();
}

Reply via email to