* [PATCH] LoongArch: Change the value of branch_cost from 2 to 6.
@ 2023-09-13 3:11 Lulu Cheng
2023-09-14 7:03 ` [pushed][PATCH] " chenglulu
0 siblings, 1 reply; 2+ messages in thread
From: Lulu Cheng @ 2023-09-13 3:11 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, xuchenghua, Lulu Cheng
gcc/ChangeLog:
* config/loongarch/loongarch-def.c: Modify the default value of
branch_cost.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/cmov_ii.c: New test.
---
gcc/config/loongarch/loongarch-def.c | 4 ++--
gcc/testsuite/gcc.target/loongarch/cmov_ii.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/loongarch/cmov_ii.c
diff --git a/gcc/config/loongarch/loongarch-def.c b/gcc/config/loongarch/loongarch-def.c
index e744ee01d6d..430ef8b2d95 100644
--- a/gcc/config/loongarch/loongarch-def.c
+++ b/gcc/config/loongarch/loongarch-def.c
@@ -85,7 +85,7 @@ loongarch_cpu_align[N_TUNE_TYPES] = {
.int_mult_di = COSTS_N_INSNS (1), \
.int_div_si = COSTS_N_INSNS (4), \
.int_div_di = COSTS_N_INSNS (6), \
- .branch_cost = 2, \
+ .branch_cost = 6, \
.memory_latency = 4
/* The following properties cannot be looked up directly using "cpucfg".
@@ -118,7 +118,7 @@ loongarch_rtx_cost_optimize_size = {
.int_mult_di = 4,
.int_div_si = 4,
.int_div_di = 4,
- .branch_cost = 2,
+ .branch_cost = 6,
.memory_latency = 4,
};
diff --git a/gcc/testsuite/gcc.target/loongarch/cmov_ii.c b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c
new file mode 100644
index 00000000000..466a4c1c9af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "main:.*xor.*masknez.*maskeqz.*or.*" } }
+ */
+void printf (char *, ...);
+extern void foo_ii (int *, int *, int *, int *);
+
+int
+test (void)
+{
+ int a, b;
+ int c, d, out;
+ foo_ii (&a, &b, &c, &d);
+ out = a == b ? c : d;
+ printf ("%d\n", out);
+}
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pushed][PATCH] LoongArch: Change the value of branch_cost from 2 to 6.
2023-09-13 3:11 [PATCH] LoongArch: Change the value of branch_cost from 2 to 6 Lulu Cheng
@ 2023-09-14 7:03 ` chenglulu
0 siblings, 0 replies; 2+ messages in thread
From: chenglulu @ 2023-09-14 7:03 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, xuchenghua
Pushed to r14-3977.
在 2023/9/13 上午11:11, Lulu Cheng 写道:
> gcc/ChangeLog:
>
> * config/loongarch/loongarch-def.c: Modify the default value of
> branch_cost.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/loongarch/cmov_ii.c: New test.
> ---
> gcc/config/loongarch/loongarch-def.c | 4 ++--
> gcc/testsuite/gcc.target/loongarch/cmov_ii.c | 16 ++++++++++++++++
> 2 files changed, 18 insertions(+), 2 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/loongarch/cmov_ii.c
>
> diff --git a/gcc/config/loongarch/loongarch-def.c b/gcc/config/loongarch/loongarch-def.c
> index e744ee01d6d..430ef8b2d95 100644
> --- a/gcc/config/loongarch/loongarch-def.c
> +++ b/gcc/config/loongarch/loongarch-def.c
> @@ -85,7 +85,7 @@ loongarch_cpu_align[N_TUNE_TYPES] = {
> .int_mult_di = COSTS_N_INSNS (1), \
> .int_div_si = COSTS_N_INSNS (4), \
> .int_div_di = COSTS_N_INSNS (6), \
> - .branch_cost = 2, \
> + .branch_cost = 6, \
> .memory_latency = 4
>
> /* The following properties cannot be looked up directly using "cpucfg".
> @@ -118,7 +118,7 @@ loongarch_rtx_cost_optimize_size = {
> .int_mult_di = 4,
> .int_div_si = 4,
> .int_div_di = 4,
> - .branch_cost = 2,
> + .branch_cost = 6,
> .memory_latency = 4,
> };
>
> diff --git a/gcc/testsuite/gcc.target/loongarch/cmov_ii.c b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c
> new file mode 100644
> index 00000000000..466a4c1c9af
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c
> @@ -0,0 +1,16 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +/* { dg-final { scan-assembler "main:.*xor.*masknez.*maskeqz.*or.*" } }
> + */
> +void printf (char *, ...);
> +extern void foo_ii (int *, int *, int *, int *);
> +
> +int
> +test (void)
> +{
> + int a, b;
> + int c, d, out;
> + foo_ii (&a, &b, &c, &d);
> + out = a == b ? c : d;
> + printf ("%d\n", out);
> +}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-14 7:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 3:11 [PATCH] LoongArch: Change the value of branch_cost from 2 to 6 Lulu Cheng
2023-09-14 7:03 ` [pushed][PATCH] " chenglulu
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).