nios2.md (ld<bhw_uns>io): Add splitter for memory operand.
authorSandra Loosemore <sandra@codesourcery.com>
Fri, 8 Dec 2017 04:24:21 +0000 (23:24 -0500)
committerSandra Loosemore <sandra@gcc.gnu.org>
Fri, 8 Dec 2017 04:24:21 +0000 (23:24 -0500)
2017-12-07  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* config/nios2/nios2.md (ld<bhw_uns>io): Add splitter for memory
operand.
(ld<bh>io_signed): Likewise.
(st<bhw>io): Likewise.
* config/nios2/predicates.md (ldstio_memory_operand): Allow
SMALL_INT12 constant integer operand.

From-SVN: r255493

gcc/ChangeLog
gcc/config/nios2/nios2.md
gcc/config/nios2/predicates.md

index 39a6f94c4adbad4e7cb01feba7b1a1284389e860..bea643d6285d2da0471c3baa05f070fda736b1d7 100644 (file)
@@ -1,3 +1,12 @@
+2017-12-07  Sandra Loosemore  <sandra@codesourcery.com>
+
+       * config/nios2/nios2.md (ld<bhw_uns>io): Add splitter for memory
+       operand.
+       (ld<bh>io_signed): Likewise.
+       (st<bhw>io): Likewise.
+       * config/nios2/predicates.md (ldstio_memory_operand): Allow
+       SMALL_INT12 constant integer operand.
+
 2017-12-07  Sandra Loosemore  <sandra@codesourcery.com>
 
        * config/nios2/nios2.c (nios2_symbolic_constant_allowed):
index 1d16be489928df735d0d5aa0c88530e260f7a410..04693b1ab4f88ffdc778de021d7e08a59f270ae5 100644 (file)
 (define_mode_attr bhw [(QI "b") (HI "h") (SI "w")])
 (define_mode_attr bhw_uns [(QI "bu") (HI "hu") (SI "w")])
 
-(define_insn "ld<bhw_uns>io"
+(define_insn_and_split "ld<bhw_uns>io"
   [(set (match_operand:BHW 0 "register_operand" "=r")
         (unspec_volatile:BHW
           [(match_operand:BHW 1 "ldstio_memory_operand" "w")] UNSPECV_LDXIO))]
   ""
   "ld<bhw_uns>io\\t%0, %1"
+  "nios2_large_constant_memory_operand_p (operands[1])"
+  [(set (match_dup 0) 
+        (unspec_volatile:BHW [(match_dup 1)] UNSPECV_LDXIO))]
+  {
+    operands[1] = nios2_split_large_constant_memory_operand (operands[1]);
+  }
   [(set_attr "type" "ld")])
 
 (define_expand "ld<bh>io"
   DONE;
 })
 
-(define_insn "ld<bh>io_signed"
+(define_insn_and_split "ld<bh>io_signed"
   [(set (match_operand:SI 0 "register_operand" "=r")
         (sign_extend:SI
           (unspec_volatile:BH
             [(match_operand:BH 1 "ldstio_memory_operand" "w")] UNSPECV_LDXIO)))]
   ""
   "ld<bh>io\\t%0, %1"
+  "nios2_large_constant_memory_operand_p (operands[1])"
+  [(set (match_dup 0) 
+        (sign_extend:SI (unspec_volatile:BH [(match_dup 1)] UNSPECV_LDXIO)))]
+  {
+    operands[1] = nios2_split_large_constant_memory_operand (operands[1]);
+  }
   [(set_attr "type" "ld")])
 
-(define_insn "st<bhw>io"
+(define_insn_and_split "st<bhw>io"
   [(set (match_operand:BHW 0 "ldstio_memory_operand" "=w")
         (unspec_volatile:BHW
           [(match_operand:BHW 1 "reg_or_0_operand" "rM")] UNSPECV_STXIO))]
   ""
   "st<bhw>io\\t%z1, %0"
+  "nios2_large_constant_memory_operand_p (operands[0])"
+  [(set (match_dup 0) (unspec_volatile:BHW [(match_dup 1)] UNSPECV_STXIO))]
+  {
+    operands[0] = nios2_split_large_constant_memory_operand (operands[0]);
+  }
   [(set_attr "type" "st")])
 
 \f
index e35a37e59688835eefcbc3af081978458fcff4ec..d60529998c9cf3ab713a0f199e0b03dcd5ace8fc 100644 (file)
         return (REG_P (XEXP (addr, 0))
                 && CONST_INT_P (XEXP (addr, 1))
                 && SMALL_INT12 (INTVAL (XEXP (addr, 1))));
+      else if (CONST_INT_P (addr))
+        return SMALL_INT12 (INTVAL (addr));
       return false;
     }
   return memory_operand (op, mode);