This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Blackfin vector shift fixes


This fixes a bit of confusion in the Blackfin vector shift patterns.  We
already had some logic for selecting the right instruction depending on
whether the shift count was positive or negative, but we forgot to
negate a negative shift count, and the order of alternatives was swapped.

Committed as 119616.


Bernd
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 119614)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2006-12-07  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* config/bfin/bfin.c (print_operand): New modifier 'N' for constants.
+	* config/bfin/bfin.md (ssashiftv2hi3, ssashifthi3, lshiftv2hi3,
+	lshifthi3): Use it, and fix the order of alternatives.
+
 2006-12-07  Maxim Kuvyrkov  <mkuvyrkov@ispras.ru>
 
 	PR target/29794
Index: config/bfin/bfin.md
===================================================================
--- config/bfin/bfin.md	(revision 119539)
+++ config/bfin/bfin.md	(working copy)
@@ -3312,8 +3312,8 @@ (define_insn "ssashiftv2hi3"
   ""
   "@
    %0 = ASHIFT %1 BY %2 (V, S)%!
-   %0 = %1 >>> %2 (V,S)%!
-   %0 = %1 << %2 (V,S)%!"
+   %0 = %1 << %2 (V,S)%!
+   %0 = %1 >>> %N2 (V,S)%!"
   [(set_attr "type" "dsp32")])
 
 (define_insn "ssashifthi3"
@@ -3326,8 +3326,8 @@ (define_insn "ssashifthi3"
   ""
   "@
    %0 = ASHIFT %1 BY %2 (V, S)%!
-   %0 = %1 >>> %2 (V,S)%!
-   %0 = %1 << %2 (V,S)%!"
+   %0 = %1 << %2 (V,S)%!
+   %0 = %1 >>> %N2 (V,S)%!"
   [(set_attr "type" "dsp32")])
 
 (define_insn "lshiftv2hi3"
@@ -3340,8 +3340,8 @@ (define_insn "lshiftv2hi3"
   ""
   "@
    %0 = LSHIFT %1 BY %2 (V)%!
-   %0 = %1 >> %2 (V)%!
-   %0 = %1 << %2 (V)%!"
+   %0 = %1 << %2 (V)%!
+   %0 = %1 >> %N2 (V)%!"
   [(set_attr "type" "dsp32")])
 
 (define_insn "lshifthi3"
@@ -3354,7 +3354,7 @@ (define_insn "lshifthi3"
   ""
   "@
    %0 = LSHIFT %1 BY %2 (V)%!
-   %0 = %1 >> %2 (V)%!
-   %0 = %1 << %2 (V)%!"
+   %0 = %1 << %2 (V)%!
+   %0 = %1 >> %N2 (V)%!"
   [(set_attr "type" "dsp32")])
 
Index: config/bfin/bfin.c
===================================================================
--- config/bfin/bfin.c	(revision 119579)
+++ config/bfin/bfin.c	(working copy)
@@ -1381,6 +1381,8 @@ print_operand (FILE *file, rtx x, char c
 	    x = GEN_INT ((INTVAL (x) >> 16) & 0xffff);
 	  else if (code == 'h')
 	    x = GEN_INT (INTVAL (x) & 0xffff);
+	  else if (code == 'N')
+	    x = GEN_INT (-INTVAL (x));
 	  else if (code == 'X')
 	    x = GEN_INT (exact_log2 (0xffffffff & INTVAL (x)));
 	  else if (code == 'Y')

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]