[gcc(refs/vendors/ventana/heads/far-branch-for-gcc11)] RISC-V: far-branch: Update branch-(not)equals-zero to support far branches
Philipp Tomsich
ptomsich@gcc.gnu.org
Mon Jan 4 19:19:49 GMT 2021
https://gcc.gnu.org/g:2df877aa80e01cec2282f27d34ef6dc0196b8297
commit 2df877aa80e01cec2282f27d34ef6dc0196b8297
Author: Philipp Tomsich <philipp.tomsich@vrull.eu>
Date: Wed Dec 30 21:26:06 2020 +0100
RISC-V: far-branch: Update branch-(not)equals-zero to support far branches
The pattern introduced for the branch-(not)equals-zero optimisation is
updated to support an additional clobber (this needs to be Pmode) to
hold the jump target.
gcc/ChangeLog:
* config/riscv/riscv.md: Update branch-(not)equals-zero
pattern to support far branches (i.e. larger than +/- 1MB).
Diff:
---
gcc/config/riscv/riscv.md | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 399b6fc871d..da72b2ce9fe 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -1868,16 +1868,22 @@
;; Conditional branches
-(define_insn "*branch<mode>_equals_zero"
+(define_insn "*branch<ANYI:mode><P:mode>_equals_zero"
[(set (pc)
(if_then_else
(match_operator 1 "equality_operator"
[(match_operand:ANYI 2 "register_operand" "r")
(const_int 0)])
(label_ref (match_operand 0 "" ""))
- (pc)))]
+ (pc)))
+ (clobber (match_scratch:P 3 "=r"))]
"!partial_subreg_p(operands[2])"
- "b%C1\t%2,zero,%0"
+{
+ if (get_attr_length (insn) == 12)
+ return "b%N1\t%2,zero,1f; jump\t%l0,%3; 1:";
+
+ return "b%C1\t%2,zero,%0";
+}
[(set_attr "type" "branch")
(set_attr "mode" "none")])
More information about the Gcc-cvs
mailing list