0

Hello support team,

I found wrong generated code regarding GNURX for RXv3 TFU mathlib hypotf(x, y). Somehow the generated code temporarily uses RAM at address 0x0 as follows.

SOURCE:

#include <math.h>

float TFU_hypotf(float x, float y)
{
return hypotf(x, y);
}

COMMAND:

rx-elf-gcc -std=gnu99 -O3 -misa=v3 -mtfu=intrinsic,mathlib -Wa,-adlnh=tfu_mathlib.lst -c tfu_mathlib.c

GENERATED CODE:

1 .file “tfu_mathlib.c”
2 .section P,”ax”
3 .global _TFU_hypotf
5 _TFU_hypotf:
6 0000 FB 5E 18 14 08 mov.L #0x81418, r5
7 0005 E3 51 mov.L r1, [r5]
8 0007 66 04 mov.L #0, r4                                          <– HERE
9 0009 F8 42 EE 74 1B 3F mov.L #0x3f1b74ee, [r4] <– HERE
10 000f EC 44 mov.L [r4], r4                                       <– HERE
11 0011 A0 5A mov.L r2, 4[r5]
12 0013 EC 51 mov.L [r5], r1
13 0015 FC 8F 41 fmul r4, r1
14 0018 02 rts
16 .ident “GCC: (GCC_Build_20220528) 8.3.0.202202-GNURX 20190222”

Best regards,
NoMaY

Open Source Tools Support commented
    • Hello NoMaY-san,

      There seems to be a bug in the inline expansion of the hypotf function, thank you for bringing it to our attention.
      We have raised an internal issue and we hope to fix this in a future release.
      __
      Best regards,
      The Open Source Tools Team