* [PATCH] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549]
@ 2024-05-08 8:06 Stefan Schulze Frielinghaus
2024-05-17 5:56 ` Andreas Krebbel
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-05-08 8:06 UTC (permalink / raw)
To: krebbel, gcc-patches; +Cc: Stefan Schulze Frielinghaus
Consider a NOCE conversion as profitable if there is at least one
conditional move.
gcc/ChangeLog:
* config/s390/s390.cc (TARGET_NOCE_CONVERSION_PROFITABLE_P):
Define.
(s390_noce_conversion_profitable_p): Implement.
gcc/testsuite/ChangeLog:
* gcc.target/s390/ccor.c: Order of loads are reversed, now, as a
consequence the condition has to be reversed.
---
Bootstrapped and regtested on s390. Ok for mainline?
gcc/config/s390/s390.cc | 32 ++++++++++++++++++++++++++++
gcc/testsuite/gcc.target/s390/ccor.c | 4 ++--
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index bf46eab2d63..23b18b5c506 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "context.h"
#include "builtins.h"
+#include "ifcvt.h"
#include "rtl-iter.h"
#include "intl.h"
#include "tm-constrs.h"
@@ -18037,6 +18038,37 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
return vectorize_vec_perm_const_1 (d);
}
+/* Consider a NOCE conversion as profitable if there is at least one
+ conditional move. */
+
+#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
+#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
+
+static bool
+s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
+{
+ if (if_info->speed_p)
+ {
+ for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
+ {
+ rtx set = single_set (insn);
+ if (set == NULL)
+ continue;
+ if (GET_CODE (SET_SRC (set)) != IF_THEN_ELSE)
+ continue;
+ rtx src = SET_SRC (set);
+ machine_mode mode = GET_MODE (src);
+ if (GET_MODE_CLASS (mode) != MODE_INT
+ && GET_MODE_CLASS (mode) != MODE_FLOAT)
+ continue;
+ if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (Pmode))
+ continue;
+ return true;
+ }
+ }
+ return default_noce_conversion_profitable_p (seq, if_info);
+}
+
/* Initialize GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
diff --git a/gcc/testsuite/gcc.target/s390/ccor.c b/gcc/testsuite/gcc.target/s390/ccor.c
index 31f30f60314..36a3c3a999a 100644
--- a/gcc/testsuite/gcc.target/s390/ccor.c
+++ b/gcc/testsuite/gcc.target/s390/ccor.c
@@ -42,7 +42,7 @@ GENFUN1(2)
GENFUN1(3)
-/* { dg-final { scan-assembler {locrno} } } */
+/* { dg-final { scan-assembler {locro} } } */
GENFUN2(0,1)
@@ -58,7 +58,7 @@ GENFUN2(0,3)
GENFUN2(1,2)
-/* { dg-final { scan-assembler {locrnlh} } } */
+/* { dg-final { scan-assembler {locrlh} } } */
GENFUN2(1,3)
--
2.44.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549]
2024-05-08 8:06 [PATCH] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549] Stefan Schulze Frielinghaus
@ 2024-05-17 5:56 ` Andreas Krebbel
2024-05-17 6:59 ` [PATCH v2] " Stefan Schulze Frielinghaus
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Krebbel @ 2024-05-17 5:56 UTC (permalink / raw)
To: Stefan Schulze Frielinghaus, gcc-patches
On 5/8/24 10:06, Stefan Schulze Frielinghaus wrote:
> Consider a NOCE conversion as profitable if there is at least one
> conditional move.
>
> gcc/ChangeLog:
>
> * config/s390/s390.cc (TARGET_NOCE_CONVERSION_PROFITABLE_P):
> Define.
> (s390_noce_conversion_profitable_p): Implement.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/s390/ccor.c: Order of loads are reversed, now, as a
> consequence the condition has to be reversed.
> ---
> Bootstrapped and regtested on s390. Ok for mainline?
>
> gcc/config/s390/s390.cc | 32 ++++++++++++++++++++++++++++
> gcc/testsuite/gcc.target/s390/ccor.c | 4 ++--
> 2 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index bf46eab2d63..23b18b5c506 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
> #include "tree-pass.h"
> #include "context.h"
> #include "builtins.h"
> +#include "ifcvt.h"
> #include "rtl-iter.h"
> #include "intl.h"
> #include "tm-constrs.h"
> @@ -18037,6 +18038,37 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
> return vectorize_vec_perm_const_1 (d);
> }
>
> +/* Consider a NOCE conversion as profitable if there is at least one
> + conditional move. */
> +
> +#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
> +#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
We collect these definitions at the very end of s390.cc
> +
> +static bool
> +s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
> +{
> + if (if_info->speed_p)
> + {
> + for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
> + {
> + rtx set = single_set (insn);
> + if (set == NULL)
> + continue;
> + if (GET_CODE (SET_SRC (set)) != IF_THEN_ELSE)
> + continue;
> + rtx src = SET_SRC (set);
> + machine_mode mode = GET_MODE (src);
> + if (GET_MODE_CLASS (mode) != MODE_INT
> + && GET_MODE_CLASS (mode) != MODE_FLOAT)
> + continue;
> + if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (Pmode))
I guess GET_MODE_SIZE(Pmode) should be UNITS_PER_WORD here to enable the conversion also for 64 bit
modes with -m31 -mzarch.
Ok with these changes. Thanks!
Andreas
> + continue;
> + return true;
> + }
> + }
> + return default_noce_conversion_profitable_p (seq, if_info);
> +}
> +
> /* Initialize GCC target structure. */
>
> #undef TARGET_ASM_ALIGNED_HI_OP
> diff --git a/gcc/testsuite/gcc.target/s390/ccor.c b/gcc/testsuite/gcc.target/s390/ccor.c
> index 31f30f60314..36a3c3a999a 100644
> --- a/gcc/testsuite/gcc.target/s390/ccor.c
> +++ b/gcc/testsuite/gcc.target/s390/ccor.c
> @@ -42,7 +42,7 @@ GENFUN1(2)
>
> GENFUN1(3)
>
> -/* { dg-final { scan-assembler {locrno} } } */
> +/* { dg-final { scan-assembler {locro} } } */
>
> GENFUN2(0,1)
>
> @@ -58,7 +58,7 @@ GENFUN2(0,3)
>
> GENFUN2(1,2)
>
> -/* { dg-final { scan-assembler {locrnlh} } } */
> +/* { dg-final { scan-assembler {locrlh} } } */
>
> GENFUN2(1,3)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549]
2024-05-17 5:56 ` Andreas Krebbel
@ 2024-05-17 6:59 ` Stefan Schulze Frielinghaus
2024-06-02 12:07 ` Stefan Schulze Frielinghaus
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-05-17 6:59 UTC (permalink / raw)
To: krebbel, gcc-patches; +Cc: Stefan Schulze Frielinghaus
I've adapted the patch as follows and will push.
Thanks,
Stefan
--
Consider a NOCE conversion as profitable if there is at least one
conditional move.
gcc/ChangeLog:
* config/s390/s390.cc (TARGET_NOCE_CONVERSION_PROFITABLE_P):
Define.
(s390_noce_conversion_profitable_p): Implement.
gcc/testsuite/ChangeLog:
* gcc.target/s390/ccor.c: Order of loads are reversed, now, as a
consequence the condition has to be reversed.
---
gcc/config/s390/s390.cc | 32 ++++++++++++++++++++++++++++
gcc/testsuite/gcc.target/s390/ccor.c | 4 ++--
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index bf46eab2d63..7f8f1681c2a 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "context.h"
#include "builtins.h"
+#include "ifcvt.h"
#include "rtl-iter.h"
#include "intl.h"
#include "tm-constrs.h"
@@ -18037,6 +18038,34 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
return vectorize_vec_perm_const_1 (d);
}
+/* Consider a NOCE conversion as profitable if there is at least one
+ conditional move. */
+
+static bool
+s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
+{
+ if (if_info->speed_p)
+ {
+ for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
+ {
+ rtx set = single_set (insn);
+ if (set == NULL)
+ continue;
+ if (GET_CODE (SET_SRC (set)) != IF_THEN_ELSE)
+ continue;
+ rtx src = SET_SRC (set);
+ machine_mode mode = GET_MODE (src);
+ if (GET_MODE_CLASS (mode) != MODE_INT
+ && GET_MODE_CLASS (mode) != MODE_FLOAT)
+ continue;
+ if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+ continue;
+ return true;
+ }
+ }
+ return default_noce_conversion_profitable_p (seq, if_info);
+}
+
/* Initialize GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -18350,6 +18379,9 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
#undef TARGET_VECTORIZE_VEC_PERM_CONST
#define TARGET_VECTORIZE_VEC_PERM_CONST s390_vectorize_vec_perm_const
+#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
+#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-s390.h"
diff --git a/gcc/testsuite/gcc.target/s390/ccor.c b/gcc/testsuite/gcc.target/s390/ccor.c
index 31f30f60314..36a3c3a999a 100644
--- a/gcc/testsuite/gcc.target/s390/ccor.c
+++ b/gcc/testsuite/gcc.target/s390/ccor.c
@@ -42,7 +42,7 @@ GENFUN1(2)
GENFUN1(3)
-/* { dg-final { scan-assembler {locrno} } } */
+/* { dg-final { scan-assembler {locro} } } */
GENFUN2(0,1)
@@ -58,7 +58,7 @@ GENFUN2(0,3)
GENFUN2(1,2)
-/* { dg-final { scan-assembler {locrnlh} } } */
+/* { dg-final { scan-assembler {locrlh} } } */
GENFUN2(1,3)
--
2.45.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549]
2024-05-17 6:59 ` [PATCH v2] " Stefan Schulze Frielinghaus
@ 2024-06-02 12:07 ` Stefan Schulze Frielinghaus
2024-06-13 7:43 ` Stefan Schulze Frielinghaus
2024-06-14 5:37 ` Andreas Krebbel
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-06-02 12:07 UTC (permalink / raw)
To: krebbel, gcc-patches
Since the patch works fine so far for mainline, ok to backport to GCC 14?
On Fri, May 17, 2024 at 08:59:05AM +0200, Stefan Schulze Frielinghaus wrote:
> I've adapted the patch as follows and will push.
>
> Thanks,
> Stefan
>
> --
>
> Consider a NOCE conversion as profitable if there is at least one
> conditional move.
>
> gcc/ChangeLog:
>
> * config/s390/s390.cc (TARGET_NOCE_CONVERSION_PROFITABLE_P):
> Define.
> (s390_noce_conversion_profitable_p): Implement.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/s390/ccor.c: Order of loads are reversed, now, as a
> consequence the condition has to be reversed.
> ---
> gcc/config/s390/s390.cc | 32 ++++++++++++++++++++++++++++
> gcc/testsuite/gcc.target/s390/ccor.c | 4 ++--
> 2 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index bf46eab2d63..7f8f1681c2a 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
> #include "tree-pass.h"
> #include "context.h"
> #include "builtins.h"
> +#include "ifcvt.h"
> #include "rtl-iter.h"
> #include "intl.h"
> #include "tm-constrs.h"
> @@ -18037,6 +18038,34 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
> return vectorize_vec_perm_const_1 (d);
> }
>
> +/* Consider a NOCE conversion as profitable if there is at least one
> + conditional move. */
> +
> +static bool
> +s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
> +{
> + if (if_info->speed_p)
> + {
> + for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
> + {
> + rtx set = single_set (insn);
> + if (set == NULL)
> + continue;
> + if (GET_CODE (SET_SRC (set)) != IF_THEN_ELSE)
> + continue;
> + rtx src = SET_SRC (set);
> + machine_mode mode = GET_MODE (src);
> + if (GET_MODE_CLASS (mode) != MODE_INT
> + && GET_MODE_CLASS (mode) != MODE_FLOAT)
> + continue;
> + if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
> + continue;
> + return true;
> + }
> + }
> + return default_noce_conversion_profitable_p (seq, if_info);
> +}
> +
> /* Initialize GCC target structure. */
>
> #undef TARGET_ASM_ALIGNED_HI_OP
> @@ -18350,6 +18379,9 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
> #undef TARGET_VECTORIZE_VEC_PERM_CONST
> #define TARGET_VECTORIZE_VEC_PERM_CONST s390_vectorize_vec_perm_const
>
> +#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
> +#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
> +
> struct gcc_target targetm = TARGET_INITIALIZER;
>
> #include "gt-s390.h"
> diff --git a/gcc/testsuite/gcc.target/s390/ccor.c b/gcc/testsuite/gcc.target/s390/ccor.c
> index 31f30f60314..36a3c3a999a 100644
> --- a/gcc/testsuite/gcc.target/s390/ccor.c
> +++ b/gcc/testsuite/gcc.target/s390/ccor.c
> @@ -42,7 +42,7 @@ GENFUN1(2)
>
> GENFUN1(3)
>
> -/* { dg-final { scan-assembler {locrno} } } */
> +/* { dg-final { scan-assembler {locro} } } */
>
> GENFUN2(0,1)
>
> @@ -58,7 +58,7 @@ GENFUN2(0,3)
>
> GENFUN2(1,2)
>
> -/* { dg-final { scan-assembler {locrnlh} } } */
> +/* { dg-final { scan-assembler {locrlh} } } */
>
> GENFUN2(1,3)
>
> --
> 2.45.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549]
2024-06-02 12:07 ` Stefan Schulze Frielinghaus
@ 2024-06-13 7:43 ` Stefan Schulze Frielinghaus
2024-06-14 5:37 ` Andreas Krebbel
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-06-13 7:43 UTC (permalink / raw)
To: krebbel, gcc-patches
Ping.
On Sun, Jun 02, 2024 at 02:07:24PM +0200, Stefan Schulze Frielinghaus wrote:
> Since the patch works fine so far for mainline, ok to backport to GCC 14?
>
> On Fri, May 17, 2024 at 08:59:05AM +0200, Stefan Schulze Frielinghaus wrote:
> > I've adapted the patch as follows and will push.
> >
> > Thanks,
> > Stefan
> >
> > --
> >
> > Consider a NOCE conversion as profitable if there is at least one
> > conditional move.
> >
> > gcc/ChangeLog:
> >
> > * config/s390/s390.cc (TARGET_NOCE_CONVERSION_PROFITABLE_P):
> > Define.
> > (s390_noce_conversion_profitable_p): Implement.
> >
> > gcc/testsuite/ChangeLog:
> >
> > * gcc.target/s390/ccor.c: Order of loads are reversed, now, as a
> > consequence the condition has to be reversed.
> > ---
> > gcc/config/s390/s390.cc | 32 ++++++++++++++++++++++++++++
> > gcc/testsuite/gcc.target/s390/ccor.c | 4 ++--
> > 2 files changed, 34 insertions(+), 2 deletions(-)
> >
> > diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> > index bf46eab2d63..7f8f1681c2a 100644
> > --- a/gcc/config/s390/s390.cc
> > +++ b/gcc/config/s390/s390.cc
> > @@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
> > #include "tree-pass.h"
> > #include "context.h"
> > #include "builtins.h"
> > +#include "ifcvt.h"
> > #include "rtl-iter.h"
> > #include "intl.h"
> > #include "tm-constrs.h"
> > @@ -18037,6 +18038,34 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
> > return vectorize_vec_perm_const_1 (d);
> > }
> >
> > +/* Consider a NOCE conversion as profitable if there is at least one
> > + conditional move. */
> > +
> > +static bool
> > +s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
> > +{
> > + if (if_info->speed_p)
> > + {
> > + for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
> > + {
> > + rtx set = single_set (insn);
> > + if (set == NULL)
> > + continue;
> > + if (GET_CODE (SET_SRC (set)) != IF_THEN_ELSE)
> > + continue;
> > + rtx src = SET_SRC (set);
> > + machine_mode mode = GET_MODE (src);
> > + if (GET_MODE_CLASS (mode) != MODE_INT
> > + && GET_MODE_CLASS (mode) != MODE_FLOAT)
> > + continue;
> > + if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
> > + continue;
> > + return true;
> > + }
> > + }
> > + return default_noce_conversion_profitable_p (seq, if_info);
> > +}
> > +
> > /* Initialize GCC target structure. */
> >
> > #undef TARGET_ASM_ALIGNED_HI_OP
> > @@ -18350,6 +18379,9 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
> > #undef TARGET_VECTORIZE_VEC_PERM_CONST
> > #define TARGET_VECTORIZE_VEC_PERM_CONST s390_vectorize_vec_perm_const
> >
> > +#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
> > +#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
> > +
> > struct gcc_target targetm = TARGET_INITIALIZER;
> >
> > #include "gt-s390.h"
> > diff --git a/gcc/testsuite/gcc.target/s390/ccor.c b/gcc/testsuite/gcc.target/s390/ccor.c
> > index 31f30f60314..36a3c3a999a 100644
> > --- a/gcc/testsuite/gcc.target/s390/ccor.c
> > +++ b/gcc/testsuite/gcc.target/s390/ccor.c
> > @@ -42,7 +42,7 @@ GENFUN1(2)
> >
> > GENFUN1(3)
> >
> > -/* { dg-final { scan-assembler {locrno} } } */
> > +/* { dg-final { scan-assembler {locro} } } */
> >
> > GENFUN2(0,1)
> >
> > @@ -58,7 +58,7 @@ GENFUN2(0,3)
> >
> > GENFUN2(1,2)
> >
> > -/* { dg-final { scan-assembler {locrnlh} } } */
> > +/* { dg-final { scan-assembler {locrlh} } } */
> >
> > GENFUN2(1,3)
> >
> > --
> > 2.45.0
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549]
2024-06-02 12:07 ` Stefan Schulze Frielinghaus
2024-06-13 7:43 ` Stefan Schulze Frielinghaus
@ 2024-06-14 5:37 ` Andreas Krebbel
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Krebbel @ 2024-06-14 5:37 UTC (permalink / raw)
To: Stefan Schulze Frielinghaus, gcc-patches
On 6/2/24 14:07, Stefan Schulze Frielinghaus wrote:
> Since the patch works fine so far for mainline, ok to backport to GCC 14?
Yes please do. Thanks!
Andreas
>
> On Fri, May 17, 2024 at 08:59:05AM +0200, Stefan Schulze Frielinghaus wrote:
>> I've adapted the patch as follows and will push.
>>
>> Thanks,
>> Stefan
>>
>> --
>>
>> Consider a NOCE conversion as profitable if there is at least one
>> conditional move.
>>
>> gcc/ChangeLog:
>>
>> * config/s390/s390.cc (TARGET_NOCE_CONVERSION_PROFITABLE_P):
>> Define.
>> (s390_noce_conversion_profitable_p): Implement.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/s390/ccor.c: Order of loads are reversed, now, as a
>> consequence the condition has to be reversed.
>> ---
>> gcc/config/s390/s390.cc | 32 ++++++++++++++++++++++++++++
>> gcc/testsuite/gcc.target/s390/ccor.c | 4 ++--
>> 2 files changed, 34 insertions(+), 2 deletions(-)
>>
>> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
>> index bf46eab2d63..7f8f1681c2a 100644
>> --- a/gcc/config/s390/s390.cc
>> +++ b/gcc/config/s390/s390.cc
>> @@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
>> #include "tree-pass.h"
>> #include "context.h"
>> #include "builtins.h"
>> +#include "ifcvt.h"
>> #include "rtl-iter.h"
>> #include "intl.h"
>> #include "tm-constrs.h"
>> @@ -18037,6 +18038,34 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
>> return vectorize_vec_perm_const_1 (d);
>> }
>>
>> +/* Consider a NOCE conversion as profitable if there is at least one
>> + conditional move. */
>> +
>> +static bool
>> +s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
>> +{
>> + if (if_info->speed_p)
>> + {
>> + for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
>> + {
>> + rtx set = single_set (insn);
>> + if (set == NULL)
>> + continue;
>> + if (GET_CODE (SET_SRC (set)) != IF_THEN_ELSE)
>> + continue;
>> + rtx src = SET_SRC (set);
>> + machine_mode mode = GET_MODE (src);
>> + if (GET_MODE_CLASS (mode) != MODE_INT
>> + && GET_MODE_CLASS (mode) != MODE_FLOAT)
>> + continue;
>> + if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
>> + continue;
>> + return true;
>> + }
>> + }
>> + return default_noce_conversion_profitable_p (seq, if_info);
>> +}
>> +
>> /* Initialize GCC target structure. */
>>
>> #undef TARGET_ASM_ALIGNED_HI_OP
>> @@ -18350,6 +18379,9 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
>> #undef TARGET_VECTORIZE_VEC_PERM_CONST
>> #define TARGET_VECTORIZE_VEC_PERM_CONST s390_vectorize_vec_perm_const
>>
>> +#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
>> +#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
>> +
>> struct gcc_target targetm = TARGET_INITIALIZER;
>>
>> #include "gt-s390.h"
>> diff --git a/gcc/testsuite/gcc.target/s390/ccor.c b/gcc/testsuite/gcc.target/s390/ccor.c
>> index 31f30f60314..36a3c3a999a 100644
>> --- a/gcc/testsuite/gcc.target/s390/ccor.c
>> +++ b/gcc/testsuite/gcc.target/s390/ccor.c
>> @@ -42,7 +42,7 @@ GENFUN1(2)
>>
>> GENFUN1(3)
>>
>> -/* { dg-final { scan-assembler {locrno} } } */
>> +/* { dg-final { scan-assembler {locro} } } */
>>
>> GENFUN2(0,1)
>>
>> @@ -58,7 +58,7 @@ GENFUN2(0,3)
>>
>> GENFUN2(1,2)
>>
>> -/* { dg-final { scan-assembler {locrnlh} } } */
>> +/* { dg-final { scan-assembler {locrlh} } } */
>>
>> GENFUN2(1,3)
>>
>> --
>> 2.45.0
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-14 5:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08 8:06 [PATCH] s390: Implement TARGET_NOCE_CONVERSION_PROFITABLE_P [PR109549] Stefan Schulze Frielinghaus
2024-05-17 5:56 ` Andreas Krebbel
2024-05-17 6:59 ` [PATCH v2] " Stefan Schulze Frielinghaus
2024-06-02 12:07 ` Stefan Schulze Frielinghaus
2024-06-13 7:43 ` Stefan Schulze Frielinghaus
2024-06-14 5:37 ` Andreas Krebbel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).