On 5/1/24 12:44 PM, Patrick O'Neill wrote:
Hi Jeff,


It looks like this patch's gcc.target/riscv/round_64.c testcase doesn't pass when run with newlib.
So I expected this would ultimately end up being a case where certain builtins aren't enabled when we're using a newlib based C library and that's exactly what happens here.

Essentially all the "function_c99_misc" routines are disabled for simplifications. So we're presented with this in forwprop:

__attribute__((noclone, noinline))
float convert_float_to_float_round (float N)
{
  double _1;
  double _2;
  float _4;

;;   basic block 2, loop depth 0, maybe hot
;;    prev block 0, next block 1, flags: (NEW, VISITED)
;;    pred:       ENTRY (FALLTHRU,EXECUTABLE)
  _1 = (double) N_3(D);
  _2 = round (_1);
  _4 = (float) _2;
  return _4;
;;    succ:       EXIT j.c:12:10

}

The test relies on the optimizer to realize that's just roundf and convert it to:

__attribute__((noclone, noinline))
float convert_float_to_float_round (float N)
{
  float _6;

;;   basic block 2, loop depth 0, maybe hot
;;    prev block 0, next block 1, flags: (NEW, VISITED)
;;    pred:       ENTRY (FALLTHRU,EXECUTABLE)
  _6 = __builtin_roundf (N_3(D));
  return _6;
;;    succ:       EXIT (EXECUTABLE) z.c:12:10

}


Failure to do that conversion will result in different code generation in the end and thus all those scan-asm failures. Thankfully we have a preexisting way to deal with this in the testsuite.




It also introduced:

FAIL: gcc.target/riscv/rvv/autovec/unop/math-nearbyint-run-2.c execution test

on rv32gcv newlib/linux.
I'll have to look at this next, but it could well end up being the same issue under the hood.

jeff

Reply via email to