Patchwork [i386] : Fix vhaddpd/vhsubpd AVX patterns

login
register
mail settings
Submitter Uros Bizjak
Date March 29, 2012, 9:56 p.m.
Message ID <CAFULd4ZPuwU7prddbTkTLVUNyUDX2UyxoO4BCN1Dn1RnOTZB3Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/149496/
State New
Headers show

Comments

Uros Bizjak - March 29, 2012, 9:56 p.m.
Hello!

My recent patch [1] exposed problem with avx_h<plusminus_insn>v4df3
AVX pattern. The pattern is defined in a wrong way, since the
components of the result should not cross 128bit lane boundary. This
is the cause of failures is [2]:

FAIL: gcc.target/i386/avx-vhaddpd-256-1.c execution test
FAIL: gcc.target/i386/avx-vhsubpd-256-1.c execution test

2012-03-29  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/sse.md (avx_h<plusminus_insn>v4df3): Fix results
	crossing 128bit lane boundary.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
AVX target. Patch was committed to mainline, will be committed to all
release branches.

BTW: It looks that the x86 testsuite is not effective enough, these
types of problems should be detected before new patterns are
introduced to the .md files.

[1] http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01819.html
[2] http://gcc.gnu.org/ml/gcc-testresults/2012-03/msg03370.html

Uros.

Patch

Index: sse.md
===================================================================
--- sse.md	(revision 185973)
+++ sse.md	(working copy)
@@ -1175,15 +1175,15 @@ 
 		(parallel [(const_int 0)]))
 	      (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
 	    (plusminus:DF
-	      (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
-	      (vec_select:DF (match_dup 1) (parallel [(const_int 3)]))))
-	  (vec_concat:V2DF
-	    (plusminus:DF
 	      (vec_select:DF
 		(match_operand:V4DF 2 "nonimmediate_operand" "xm")
 		(parallel [(const_int 0)]))
-	      (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))
+	      (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
+	  (vec_concat:V2DF
 	    (plusminus:DF
+	      (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
+	      (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
+	    (plusminus:DF
 	      (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
 	      (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
   "TARGET_AVX"