Support -mxl-reorder and swap instructions.
authorDavid Holsgrove <david.holsgrove@xilinx.com>
Sun, 3 Mar 2013 17:34:50 +0000 (17:34 +0000)
committerMichael Eager <eager@gcc.gnu.org>
Sun, 3 Mar 2013 17:34:50 +0000 (17:34 +0000)
*  config/microblaze/microblaze.c:
Check mcpu, pcmp requirement and set TARGET_REORDER to 0 if not met.
*  config/microblaze/microblaze.h: Add -mxl-reorder to DRIVER_SELF_SPECS
*  config/microblaze/microblaze.md: New bswapsi2 and bswaphi2
instructions emitted if TARGET_REORDER
*  config/microblaze/microblaze.opt: New option -mxl-reorder set to 1
or 0 for -m/-mno case, but initialises as 2 to detect default use case
separately

From-SVN: r196415

gcc/ChangeLog
gcc/config/microblaze/microblaze.c
gcc/config/microblaze/microblaze.h
gcc/config/microblaze/microblaze.md
gcc/config/microblaze/microblaze.opt

index 32f6e4b6f0fe55f1288e16b6cd8b1d7b5ff89643..dabc79ad32e1518eace0cfd5b0287f594f597bd7 100644 (file)
@@ -1,3 +1,14 @@
+2013-03-02  David Holsgrove <david.holsgrove@xilinx.com>
+
+       *  config/microblaze/microblaze.c:
+       Check mcpu, pcmp requirement and set TARGET_REORDER to 0 if not met.
+       *  config/microblaze/microblaze.h: Add -mxl-reorder to DRIVER_SELF_SPECS
+       *  config/microblaze/microblaze.md: New bswapsi2 and bswaphi2
+       instructions emitted if TARGET_REORDER
+       *  config/microblaze/microblaze.opt: New option -mxl-reorder set to 1 
+       or 0 for -m/-mno case, but initialises as 2 to detect default use case 
+       separately
+
 2013-03-01  Xinliang David Li  <davidxl@google.com>
 
        * tree-ssa-uninit.c (compute_control_dep_chain): Limit post-dom
index f45d30cf450756a88cfc646b1d8dc7b392bf0ff1..8458253253ca48eecf997a1c600766a42e704954 100644 (file)
@@ -1380,6 +1380,21 @@ microblaze_option_override (void)
         microblaze_has_clz = 0;
     }
 
+  /* TARGET_REORDER defaults to 2 if -mxl-reorder not specified.  */
+  ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.30.a");
+  if (ver < 0)
+    {
+        if (TARGET_REORDER == 1)
+          warning (0, "-mxl-reorder can be used only with -mcpu=v8.30.a or greater");
+        TARGET_REORDER = 0;
+    }
+  else if ((ver == 0) && !TARGET_PATTERN_COMPARE)
+    {
+        if (TARGET_REORDER == 1)
+          warning (0, "-mxl-reorder requires -mxl-pattern-compare for -mcpu=v8.30.a");
+        TARGET_REORDER = 0;
+    }
+
   if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
     error ("-mxl-multiply-high requires -mno-xl-soft-mul");
 
index a188a2eb1137c97d1c0aad30429c56cc69b3265b..23ed16e4f6c14b04ee5b0d66d41cccc506bdd569 100644 (file)
@@ -78,6 +78,7 @@ extern enum pipeline_type microblaze_pipe;
        "%{mno-xl-barrel-shift:%<mxl-barrel-shift}",    \
        "%{mno-xl-pattern-compare:%<mxl-pattern-compare}", \
        "%{mxl-soft-div:%<mno-xl-soft-div}",            \
+       "%{mxl-reorder:%<mno-xl-reorder}",              \
        "%{msoft-float:%<mhard-float}"
 
 /* Tell collect what flags to pass to nm.  */
index 339186455baf2d84a20e949f88e9c689f21729d0..9f177331389af910c88781dcc83b6bef0eb17eeb 100644 (file)
 (automata_option "time")
 (automata_option "progress")
 
+(define_insn "bswapsi2"
+  [(set (match_operand:SI 0 "register_operand" "=r")
+        (bswap:SI (match_operand:SI 1 "register_operand" "r")))]
+  "TARGET_REORDER"
+  "swapb %0, %1"
+)
+
+(define_insn "bswaphi2"
+  [(set (match_operand:HI 0 "register_operand" "=r")
+        (bswap:HI (match_operand:HI 1 "register_operand" "r")))]
+  "TARGET_REORDER"
+  "swaph %0, %1"
+)
+
 ;;----------------------------------------------------------------
 ;; Microblaze delay slot description
 ;;----------------------------------------------------------------
index fc7d0cdd1d0b1b7525675bdf2fd2e4b7a18cd23f..a659166372a6b7a802e782cbe3a574183c3fd8ab 100644 (file)
@@ -67,6 +67,10 @@ mxl-soft-mul
 Target Mask(SOFT_MUL)
 Use the soft multiply emulation (default)
 
+mxl-reorder
+Target Var(TARGET_REORDER) Init(2)
+Use reorder instructions (swap and byte reversed load/store) (default)
+
 mxl-soft-div
 Target Mask(SOFT_DIV)
 Use the software emulation for divides (default)