代码拉取完成,页面将自动刷新
同步操作将从 ChunyangWang/gcc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 7e843ed8da168a05eb04eee0b14cbe681bf798fe Mon Sep 17 00:00:00 2001
From: Lulu Cheng <chenglulu@loongson.cn>
Date: Wed, 13 Sep 2023 11:01:34 +0800
Subject: [PATCH 123/124] LoongArch: Change the value of branch_cost from 2 to
6.
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.
Signed-off-by: Peng Fan <fanpeng@loongson.cn>
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
---
gcc/config/loongarch/loongarch-def.c | 4 ++--
gcc/testsuite/gcc.target/loongarch/cmov_ii.c | 15 +++++++++++++++
2 files changed, 17 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 d29d5f001..eeb32dbf6 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 000000000..21b468e8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "test:.*xor.*maskeqz.*masknez.*or.*" } } */
+
+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;
+ return out;
+}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。