gcc/0139-LoongArch-NFC-Deduplicate-crc-instruction-defines.patch

57 lines
1.8 KiB
Diff
Raw Normal View History

From 7a4761a31454f999331e8aa5f831e26e249c4295 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Sun, 25 Feb 2024 20:40:41 +0800
Subject: [PATCH 139/188] LoongArch: NFC: Deduplicate crc instruction defines
Introduce an iterator for UNSPEC_CRC and UNSPEC_CRCC to make the next
change easier.
gcc/ChangeLog:
* config/loongarch/loongarch.md (CRC): New define_int_iterator.
(crc): New define_int_attr.
(loongarch_crc_w_<size>_w, loongarch_crcc_w_<size>_w): Unify
into ...
(loongarch_<crc>_w_<size>_w): ... here.
---
gcc/config/loongarch/loongarch.md | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md
index 9356194fe..b5ad9eada 100644
--- a/gcc/config/loongarch/loongarch.md
+++ b/gcc/config/loongarch/loongarch.md
@@ -4251,24 +4251,16 @@
(define_mode_iterator QHSD [QI HI SI DI])
+(define_int_iterator CRC [UNSPEC_CRC UNSPEC_CRCC])
+(define_int_attr crc [(UNSPEC_CRC "crc") (UNSPEC_CRCC "crcc")])
-(define_insn "loongarch_crc_w_<size>_w"
+(define_insn "loongarch_<crc>_w_<size>_w"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI [(match_operand:QHSD 1 "register_operand" "r")
(match_operand:SI 2 "register_operand" "r")]
- UNSPEC_CRC))]
+ CRC))]
""
- "crc.w.<size>.w\t%0,%1,%2"
- [(set_attr "type" "unknown")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "loongarch_crcc_w_<size>_w"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (unspec:SI [(match_operand:QHSD 1 "register_operand" "r")
- (match_operand:SI 2 "register_operand" "r")]
- UNSPEC_CRCC))]
- ""
- "crcc.w.<size>.w\t%0,%1,%2"
+ "<crc>.w.<size>.w\t%0,%1,%2"
[(set_attr "type" "unknown")
(set_attr "mode" "<MODE>")])
--
2.43.0