public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [i386] scalar ops that preserve the high part of a vector
@ 2012-10-13  9:33 Marc Glisse
  2012-10-14  9:54 ` Uros Bizjak
  0 siblings, 1 reply; 36+ messages in thread
From: Marc Glisse @ 2012-10-13  9:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: ubizjak

[-- Attachment #1: Type: TEXT/PLAIN, Size: 573 bytes --]

Hello,

this patch provides an alternate pattern to let combine recognize scalar 
operations that preserve the high part of a vector. If the strategy is all 
right, I could do the same for more operations (mul, div, ...). Something 
similar is also possible for V4SF (different pattern though), but probably 
not as useful.

bootstrap+testsuite ok.

2012-10-13  Marc Glisse  <marc.glisse@inria.fr>

 	PR target/54855

gcc/
 	* config/i386/sse.md (*sse2_vm<plusminus_insn>v2df3): New define_insn.

gcc/testsuite/
 	* gcc.target/i386/pr54855.c: New testcase.

-- 
Marc Glisse

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2294 bytes --]

Index: config/i386/sse.md
===================================================================
--- config/i386/sse.md	(revision 192420)
+++ config/i386/sse.md	(working copy)
@@ -812,20 +812,38 @@
 	  (const_int 1)))]
   "TARGET_SSE"
   "@
    <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %2}
    v<plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "<ssescalarmode>")])
 
+(define_insn "*sse2_vm<plusminus_insn>v2df3"
+  [(set (match_operand:V2DF 0 "register_operand" "=x,x")
+	(vec_concat:V2DF
+	  (plusminus:DF
+	    (vec_select:DF 
+	      (match_operand:V2DF 1 "register_operand" "0,x")
+	      (parallel [(const_int 0)]))
+	    (match_operand:DF 2 "nonimmediate_operand" "xm,xm"))
+	  (vec_select:DF (match_dup 1) (parallel [(const_int 1)]))))]
+  "TARGET_SSE2"
+  "@
+   <plusminus_mnemonic>sd\t{%2, %0|%0, %2}
+   v<plusminus_mnemonic>sd\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "isa" "noavx,avx")
+   (set_attr "type" "sseadd")
+   (set_attr "prefix" "orig,vex")
+   (set_attr "mode" "DF")])
+
 (define_expand "mul<mode>3"
   [(set (match_operand:VF 0 "register_operand")
 	(mult:VF
 	  (match_operand:VF 1 "nonimmediate_operand")
 	  (match_operand:VF 2 "nonimmediate_operand")))]
   "TARGET_SSE"
   "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
 
 (define_insn "*mul<mode>3"
   [(set (match_operand:VF 0 "register_operand" "=x,x")
Index: testsuite/gcc.target/i386/pr54855.c
===================================================================
--- testsuite/gcc.target/i386/pr54855.c	(revision 0)
+++ testsuite/gcc.target/i386/pr54855.c	(revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O -msse2" } */
+
+typedef double vec __attribute__((vector_size(16)));
+
+vec f (vec x)
+{
+  x[0] += 2;
+  return x;
+}
+
+vec g (vec x)
+{
+  x[0] -= 1;
+  return x;
+}
+
+/* { dg-final { scan-assembler-not "mov" } } */

Property changes on: testsuite/gcc.target/i386/pr54855.c
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision URL
Added: svn:eol-style
   + native


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2012-12-12 15:48 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13  9:33 [i386] scalar ops that preserve the high part of a vector Marc Glisse
2012-10-14  9:54 ` Uros Bizjak
2012-10-14 12:52   ` Marc Glisse
2012-11-30 12:36     ` Marc Glisse
2012-11-30 13:55       ` Uros Bizjak
2012-11-30 22:36         ` Marc Glisse
2012-12-01 17:27           ` Marc Glisse
2012-12-02 10:51             ` Uros Bizjak
2012-12-02 12:30               ` Marc Glisse
2012-12-03  8:53                 ` Uros Bizjak
2012-12-03 15:34                   ` Marc Glisse
2012-12-03 17:55                     ` Uros Bizjak
2012-12-04 14:05                       ` Marc Glisse
2012-12-04 16:28                         ` Marc Glisse
2012-12-04 18:06                           ` Uros Bizjak
2012-12-04 18:12                             ` H.J. Lu
2012-12-06 13:42                               ` Kirill Yukhin
2012-12-07  6:50                                 ` Michael Zolotukhin
2012-12-07  8:46                                   ` Uros Bizjak
2012-12-07  8:49                                   ` Marc Glisse
2012-12-07 10:52                                     ` Michael Zolotukhin
2012-12-07 14:02                                       ` Marc Glisse
2012-12-07 14:43                                     ` Richard Henderson
2012-12-07 14:47                                       ` Jakub Jelinek
2012-12-07 14:53                                         ` Richard Henderson
2012-12-07 15:00                                       ` Marc Glisse
2012-12-07 15:06                                         ` Richard Henderson
2012-12-07 15:12                                           ` Marc Glisse
2012-12-07 16:24                                             ` Richard Henderson
2012-12-07 17:23                                               ` Marc Glisse
2012-12-08  5:47                                                 ` Marc Glisse
2012-12-12 15:48                                                   ` Richard Henderson
2012-12-05 14:22                             ` Marc Glisse
2012-12-05 17:07                               ` Paolo Bonzini
2012-12-05 20:22                                 ` Marc Glisse
2012-12-05 21:05                               ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).