]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: NFC: Deduplicate crc instruction defines
authorXi Ruoyao <xry111@xry111.site>
Sun, 25 Feb 2024 12:40:41 +0000 (20:40 +0800)
committerXi Ruoyao <xry111@xry111.site>
Thu, 29 Feb 2024 06:48:18 +0000 (14:48 +0800)
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

index dffa41b0bf5d166e5b6644407f614178d8688433..9646fa90eab784d881f31187833a977b45d7a2d0 100644 (file)
 
 
 (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>")])