summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/config/rl78/constraints.md2
-rw-r--r--gcc/config/rl78/rl78-protos.h2
-rw-r--r--gcc/config/rl78/rl78-real.md4
-rw-r--r--gcc/config/rl78/rl78-virt.md60
-rw-r--r--gcc/config/rl78/rl78.c18
6 files changed, 72 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f6f3ff57231..858d2b8ffa0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/rl78/constraints.md b/gcc/config/rl78/constraints.md
index 209f1e660a1..93c5f32ad47 100644
--- a/gcc/config/rl78/constraints.md
+++ b/gcc/config/rl78/constraints.md
@@ -364,7 +364,7 @@
|| 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)"))
diff --git a/gcc/config/rl78/rl78-protos.h b/gcc/config/rl78/rl78-protos.h
index 614bf63b88d..7a8b4c9e238 100644
--- a/gcc/config/rl78/rl78-protos.h
+++ b/gcc/config/rl78/rl78-protos.h
@@ -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);
diff --git a/gcc/config/rl78/rl78-real.md b/gcc/config/rl78/rl78-real.md
index 4674113ba4e..8deb1bd20c2 100644
--- a/gcc/config/rl78/rl78-real.md
+++ b/gcc/config/rl78/rl78-real.md
@@ -589,7 +589,7 @@
(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"))]
)
@@ -601,7 +601,7 @@
(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"))]
)
diff --git a/gcc/config/rl78/rl78-virt.md b/gcc/config/rl78/rl78-virt.md
index c70beaec539..a26aa1da85d 100644
--- a/gcc/config/rl78/rl78-virt.md
+++ b/gcc/config/rl78/rl78-virt.md
@@ -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")]
@@ -68,17 +68,17 @@
;;---------- 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")]
)
@@ -95,20 +95,20 @@
)
(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"
)
@@ -131,29 +131,29 @@
)
(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"
)
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 9d136a4e004..0735d277cb9 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -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