summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2015-11-12 22:17:09 +1000
committerNathan Rossi <nathan@nathanrossi.com>2015-11-12 22:17:09 +1000
commit2b511e06a0b4e410760e36345187e2a5d3c9bc0b (patch)
tree0d369faff2ce66832cd9a281811e89eb7b5656e6
parent58b58ccb4f1460b154d321855da2a06a15849806 (diff)
downloadmeta-xilinx-2b511e06a0b4e410760e36345187e2a5d3c9bc0b.tar.gz
gcc_5.2: Add patch to fix MicroBlaze 'adddi3' instruction issue
* This patch improves and fixes an issue with the MicroBlaze instruction definitions for 64-bit addition with immediate/constant operands. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
-rw-r--r--recipes-microblaze/gcc/files/microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch66
-rw-r--r--recipes-microblaze/gcc/gcc-source_5.2.bbappend7
2 files changed, 73 insertions, 0 deletions
diff --git a/recipes-microblaze/gcc/files/microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch b/recipes-microblaze/gcc/files/microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch
new file mode 100644
index 00000000..446ff47d
--- /dev/null
+++ b/recipes-microblaze/gcc/files/microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch
@@ -0,0 +1,66 @@
1From ba9d2df1fa18243bd9fd77e499caa0224a1a13bc Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan@nathanrossi.com>
3Date: Thu, 12 Nov 2015 16:09:31 +1000
4Subject: [PATCH] microblaze.md: Improve 'adddi3' and 'subdi3' insn definitions
5
6Change adddi3 to handle DI immediates as the second operand, this
7requires modification to the output template however reduces the need to
8specify seperate templates for 16-bit positive/negative immediate
9operands. The use of 32-bit immediates for the addi and addic
10instructions is handled by the assembler, which will emit the imm
11instructions when required. This conveniently handles the optimizable
12cases where the immediate constant value does not need the higher half
13words of the operands upper/lower words.
14
15Change the constraints of the subdi3 instruction definition such that it
16does not match the second operand as an immediate value. This is because
17there is no definition to handle this case nor is it possible to
18implement purely with instructions as microblaze does not provide an
19instruction to perform a forward arithmetic subtraction (it only
20provides reverse 'rD = IMM - rA').
21
22Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
23Upstream-Status: Unsubmitted
24---
25 gcc/config/microblaze/microblaze.md | 13 ++++++-------
26 1 file changed, 6 insertions(+), 7 deletions(-)
27
28diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
29index 67e509c..1ab10b7 100644
30--- a/gcc/config/microblaze/microblaze.md
31+++ b/gcc/config/microblaze/microblaze.md
32@@ -480,17 +480,16 @@
33 ;; Adding 2 DI operands in register or reg/imm
34
35 (define_insn "adddi3"
36- [(set (match_operand:DI 0 "register_operand" "=d,d,d")
37- (plus:DI (match_operand:DI 1 "register_operand" "%d,d,d")
38- (match_operand:DI 2 "arith_operand32" "d,P,N")))]
39+ [(set (match_operand:DI 0 "register_operand" "=d,d")
40+ (plus:DI (match_operand:DI 1 "register_operand" "%d,d")
41+ (match_operand:DI 2 "arith_operand" "d,i")))]
42 ""
43 "@
44 add\t%L0,%L1,%L2\;addc\t%M0,%M1,%M2
45- addi\t%L0,%L1,%2\;addc\t%M0,%M1,r0
46- addi\t%L0,%L1,%2\;addc\t%M0,%M1,r0\;addi\t%M0,%M0,-1"
47+ addi\t%L0,%L1,%j2\;addic\t%M0,%M1,%h2"
48 [(set_attr "type" "darith")
49 (set_attr "mode" "DI")
50- (set_attr "length" "8,8,12")])
51+ (set_attr "length" "8,8")])
52
53 ;;----------------------------------------------------------------
54 ;; Subtraction
55@@ -516,7 +515,7 @@
56 (define_insn "subdi3"
57 [(set (match_operand:DI 0 "register_operand" "=&d")
58 (minus:DI (match_operand:DI 1 "register_operand" "d")
59- (match_operand:DI 2 "arith_operand32" "d")))]
60+ (match_operand:DI 2 "register_operand" "d")))]
61 ""
62 "rsub\t%L0,%L2,%L1\;rsubc\t%M0,%M2,%M1"
63 [(set_attr "type" "darith")
64--
652.6.2
66
diff --git a/recipes-microblaze/gcc/gcc-source_5.2.bbappend b/recipes-microblaze/gcc/gcc-source_5.2.bbappend
new file mode 100644
index 00000000..ce84c6b1
--- /dev/null
+++ b/recipes-microblaze/gcc/gcc-source_5.2.bbappend
@@ -0,0 +1,7 @@
1
2# Add MicroBlaze Patches
3FILESEXTRAPATHS_append := "${THISDIR}/files:"
4SRC_URI_append += " \
5 file://microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch \
6 "
7