Hi Here is an updated version.
Changelog: * gcc.dg/builtin-apply2.c: skip test on arm hardfloat ABI targets * gcc.dg/tls/pr42894.c: Remove options, forcing -mthumb fails with hardfloat, and test is not thumb-specific * gcc,target/arm/thumb-ltu.c: Avoid test failure with hardfloat ABI by requiring arm_thumb1_ok * lib/target-supports.exp (check_effective_target_arm_fp16_ok_nocache): don't force -mfloat-abi=soft when building for hardfloat target On 19 August 2013 16:34, Richard Earnshaw <rearn...@arm.com> wrote: > On 15/08/13 15:10, Charles Baylis wrote: >> Hi >> >> The attached patch fixes some tests which fail when testing gcc for a >> arm-none-linux-gnueabihf target because they do not expect to be built >> with a hard float ABI. >> >> The change in target-supports.exp fixes arm-fp16-ops-5.c and >> arm-fp16-ops-6.c. >> >> Tested on arm-none-linux-gnueabihf using qemu-arm, and does not cause >> any other tests to break. >> >> Comments? This is my first patch, so please point out anything wrong. >> >> > >> >> >> 2013-08-15 Charles Baylis <charles.bay...@linaro.org> >> >> * gcc.dg/builtin-apply2.c: skip test on arm hardfloat ABI targets >> * gcc.dg/tls/pr42894.c: Use -mfloat-abi=soft as Thumb1 does >> not support hardfloat ABI >> * arm/thumb-ltu.c: Use -mfloat-abi=soft as Thumb1 does not >> support hardfloat ABI >> * target-supports.exp: don't force -mfloat-abi=soft when >> building for hardfloat target >> >> >> hf-fixes.txt >> >> >> Index: gcc/testsuite/gcc.dg/builtin-apply2.c >> =================================================================== >> --- gcc/testsuite/gcc.dg/builtin-apply2.c (revision 201726) >> +++ gcc/testsuite/gcc.dg/builtin-apply2.c (working copy) >> @@ -1,6 +1,7 @@ >> /* { dg-do run } */ >> /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have >> args in registers." { "aarch64*-*-* avr-*-* " } { "*" } { "" } } */ >> /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP >> variant." { "arm*-*-*" } { "-mfloat-abi=hard" } { "" } } */ >> +/* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP >> variant." { "arm*-*-gnueabihf" } { "*" } { "-mfloat-abi=soft*" } } */ >> > > > As you've noticed, basing the test's behaviour on the config variant > doesn't work reliably. The builtin-apply2 test really should be skipped > if the current test variant is not soft-float. We already have > check_effective_target_arm_hf_eabi in target-supports.exp that checks > whether __ARM_PCS_VFP is defined during a compilation. So can replace > both arm related lines in builtin-apply2 with > > /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP > variant." { "arm*-*-*" && arm_hf_eabi} { "*" } { "" } } */ > >> /* PR target/12503 */ >> /* Origin: <pierre.nguyen-tu...@asim.lip6.fr> */ >> Index: gcc/testsuite/gcc.dg/tls/pr42894.c >> =================================================================== >> --- gcc/testsuite/gcc.dg/tls/pr42894.c (revision 201726) >> +++ gcc/testsuite/gcc.dg/tls/pr42894.c (working copy) >> @@ -1,6 +1,7 @@ >> /* PR target/42894 */ >> /* { dg-do compile } */ >> /* { dg-options "-march=armv5te -mthumb" { target arm*-*-* } } */ >> +/* { dg-options "-march=armv5te -mthumb -mfloat-abi=soft" { target >> arm*-*-*hf } } */ >> /* { dg-require-effective-target tls } */ >> > > Although the original PR was for Thumb1, this is a generic test. I'm > not convinced that on ARM it should try to force thumb1. Removing the > original dg-options line should solve the problem and we then get better > multi-lib testing as well. > >> extern __thread int t; >> Index: gcc/testsuite/gcc.target/arm/thumb-ltu.c >> =================================================================== >> --- gcc/testsuite/gcc.target/arm/thumb-ltu.c (revision 201726) >> +++ gcc/testsuite/gcc.target/arm/thumb-ltu.c (working copy) >> @@ -1,6 +1,6 @@ >> /* { dg-do compile } */ >> /* { dg-skip-if "incompatible options" { arm*-*-* } { "-march=*" } { >> "-march=armv6" "-march=armv6j" "-march=armv6z" } } */ >> -/* { dg-options "-mcpu=arm1136jf-s -mthumb -O2" } */ >> +/* { dg-options "-mcpu=arm1136jf-s -mthumb -O2 -mfloat-abi=soft" } */ >> > > This won't work if there's an explict -mfloat-abi={softfp,hard} on the > multilib options. Probably the best thing to do here is to skip the > test if arm_thumb1_ok is not true. > >> void f(unsigned a, unsigned b, unsigned c, unsigned d) >> { >> Index: gcc/testsuite/lib/target-supports.exp >> =================================================================== >> --- gcc/testsuite/lib/target-supports.exp (revision 201726) >> +++ gcc/testsuite/lib/target-supports.exp (working copy) >> @@ -2445,6 +2445,11 @@ >> # Must generate floating-point instructions. >> return 0 >> } >> + if [check-flags [list "" { *-*-gnueabihf } { "*" } { "" } ]] { >> + # Use existing float-abi and force an fpu which supports fp16 > > This should use arm_hf_eabi as described above. > >> + set et_arm_fp16_flags "-mfpu=vfpv4" >> + return 1; >> + } >> if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] { >> # The existing -mfpu value is OK; use it, but add softfp. >> set et_arm_fp16_flags "-mfloat-abi=softfp" >> > > Kyrill's comments re ChangeLogs also apply. > > R. >
Index: gcc/testsuite/gcc.dg/builtin-apply2.c =================================================================== --- gcc/testsuite/gcc.dg/builtin-apply2.c (revision 202747) +++ gcc/testsuite/gcc.dg/builtin-apply2.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "aarch64*-*-* avr-*-* " } { "*" } { "" } } */ -/* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { "arm*-*-*" } { "-mfloat-abi=hard" } { "" } } */ +/* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } { "*" } { "" } } */ /* PR target/12503 */ /* Origin: <pierre.nguyen-tu...@asim.lip6.fr> */ Index: gcc/testsuite/gcc.dg/tls/pr42894.c =================================================================== --- gcc/testsuite/gcc.dg/tls/pr42894.c (revision 202747) +++ gcc/testsuite/gcc.dg/tls/pr42894.c (working copy) @@ -1,6 +1,5 @@ /* PR target/42894 */ /* { dg-do compile } */ -/* { dg-options "-march=armv5te -mthumb" { target arm*-*-* } } */ /* { dg-require-effective-target tls } */ extern __thread int t; Index: gcc/testsuite/gcc.target/arm/thumb-ltu.c =================================================================== --- gcc/testsuite/gcc.target/arm/thumb-ltu.c (revision 202747) +++ gcc/testsuite/gcc.target/arm/thumb-ltu.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-skip-if "incompatible options" { arm*-*-* } { "-march=*" } { "-march=armv6" "-march=armv6j" "-march=armv6z" } } */ +/* { dg-require-effective-target arm_thumb1_ok } */ /* { dg-options "-mcpu=arm1136jf-s -mthumb -O2" } */ void f(unsigned a, unsigned b, unsigned c, unsigned d) Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp (revision 202747) +++ gcc/testsuite/lib/target-supports.exp (working copy) @@ -2467,6 +2467,11 @@ # Must generate floating-point instructions. return 0 } + if [check_effective_target_arm_hf_eabi] { + # Use existing float-abi and force an fpu which supports fp16 + set et_arm_fp16_flags "-mfpu=vfpv4" + return 1; + } if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] { # The existing -mfpu value is OK; use it, but add softfp. set et_arm_fp16_flags "-mfloat-abi=softfp"