]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Robustify MMX move patterns
authorUros Bizjak <ubizjak@gmail.com>
Sat, 12 Jul 2025 15:34:18 +0000 (17:34 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Sat, 12 Jul 2025 15:34:18 +0000 (17:34 +0200)
MMX allows only direct moves from zero, so correct V_32:mode and v2qi
move patterns to allow only nonimm_or_0_operand as their input operand.

gcc/ChangeLog:

* config/i386/mmx.md (mov<V_32:mode>):
Use nonimm_or_0_operand predicate for operand 1.
(*mov<V_32:mode>_internal): Ditto.
(movv2qi): Ditto.
(*movv2qi_internal): Ditto.  Use ix86_hardreg_mov_ok
in insn condition.

gcc/config/i386/mmx.md

index 79202323e534b6afd6f3de392874034e2209658e..29a8cb599a7e72b7c12a82cb116614f1a3bfeab0 100644 (file)
 
 (define_expand "mov<mode>"
   [(set (match_operand:V_32 0 "nonimmediate_operand")
-       (match_operand:V_32 1 "nonimmediate_operand"))]
+       (match_operand:V_32 1 "nonimm_or_0_operand"))]
   ""
 {
   ix86_expand_vector_move (<MODE>mode, operands);
 (define_insn "*mov<mode>_internal"
   [(set (match_operand:V_32 0 "nonimmediate_operand"
     "=r ,m ,v,v,v,m,r,v")
-       (match_operand:V_32 1 "general_operand"
+       (match_operand:V_32 1 "nonimm_or_0_operand"
     "rmC,rC,C,v,m,v,v,r"))]
   "!(MEM_P (operands[0]) && MEM_P (operands[1]))
    && ix86_hardreg_mov_ok (operands[0], operands[1])"
 
 (define_expand "movv2qi"
   [(set (match_operand:V2QI 0 "nonimmediate_operand")
-       (match_operand:V2QI 1 "nonimmediate_operand"))]
+       (match_operand:V2QI 1 "nonimm_or_0_operand"))]
   ""
 {
   ix86_expand_vector_move (V2QImode, operands);
 (define_insn "*movv2qi_internal"
   [(set (match_operand:V2QI 0 "nonimmediate_operand"
     "=r,r,r,m ,v,v,v,jm,m,r,v")
-       (match_operand:V2QI 1 "general_operand"
+       (match_operand:V2QI 1 "nonimm_or_0_operand"
     "r ,C,m,rC,C,v,m,x,v,v,r"))]
-  "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
+  "!(MEM_P (operands[0]) && MEM_P (operands[1]))
+   && ix86_hardreg_mov_ok (operands[0], operands[1])"
 {
   switch (get_attr_type (insn))
     {