]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Tighten ashift to lea splitter operand predicates [PR109733]
authorUros Bizjak <ubizjak@gmail.com>
Thu, 4 May 2023 18:26:12 +0000 (20:26 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Thu, 4 May 2023 18:27:05 +0000 (20:27 +0200)
The predicates of ashift to lea post-reload splitter were too broad
so the splitter tried to convert the mask shift instruction.  Tighten
operand predicates to match only general registers.

gcc/ChangeLog:

PR target/109733
* config/i386/predicates.md (index_reg_operand): New predicate.
* config/i386/i386.md (ashift to lea spliter): Use
general_reg_operand and index_reg_operand predicates.

gcc/config/i386/i386.md
gcc/config/i386/predicates.md

index d49f1cdc3fed72996ed558e342376ecac5dbe814..63207fc9305608d1a1b15666ec57bcdaf126baa1 100644 (file)
 
 ;; Convert ashift to the lea pattern to avoid flags dependency.
 (define_split
-  [(set (match_operand:SWI 0 "register_operand")
-       (ashift:SWI (match_operand:SWI 1 "index_register_operand")
+  [(set (match_operand:SWI 0 "general_reg_operand")
+       (ashift:SWI (match_operand:SWI 1 "index_reg_operand")
                    (match_operand 2 "const_0_to_3_operand")))
    (clobber (reg:CC FLAGS_REG))]
   "reload_completed
 
 ;; Convert ashift to the lea pattern to avoid flags dependency.
 (define_split
-  [(set (match_operand:DI 0 "register_operand")
+  [(set (match_operand:DI 0 "general_reg_operand")
        (zero_extend:DI
-         (ashift:SI (match_operand:SI 1 "index_register_operand")
+         (ashift:SI (match_operand:SI 1 "index_reg_operand")
                     (match_operand 2 "const_0_to_3_operand"))))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT && reload_completed
index 878b144b0fb3c48e5620b2030da8616201c5b4a2..362266e1f6c013f46d82e3c3ea323ae1f6c3fe42 100644 (file)
   (and (match_code "reg")
        (match_test "GENERAL_REGNO_P (REGNO (op))")))
 
+;; True if the operand is an INDEX class register.
+(define_predicate "index_reg_operand"
+  (and (match_code "reg")
+       (match_test "INDEX_REGNO_P (REGNO (op))")))
+
 ;; True if the operand is a nonimmediate operand with GENERAL class register.
 (define_predicate "nonimmediate_gr_operand"
   (if_then_else (match_code "reg")