diff mbox

PATCH: PR target/59458: alternative 13 in *movsf_internal is mishandled

Message ID 20131210222328.GA6495@intel.com
State New
Headers show

Commit Message

H.J. Lu Dec. 10, 2013, 10:23 p.m. UTC
Hi,

We have

(define_insn "*movsf_internal"
  [(set (match_operand:SF 0 "nonimmediate_operand"
          "=Yf*f,m   ,Yf*f,?r ,?m,v,v,v,m,?r,?Yi,!*y,!*y,!m,!r ,!*Ym")
        (match_operand:SF 1 "general_operand"
          "Yf*fm,Yf*f,G   ,rmF,rF,C,v,m,v,Yj,r  ,*y ,m  ,*y,*Yn,r"))]

alternative 13 is MMXMOV instruction to store "*y" to "!m".  But
alternative 13 gets the default mode, SF.  But MMXMOV is

    case TYPE_MMXMOV:
      switch (get_attr_mode (insn))
        {
        case MODE_DI:
          return "movq\t{%1, %0|%0, %1}";
        case MODE_SI:
          return "movd\t{%1, %0|%0, %1}";

        default:
          gcc_unreachable ();
        }

MODE_SF gets gcc_unreachable.  This patch sets mode to SI for
alternative 13. Tested on Linux/x86-64.  OK to install?

Thanks.


H.J.
---
2013-12-10   H.J. Lu  <hongjiu.lu@intel.com>

	PR target/59458
	* config/i386/i386.md (*movsf_internal): Set mode to SI for
	alternative 13.

Comments

Uros Bizjak Dec. 10, 2013, 11:19 p.m. UTC | #1
On Tue, Dec 10, 2013 at 11:23 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> We have
>
> (define_insn "*movsf_internal"
>   [(set (match_operand:SF 0 "nonimmediate_operand"
>           "=Yf*f,m   ,Yf*f,?r ,?m,v,v,v,m,?r,?Yi,!*y,!*y,!m,!r ,!*Ym")
>         (match_operand:SF 1 "general_operand"
>           "Yf*fm,Yf*f,G   ,rmF,rF,C,v,m,v,Yj,r  ,*y ,m  ,*y,*Yn,r"))]
>
> alternative 13 is MMXMOV instruction to store "*y" to "!m".  But
> alternative 13 gets the default mode, SF.  But MMXMOV is
>
>     case TYPE_MMXMOV:
>       switch (get_attr_mode (insn))
>         {
>         case MODE_DI:
>           return "movq\t{%1, %0|%0, %1}";
>         case MODE_SI:
>           return "movd\t{%1, %0|%0, %1}";
>
>         default:
>           gcc_unreachable ();
>         }
>
> MODE_SF gets gcc_unreachable.  This patch sets mode to SI for
> alternative 13. Tested on Linux/x86-64.  OK to install?
>
> Thanks.
>
>
> H.J.
> ---
> 2013-12-10   H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR target/59458
>         * config/i386/i386.md (*movsf_internal): Set mode to SI for
>         alternative 13.

OK for mainline and release branches.

Thanks,
Uros.
H.J. Lu Dec. 10, 2013, 11:29 p.m. UTC | #2
On Tue, Dec 10, 2013 at 3:19 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Dec 10, 2013 at 11:23 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> Hi,
>>
>> We have
>>
>> (define_insn "*movsf_internal"
>>   [(set (match_operand:SF 0 "nonimmediate_operand"
>>           "=Yf*f,m   ,Yf*f,?r ,?m,v,v,v,m,?r,?Yi,!*y,!*y,!m,!r ,!*Ym")
>>         (match_operand:SF 1 "general_operand"
>>           "Yf*fm,Yf*f,G   ,rmF,rF,C,v,m,v,Yj,r  ,*y ,m  ,*y,*Yn,r"))]
>>
>> alternative 13 is MMXMOV instruction to store "*y" to "!m".  But
>> alternative 13 gets the default mode, SF.  But MMXMOV is
>>
>>     case TYPE_MMXMOV:
>>       switch (get_attr_mode (insn))
>>         {
>>         case MODE_DI:
>>           return "movq\t{%1, %0|%0, %1}";
>>         case MODE_SI:
>>           return "movd\t{%1, %0|%0, %1}";
>>
>>         default:
>>           gcc_unreachable ();
>>         }
>>
>> MODE_SF gets gcc_unreachable.  This patch sets mode to SI for
>> alternative 13. Tested on Linux/x86-64.  OK to install?
>>
>> Thanks.
>>
>>
>> H.J.
>> ---
>> 2013-12-10   H.J. Lu  <hongjiu.lu@intel.com>
>>
>>         PR target/59458
>>         * config/i386/i386.md (*movsf_internal): Set mode to SI for
>>         alternative 13.
>
> OK for mainline and release branches.
>

Fixed ion trunk.  4.7 and 4.8 branches are OK:

(define_insn "*movsi_internal"
  [(set (match_operand:SI 0 "nonimmediate_operand"
                        "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x")
        (match_operand:SI 1 "general_operand"
                        "g ,re,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r   ,m "))]

...
    case TYPE_MMXMOV:
      if (get_attr_mode (insn) == MODE_DI)
        return "movq\t{%1, %0|%0, %1}";
      return "movd\t{%1, %0|%0, %1}";
diff mbox

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 7138868..aa2664f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -3126,7 +3140,7 @@ 
        (const_string "1")
        (const_string "*")))
    (set (attr "mode")
-        (cond [(eq_attr "alternative" "3,4,9,10,14,15")
+        (cond [(eq_attr "alternative" "3,4,9,10,13,14,15")
 		 (const_string "SI")
 	       (eq_attr "alternative" "11")
 		 (const_string "DI")