On 20/11/2023 10:41, Christophe Lyon wrote:
Hi Richard,


On Mon, 13 Nov 2023 at 15:27, Richard Earnshaw <rearn...@arm.com> wrote:


Add an arm-specific test to check_effective_target_hard_float for
Arm to handle cases where we only have single-precision FP in hardware.

gcc/testsuite:

         * lib/target-supports.exp (check_effective_target_hard_float): Add
         arm-specific test.
---
  gcc/testsuite/lib/target-supports.exp | 11 +++++++++++
  1 file changed, 11 insertions(+)


Our CI has detected a problem when testing this patch for cortex-m33:
with -mthumb/-march=armv8-m.main+dsp+fp/-mtune=cortex-m33/-mfloat-abi=hard/-mfpu=auto
and GCC configured with --disable-multilib --with-mode=thumb
--with-cpu=cortex-m33 --with-float=hard

FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -O0  execution test
FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -O1  execution test
FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -O2  execution test
FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution
test
FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test
FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -O3 -g  execution test
FAIL: gcc:gcc.dg/torture/dg-torture.exp=gcc.dg/torture/fp-double-convert-float-1.c
   -Os  execution test


I think this technically is a real bug in the port. This test changes the rounding modes, but cortex-m33 only has a single-precision FP unit, so single-precision is handled in HW, while double-precision is handled in SW. The soft-float functions don't support changing the rounding mode, and certainly not through fesetround(), so we don't get the expected results. I think the test would always have failed, but we didn't run it in the past as the default test for HW fp only checked for double precision HW.

Fixing the real problem is not trivial though, especially in a mixed hard/soft environment.


We use qemu for testing. Do these tests pass in your configuration?

Thanks,

Christophe

R.

Reply via email to