check_effective_target_ifn_copysign is true for arm_neon, but arm has
no scalar copysign expanders when NEON is available: copysignsf3 and
copysigndf3 in arm.md need TARGET_SOFT_FLOAT and Thumb-2, and the
copysign<mode>3 expander in neon.md handles vector modes only. All
users of ifn_copysign test scalar code, so with -mfloat-abi=hard or
softfp they fail, and with soft float on Thumb-2 they take the
!ifn_copysign path and fail the other way.
Check for the conditions of the arm.md expanders instead. On arm,
long double has the same mode as double, so abs-4.c and backprop-6.c
see three copysigns, as on s390.
Assisted-by: Claude Opus 5.5
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_effective_target_ifn_copysign):
For arm, require soft float and Thumb-2 instead of NEON.
* gcc.dg/tree-ssa/abs-4.c: Expect the s390 counts on arm too.
* gcc.dg/tree-ssa/backprop-6.c: Likewise.
Signed-off-by: Igor Shevlyakov <[email protected]>
---
Not fully regtested: verdict for 33e85f6c7c5e is -.
gcc/testsuite/gcc.dg/tree-ssa/abs-4.c | 8 ++++----
gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c | 8 ++++----
gcc/testsuite/lib/target-supports.exp | 7 ++++++-
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
b/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
index f43018d0dff..fbe558b8e33 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/abs-4.c
@@ -10,9 +10,9 @@ long double abs_ld(long double x) { return
__builtin_signbit(x) ? x : -x; }
/* __builtin_signbit(x) ? x : -x. Should be convert into - ABS_EXP<x> */
/* { dg-final { scan-tree-dump-not "signbit" "optimized"} } */
-/* { dg-final { scan-tree-dump-times "= ABS_EXPR" 1 "optimized" { target {
ifn_copysign && { ! { s390*-*-* } } } } } } */
-/* { dg-final { scan-tree-dump-times "= -" 1 "optimized" { target {
ifn_copysign && { ! { s390*-*-* } } } } } } */
-/* { dg-final { scan-tree-dump-times "= \.COPYSIGN" 2 "optimized" { target {
ifn_copysign && { ! { s390*-*-* } } } } } } */
-/* { dg-final { scan-tree-dump-times "= \.COPYSIGN" 3 "optimized" { target {
ifn_copysign && s390*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "= ABS_EXPR" 1 "optimized" { target {
ifn_copysign && { ! { s390*-*-* || arm*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times "= -" 1 "optimized" { target {
ifn_copysign && { ! { s390*-*-* || arm*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times "= \.COPYSIGN" 2 "optimized" { target {
ifn_copysign && { ! { s390*-*-* || arm*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times "= \.COPYSIGN" 3 "optimized" { target {
ifn_copysign && { s390*-*-* || arm*-*-* } } } } } */
/* { dg-final { scan-tree-dump-times "= ABS_EXPR" 3 "optimized" { target { !
ifn_copysign } } } } */
/* { dg-final { scan-tree-dump-times "= -" 3 "optimized" { target { !
ifn_copysign } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
b/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
index efb53f17f86..36993b82445 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/backprop-6.c
@@ -27,9 +27,9 @@ TEST_FUNCTION (float, f)
TEST_FUNCTION (double, )
TEST_FUNCTION (long double, l)
-/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -} 4 "backprop" {
target { ifn_copysign && { ! { s390*-*-* } } } } } } */
-/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = \.COPYSIGN} 2
"backprop" { target { ifn_copysign && { ! { s390*-*-* } } } } } } */
-/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = ABS_EXPR <} 1
"backprop" { target { ifn_copysign && { ! { s390*-*-* } } } } } } */
-/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = \.COPYSIGN} 3
"backprop" { target { ifn_copysign && s390*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -} 4 "backprop" {
target { ifn_copysign && { ! { s390*-*-* || arm*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = \.COPYSIGN} 2
"backprop" { target { ifn_copysign && { ! { s390*-*-* || arm*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = ABS_EXPR <} 1
"backprop" { target { ifn_copysign && { ! { s390*-*-* || arm*-*-* } } } } } } */
+/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = \.COPYSIGN} 3
"backprop" { target { ifn_copysign && { s390*-*-* || arm*-*-* } } } } } */
/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -} 6 "backprop" {
target { ! ifn_copysign } } } } */
/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = ABS_EXPR <} 3
"backprop" { target { ! ifn_copysign } } } } */
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index 3c5dfd59f6f..bc157fb4d13 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9095,7 +9095,12 @@ proc check_effective_target_ifn_copysign { } {
|| [istarget powerpc*-*-*]
|| [istarget alpha*-*-*]
|| [istarget aarch64*-*-*]
- || [is-effective-target arm_neon]
+ || ([istarget arm*-*-*]
+ && [check_no_compiler_messages ifn_copysign_arm assembly {
+ #if !defined (__SOFTFP__) || __ARM_ARCH_ISA_THUMB != 2
+ #error no copysignsf3 or copysigndf3
+ #endif
+ }])
|| ([istarget s390*-*-*]
&& [check_effective_target_s390_vx])
|| ([istarget riscv*-*-*]
--
2.55.0