代码拉取完成,页面将自动刷新
From 08d337cc5186e47949b60e4b3eeebd1f763337e0 Mon Sep 17 00:00:00 2001
From: Lixing <lixing@loongosn.cn>
Date: Mon, 31 Jul 2023 09:46:12 +0800
Subject: [PATCH 1/2] LoongArch: Remove NOOP_TRUNCATION and fix extendsidi2
We can safely convert value from inprec to outprec because we hold on
extention if needed.
---
gcc/config/loongarch/loongarch.c | 11 --------
gcc/config/loongarch/loongarch.md | 44 +++++++------------------------
2 files changed, 9 insertions(+), 46 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.c b/gcc/config/loongarch/loongarch.c
index a1dde5a0f..f8f96329c 100644
--- a/gcc/config/loongarch/loongarch.c
+++ b/gcc/config/loongarch/loongarch.c
@@ -10313,14 +10313,6 @@ loongarch_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
return mode;
}
-/* Implement TARGET_TRULY_NOOP_TRUNCATION. */
-
-static bool
-loongarch_truly_noop_truncation (poly_uint64 outprec, poly_uint64 inprec)
-{
- return !TARGET_64BIT || inprec <= 32 || outprec > 32;
-}
-
/* Implement TARGET_STARTING_FRAME_OFFSET. See loongarch_compute_frame_info
for details about the frame layout. */
@@ -10940,9 +10932,6 @@ loongarch_prefetch_cookie (rtx write, rtx locality)
#undef TARGET_CAN_CHANGE_MODE_CLASS
#define TARGET_CAN_CHANGE_MODE_CLASS loongarch_can_change_mode_class
-#undef TARGET_TRULY_NOOP_TRUNCATION
-#define TARGET_TRULY_NOOP_TRUNCATION loongarch_truly_noop_truncation
-
#undef TARGET_CONSTANT_ALIGNMENT
#define TARGET_CONSTANT_ALIGNMENT loongarch_constant_alignment
diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
index 097c9f4db..a08c4a62c 100644
--- a/gcc/config/loongarch/loongarch.md
+++ b/gcc/config/loongarch/loongarch.md
@@ -1433,43 +1433,17 @@
;;
;; ....................
-(define_insn_and_split "extendsidi2"
+(define_insn "extendsidi2"
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
- (sign_extend:DI
- (match_operand:SI 1 "nonimmediate_operand" "0,ZC,m,k")))]
+ (sign_extend:DI
+ (match_operand:SI 1 "nonimmediate_operand" "r,ZC,m,k")))]
"TARGET_64BIT"
-{
- switch (which_alternative)
- {
- case 0:
- return "#";
- case 1:
- {
- rtx offset = XEXP (operands[1], 0);
- if (GET_CODE (offset) == PLUS)
- offset = XEXP (offset, 1);
- else
- offset = const0_rtx;
- if (const_arith_operand (offset, Pmode) || (offset == const0_rtx))
- return "ld.w\t%0,%1";
- else
- return "ldptr.w\t%0,%1";
- }
- case 2:
- return "ld.w\t%0,%1";
- case 3:
- return "ldx.w\t%0,%1";
- default:
- gcc_unreachable ();
- }
-}
- "&& reload_completed && register_operand (operands[1], VOIDmode)"
- [(const_int 0)]
-{
- emit_note (NOTE_INSN_DELETED);
- DONE;
-}
- [(set_attr "move_type" "move,load,load,load")
+ "@
+ slli.w\t%0,%1,0
+ ldptr.w\t%0,%1
+ ld.w\t%0,%1
+ ldx.w\t%0,%1"
+ [(set_attr "move_type" "sll0,load,load,load")
(set_attr "mode" "DI")])
(define_insn "extend<SHORT:mode><GPR:mode>2"
--
2.39.3
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。