21 Star 27 Fork 151

src-openEuler/gcc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0167-LoongArch-Guard-REGNO-with-REG_P-in-loongarch_expand.patch 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
ticat_fp 提交于 2024-10-31 10:33 +08:00 . LoongArch: Sync to upstream
From be1397b598a436d562e6a35a13ed2ae695531255 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Wed, 22 May 2024 09:29:43 +0800
Subject: [PATCH 167/188] LoongArch: Guard REGNO with REG_P in
loongarch_expand_conditional_move [PR115169]
gcc/ChangeLog:
PR target/115169
* config/loongarch/loongarch.cc
(loongarch_expand_conditional_move): Guard REGNO with REG_P.
---
gcc/config/loongarch/loongarch.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index c86a0856b..0c2c38f6f 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -5341,6 +5341,7 @@ loongarch_expand_conditional_move (rtx *operands)
rtx op1_extend = op1;
/* Record whether operands[2] and operands[3] modes are promoted to word_mode. */
+ bool promote_op[2] = {false, false};
bool promote_p = false;
machine_mode mode = GET_MODE (operands[0]);
@@ -5348,9 +5349,15 @@ loongarch_expand_conditional_move (rtx *operands)
loongarch_emit_float_compare (&code, &op0, &op1);
else
{
- if ((REGNO (op0) == REGNO (operands[2])
- || (REGNO (op1) == REGNO (operands[3]) && (op1 != const0_rtx)))
- && (GET_MODE_SIZE (GET_MODE (op0)) < word_mode))
+ if (GET_MODE_SIZE (GET_MODE (op0)) < word_mode)
+ {
+ promote_op[0] = (REG_P (op0) && REG_P (operands[2]) &&
+ REGNO (op0) == REGNO (operands[2]));
+ promote_op[1] = (REG_P (op1) && REG_P (operands[3]) &&
+ REGNO (op1) == REGNO (operands[3]));
+ }
+
+ if (promote_op[0] || promote_op[1])
{
mode = word_mode;
promote_p = true;
@@ -5392,7 +5399,7 @@ loongarch_expand_conditional_move (rtx *operands)
if (promote_p)
{
- if (REGNO (XEXP (operands[1], 0)) == REGNO (operands[2]))
+ if (promote_op[0])
op2 = op0_extend;
else
{
@@ -5400,7 +5407,7 @@ loongarch_expand_conditional_move (rtx *operands)
op2 = force_reg (mode, op2);
}
- if (REGNO (XEXP (operands[1], 1)) == REGNO (operands[3]))
+ if (promote_op[1])
op3 = op1_extend;
else
{
--
2.43.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gcc.git
git@gitee.com:src-openeuler/gcc.git
src-openeuler
gcc
gcc
master

搜索帮助