Patchwork [4.8,i386] : Fix PR 57356, SSE2 instructions generated with '-mno-sse2'

login
register
mail settings
Submitter Uros Bizjak
Date May 22, 2013, 12:18 p.m.
Message ID <CAFULd4YQ5J9Vs8uqpweG5CNsHErjzB6pZ6Be38a0u8pBQr9Rnw@mail.gmail.com>
Download mbox | patch
Permalink /patch/245598/
State New
Headers show

Comments

Uros Bizjak - May 22, 2013, 12:18 p.m.
On Wed, May 22, 2013 at 10:01 AM, Uros Bizjak <ubizjak@gmail.com> wrote:

>>> This patch avoids movdqu/movdqa when SSE2 is disabled. Although
>>> -mno-sse2 is bordering on ABI violation for 64bit targets, the patch
>>> is simple enough to fix movti_internal_rex64 pattern.
>>
>> If the TImode attr variant isn't valid for !SSE2, I'd find it clearer
>> to do
>> (match_test "!TARGET_SSE2") (const_string "V4SF")
>> much earlier in the cond, before TARGET_AVX case that returns TImode
>> (sure, when TARGET_AVX is true, then !TARGET_SSE2 is false), and
>> not added using ior to an unrelated condition.
>
> Yes, this is a good suggestion, I was trying to be consistent with the
> movti_internal pattern.
>
> I will change both in the way you suggested ASAP.

I have committed attached patch to 4.8 branch.

Uros.

Patch

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 199189)
+++ config/i386/i386.md	(working copy)
@@ -1798,6 +1798,8 @@ 
    (set (attr "mode")
    	(cond [(eq_attr "alternative" "0,1")
 		 (const_string "DI")
+	       (not (match_test "TARGET_SSE2"))
+	         (const_string "V4SF")
 	       (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
 		 (const_string "V4SF")
 	       (and (eq_attr "alternative" "4")
@@ -1854,15 +1856,16 @@ 
   [(set_attr "type" "sselog1,ssemov,ssemov")
    (set_attr "prefix" "maybe_vex")
    (set (attr "mode")
-	(cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
+	(cond [(not (match_test "TARGET_SSE2"))
+	         (const_string "V4SF")
+	       (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
 		 (const_string "V4SF")
 	       (and (eq_attr "alternative" "2")
 		    (match_test "TARGET_SSE_TYPELESS_STORES"))
 		 (const_string "V4SF")
 	       (match_test "TARGET_AVX")
 		 (const_string "TI")
-	       (ior (not (match_test "TARGET_SSE2"))
-		    (match_test "optimize_function_for_size_p (cfun)"))
+	       (match_test "optimize_function_for_size_p (cfun)")
 		 (const_string "V4SF")
 	      ]
 	      (const_string "TI")))])