]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
xtensa: Simplify "zero_extend[hq]isi2" insn patterns
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Sun, 24 Aug 2025 21:26:41 +0000 (06:26 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Mon, 25 Aug 2025 14:55:08 +0000 (07:55 -0700)
gcc/ChangeLog:

* config/xtensa/xtensa.md (mode_bits):
New mode attribute.
(zero_extend<mode>si2): Use the appropriate mode iterator and
attribute to unify "zero_extend[hq]isi2" to this description.

gcc/config/xtensa/xtensa.md

index f38fe6da8e483d61ce9600c97e348a66099d7295..4a02a6efe51ab3d9002e641632059c74278dbfbe 100644 (file)
@@ -88,6 +88,7 @@
 ;; This mode iterator allows the HI and QI patterns to be defined from
 ;; the same template.
 (define_mode_iterator HQI [HI QI])
+(define_mode_attr mode_bits [(HI "16") (QI "8")])
 
 ;; This mode iterator allows the SI and HI patterns to be defined from
 ;; the same template.
 \f
 ;; Zero-extend instructions.
 
-(define_insn "zero_extendhisi2"
+(define_insn "zero_extend<mode>si2"
   [(set (match_operand:SI 0 "register_operand" "=a,a")
-       (zero_extend:SI (match_operand:HI 1 "nonimmed_operand" "r,U")))]
+       (zero_extend:SI (match_operand:HQI 1 "nonimmed_operand" "r,U")))]
   ""
   "@
-   extui\t%0, %1, 0, 16
-   %v1l16ui\t%0, %1"
-  [(set_attr "type"    "arith,load")
-   (set_attr "mode"    "SI")
-   (set_attr "length"  "3,3")])
-
-(define_insn "zero_extendqisi2"
-  [(set (match_operand:SI 0 "register_operand" "=a,a")
-       (zero_extend:SI (match_operand:QI 1 "nonimmed_operand" "r,U")))]
-  ""
-  "@
-   extui\t%0, %1, 0, 8
-   %v1l8ui\t%0, %1"
+   extui\t%0, %1, 0, <mode_bits>
+   %v1l<mode_bits>ui\t%0, %1"
   [(set_attr "type"    "arith,load")
    (set_attr "mode"    "SI")
    (set_attr "length"  "3,3")])