Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 1 | From b066cb189302814fcd91b38f2f9da830a2c5b8fe Mon Sep 17 00:00:00 2001 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 2 | From: Mahesh Bodapati <mbodapat@xilinx.com> |
| 3 | Date: Tue, 17 Jan 2017 18:07:24 +0530 |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 4 | Subject: [PATCH 22/58] [PATCH] microblaze.md: Improve 'adddi3' and 'subdi3' |
| 5 | insn definitions |
| 6 | |
| 7 | Change adddi3 to handle DI immediates as the second operand, this |
| 8 | requires modification to the output template however reduces the need to |
| 9 | specify seperate templates for 16-bit positive/negative immediate |
| 10 | operands. The use of 32-bit immediates for the addi and addic |
| 11 | instructions is handled by the assembler, which will emit the imm |
| 12 | instructions when required. This conveniently handles the optimizable |
| 13 | cases where the immediate constant value does not need the higher half |
| 14 | words of the operands upper/lower words. |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 15 | |
| 16 | Change the constraints of the subdi3 instruction definition such that it |
| 17 | does not match the second operand as an immediate value. This is because |
| 18 | there is no definition to handle this case nor is it possible to |
| 19 | implement purely with instructions as microblaze does not provide an |
| 20 | instruction to perform a forward arithmetic subtraction (it only |
| 21 | provides reverse 'rD = IMM - rA'). |
| 22 | |
| 23 | Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 24 | --- |
| 25 | gcc/config/microblaze/microblaze.md | 13 ++++++------- |
| 26 | 1 file changed, 6 insertions(+), 7 deletions(-) |
| 27 | |
| 28 | diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 29 | index 986d9c3aa25..efd2c34e0b7 100644 |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 30 | --- a/gcc/config/microblaze/microblaze.md |
| 31 | +++ b/gcc/config/microblaze/microblaze.md |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 32 | @@ -502,17 +502,16 @@ |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 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 |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 55 | @@ -549,7 +548,7 @@ |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 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 | -- |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 65 | 2.17.1 |
Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 66 | |