constraints.md (Wfr): Change to be a non-memory constraint.
authorDJ Delorie <dj@redhat.com>
Tue, 8 Dec 2015 06:10:17 +0000 (01:10 -0500)
committerDJ Delorie <dj@gcc.gnu.org>
Tue, 8 Dec 2015 06:10:17 +0000 (01:10 -0500)
* config/rl78/constraints.md (Wfr): Change to be a non-memory
constraint.
* config/rl78/rl78-protos.h (rl78_one_far_p): Declare.
* config/rl78/rl78.c (rl78_one_far_p): Define.
* config/rl78/rl78-virt (movqi_virt): Fix far memory
alternatives.
(movhi_virt): Likewise.
(zero_extendqihi2_virt): Likewise.
(extendqihi2_virt): Likewise.
(add<mode>3_virt): Likewise.
(sub<mode>3_virt): Likewise.
(andqi3_virt): Likewise.
(iorqi3_virt): Likewise.
(xorqi3_virt): Likewise.
* config/rl78/rl78-real.md (bf,br): Use long forms to avoid reloc
overflow in large files.

From-SVN: r231394

gcc/ChangeLog
gcc/config/rl78/constraints.md
gcc/config/rl78/rl78-protos.h
gcc/config/rl78/rl78-real.md
gcc/config/rl78/rl78-virt.md
gcc/config/rl78/rl78.c

index f6f3ff5723192b60e0c75f2f3eb171e1f1c47f5b..858d2b8ffa0ab0d5fc80164a80c691a37c4d43cd 100644 (file)
@@ -1,3 +1,22 @@
+2015-12-07  DJ Delorie  <dj@redhat.com>
+
+       * config/rl78/constraints.md (Wfr): Change to be a non-memory
+       constraint.
+       * config/rl78/rl78-protos.h (rl78_one_far_p): Declare.
+       * config/rl78/rl78.c (rl78_one_far_p): Define.
+       * config/rl78/rl78-virt (movqi_virt): Fix far memory
+       alternatives.
+       (movhi_virt): Likewise.
+       (zero_extendqihi2_virt): Likewise.
+       (extendqihi2_virt): Likewise.
+       (add<mode>3_virt): Likewise.
+       (sub<mode>3_virt): Likewise.
+       (andqi3_virt): Likewise.
+       (iorqi3_virt): Likewise.
+       (xorqi3_virt): Likewise.
+       * config/rl78/rl78-real.md (bf,br): Use long forms to avoid reloc
+       overflow in large files.
+
 2015-12-07  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/63668
index 209f1e660a176c343f15671005278484a6ff40eb..93c5f32ad47238e52f6d7f6cae4a7b6741336313 100644 (file)
                || satisfies_constraint_Cs1 (op)")
   )
 
-(define_memory_constraint "Wfr"
+(define_constraint "Wfr"
   "ES/CS far pointer"
   (and (match_code "mem")
        (match_test "rl78_far_p (op)"))
index 614bf63b88d4ad58c611ad0ed7eb13e3c83f653c..7a8b4c9e2381e54cc793ad3634a922a7e7813176 100644 (file)
@@ -54,3 +54,5 @@ int           rl78_saddr_p (rtx x);
 int            rl78_sfr_p (rtx x);
 void           rl78_output_aligned_common (FILE *, tree, const char *,
                                            int, int, int);
+
+int            rl78_one_far_p (rtx *operands, int num_operands);
index 4674113ba4ee46861e0e691fe08093104cf33071..8deb1bd20c2dbd2859f7fa1352f4c5a1cf34e79b 100644 (file)
                      (label_ref (match_operand 1 "" ""))
                      (pc)))]
   ""
-  "bf\tA.%B0, $%1"
+  "bt\tA.%B0, $1f\n\tbr !!%1\n\t1:"
   [(set (attr "update_Z") (const_string "clobber"))]
 )
 
                      (label_ref (match_operand 1 "" ""))
                      (pc)))]
   ""
-  "bt\tA.%B0, $%1"
+  "bf\tA.%B0, $1f\n\tbr !!%1\n\t1:"
   [(set (attr "update_Z") (const_string "clobber"))]
 )
 
index c70beaec539e8d3a3b825830a5b542f42bcdee89..a26aa1da85de449e5c9ef0fa4693a311e76b6ad2 100644 (file)
@@ -42,8 +42,8 @@
 )
 
 (define_insn "*movqi_virt"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=vY,v,Wfr")
-       (match_operand    1 "general_operand" "vInt8J,YWfr,vInt8J"))]
+  [(set (match_operand:QI 0 "nonimmediate_operand" "=vY,v,*Wfr,Y,*Wfr,*Wfr")
+       (match_operand    1 "general_operand" "vInt8JY,*Wfr,vInt8J,*Wfr,Y,*Wfr"))]
   "rl78_virt_insns_ok ()"
   "v.mov %0, %1"
   [(set_attr "valloc" "op1")]
@@ -58,8 +58,8 @@
 )
 
 (define_insn "*movhi_virt"
-  [(set (match_operand:HI 0 "nonimmediate_operand" "=vS,  Y,   v,   Wfr")
-       (match_operand:HI 1 "general_operand"      "viYS, viS, Wfr, vi"))]
+  [(set (match_operand:HI 0 "nonimmediate_operand" "=vS,  Y,   v,   *Wfr")
+       (match_operand:HI 1 "general_operand"      "viYS, viS, *Wfr, vi"))]
   "rl78_virt_insns_ok ()"
   "v.movw %0, %1"
   [(set_attr "valloc" "op1")]
 ;;---------- Conversions ------------------------
 
 (define_insn "*zero_extendqihi2_virt"
-  [(set (match_operand:HI                 0 "rl78_nonfar_nonimm_operand" "=vm")
-       (zero_extend:HI (match_operand:QI 1 "general_operand" "vim")))]
-  "rl78_virt_insns_ok ()"
+  [(set (match_operand:HI                 0 "rl78_nonfar_nonimm_operand" "=vY,*Wfr")
+       (zero_extend:HI (match_operand:QI 1 "general_operand" "vim,viY")))]
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 2)"
   "v.zero_extend\t%0, %1"
   [(set_attr "valloc" "op1")]
   )
 
 (define_insn "*extendqihi2_virt"
-  [(set (match_operand:HI                 0 "rl78_nonfar_nonimm_operand" "=vm")
-       (sign_extend:HI (match_operand:QI 1 "general_operand" "vim")))]
-  "rl78_virt_insns_ok ()"
+  [(set (match_operand:HI                 0 "rl78_nonfar_nonimm_operand" "=vY,*Wfr")
+       (sign_extend:HI (match_operand:QI 1 "general_operand" "vim,viY")))]
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 2)"
   "v.sign_extend\t%0, %1"
   [(set_attr "valloc" "op1")]
   )
 )
 
 (define_insn "*add<mode>3_virt"
-  [(set (match_operand:QHI           0 "rl78_nonfar_nonimm_operand" "=vY,S")
-       (plus:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "viY,0")
-                 (match_operand:QHI 2 "rl78_general_operand" "vim,i")))
+  [(set (match_operand:QHI           0 "rl78_nonimmediate_operand" "=vY,  S, *Wfr,  vY")
+       (plus:QHI (match_operand:QHI 1 "rl78_general_operand"      "%viY, 0, 0viY, *Wfr")
+                 (match_operand:QHI 2 "rl78_general_operand"       "vim, i, viY,  viY")))
    ]
-  "rl78_virt_insns_ok ()"
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
   "v.add\t%0, %1, %2"
 )
 
 (define_insn "*sub<mode>3_virt"
-  [(set (match_operand:QHI            0 "rl78_nonfar_nonimm_operand" "=vm,S")
-       (minus:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim,0")
-                  (match_operand:QHI 2 "rl78_general_operand" "vim,i")))
+  [(set (match_operand:QHI            0 "rl78_nonimmediate_operand" "=vY, S, *Wfr,  vY")
+       (minus:QHI (match_operand:QHI 1 "rl78_general_operand"      "viY, 0, 0viY, *Wfr")
+                  (match_operand:QHI 2 "rl78_general_operand"      "vim, i, viY,  viY")))
    ]
-  "rl78_virt_insns_ok ()"
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
   "v.sub\t%0, %1, %2"
 )
 
 )
 
 (define_insn "*andqi3_virt"
-  [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm")
-       (and:QI (match_operand:QI 1 "rl78_general_operand" "vim")
-               (match_operand:QI 2 "rl78_general_operand" "vim")))
+  [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm,  *Wfr,  vY")
+       (and:QI (match_operand:QI 1 "rl78_general_operand"      "%vim, 0viY, *Wfr")
+               (match_operand:QI 2 "rl78_general_operand"      "vim,  viY,  viY")))
    ]
-  "rl78_virt_insns_ok ()"
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
   "v.and\t%0, %1, %2"
 )
 
 (define_insn "*iorqi3_virt"
-  [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm")
-       (ior:QI (match_operand:QI 1 "rl78_general_operand" "vim")
-               (match_operand:QI 2 "rl78_general_operand" "vim")))
+  [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm,  *Wfr,  vY")
+       (ior:QI (match_operand:QI 1 "rl78_general_operand"      "%vim, 0viY, *Wfr")
+               (match_operand:QI 2 "rl78_general_operand"      "vim,  viY,  viY")))
    ]
-  "rl78_virt_insns_ok ()"
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
   "v.or\t%0, %1, %2"
 )
 
 (define_insn "*xorqi3_virt"
-  [(set (match_operand:QI         0 "rl78_nonfar_nonimm_operand" "=v,vm,m")
-       (xor:QI (match_operand:QI 1 "rl78_nonfar_operand" "%0,vm,vm")
-               (match_operand    2 "rl78_general_operand" "i,vm,vim")))
+  [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm,  *Wfr,  vY")
+       (xor:QI (match_operand:QI 1 "rl78_general_operand"      "%vim, 0viY, *Wfr")
+               (match_operand    2 "rl78_general_operand"      "vim,  viY,  viY")))
    ]
-  "rl78_virt_insns_ok ()"
+  "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
   "v.xor\t%0, %1, %2"
 )
 
index 9d136a4e0046ea4f750d2b2691eb7b348bbaf437..0735d277cb9c23687ab23ce9483fa4dc3b555b37 100644 (file)
@@ -610,6 +610,24 @@ rl78_force_nonfar_3 (rtx *operands, rtx (*gen)(rtx,rtx,rtx))
   return 1;
 }
 
+int
+rl78_one_far_p (rtx *operands, int n)
+{
+  rtx which = NULL;
+  int i, c = 0;
+
+  for (i = 0; i < n; i ++)
+    if (rl78_far_p (operands[i]))
+      {
+       if (which == NULL)
+         which = operands[i];
+       else if (rtx_equal_p (operands[i], which))
+         continue;
+       c ++;
+      }
+  return c <= 1;
+}
+
 #undef  TARGET_CAN_ELIMINATE
 #define TARGET_CAN_ELIMINATE           rl78_can_eliminate