annotate extra/gcc6809lw-4.6.4-8.patch @ 520:63450eb68f45

Update version string to reflect ongoing development
author William Astle <lost@l-w.ca>
date Sun, 19 Dec 2021 17:09:15 -0700
parents 818b096ac128
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
446
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1 diff -urN gcc-4.6.4-clean/config.sub gcc-4.6.4/config.sub
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2 --- gcc-4.6.4-clean/config.sub 2010-05-25 07:22:07.000000000 -0600
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3 +++ gcc-4.6.4/config.sub 2017-11-28 21:12:11.136911706 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4 @@ -313,7 +313,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5 c6x)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6 basic_machine=tic6x-unknown
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8 - m6811 | m68hc11 | m6812 | m68hc12 | picochip)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
9 + m6809 | m6811 | m68hc11 | m6812 | m68hc12 | picochip)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
10 # Motorola 68HC11/12.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
11 basic_machine=$basic_machine-unknown
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
12 os=-none
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
13 @@ -354,7 +354,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
14 | i*86-* | i860-* | i960-* | ia64-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
15 | ip2k-* | iq2000-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
16 | lm32-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
17 - | m32c-* | m32r-* | m32rle-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
18 + | m32c-* | m32r-* | m32rle-* | m6809-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
19 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
20 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
21 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
22 @@ -509,6 +509,10 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
23 basic_machine=arm-unknown
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
24 os=-cegcc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
25 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
26 + coco)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
27 + basic_machine=coco
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
28 + os=-none
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
29 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
30 convex-c1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
31 basic_machine=c1-convex
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
32 os=-bsd
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
33 diff -urN gcc-4.6.4-clean/configure gcc-4.6.4/configure
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
34 --- gcc-4.6.4-clean/configure 2011-12-18 03:03:44.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
35 +++ gcc-4.6.4/configure 2017-11-28 21:12:11.136911706 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
36 @@ -3439,6 +3439,9 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
37 m32r-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
38 noconfigdirs="$noconfigdirs ${libgcj}"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
39 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
40 + m6809*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
41 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
42 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
43 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
44 noconfigdirs="$noconfigdirs target-libstdc++-v3 ${libgcj}"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
45 libgloss_dir=m68hc11
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
46 diff -urN gcc-4.6.4-clean/configure.ac gcc-4.6.4/configure.ac
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
47 --- gcc-4.6.4-clean/configure.ac 2011-11-18 04:45:44.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
48 +++ gcc-4.6.4/configure.ac 2017-11-28 21:12:11.140911685 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
49 @@ -885,6 +885,9 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
50 m32r-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
51 noconfigdirs="$noconfigdirs ${libgcj}"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
52 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
53 + m6809*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
54 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
55 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
56 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
57 noconfigdirs="$noconfigdirs target-libstdc++-v3 ${libgcj}"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
58 libgloss_dir=m68hc11
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
59 diff -urN gcc-4.6.4-clean/gcc/calls.c gcc-4.6.4/gcc/calls.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
60 --- gcc-4.6.4-clean/gcc/calls.c 2012-02-09 10:27:25.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
61 +++ gcc-4.6.4/gcc/calls.c 2017-11-28 21:12:11.140911685 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
62 @@ -2561,7 +2561,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
63 call sequence.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
64 Also do the adjustments before a throwing call, otherwise
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
65 exception handling can fail; PR 19225. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
66 - if (pending_stack_adjust >= 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
67 + if (pending_stack_adjust >= 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
68 || (pending_stack_adjust > 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
69 && (flags & ECF_MAY_BE_ALLOCA))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
70 || (pending_stack_adjust > 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
71 diff -urN gcc-4.6.4-clean/gcc/config/m6809/crt0.S gcc-4.6.4/gcc/config/m6809/crt0.S
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
72 --- gcc-4.6.4-clean/gcc/config/m6809/crt0.S 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
73 +++ gcc-4.6.4/gcc/config/m6809/crt0.S 2017-11-28 21:12:11.152911619 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
74 @@ -0,0 +1,173 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
75 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
76 +;;; Copyright 2006, 2007, 2008, 2009 by Brian Dominy <brian@oddchange.com>
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
77 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
78 +;;; This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
79 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
80 +;;; GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
81 +;;; it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
82 +;;; the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
83 +;;; any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
84 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
85 +;;; GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
86 +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
87 +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
88 +;;; GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
89 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
90 +;;; You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
91 +;;; along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
92 +;;; <http://www.gnu.org/licenses/>.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
93 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
94 + /* Declare external for main() */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
95 + .globl _main
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
96 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
97 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
98 +/* The startup is heavily dependent on the type of machine and
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
99 +OS environment that is available at the start point.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
100 +For the most part, the general idea is the same across machines,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
101 +but the implementation is vastly different. This is managed via
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
102 +conditional compiles throughout the startup code for each of the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
103 +supported machines. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
104 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
105 +#ifdef TARGET_COCO /* CoCo memory map */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
106 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
107 +#define COCO_RAMROM_MODE 0xFFDE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
108 +#define COCO_ALLRAM_MODE 0xFFDF
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
109 +#define COCO_PAGE1 0xFFD5
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
110 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
111 +/* SAM M1 and M0 adjusts the memory size */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
112 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
113 +#define BASIC_WARMSTART_FLAG 0x0071
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
114 +#define BASIC_START 0xA027
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
115 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
116 +#define __STACK_TOP 0x6800
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
117 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
118 +#else /* Simulator (default) memory map */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
119 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
120 +#define SIM_EXIT_REG 0xFF01
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
121 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
122 +#define __STACK_TOP 0xFE00
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
123 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
124 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
125 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
126 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
127 + .area .data
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
128 + .area .ctors
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
129 + .area .dtors
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
130 + .area .bss
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
131 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
132 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
133 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
134 + ;;; __exit : Exit point from the program
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
135 + ;;; For simulation, this writes to a special I/O register that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
136 + ;;; the simulator interprets as end-of-program.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
137 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
138 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
139 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
140 + .globl __exit
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
141 +__exit:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
142 +#ifdef TARGET_COCO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
143 + ;; Go back to ROM/RAM mode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
144 + sta COCO_RAMROM_MODE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
145 + clr BASIC_WARMSTART_FLAG
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
146 + jmp BASIC_START
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
147 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
148 + tfr x,d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
149 + stb SIM_EXIT_REG
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
150 + bra __exit
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
151 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
152 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
153 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
154 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
155 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
156 + ;;; __start : Entry point to the program
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
157 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
158 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
159 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
160 + .globl __start
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
161 +__start:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
162 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
163 +#ifdef HAVE_DIRECT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
164 + ;; Initialize the direct page pointer
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
165 + lda #<s_.direct
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
166 + tfr a,dp
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
167 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
168 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
169 +#ifdef TARGET_COCO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
170 + ;; Turn off interrupts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
171 + orcc #(0x10|0x40)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
172 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
173 + ;; Setup All RAM Mode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
174 + sta COCO_ALLRAM_MODE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
175 +#endif /* TARGET_COCO */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
176 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
177 + ;; Initialize the stack
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
178 + lds #__STACK_TOP - 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
179 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
180 + ;; Call any "initializer" functions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
181 + ldu #s_.ctors
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
182 +__ctors_loop:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
183 + ldy ,u++
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
184 + cmpy #0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
185 + beq __ctors_done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
186 + jsr ,y
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
187 + bra __ctors_loop
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
188 +__ctors_done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
189 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
190 + ;; Enable interrupts on the simulator
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
191 +#ifndef TARGET_COCO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
192 + andcc #~(0x10|0x40)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
193 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
194 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
195 + ;; Set up the environment
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
196 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
197 + ;; Set up argc/argv arrays
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
198 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
199 + ;; Call the main function. The exit code will
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
200 + ;; be returned in the X register, unless compiled
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
201 + ;; with -mdret, in which case it comes back in D.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
202 + jsr _main
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
203 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
204 + ;; Call any finalizer functions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
205 + ldu #s_.dtors
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
206 +__dtors_loop:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
207 + ldy ,u++
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
208 + cmpy #0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
209 + beq __dtors_done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
210 + jsr ,y
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
211 + bra __dtors_loop
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
212 +__dtors_done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
213 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
214 + ;; If main returns, then invoke _exit() to stop the program
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
215 + ;; The C library doesn't support -mdret yet, so move the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
216 + ;; argument first.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
217 +#ifdef __DRET__
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
218 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
219 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
220 + jmp _exit
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
221 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
222 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
223 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
224 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
225 + ;;; __crt0_vector : Default handler for interrupts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
226 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
227 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
228 +___crt0_vector:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
229 + ;; The default behavior is to simply ignore all
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
230 + ;; non-reset interrupts.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
231 + rti
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
232 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
233 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
234 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
235 + ;;; vector : The interrupt vector table
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
236 + ;;; The linker will ensure that this gets loaded at address 0xFFF0.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
237 + ;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
238 + .area vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
239 +vectors:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
240 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
241 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
242 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
243 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
244 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
245 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
246 + .word ___crt0_vector
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
247 + .word __start
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
248 diff -urN gcc-4.6.4-clean/gcc/config/m6809/libgcc1.s gcc-4.6.4/gcc/config/m6809/libgcc1.s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
249 --- gcc-4.6.4-clean/gcc/config/m6809/libgcc1.s 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
250 +++ gcc-4.6.4/gcc/config/m6809/libgcc1.s 2017-11-28 21:12:11.152911619 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
251 @@ -0,0 +1,511 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
252 +/* libgcc routines for m6809
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
253 + Copyright (C) 2006 Free Software Foundation, Inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
254 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
255 +This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
256 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
257 +GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
258 +it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
259 +the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
260 +any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
261 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
262 +GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
263 +but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
264 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
265 +GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
266 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
267 +You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
268 +along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
269 +<http://www.gnu.org/licenses/>. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
270 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
271 +/* As a special exception, if you link this library with other files,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
272 + some of which are compiled with GCC, to produce an executable,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
273 + this library does not by itself cause the resulting executable
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
274 + to be covered by the GNU General Public License.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
275 + This exception does not however invalidate any other reasons why
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
276 + the executable file might be covered by the GNU General Public License. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
277 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
278 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
279 +#define SIGFPE jmp _abort
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
280 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
281 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
282 + ; Shift functions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
283 + ; On input, D is value to be shifted, and X has shift count.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
284 + ; Result is also in D.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
285 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
286 +#ifdef L_ashlhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
287 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
288 + .globl _ashlhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
289 +_ashlhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
290 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
291 +1$:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
292 + leax -1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
293 + cmpx #-1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
294 + beq 2$
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
295 + aslb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
296 + rola
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
297 + bra 1$
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
298 +2$:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
299 + puls x,pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
300 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
301 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
302 +#ifdef L_ashrhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
303 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
304 + .globl _ashrhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
305 +_ashrhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
306 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
307 +1$:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
308 + leax -1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
309 + cmpx #-1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
310 + beq 2$
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
311 + asra
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
312 + rorb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
313 + bra 1$
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
314 +2$:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
315 + puls x,pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
316 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
317 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
318 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
319 +#ifdef L_lshrhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
320 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
321 + .globl _lshrhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
322 +_lshrhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
323 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
324 +1$:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
325 + leax -1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
326 + cmpx #-1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
327 + beq 2$
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
328 + lsra
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
329 + rorb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
330 + bra 1$
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
331 +2$:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
332 + puls x,pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
333 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
334 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
335 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
336 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
337 +#ifdef L_softregs
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
338 + .area direct
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
339 + .globl m0, m1, m2, m3, m4, m5, m6, m7
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
340 + .globl m8, m9, m10, m11, m12, m13, m14, m15
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
341 +m0: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
342 +m1: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
343 +m2: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
344 +m3: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
345 +m4: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
346 +m5: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
347 +m6: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
348 +m7: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
349 +m8: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
350 +m9: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
351 +m10: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
352 +m11: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
353 +m12: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
354 +m13: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
355 +m14: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
356 +m15: .blkb 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
357 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
358 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
359 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
360 +#ifdef L_ashlsi3_one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
361 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
362 + .globl _ashlsi3_one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
363 +_ashlsi3_one:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
364 + asl 3,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
365 + rol 2,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
366 + rol 1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
367 + rol ,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
368 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
369 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
370 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
371 +#ifdef L_ashlsi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
372 + /* X points to the SImode (source/dest)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
373 + B is the count */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
374 +_ashlsi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
375 + pshs u
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
376 + cmpb #16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
377 + blt try8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
378 + subb #16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
379 + ; Shift by 16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
380 + ldu 2,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
381 + stu ,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
382 +try8:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
383 + cmpb #8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
384 + blt try_rest
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
385 + subb #8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
386 + ; Shift by 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
387 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
388 +try_rest:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
389 + tstb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
390 + beq done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
391 +do_rest:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
392 + ; Shift by 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
393 + asl 3,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
394 + rol 2,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
395 + rol 1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
396 + rol ,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
397 + decb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
398 + bne do_rest
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
399 +done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
400 + puls u,pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
401 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
402 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
403 +#ifdef L_ashrsi3_one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
404 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
405 + .globl _ashlsi3_one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
406 +_ashrsi3_one:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
407 + asr ,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
408 + ror 1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
409 + ror 2,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
410 + ror 3,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
411 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
412 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
413 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
414 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
415 +#ifdef L_lshrsi3_one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
416 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
417 + .globl _lshrsi3_one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
418 +_lshrsi3_one:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
419 + lsr ,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
420 + ror 1,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
421 + ror 2,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
422 + ror 3,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
423 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
424 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
425 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
426 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
427 +#ifdef L_clzsi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
428 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
429 + .globl ___clzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
430 + ; Input: X = 16-bit unsigned integer
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
431 + ; Output: X = number of leading zeros
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
432 + ; This function destroys the value in D.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
433 +___clzhi2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
434 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
435 + ; Find the offset of the leftmost '1' bit in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
436 + ; the left half of the word.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
437 + ;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
438 + ; Bits are numbered in the table with 1 meaning the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
439 + ; LSB and 8 meaning the MSB.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
440 + ;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
441 + ; If nonzero, then clz is 8-a.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
442 + tfr x,d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
443 + ldx #___clz_tab
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
444 + tfr a,b
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
445 + clra
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
446 + ldb d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
447 + bne upper_bit_set
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
448 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
449 +lower_bit_set:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
450 + ; If the upper byte is zero, then check the lower
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
451 + ; half of the word. Return 16-a.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
452 + puls d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
453 + clra
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
454 + ldb d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
455 + negb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
456 + addb #16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
457 + bra done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
458 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
459 +upper_bit_set:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
460 + negb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
461 + addb #8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
462 + puls x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
463 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
464 +done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
465 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
466 + puls pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
467 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
468 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
469 +#ifdef L_clzdi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
470 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
471 + .globl ___clzsi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
472 + ; Input: 32-bit unsigned integer is on the stack, just
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
473 + ; above the return address
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
474 + ; Output: X = number of leading zeros
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
475 +___clzsi2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
476 + ; Check the upper 16-bit word
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
477 + ; If it is not zero, then return clzhi2(X).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
478 + ; A branch can be used instead of a call since no
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
479 + ; postprocessing is needed. Use long branch form
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
480 + ; though since functions may not be near each other.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
481 + ldx 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
482 + lbne ___clzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
483 + ldx 4,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
484 + jsr ___clzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
485 + leax 16,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
486 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
487 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
488 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
489 +#ifdef L_ctzsi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
490 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
491 + .globl ___ctzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
492 + ; Input: X = 16-bit unsigned integer
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
493 + ; Output: X = number of trailing zeros
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
494 + ; F(x) = 15 - clzhi2(X & -x)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
495 + ; This function destroys the value in D.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
496 +___ctzhi2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
497 + tfr x,d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
498 + coma
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
499 + comb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
500 + addd #1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
501 + pshs a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
502 + pshs b
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
503 + tfr x,d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
504 + andb ,s+
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
505 + anda ,s+
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
506 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
507 + jsr ___clzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
508 + tfr x,d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
509 + subd #16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
510 + coma
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
511 + comb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
512 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
513 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
514 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
515 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
516 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
517 +#ifdef L_ctzdi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
518 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
519 + .globl ___ctzsi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
520 + ; Input: 32-bit unsigned integer is on the stack, just
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
521 + ; above the return address
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
522 + ; Output: X = number of leading zeros
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
523 +___ctzsi2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
524 + ; Check the lower 16-bit word
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
525 + ; If it is not zero, then return ctzhi2(X).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
526 + ; A branch can be used instead of a call since no
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
527 + ; postprocessing is needed. Use long branch form
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
528 + ; though since functions may not be near each other.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
529 + ldx 4,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
530 + lbne ___ctzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
531 + ldx 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
532 + jsr ___ctzhi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
533 + leax 16,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
534 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
535 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
536 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
537 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
538 +#ifdef L_mulhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
539 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
540 +;;; ___mulhi3 - signed/unsigned multiply
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
541 +;;; Called by GCC to implement 16x16 multiplication
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
542 +;;; Arguments: Two 16-bit values, one in stack, one in X.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
543 +;;; Result: 16-bit result in X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
544 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
545 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
546 + .globl _mulhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
547 +_mulhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
548 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
549 + lda 5,s ; left msb * right lsb * 256
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
550 + ldb ,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
551 + mul
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
552 + tfr b,a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
553 + clrb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
554 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
555 + ldb 1,s ; left lsb * right msb * 256
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
556 + lda 4,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
557 + mul
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
558 + tfr b,a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
559 + clrb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
560 + leax d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
561 + ldb 1,s ; left lsb * right lsb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
562 + lda 5,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
563 + mul
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
564 + leax d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
565 + puls d,pc ; kill D to remove initial push
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
566 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
567 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
568 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
569 +#ifdef L_divhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
570 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
571 +;;; ___divhi3 - signed division
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
572 +;;; Arguments: Dividend in X, divisor on the stack
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
573 +;;; Returns result in X.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
574 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
575 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
576 + .globl _divhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
577 +_divhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
578 + ldd 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
579 + bne do_div ; check dividend
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
580 + SIGFPE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
581 +do_div:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
582 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
583 + jsr _seuclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
584 + puls x,pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
585 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
586 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
587 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
588 +#ifdef L_modhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
589 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
590 +;;; ___modhi3 - signed modulo
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
591 +;;; Arguments: Dividend in X, divisor on the stack
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
592 +;;; Returns result in X.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
593 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
594 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
595 + .globl _modhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
596 +_modhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
597 + ldd 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
598 + bne do_mod ; check dividend
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
599 + SIGFPE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
600 +do_mod:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
601 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
602 + jsr _seuclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
603 + leas 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
604 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
605 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
606 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
607 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
608 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
609 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
610 +#ifdef L_udivhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
611 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
612 +;;; ___udivhi3 - unsigned division
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
613 +;;; Arguments: Dividend in X, divisor on the stack
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
614 +;;; Returns result in X.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
615 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
616 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
617 + .globl _udivhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
618 +_udivhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
619 + ldd 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
620 + bne do_udiv ; check dividend
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
621 + SIGFPE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
622 +do_udiv:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
623 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
624 + jsr _euclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
625 + puls x,pc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
626 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
627 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
628 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
629 +#ifdef L_umodhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
630 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
631 +;;; ___umodhi3 - unsigned modulo
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
632 +;;; Arguments: Dividend in X, divisor on the stack
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
633 +;;; Returns result in X.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
634 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
635 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
636 + .globl _umodhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
637 +_umodhi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
638 + ldd 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
639 + bne do_umod ; check dividend
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
640 + SIGFPE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
641 +do_umod:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
642 + pshs x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
643 + jsr _euclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
644 + leas 2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
645 + tfr d,x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
646 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
647 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
648 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
649 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
650 +#ifdef L_euclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
651 +; unsigned euclidean division
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
652 +; calling: (left / right)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
653 +; push left
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
654 +; ldd right
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
655 +; jsr _euclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
656 +; quotient on the stack (left)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
657 +; modulus in d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
658 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
659 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
660 + .globl _euclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
661 + left=5
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
662 + right=1 ; word
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
663 + count=0 ; byte
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
664 + CARRY=1 ; alias
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
665 +_euclid:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
666 + leas -3,s ; 2 local variables
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
667 + clr count,s ; prescale divisor
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
668 + inc count,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
669 + tsta
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
670 +presc:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
671 + bmi presc_done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
672 + inc count,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
673 + aslb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
674 + rola
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
675 + bra presc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
676 +presc_done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
677 + std right,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
678 + ldd left,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
679 + clr left,s ; quotient = 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
680 + clr left+1,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
681 +mod1:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
682 + subd right,s ; check subtract
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
683 + bcc mod2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
684 + addd right,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
685 + andcc #~CARRY
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
686 + bra mod3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
687 +mod2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
688 + orcc #CARRY
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
689 +mod3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
690 + rol left+1,s ; roll in carry
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
691 + rol left,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
692 + lsr right,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
693 + ror right+1,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
694 + dec count,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
695 + bne mod1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
696 + leas 3,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
697 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
698 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
699 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
700 +#ifdef L_seuclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
701 +; signed euclidean division
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
702 +; calling: (left / right)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
703 +; push left
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
704 +; ldd right
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
705 +; jsr _seuclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
706 +; quotient on the stack (left)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
707 +; modulus in d
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
708 + .area .text
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
709 + .globl _seuclid
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
710 + left=6
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
711 + right=2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
712 + quot_sign=1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
713 + mod_sign=0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
714 +_seuclid:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
715 + leas -4,s ; 3 local variables
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
716 + std right,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
717 + clr mod_sign,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
718 + clr quot_sign,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
719 + ldd left,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
720 + bge mod_abs
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
721 + inc mod_sign,s ; sign(mod) = sign(left)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
722 + inc quot_sign,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
723 + bsr negd ; abs(left) -> D
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
724 +mod_abs:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
725 + pshs b,a ; push abs(left)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
726 + ldd right+2,s ; all references shifted by 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
727 + bge quot_abs
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
728 + dec quot_sign+2,s ; sign(quot) = sign(left) XOR sign(right)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
729 + bsr negd ; abs(right) -> D
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
730 +quot_abs:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
731 + jsr _euclid ; call (unsigned) euclidean division
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
732 + std right+2,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
733 + puls a,b ; quot -> D
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
734 + tst quot_sign,s ; all references no longer shifted
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
735 + beq quot_done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
736 + bsr negd
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
737 +quot_done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
738 + std left,s ; quot -> left
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
739 + ldd right,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
740 + tst mod_sign,s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
741 + beq mod_done
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
742 + bsr negd
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
743 +mod_done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
744 + leas 4,s ; destroy stack frame
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
745 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
746 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
747 +negd: ; self-explanatory !
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
748 + nega
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
749 + negb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
750 + sbca #0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
751 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
752 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
753 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
754 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
755 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
756 +#ifdef L_pending_addsi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
757 +_addsi3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
758 + rts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
759 +#endif /* L_pending_addsi3 */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
760 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
761 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
762 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
763 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.c gcc-4.6.4/gcc/config/m6809/m6809.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
764 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.c 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
765 +++ gcc-4.6.4/gcc/config/m6809/m6809.c 2017-11-28 21:12:11.152911619 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
766 @@ -0,0 +1,3025 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
767 +/*-------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
768 + FILE: m6809.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
769 +-------------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
770 +/* Subroutines for insn-output.c for MC6809.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
771 + Copyright (C) 1989-2007 Free Software Foundation, Inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
772 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
773 + MC6809 Version by Tom Jones (jones@sal.wisc.edu)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
774 + Space Astronomy Laboratory
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
775 + University of Wisconsin at Madison
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
776 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
777 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
778 + ( msdoerfe@informatik.uni-erlangen.de )
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
779 + also added #pragma interrupt (inspired by gcc-6811)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
780 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
781 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
782 + (ebotcazou@multimania.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
783 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
784 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
785 + (ebotcazou@multimania.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
786 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
787 + major cleanup, improvements, and upgrade to gcc 3.4 by Brian Dominy
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
788 + (brian@oddchange.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
789 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
790 + additional adjustments, etc., for gcc 4.6.1 by William Astle (lost@l-w.ca)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
791 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
792 +This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
793 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
794 +GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
795 +it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
796 +the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
797 +any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
798 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
799 +GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
800 +but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
801 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
802 +GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
803 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
804 +You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
805 +along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
806 +<http://www.gnu.org/licenses/>. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
807 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
808 +#include <string.h>
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
809 +#include <time.h>
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
810 +#include <sys/types.h>
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
811 +#include <sys/timeb.h>
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
812 +#include <stdio.h>
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
813 +#include "config.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
814 +#include "system.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
815 +#include "coretypes.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
816 +#include "tm.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
817 +#include "tree.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
818 +#include "rtl.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
819 +#include "tm_p.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
820 +#include "regs.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
821 +#include "flags.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
822 +#include "hard-reg-set.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
823 +#include "real.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
824 +#include "tree.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
825 +#include "insn-config.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
826 +#include "conditions.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
827 +#include "insn-flags.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
828 +#include "output.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
829 +#include "insn-attr.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
830 +#include "function.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
831 +#include "target.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
832 +#include "target-def.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
833 +#include "expr.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
834 +#include "recog.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
835 +#include "cpplib.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
836 +#include "c-family/c-pragma.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
837 +#include "c-family/c-common.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
838 +#include "toplev.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
839 +#include "optabs.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
840 +#include "version.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
841 +#include "df.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
842 +#include "rtlhooks-def.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
843 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
844 +/* macro to return TRUE if length of operand mode is one byte */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
845 +#define BYTE_MODE(X) ((GET_MODE_SIZE (GET_MODE (X))) == 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
846 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
847 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
848 +/* REAL_REG_P(x) is a true if the rtx 'x' represents a real CPU
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
849 +register and not a fake one that is emulated in software. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
850 +#define REAL_REG_P(x) (REG_P(x) && !M_REG_P(x))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
851 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
852 +/*-------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
853 + Target hooks, moved from target.h
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
854 +-------------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
855 +static void m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
856 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
857 +#undef TARGET_ENCODE_SECTION_INFO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
858 +#define TARGET_ENCODE_SECTION_INFO m6809_encode_section_info
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
859 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
860 +#undef TARGET_ASM_FILE_START
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
861 +#define TARGET_ASM_FILE_START m6809_asm_file_start
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
862 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
863 +#undef TARGET_ASM_ALIGNED_HI_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
864 +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
865 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
866 +#undef TARGET_ASM_ALIGNED_SI_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
867 +#define TARGET_ASM_ALIGNED_SI_OP NULL
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
868 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
869 +#undef TARGET_ASM_UNALIGNED_HI_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
870 +#define TARGET_ASM_UNALIGNED_HI_OP "\t.word\t"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
871 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
872 +#undef TARGET_ASM_UNALIGNED_SI_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
873 +#define TARGET_ASM_UNALIGNED_SI_OP NULL
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
874 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
875 +#undef TARGET_RTX_COSTS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
876 +#define TARGET_RTX_COSTS m6809_rtx_costs
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
877 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
878 +#undef TARGET_ATTRIBUTE_TABLE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
879 +#define TARGET_ATTRIBUTE_TABLE m6809_attribute_table
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
880 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
881 +#undef TARGET_INIT_BUILTINS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
882 +#define TARGET_INIT_BUILTINS m6809_init_builtins
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
883 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
884 +#undef TARGET_EXPAND_BUILTIN
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
885 +#define TARGET_EXPAND_BUILTIN m6809_expand_builtin
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
886 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
887 +#undef TARGET_DEFAULT_TARGET_FLAGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
888 +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_REG_ARGS | MASK_DIRECT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
889 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
890 +#undef TARGET_FUNCTION_OK_FOR_SIBCALL
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
891 +#define TARGET_FUNCTION_OK_FOR_SIBCALL m6809_function_ok_for_sibcall
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
892 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
893 +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
894 +#define TARGET_ASM_TRAMPOLINE_TEMPLATE m6809_asm_trampoline_template
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
895 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
896 +#undef TARGET_TRAMPOLINE_INIT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
897 +#define TARGET_TRAMPOLINE_INIT m6809_initialize_trampoline
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
898 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
899 +#undef TARGET_FRAME_POINTER_REQUIRED
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
900 +#define TARGET_FRAME_POINTER_REQUIRED m6809_frame_pointer_required
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
901 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
902 +#undef TARGET_OPTION_OVERRIDE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
903 +#define TARGET_OPTION_OVERRIDE m6809_override_options
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
904 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
905 +/* External variables used */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
906 +extern int reload_completed; /* set in toplev.c */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
907 +extern FILE *asm_out_file;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
908 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
909 +static int last_mem_size; /* operand size (bytes) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
910 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
911 +/* True if the section was recently changed and another .area
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
912 + * directive needs to be output before emitting the next label. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
913 +int section_changed = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
914 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
915 +/* Section names. The defaults here are used until an
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
916 + * __attribute__((section)) is seen that changes it. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
917 +char code_section_op[128] = "\t.area .text";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
918 +char data_section_op[128] = "\t.area .data";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
919 +char bss_section_op[128] = "\t.area .bss";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
920 +const char *code_bank_option = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
921 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
922 +/* TRUE if the direct mode prefix might be valid in this context.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
923 + * This is set by 'print_address' prior to calling output_addr_const,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
924 + * which performs into 'print_direct_prefix' to do the final checks. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
925 +static int check_direct_prefix_flag;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
926 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
927 +/* Nonzero if an address is being printed in a context which does not
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
928 + * permit any PIC modifications to the address */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
929 +static int pic_ok_for_addr_p = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
930 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
931 +/* Current code page. This supports machines which can do bank
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
932 + * switching to allow for more than 64KB of code/data. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
933 +char far_code_page[64];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
934 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
935 +/* Current bank name */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
936 +static char current_bank_name[8] = "-1";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
937 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
938 +/* Default bank name */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
939 +static char default_code_bank_name[8] = "-1";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
940 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
941 +/* Direct memory reserved as soft registers */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
942 +unsigned int m6809_soft_regs = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
943 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
944 +/* ABI version */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
945 +unsigned int m6809_abi_version = M6809_ABI_VERSION_REGS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
946 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
947 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
948 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
949 + * Called after options have been parsed.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
950 + * If overrides have been specified on the command-line, then
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
951 + * these values are copied into the main storage variables.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
952 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
953 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
954 +m6809_override_options (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
955 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
956 + /* Handle -mfar-code-page */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
957 + if (far_code_page_option == 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
958 + far_code_page_option = "__default_code_page";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
959 + strcpy (far_code_page, far_code_page_option);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
960 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
961 + /* Handle -mcode-section, -mdata-section, and -mbss-section */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
962 + if (code_section_ptr != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
963 + sprintf (code_section_op, "\t.area %s", code_section_ptr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
964 + if (data_section_ptr != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
965 + sprintf (data_section_op, "\t.area %s", data_section_ptr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
966 + if (bss_section_ptr != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
967 + sprintf (bss_section_op, "\t.area %s", bss_section_ptr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
968 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
969 + /* Handle -mcode-bank */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
970 + if (code_bank_option != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
971 + sprintf (default_code_bank_name, "%s", code_bank_option);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
972 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
973 + /* Handle -mabi-version or -mno-reg-args */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
974 + if (m6809_abi_version_ptr != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
975 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
976 + if (!strcmp (m6809_abi_version_ptr, "stack"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
977 + m6809_abi_version = M6809_ABI_VERSION_STACK;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
978 + else if (!strcmp (m6809_abi_version_ptr, "regs"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
979 + m6809_abi_version = M6809_ABI_VERSION_REGS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
980 + else if (!strcmp (m6809_abi_version_ptr, "bx"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
981 + m6809_abi_version = M6809_ABI_VERSION_BX;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
982 + else if (!strcmp (m6809_abi_version_ptr, "latest"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
983 + m6809_abi_version = M6809_ABI_VERSION_LATEST;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
984 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
985 + m6809_abi_version = atoi (m6809_abi_version_ptr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
986 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
987 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
988 + /* The older -mno-reg-args option is deprecated, and treated
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
989 + as -mabi=stack. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
990 + if (!TARGET_REG_ARGS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
991 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
992 + warning (WARNING_OPT "-mno-reg-args deprecated; use -mabi=stack instead.");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
993 + m6809_abi_version = M6809_ABI_VERSION_STACK;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
994 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
995 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
996 + /* -fexceptions is unsupported */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
997 + flag_exceptions = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
998 + flag_non_call_exceptions = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
999 + flag_unwind_tables = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1000 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1001 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1002 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1003 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1004 + * Output prefix that directs the assembler to use a direct-mode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1005 + * instruction if globally enabled, address is a symbol, and symbol
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1006 + * has been marked as in direct page. Also, never do this if
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1007 + * using the indirect mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1008 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1009 +print_direct_prefix (FILE * file, rtx addr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1010 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1011 + if (TARGET_DIRECT &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1012 + (GET_CODE (addr) == SYMBOL_REF) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1013 + SYMBOL_REF_FLAG (addr) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1014 + check_direct_prefix_flag)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1015 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1016 + putc ('*', file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1017 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1018 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1019 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1020 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1021 +/** Prints an operand (that is not an address) in assembly from RTL. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1022 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1023 +print_operand (FILE * file, rtx x, int code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1024 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1025 + if (REG_P (x)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1026 + /* gcc currently allocates the entire 16-bit 'd' register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1027 + * even when it only needs an 8-bit value. So here it
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1028 + * is tricked into printing only the lower 8-bit 'b'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1029 + * register into the assembly output.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1030 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1031 + * Eventually gcc should be modified to allocate a/b
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1032 + * independently and this hack can be removed.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1033 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1034 + * Occasionally, we may want to do an operation using
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1035 + * the 'a' register instead of 'b'; use the 'A' code
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1036 + * to specify that.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1037 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1038 + if (code == 'A')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1039 + fputs ("a", file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1040 + else if ((BYTE_MODE (x)) && (REGNO (x) == HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1041 + fputs ("b", file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1042 + else if (M_REG_P (x) && code == 'L')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1043 + /* Soft registers can be treated like memory and accessed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1044 + * at a particular offset. TODO : handle 'W' */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1045 + fputs (reg_names[REGNO (x)+1], file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1046 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1047 + fputs (reg_names[REGNO (x)], file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1048 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1049 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1050 + else if (MEM_P (x)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1051 + last_mem_size = GET_MODE_SIZE (GET_MODE (x));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1052 + if (code == 'L') { /* LSH of word address */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1053 + if (GET_CODE (XEXP (x, 0)) == MEM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1054 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1055 + /* Offseting an indirect addressing mode is not supported */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1056 + error ("expression too complex for 6809 (offset indirect mode)");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1057 + debug_rtx (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1058 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1059 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1060 + x = adjust_address (x, QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1061 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1062 + else if (code == 'M') { /* MSH of word address */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1063 + if (GET_CODE (XEXP (x, 0)) == MEM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1064 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1065 + /* Offseting an indirect addressing mode is not supported */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1066 + error ("expression too complex for 6809 (offset indirect mode)");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1067 + debug_rtx (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1068 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1069 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1070 + x = adjust_address (x, QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1071 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1072 + else if (code == 'W') { /* least significant half of 32-bit */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1073 + x = adjust_address (x, HImode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1074 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1075 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1076 + pic_ok_for_addr_p = (code != 'C');
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1077 + output_address (XEXP (x, 0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1078 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1079 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1080 + else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != DImode) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1081 + union { double d; int i[2]; } u;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1082 + u.i[0] = CONST_DOUBLE_LOW (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1083 + u.i[1] = CONST_DOUBLE_HIGH (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1084 + fprintf (file, "#%#9.9g", u.d);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1085 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1086 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1087 + else if (code == 'R') {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1088 + fprintf (file, "%s",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1089 + m6809_get_regs_printable (INTVAL (x)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1090 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1091 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1092 + else {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1093 + if (code == 'L') { /* LSH of word address */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1094 + x = gen_rtx_CONST_INT (VOIDmode, (INTVAL(x) & 0xff));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1095 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1096 + else if (code == 'M') { /* MSH of word address */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1097 + x = gen_rtx_CONST_INT (VOIDmode, ((INTVAL(x) >> 8) & 0xff));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1098 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1099 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1100 + putc ('#', file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1101 + output_addr_const (file, x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1102 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1103 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1104 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1105 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1106 +/** Prints an address operand to assembler from its RTL representation. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1107 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1108 +print_operand_address (FILE *file, rtx addr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1109 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1110 + register rtx base = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1111 + register rtx offset = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1112 + int regno;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1113 + int indirect_flag = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1114 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1115 + check_direct_prefix_flag = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1116 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1117 + /*** check for indirect addressing ***/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1118 + if (MEM_P (addr)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1119 + last_mem_size = GET_MODE_SIZE (GET_MODE (addr));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1120 + addr = XEXP (addr, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1121 + if (pic_ok_for_addr_p)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1122 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1123 + indirect_flag = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1124 + fprintf (file, "[");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1125 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1126 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1127 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1128 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1129 + switch (GET_CODE (addr)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1130 + case REG:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1131 + regno = REGNO (addr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1132 + fprintf (file, ",%s", reg_names[regno]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1133 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1134 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1135 + case PRE_DEC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1136 + regno = REGNO (XEXP (addr, 0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1137 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1138 + fprintf (file, "%s", reg_names[regno]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1139 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1140 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1141 + case POST_INC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1142 + regno = REGNO (XEXP (addr, 0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1143 + fprintf (file, ",%s", reg_names[regno]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1144 + fputs (((last_mem_size == 1) ? "+" : "++"), file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1145 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1146 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1147 + case PLUS:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1148 + base = XEXP (addr, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1149 + if (MEM_P (base))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1150 + base = XEXP (base, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1151 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1152 + offset = XEXP (addr, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1153 + if (MEM_P (offset))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1154 + offset = XEXP (offset, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1155 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1156 + if ((CONSTANT_ADDRESS_P (base)) && (CONSTANT_ADDRESS_P (offset))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1157 + if (!indirect_flag)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1158 + check_direct_prefix_flag = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1159 + output_addr_const (file, base);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1160 + check_direct_prefix_flag = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1161 + fputs ("+", file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1162 + output_addr_const (file, offset);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1163 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1164 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1165 + else if ((CONSTANT_ADDRESS_P (base)) && (A_REG_P (offset))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1166 + output_addr_const (file, base);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1167 + fprintf (file, ",%s", reg_names[REGNO (offset)]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1168 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1169 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1170 + else if ((CONSTANT_ADDRESS_P (offset)) && (A_REG_P (base))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1171 + output_addr_const (file, offset);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1172 + fprintf (file, ",%s", reg_names[REGNO (base)]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1173 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1174 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1175 + /*** accumulator offset ***/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1176 + else if (((D_REG_P (offset)) || (Q_REG_P (offset)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1177 + && (A_REG_P (base))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1178 + fprintf (file, "%s,%s",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1179 + reg_names[REGNO (offset)], reg_names[REGNO (base)]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1180 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1181 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1182 + else if (((D_REG_P (base)) || (Q_REG_P (base)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1183 + && (A_REG_P (offset))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1184 + fprintf (file, "%s,%s",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1185 + reg_names[REGNO (base)], reg_names[REGNO (offset)]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1186 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1187 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1188 + else if (GET_CODE (base) == PRE_DEC) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1189 + regno = REGNO (XEXP (base, 0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1190 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1191 + fprintf (file, "%s", reg_names[regno]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1192 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1193 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1194 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1195 + abort ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1196 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1197 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1198 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1199 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1200 + /* Set this global before calling output_addr_const() */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1201 + if (!indirect_flag)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1202 + check_direct_prefix_flag = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1203 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1204 + /* When printing a SYMBOL_REF in PIC mode, do not print the leading
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1205 + * '#' and follow it by ',pcr' to enable relative addressing. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1206 + if (flag_pic && pic_ok_for_addr_p && GET_CODE (addr) == SYMBOL_REF)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1207 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1208 + ASM_OUTPUT_SYMBOL_REF (file, addr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1209 + fputs (",pcr", file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1210 + pic_ok_for_addr_p = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1211 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1212 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1213 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1214 + output_addr_const (file, addr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1215 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1216 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1217 + check_direct_prefix_flag = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1218 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1219 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1220 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1221 + if (indirect_flag)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1222 + fprintf (file, "]");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1223 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1224 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1225 +/*-------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1226 + Update the CC Status
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1227 +---------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1228 + Set the cc_status for the results of an insn whose pattern is EXP.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1229 + We assume that jumps don't affect the condition codes.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1230 + All else, clobbers the condition codes, by assumption.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1231 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1232 + We assume that ALL add, minus, etc. instructions effect the condition
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1233 + codes.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1234 +-------------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1235 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1236 +notice_update_cc (rtx exp, rtx insn ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1237 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1238 + int src_code;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1239 + int dst_code;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1240 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1241 + /*** recognize SET insn's ***/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1242 + if (GET_CODE (exp) == SET)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1243 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1244 + src_code = GET_CODE (SET_SRC (exp));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1245 + dst_code = GET_CODE (SET_DEST (exp));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1246 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1247 + /* Jumps do not alter the cc's. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1248 + if (SET_DEST (exp) == pc_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1249 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1250 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1251 + /* Moving one register into another register (tfr):
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1252 + Doesn't alter the cc's. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1253 + if (REG_P (SET_DEST (exp)) && (REG_P (SET_SRC (exp))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1254 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1255 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1256 + /* Moving memory into a register (load): Sets cc's. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1257 + if (REG_P (SET_DEST (exp)) && src_code == MEM) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1258 + cc_status.value1 = SET_SRC (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1259 + cc_status.value2 = SET_DEST (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1260 + cc_status.flags |= CC_NO_OVERFLOW;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1261 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1262 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1263 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1264 + /* Moving register into memory (store): Sets cc's. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1265 + if (dst_code == MEM && REG_P (SET_SRC (exp))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1266 + cc_status.value1 = SET_SRC (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1267 + cc_status.value2 = SET_DEST (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1268 + cc_status.flags |= CC_NO_OVERFLOW;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1269 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1270 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1271 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1272 + /* Function calls clobber the cc's. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1273 + else if (GET_CODE (SET_SRC (exp)) == CALL) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1274 + CC_STATUS_INIT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1275 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1276 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1277 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1278 + /* Tests and compares set the cc's in predictable ways. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1279 + else if (SET_DEST (exp) == cc0_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1280 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1281 + cc_status.flags = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1282 + cc_status.value1 = SET_SRC (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1283 + cc_status.value2 = SET_DEST (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1284 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1285 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1286 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1287 + else if (A_REG_P (SET_DEST (exp)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1288 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1289 + CC_STATUS_INIT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1290 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1291 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1292 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1293 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1294 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1295 + /* Certain instructions affect the condition codes. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1296 + switch (src_code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1297 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1298 + case PLUS:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1299 + case MINUS:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1300 + case NEG:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1301 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1302 + /* These instructions set the condition codes,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1303 + * and may modify the V bit. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1304 + cc_status.flags |= CC_NO_OVERFLOW;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1305 + /* FALLTHRU */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1306 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1307 + case AND:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1308 + case IOR:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1309 + case XOR:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1310 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1311 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1312 + /* These instructions set the condition codes,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1313 + * but cannot overflow (V=0). */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1314 + cc_status.value1 = SET_SRC (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1315 + cc_status.value2 = SET_DEST (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1316 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1317 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1318 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1319 + /* Everything else is clobbered */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1320 + CC_STATUS_INIT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1321 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1322 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1323 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1324 + } /* SET */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1325 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1326 + else if (GET_CODE (exp) == PARALLEL
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1327 + && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1328 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1329 + if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1330 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1331 + if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1332 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1333 + CC_STATUS_INIT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1334 + cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1335 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1336 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1337 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1338 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1339 + /*** default action if we haven't recognized something
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1340 + and returned earlier ***/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1341 + CC_STATUS_INIT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1342 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1343 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1344 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1345 +/** Returns nonzero if the expression EXP can be implemented using one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1346 + * of the 6809's single operand instructions. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1347 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1348 +m6809_single_operand_operator (rtx exp)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1349 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1350 + rtx op1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1351 + HOST_WIDE_INT val;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1352 + enum rtx_code code;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1353 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1354 + debug_rtx(exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1355 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1356 + code = GET_CODE (exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1357 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1358 + /* Unary operators always qualify */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1359 + switch (code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1360 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1361 + case NEG:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1362 + case NOT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1363 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1364 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1365 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1366 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1367 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1368 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1369 + /* Binary operators can only qualify if the second
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1370 + * argument is a CONST_INT of certain value. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1371 + op1 = XEXP (exp, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1372 + if (GET_CODE (op1) != CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1373 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1374 + val = INTVAL (op1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1375 + switch (code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1376 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1377 + case PLUS:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1378 + case MINUS:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1379 + if (val == -1 || val == 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1380 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1381 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1382 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1383 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1384 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1385 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1386 + case ROTATE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1387 + case ROTATERT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1388 + if (val == 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1389 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1390 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1391 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1392 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1393 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1394 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1395 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1396 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1397 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1398 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1399 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1400 +/** Return a bitarray of the hard registers which are used by a function. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1401 +unsigned int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1402 +m6809_get_live_regs (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1403 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1404 + unsigned int regs = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1405 + int regno;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1406 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1407 + if (frame_pointer_needed)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1408 + regs |= (1 << HARD_FRAME_POINTER_REGNUM);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1409 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1410 + for (regno = HARD_X_REGNUM; regno <= HARD_U_REGNUM; regno++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1411 + if (df_regs_ever_live_p (regno) && ! call_used_regs[regno])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1412 + regs |= (1 << regno);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1413 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1414 + return regs;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1415 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1416 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1417 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1418 +/** Return a printable version of a list of hard registers, suitable
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1419 + * for use in a PSHx or PULx insn. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1420 +const char *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1421 +m6809_get_regs_printable (unsigned int regs)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1422 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1423 + static char list[64];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1424 + char *listp = list;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1425 + unsigned int regno;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1426 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1427 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1428 + if ((regs & (1 << regno)) && !S_REGNO_P (regno))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1429 + listp += sprintf (listp,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1430 + (listp == list) ? "%s" : ",%s", reg_names[regno]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1431 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1432 + return list;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1433 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1434 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1435 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1436 +/** Return the total number of bytes covered by a set of hard registers. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1437 +unsigned int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1438 +m6809_get_regs_size (unsigned int regs)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1439 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1440 + unsigned int regno;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1441 + unsigned int size = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1442 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1443 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1444 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1445 + /* Only count register in the given register set */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1446 + if (REGSET_CONTAINS_P (regno, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1447 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1448 + /* Add 1 or 2 byte, depending on the size of the register.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1449 + * Since 'D' may be in both sets, check for WORD_REGSET first. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1450 + if (REGSET_CONTAINS_P(regno, WORD_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1451 + size += 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1452 + else if (REGSET_CONTAINS_P(regno, BYTE_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1453 + size++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1454 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1455 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1456 + return size;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1457 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1458 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1459 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1460 +/* Given the target of call instruction in X,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1461 + * return the tree node that contains the function declaration for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1462 + * that target.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1463 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1464 + * If the rtx or the tree do not appear valid for any reason,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1465 + * then return NULL_TREE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1466 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1467 +static tree call_target_decl (rtx x)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1468 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1469 + tree decl;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1470 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1471 + /* Make sure the target is really a MEM. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1472 + if (!x || !MEM_P (x))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1473 + return NULL_TREE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1474 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1475 + /* Make sure the address is a SYMBOL_REF. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1476 + x = XEXP (x, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1477 + if (!x || (GET_CODE (x) != SYMBOL_REF))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1478 + return NULL_TREE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1479 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1480 + /* Get the declaration of this symbol */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1481 + decl = SYMBOL_REF_DECL (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1482 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1483 + /* Make sure the declaration is really a function. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1484 + if (!decl || (TREE_CODE(decl) != FUNCTION_DECL))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1485 + return NULL_TREE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1486 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1487 + return decl;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1488 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1489 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1490 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1491 +/** Returns nonzero if a function, whose declaration is in DECL,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1492 + * was declared to have the attribute given by ATTR_NAME. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1493 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1494 +m6809_function_has_type_attr_p (tree decl, const char *attr_name)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1495 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1496 + tree type;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1497 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1498 + type = TREE_TYPE (decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1499 + return lookup_attribute (attr_name, TYPE_ATTRIBUTES (type)) != NULL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1500 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1501 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1502 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1503 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1504 +/** Returns nonzero if the current function was declared to have the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1505 + * attribute given by ATTR_NAME. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1506 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1507 +m6809_current_function_has_type_attr_p (const char *attr_name)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1508 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1509 + return m6809_function_has_type_attr_p (current_function_decl, attr_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1510 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1511 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1512 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1513 +/** Return nonzero if the current function has no return value. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1514 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1515 +m6809_current_function_is_void (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1516 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1517 + return (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1518 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1519 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1520 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1521 +/** Get the value of a declaration's 'bank', as set by the 'bank'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1522 + * attribute. If no bank was declared, it returns NULL by default. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1523 +const char *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1524 +m6809_get_decl_bank (tree decl)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1525 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1526 + tree attr;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1527 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1528 + /* Lookup the 'bank' attribute. If it does not exist, then
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1529 + * return NULL */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1530 + attr = lookup_attribute ("bank", DECL_ATTRIBUTES (decl));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1531 + if (attr == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1532 + return NULL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1533 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1534 + /* Make sure it has a value assigned to it */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1535 + attr = TREE_VALUE (attr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1536 + if (attr == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1537 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1538 + warning (WARNING_OPT "banked function did not declare a bank number");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1539 + return NULL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1540 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1541 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1542 + /* Return the bank name */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1543 + attr = TREE_VALUE (attr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1544 + return TREE_STRING_POINTER (attr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1545 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1546 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1547 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1548 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1549 +m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1550 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1551 + /* Check the function declaration for special properties.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1552 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1553 + * If the function was declare with __attribute__((bank)), output
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1554 + * assembler definitions to force the function to go into the named
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1555 + * bank.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1556 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1557 + const char *bank_name = m6809_get_decl_bank (decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1558 + if (bank_name != NULL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1559 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1560 + /* Declare __self_bank as a local assembler value that denotes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1561 + * which bank the current function is in. This is required only
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1562 + * when the bank actually changes. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1563 + if (strcmp (bank_name, current_bank_name))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1564 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1565 + fprintf (asm_out_file, "__self_bank\t.equ %s\n", bank_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1566 + strcpy (current_bank_name, bank_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1567 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1568 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1569 + /* Declare a global assembler value that denotes which bank the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1570 + * named function is in. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1571 + fprintf (asm_out_file, "__%s_bank\t.gblequ %s\n", name, bank_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1572 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1573 + /* Force the current function into a new area */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1574 + fprintf (asm_out_file, "\t.bank bank_%s (FSFX=_%s)\n",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1575 + bank_name, bank_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1576 + fprintf (asm_out_file, "\t.area bank_%s (BANK=bank_%s)\n",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1577 + bank_name, bank_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1578 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1579 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1580 + /* Emit the label for the function's name */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1581 + ASM_OUTPUT_LABEL (asm_out_file, name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1582 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1583 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1584 +#if 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1585 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1586 + * Handle pragmas. Note that only the last branch pragma seen in the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1587 + * source has any affect on code generation.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1588 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1589 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1590 +#define BAD_PRAGMA(msgid, arg) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1591 + do { warning (WARNING_OPT msgid, arg); return -1; } while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1592 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1593 +static int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1594 +pragma_parse (const char *name, tree *sect)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1595 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1596 + tree s, x;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1597 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1598 + if (pragma_lex (&x) != CPP_OPEN_PAREN)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1599 + BAD_PRAGMA ("missing '(' after '#pragma %s' - ignored", name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1600 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1601 + if (pragma_lex (&s) != CPP_STRING)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1602 + BAD_PRAGMA ("missing section name in '#pragma %s' - ignored", name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1603 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1604 + if (pragma_lex (&x) != CPP_CLOSE_PAREN)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1605 + BAD_PRAGMA ("missing ')' for '#pragma %s' - ignored", name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1606 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1607 + if (pragma_lex (&x) != CPP_EOF)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1608 + warning (WARNING_OPT "junk at end of '#pragma %s'", name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1609 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1610 + *sect = s;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1611 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1612 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1613 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1614 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1615 +/*
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1616 + * Handle #pragma section.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1617 + * This is deprecated; code should use __attribute__(section("name"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1618 + * instead.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1619 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1620 +void pragma_section (cpp_reader *pfile ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1621 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1622 + tree sect;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1623 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1624 + if (pragma_parse ("section", &sect))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1625 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1626 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1627 + snprintf (code_section_op, 6+TREE_STRING_LENGTH (sect),
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1628 + ".area\t%s", TREE_STRING_POINTER (sect));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1629 + snprintf (data_section_op, 6+TREE_STRING_LENGTH (sect),
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1630 + ".area\t%s", TREE_STRING_POINTER (sect));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1631 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1632 + /* Mark a flag that sections have changed. Upon emitting another
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1633 + * declaration, the new .area directive will be written. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1634 + section_changed++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1635 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1636 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1637 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1638 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1639 + * Check a `double' value for validity for a particular machine mode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1640 + * Called by the CHECK_FLOAT_VALUE() machine-dependent macro.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1641 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1642 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1643 +check_float_value (enum machine_mode mode, double *d, int overflow)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1644 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1645 + if (mode == SFmode) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1646 + if (*d > 1.7014117331926443e+38) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1647 + error("magnitude of constant too large for `float'");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1648 + *d = 1.7014117331926443e+38;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1649 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1650 + else if (*d < -1.7014117331926443e+38) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1651 + error("magnitude of constant too large for `float'");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1652 + *d = -1.7014117331926443e+38;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1653 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1654 + else if ((*d > 0) && (*d < 2.9387358770557188e-39)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1655 + warning(WARNING_OPT "`float' constant truncated to zero");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1656 + *d = 0.0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1657 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1658 + else if ((*d < 0) && (*d > -2.9387358770557188e-39)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1659 + warning(WARNING_OPT "`float' constant truncated to zero");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1660 + *d = 0.0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1661 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1662 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1663 + return overflow;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1664 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1665 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1666 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1667 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1668 +/** Declare that the target supports named output sections. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1669 +bool m6809_have_named_section = (bool)1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1670 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1671 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1672 +/** Write to the assembler file a directive to place
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1673 + * subsequent objects to a different section in the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1674 + * object file. ASxxxx uses the "area" directive for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1675 + * this purpose. It does not however support generalized
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1676 + * alignment, and can only place items on an odd/even
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1677 + * boundary. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1678 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1679 +m6809_asm_named_section (
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1680 + const char *name,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1681 + unsigned int flags ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1682 + tree decl)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1683 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1684 + fprintf (asm_out_file, "\t.area\t%s\n", name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1685 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1686 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1687 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1688 +enum reg_class
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1689 +m6809_preferred_reload_class (rtx x, enum reg_class regclass)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1690 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1691 + /* Check cases based on type code of rtx */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1692 + switch (GET_CODE(x))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1693 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1694 + /*
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1695 + * Observation, 2015-07-19, William Astle
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1696 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1697 + * The original comparison for range for 16 bits was wrong, adding 0x80
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1698 + * instead of 0x8000. Replaced both 8 bit and 16 bit comparisions with
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1699 + * a more straight forward range comparison - excessive cleverness isn't
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1700 + * really required here.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1701 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1702 + case CONST_INT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1703 + /* Constants that can fit into 1 byte should be
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1704 + * loaded into a Q_REGS reg */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1705 + if ((INTVAL(x) >= -128 && INTVAL(x) <= 127) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1706 +// if (((unsigned) (INTVAL(x) + 0x80) < 0x100) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1707 + (regclass > A_REGS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1708 + return Q_REGS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1709 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1710 + /* 16-bit constants should be loaded into A_REGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1711 + * when possible. gcc may already require A_REGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1712 + * or D_REGS for certain types of instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1713 + * This case applies mostly to simple copy operations
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1714 + * to/from memory when any register will do, but
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1715 + * it's best to avoid using D register since it is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1716 + * needed for other things.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1717 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1718 + else if ((INTVAL(x) >= -32768 && INTVAL(x) <= 32767) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1719 +// else if (((unsigned) (INTVAL(x) + 0x80) < 0x10000) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1720 + (regclass > A_REGS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1721 + return A_REGS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1722 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1723 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1724 + case SYMBOL_REF:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1725 + case LABEL_REF:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1726 + /* Addresses should always be loaded into A_REGS */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1727 + if (regclass >= A_REGS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1728 + return (A_REGS);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1729 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1730 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1731 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1732 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1733 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1734 + /* Check cases based on mode of rtx */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1735 + if ((GET_MODE(x) == QImode) && (regclass != A_REGS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1736 + return Q_REGS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1737 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1738 + /* Default: return whatever class reload suggested */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1739 + return regclass;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1740 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1741 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1742 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1743 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1744 + * Check a new declaration for the "section" attribute.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1745 + * If it exists, and the target section is "direct", then mark
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1746 + * the declaration (in RTL) to indicate special treatment.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1747 + * When the variable is referenced later, we test for this flag
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1748 + * and can emit special asm text to force the assembler to use
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1749 + * short instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1750 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1751 +static void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1752 +m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1753 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1754 + tree attr, id;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1755 + const char *name;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1756 + const char *decl_name;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1757 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1758 + /* We only care about variable declarations, not functions */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1759 + if (TREE_CODE (decl) != VAR_DECL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1760 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1761 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1762 + /* For debugging purposes only; grab the decl's name */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1763 + decl_name = IDENTIFIER_POINTER (DECL_NAME (decl));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1764 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1765 + /* Give up if the decl doesn't have any RTL */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1766 + if (!DECL_RTL (decl))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1767 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1768 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1769 + /* See if it has a section attribute */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1770 + attr = lookup_attribute ("section", DECL_ATTRIBUTES (decl));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1771 + if (!attr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1772 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1773 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1774 + /* See if the section attribute has a value */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1775 + id = TREE_VALUE (TREE_VALUE (attr));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1776 + if (!id)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1777 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1778 + name = TREE_STRING_POINTER (id);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1779 + if (!name)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1780 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1781 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1782 + /* See if the value is 'direct'. If so, mark it. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1783 + if (!strcmp (name, "direct"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1784 + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1785 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1786 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1787 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1788 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1789 + * Output code to perform a complex shift, for which there is no
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1790 + * direct support in the instruction set.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1791 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1792 + * shift1 is an instruction pattern for performing a 1-bit modification.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1793 + * This code wraps that pattern in a loop to perform the shift N times,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1794 + * where N is given by the address register in operands[2].
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1795 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1796 + * To support 16-bit shifts, shift2 can also be provided: it is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1797 + * a second instruction to be included in the loop. 8-bit shift
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1798 + * insns will pass NULL here.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1799 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1800 + * The insn length of shift1/shift2 is assumed to be 1 byte,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1801 + * which works in all of the cases it is needed so far.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1802 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1803 +static void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1804 +m6809_gen_register_shift (
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1805 + rtx *operands,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1806 + const char *shift1,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1807 + const char *shift2 )
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1808 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1809 + char beq_pattern[32];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1810 + char bra_pattern[32];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1811 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1812 + int shiftlen = (shift1 && shift2) ? 2 : 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1813 + int cmplen = (REGNO (operands[2]) == HARD_X_REGNUM) ? 3 : 4;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1814 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1815 + int beq_offset = 2 + shiftlen + 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1816 + int bra_offset = shiftlen + 2 + cmplen + 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1817 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1818 + sprintf (beq_pattern, "beq\t.+%d", beq_offset);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1819 + sprintf (bra_pattern, "bra\t.-%d", bra_offset);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1820 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1821 + output_asm_insn ("pshs\t%2", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1822 + output_asm_insn ("lea%2\t-1,%2", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1823 + output_asm_insn ("cmp%2\t#-1", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1824 + output_asm_insn (beq_pattern, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1825 + if (shift1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1826 + output_asm_insn (shift1, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1827 + if (shift2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1828 + output_asm_insn (shift2, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1829 + output_asm_insn (bra_pattern, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1830 + output_asm_insn ("puls\t%2", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1831 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1832 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1833 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1834 +/** Generate RTL for the upper 8-bits of a 16-bit constant. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1835 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1836 +gen_rtx_const_high (rtx r)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1837 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1838 + unsigned char v = (INTVAL (r) >> 8) & 0xFF;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1839 + signed char s = (signed char)v;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1840 + return gen_int_mode (s, QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1841 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1842 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1843 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1844 +/** Generate RTL for the lower 8-bits of a 16-bit constant. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1845 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1846 +gen_rtx_const_low (rtx r)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1847 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1848 + unsigned char v = INTVAL (r) & 0xFF;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1849 + signed char s = (signed char)v;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1850 + return gen_int_mode (s, QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1851 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1852 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1853 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1854 +/** Generate RTL to allocate/free bytes on the stack.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1855 + * CODE is given as MINUS when allocating and PLUS when freeing,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1856 + * to match the semantics of a downward-growing stack. SIZE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1857 + * is always given as a positive integer.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1858 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1859 +static rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1860 +gen_rtx_stack_adjust (enum rtx_code code, int size)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1861 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1862 + if (size <= 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1863 + return NULL_RTX;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1864 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1865 + if (code == MINUS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1866 + size = -size;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1867 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1868 + return gen_rtx_SET (Pmode, stack_pointer_rtx,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1869 + gen_rtx_PLUS (Pmode, stack_pointer_rtx,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1870 + gen_int_mode (size, HImode)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1871 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1872 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1873 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1874 +/** Generate RTL to push/pop a set of registers. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1875 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1876 +gen_rtx_register_pushpop (int op, int regs)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1877 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1878 + rtx nregs = gen_int_mode (regs, QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1879 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1880 + if (op == UNSPEC_PUSH_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1881 + return gen_register_push (nregs);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1882 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1883 + return gen_register_pop (nregs);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1884 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1885 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1886 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1887 +/* Given a register set REGS, where the bit positions correspond to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1888 + * hard register numbers, return another bitmask that represents the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1889 + * order in which those registers would be pushed/popped.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1890 + * Registers that are pushed first have higher bit positions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1891 + * The pop order is just the reverse bitmask.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1892 + * These values are the same as the bitmasks actually used in the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1893 + * machine instructions. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1894 +static unsigned int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1895 +register_push_order (int regs)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1896 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1897 + unsigned int order = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1898 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1899 + if (REGSET_CONTAINS_P (HARD_PC_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1900 + order |= 0x80;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1901 + if (REGSET_CONTAINS_P (HARD_U_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1902 + order |= 0x40;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1903 + if (REGSET_CONTAINS_P (HARD_Y_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1904 + order |= 0x20;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1905 + if (REGSET_CONTAINS_P (HARD_X_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1906 + order |= 0x10;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1907 + if (REGSET_CONTAINS_P (HARD_DP_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1908 + order |= 0x8;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1909 + if (REGSET_CONTAINS_P (HARD_B_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1910 + order |= 0x4;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1911 + if (REGSET_CONTAINS_P (HARD_A_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1912 + order |= 0x2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1913 + if (REGSET_CONTAINS_P (HARD_CC_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1914 + order |= 0x1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1915 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1916 + if (REGSET_CONTAINS_P (HARD_D_REGNUM, regs))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1917 + order |= (0x4 | 0x2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1918 + return order;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1919 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1920 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1921 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1922 +/* Returns nonzero if two consecutive push or pop instructions,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1923 + * as determined by the OP, can be merged into a single instruction.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1924 + * The first instruction in the sequence pushes/pops REGS1; the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1925 + * second applies to REGS2.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1926 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1927 + * If true, the resulting instruction can use (regs1 | regs2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1928 + * safely.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1929 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1930 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1931 +m6809_can_merge_pushpop_p (int op, int regs1, int regs2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1932 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1933 + /* Register sets must not overlap */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1934 + if (regs1 & regs2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1935 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1936 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1937 + if (op == UNSPEC_PUSH_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1938 + return (register_push_order (regs1) > register_push_order (regs2));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1939 + else if (op == UNSPEC_POP_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1940 + return (register_push_order (regs1) < register_push_order (regs2));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1941 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1942 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1943 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1944 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1945 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1946 +/** Emit instructions for making a library call.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1947 + * MODE is the mode of the operation.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1948 + * NAME is the library function name.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1949 + * OPERANDS is the rtx array provided by the recognizer.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1950 + * COUNT is the number of input operands to the call, and
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1951 + * should be 1 for a unary op or 2 for a binary op.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1952 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1953 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1954 +emit_libcall_insns (enum machine_mode mode,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1955 + const char *name,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1956 + rtx *operands,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1957 + int count)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1958 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1959 + /* Generate an rtx for the call target. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1960 + rtx symbol = gen_rtx_SYMBOL_REF (Pmode, name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1961 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1962 + /* Emit the library call. Slightly different based
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1963 + on the number of operands */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1964 + if (count == 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1965 + emit_library_call (symbol, LCT_NORMAL, mode,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1966 + 2, operands[1], mode, operands[2], mode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1967 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1968 + emit_library_call (symbol, LCT_NORMAL, mode,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1969 + 1, operands[1], mode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1970 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1971 + /* The library call is expected to put its result
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1972 + in LIBCALL_VALUE, so need to copy it into the destination. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1973 + emit_move_insn (operands[0], LIBCALL_VALUE(mode));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1974 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1975 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1976 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1977 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1978 + * A small helper function that writes out a single branch instruction.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1979 + * OPCODE is the short name, e.g. "ble".
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1980 + * OPERANDS has the rtx for the target label.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1981 + * LONG_P is nonzero if we are emitting a long branch, and need to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1982 + * prepend an 'l' to the opcode name.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1983 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1984 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1985 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1986 + char pattern[64];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1987 + sprintf (pattern, "%s%s\t%%l0", long_p ? "l" : "", opcode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1988 + output_asm_insn (pattern, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1989 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1990 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1991 +/**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1992 + * Output a branch/conditional branch insn of the proper
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1993 + * length. code identifies the particular branch insn.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1994 + * operands holds the branch target in operands[0].
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1995 + * length says what the size of this insn should be.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1996 + * Based on the length, we know whether it should be a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1997 + * short (8-bit) or long (16-bit) branch.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1998 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
1999 +const char *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2000 +output_branch_insn (enum rtx_code code, rtx *operands, int length)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2001 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2002 + int shortform;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2003 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2004 + /* Decide whether or not to use the long or short form.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2005 + * Calculate automatically based on insn lengths. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2006 + shortform = ((length > 2) ? 0 : 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2007 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2008 + /* Determine the proper opcode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2009 + * Use the short (2-byte) opcode if the target is within
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2010 + * reach. Otherwise, use jmp (3-byte opcode), unless
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2011 + * compiling with -fpic, in which case we'll need to use
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2012 + * lbra (4-byte opcode).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2013 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2014 + switch (code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2015 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2016 + case LABEL_REF:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2017 + if (shortform)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2018 + output_branch_insn1 ("bra", operands, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2019 + else if (flag_pic)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2020 + output_branch_insn1 ("bra", operands, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2021 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2022 + output_branch_insn1 ("jmp", operands, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2023 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2024 + case EQ:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2025 + output_branch_insn1 ("beq", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2026 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2027 + case NE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2028 + output_branch_insn1 ("bne", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2029 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2030 + case GT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2031 + output_branch_insn1 ("bgt", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2032 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2033 + case GTU:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2034 + output_branch_insn1 ("bhi", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2035 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2036 + case LT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2037 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2038 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2039 + output_branch_insn1 ("bmi", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2040 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2041 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2042 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2043 + output_branch_insn1 ("blt", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2044 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2045 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2046 + case LTU:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2047 + output_branch_insn1 ("blo", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2048 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2049 + case GE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2050 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2051 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2052 + output_branch_insn1 ("bpl", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2053 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2054 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2055 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2056 + output_branch_insn1 ("bge", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2057 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2058 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2059 + case GEU:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2060 + output_branch_insn1 ("bhs", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2061 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2062 + case LE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2063 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2064 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2065 + output_branch_insn1 ("bmi", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2066 + output_branch_insn1 ("beq", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2067 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2068 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2069 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2070 + output_branch_insn1 ("ble", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2071 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2072 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2073 + case LEU:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2074 + output_branch_insn1 ("bls", operands, !shortform);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2075 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2076 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2077 + abort();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2078 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2079 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2080 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2081 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2082 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2083 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2084 +/** Returns the "cost" of an RTL expression.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2085 + * In general, the expression "COSTS_N_INSNS(1)" is used to represent
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2086 + * the cost of a fast 8-bit arithmetic instruction that operates on
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2087 + * a reg/mem or a reg/immed. Other costs are relative to this.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2088 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2089 + * Notes:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2090 + * - The cost of a REG is always zero; this cannot be changed.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2091 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2092 + * - On the 6809, instructions on two registers will nearly always take
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2093 + * longer than those that operate on a register and a constant/memory,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2094 + * because of the way the instruction set is structured.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2095 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2096 + * TODO: multiply HImode by 2 should be done via shifts, instead of add.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2097 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2098 +static bool
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2099 +m6809_rtx_costs (rtx X, int code, int outer_code ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2100 + int *total, bool speed)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2101 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2102 + int has_const_arg = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2103 + HOST_WIDE_INT const_arg;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2104 + enum machine_mode mode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2105 + int nargs = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2106 + rtx op0, op1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2107 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2108 + /* Data RTXs return a value between 0-3, depending on complexity.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2109 + All of these are less than COSTS_N_INSNS(1). */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2110 + switch (code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2111 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2112 + case CC0:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2113 + case PC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2114 + *total = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2115 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2116 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2117 + case CONST_INT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2118 + if (X == const0_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2119 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2120 + *total = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2121 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2122 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2123 + else if ((unsigned) INTVAL (X) < 077)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2124 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2125 + *total = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2126 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2127 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2128 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2129 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2130 + *total = 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2131 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2132 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2133 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2134 + case LABEL_REF: case CONST:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2135 + *total = 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2136 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2137 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2138 + case SYMBOL_REF:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2139 + /* References to memory are made cheaper if they have
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2140 + * the 'direct' mode attribute set */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2141 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2142 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2143 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2144 + case MEM:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2145 + /* See what form of address was given */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2146 + X = XEXP (X, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2147 + switch (GET_CODE (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2148 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2149 + case SYMBOL_REF:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2150 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2151 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2152 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2153 + case CONST_INT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2154 + *total = 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2155 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2156 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2157 + case MEM:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2158 + *total = COSTS_N_INSNS (1) + 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2159 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2160 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2161 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2162 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2163 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2164 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2165 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2166 + case CONST_DOUBLE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2167 + /* TODO : not sure about this value. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2168 + *total = 3;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2169 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2170 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2171 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2172 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2173 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2174 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2175 + /* Decode the rtx */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2176 + mode = GET_MODE (X);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2177 + op0 = XEXP (X, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2178 + op1 = XEXP (X, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2179 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2180 + /* We don't implement anything in SImode or greater. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2181 + if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2182 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2183 + *total = COSTS_N_INSNS (100);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2184 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2185 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2186 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2187 + /* Figure out if there is a constant argument, and its value. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2188 + if (GET_RTX_CLASS (code) == RTX_BIN_ARITH
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2189 + || GET_RTX_CLASS (code) == RTX_COMM_ARITH)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2190 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2191 + nargs = 2;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2192 + if (GET_CODE (op1) == CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2193 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2194 + has_const_arg = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2195 + const_arg = INTVAL (op1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2196 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2197 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2198 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2199 + /* Penalize a reg/reg operation by adding MEMORY_MOVE_COST,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2200 + * Ignore soft registers, since these are really in memory.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2201 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2202 + * TODO: penalize HImode reg/reg for most operations, except maybe
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2203 + * additions since index registers allow for that.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2204 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2205 + * TODO: shifts by constant N do not always require N instructions;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2206 + * some of this can be done cheaper. The number of actual insns can be
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2207 + * predicted well.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2208 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2209 + if (nargs == 2 && REAL_REG_P (op0) && REAL_REG_P (op1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2210 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2211 + *total = MEMORY_MOVE_COST (mode, Q_REGS, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2212 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2213 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2214 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2215 + *total = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2216 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2217 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2218 + /* Operator RTXs are counted as COSTS_N_INSNS(N), where N is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2219 + the estimated number of actual machine instructions needed to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2220 + perform the computation. Some small adjustments are made since
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2221 + some "instructions" are more complex than others. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2222 + switch (code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2223 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2224 + case PLUS: case MINUS: case COMPARE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2225 + /* 6809 handles these natively in QImode, and in HImode as long
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2226 + * as operand 1 is constant. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2227 + if (mode == QImode || (mode == HImode && has_const_arg))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2228 + *total += COSTS_N_INSNS (1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2229 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2230 + *total += COSTS_N_INSNS (GET_MODE_SIZE (mode));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2231 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2232 + /* -1, 0, and 1 can be done using inherent instructions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2233 + * for PLUS and MINUS in QImode, so don't add extra cost. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2234 + if (has_const_arg
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2235 + && (mode == QImode || mode == HImode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2236 + && (const_arg == -1 || const_arg == 0 || const_arg == 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2237 + && (code == PLUS || code == MINUS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2238 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2239 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2240 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2241 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2242 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2243 + case AND: case IOR: case XOR:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2244 + case NEG: case NOT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2245 + /* 6809 handles these natively in QImode, but requires
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2246 + * splitting in HImode. Treat these as 2 insns. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2247 + *total += COSTS_N_INSNS (1) * GET_MODE_SIZE (mode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2248 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2249 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2250 + case ASHIFT: case ASHIFTRT: case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2251 + case ROTATE: case ROTATERT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2252 + /* 6809 can do shift/rotates of a QImode by a constant in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2253 + * 1 insn times the shift count, or in HImode by a constant
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2254 + * by splitting to 2 insns.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2255 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2256 + * Shift by a nonconstant will take significantly longer
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2257 + * than any of these. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2258 + if (has_const_arg)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2259 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2260 + const_arg %= (GET_MODE_SIZE (mode) * 8);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2261 + if (const_arg == 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2262 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2263 + *total += COSTS_N_INSNS(1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2264 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2265 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2266 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2267 + /* HImode shifts greater than 8 get optimized due
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2268 + * to register transfer from b to a; this cuts down the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2269 + * cost. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2270 + if (const_arg >= 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2271 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2272 + *total += COSTS_N_INSNS (1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2273 + const_arg -= 8;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2274 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2275 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2276 + /* The computed cost is 'const_arg' 1-bit shifts, doubled
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2277 + if in HImode, minus the cost of the constant itself which
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2278 + will be added in later but really shouldn't be. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2279 + *total += COSTS_N_INSNS (const_arg) * GET_MODE_SIZE (mode) - 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2280 + return true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2281 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2282 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2283 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2284 + /* It may take up to 7 iterations of about 6-7 real
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2285 + * instructions, so make this expensive. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2286 + *total += COSTS_N_INSNS (50);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2287 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2288 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2289 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2290 + case MULT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2291 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2292 + /* Multiply is cheap when both arguments are 8-bits. They
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2293 + could be QImode, or QImode widened to HImode, or a constant
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2294 + that fits into 8-bits. As long as both operands qualify,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2295 + we can use a single mul instruction.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2296 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2297 + Assume that fast multiply can be used, and change this if we find
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2298 + differently... */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2299 + int ok_for_qihi3 = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2300 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2301 + /* Check the first operand */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2302 + switch (GET_MODE (op0))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2303 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2304 + case QImode:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2305 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2306 + case HImode:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2307 + if (GET_CODE (op0) != SIGN_EXTEND && GET_CODE (op0) != ZERO_EXTEND)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2308 + ok_for_qihi3 = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2309 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2310 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2311 + ok_for_qihi3 = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2312 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2313 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2314 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2315 + /* Likewise, check the second operand. This is where constants may appear. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2316 + switch (GET_MODE (op1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2317 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2318 + case QImode:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2319 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2320 + case HImode:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2321 + if (GET_CODE (op1) != SIGN_EXTEND && GET_CODE (op1) != ZERO_EXTEND)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2322 + ok_for_qihi3 = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2323 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2324 + case VOIDmode:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2325 + if (!CONST_OK_FOR_LETTER_P (const_arg, 'K'))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2326 + ok_for_qihi3 = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2327 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2328 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2329 + ok_for_qihi3 = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2330 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2331 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2332 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2333 + /* Fast multiply takes about 4 times as many cycles as a normal
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2334 + arithmetic operation. Otherwise, it will take an expensive libcall. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2335 + if (ok_for_qihi3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2336 + *total += COSTS_N_INSNS (4);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2337 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2338 + *total = COSTS_N_INSNS (50);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2339 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2340 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2341 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2342 + case DIV: case UDIV: case MOD: case UMOD:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2343 + /* These all require more expensive libcalls. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2344 + *total += COSTS_N_INSNS (100);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2345 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2346 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2347 + /* TODO : TRUNCATE, SIGN_EXTEND, and ZERO_EXTEND */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2348 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2349 + /* These can normally be done with autoincrement, etc., so
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2350 + * don't charge for them. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2351 + case PRE_DEC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2352 + case PRE_INC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2353 + case POST_DEC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2354 + case POST_INC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2355 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2356 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2357 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2358 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2359 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2360 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2361 + /* Always return false, and let the caller gather the costs
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2362 + * of the operands */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2363 + return false;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2364 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2365 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2366 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2367 +static tree
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2368 +m6809_handle_fntype_attribute (tree *node, tree name,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2369 + tree args ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2370 + int flags ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2371 + bool *no_add_attrs)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2372 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2373 + if (TREE_CODE (*node) != FUNCTION_TYPE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2374 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2375 + warning (WARNING_OPT "'%s' only valid for functions",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2376 + IDENTIFIER_POINTER (name));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2377 + *no_add_attrs = TRUE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2378 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2379 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2380 + return NULL_TREE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2381 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2382 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2383 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2384 +static tree
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2385 +m6809_handle_data_type_attribute (tree *node ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2386 + tree name ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2387 + tree args ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2388 + int flags ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2389 + bool *no_add_attrs ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2390 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2391 + return NULL_TREE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2392 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2393 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2394 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2395 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2396 +static tree
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2397 +m6809_handle_default_attribute (tree *node ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2398 + tree name ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2399 + tree args ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2400 + int flags ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2401 + bool *no_add_attrs ATTRIBUTE_UNUSED )
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2402 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2403 + return NULL_TREE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2404 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2405 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2406 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2407 +/* Table of valid machine attributes */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2408 +const struct attribute_spec m6809_attribute_table[] = { /*
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2409 +{ name, min, max, decl, type, fntype, handler } */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2410 +{ "interrupt", 0, 0, false, true, true, m6809_handle_fntype_attribute },
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2411 +{ "naked", 0, 0, false, true, true, m6809_handle_fntype_attribute },
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2412 +{ "far", 0, 1, false, true, true, m6809_handle_fntype_attribute },
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2413 +{ "bank", 0, 1, true, false, false, m6809_handle_default_attribute },
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2414 +{ "boolean", 0, 0, false, true, false, m6809_handle_data_type_attribute },
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2415 +{ NULL, 0, 0, false, true, false, NULL },
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2416 +};
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2417 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2418 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2419 +/** Initialize builtin routines for the 6809. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2420 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2421 +m6809_init_builtins (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2422 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2423 + /* Create type trees for each function signature required.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2424 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2425 + * void_ftype_void = void f(void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2426 + * void_ftype_uchar = void f(unsigned char)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2427 + * uchar_ftype_uchar2 = unsigned char f (unsigned char, unsigned char)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2428 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2429 + tree void_ftype_void =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2430 + build_function_type (void_type_node, void_list_node);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2431 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2432 + tree void_ftype_uchar =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2433 + build_function_type (void_type_node,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2434 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2435 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2436 + tree uchar_ftype_uchar2 =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2437 + build_function_type (unsigned_char_type_node,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2438 + tree_cons (NULL_TREE, unsigned_char_type_node,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2439 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2440 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2441 + /* Register each builtin function. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2442 + add_builtin_function ("__builtin_swi", void_ftype_void,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2443 + M6809_SWI, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2444 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2445 + add_builtin_function ("__builtin_swi2", void_ftype_void,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2446 + M6809_SWI2, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2447 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2448 + add_builtin_function ("__builtin_swi3", void_ftype_void,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2449 + M6809_SWI3, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2450 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2451 + add_builtin_function ("__builtin_cwai", void_ftype_uchar,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2452 + M6809_CWAI, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2453 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2454 + add_builtin_function ("__builtin_sync", void_ftype_void,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2455 + M6809_SYNC, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2456 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2457 + add_builtin_function ("__builtin_nop", void_ftype_void,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2458 + M6809_NOP, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2459 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2460 + add_builtin_function ("__builtin_blockage", void_ftype_void,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2461 + M6809_BLOCKAGE, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2462 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2463 + add_builtin_function ("__builtin_add_decimal", uchar_ftype_uchar2,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2464 + M6809_ADD_DECIMAL, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2465 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2466 + add_builtin_function ("__builtin_add_carry", uchar_ftype_uchar2,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2467 + M6809_ADD_CARRY, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2468 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2469 + add_builtin_function ("__builtin_sub_carry", uchar_ftype_uchar2,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2470 + M6809_SUB_CARRY, BUILT_IN_MD, NULL, NULL_TREE);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2471 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2472 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2473 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2474 +/** Used by m6809_expand_builtin, given a tree ARGLIST which
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2475 + * refers to the operands of a builtin call, return an rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2476 + * that represents the nth operand, as denoted by OPNUM, which
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2477 + * is a zero-based integer. MODE gives the expected mode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2478 + * of the operand.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2479 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2480 + * This rtx is suitable for use in the emitted RTL for the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2481 + * builtin instruction. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2482 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2483 +m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2484 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2485 + tree arg;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2486 + rtx r;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2487 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2488 + arg = CALL_EXPR_ARG (arglist, opnum);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2489 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2490 + /* Convert the tree to RTL */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2491 + r = expand_expr (arg, NULL_RTX, mode, EXPAND_NORMAL);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2492 + if (r == NULL_RTX)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2493 + return NULL_RTX;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2494 + return r;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2495 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2496 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2497 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2498 +/** Expand a builtin that was registered in init_builtins into
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2499 + * RTL. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2500 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2501 +m6809_expand_builtin (tree exp,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2502 + rtx target,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2503 + rtx subtarget ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2504 + enum machine_mode mode ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2505 + int ignore ATTRIBUTE_UNUSED )
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2506 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2507 + tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2508 + tree arglist = exp;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2509 + unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2510 + rtx r0, r1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2511 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2512 + switch (fcode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2513 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2514 + case M6809_SWI:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2515 + r0 = gen_rtx_CONST_INT (VOIDmode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2516 + emit_insn (target = gen_m6809_swi (r0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2517 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2518 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2519 + case M6809_SWI2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2520 + r0 = gen_rtx_CONST_INT (VOIDmode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2521 + emit_insn (target = gen_m6809_swi (r0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2522 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2523 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2524 + case M6809_SWI3:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2525 + r0 = gen_rtx_CONST_INT (VOIDmode, 3);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2526 + emit_insn (target = gen_m6809_swi (r0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2527 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2528 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2529 + case M6809_CWAI:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2530 + r0 = m6809_builtin_operand (arglist, QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2531 + emit_insn (target = gen_m6809_cwai (r0));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2532 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2533 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2534 + case M6809_SYNC:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2535 + emit_insn (target = gen_m6809_sync ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2536 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2537 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2538 + case M6809_ADD_CARRY:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2539 + r0 = m6809_builtin_operand (arglist, QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2540 + r1 = m6809_builtin_operand (arglist, QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2541 + if (!target)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2542 + target = gen_reg_rtx (QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2543 + emit_insn (gen_addqi3_carry (target, r0, r1));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2544 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2545 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2546 + case M6809_SUB_CARRY:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2547 + r0 = m6809_builtin_operand (arglist, QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2548 + r1 = m6809_builtin_operand (arglist, QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2549 + if (!target)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2550 + target = gen_reg_rtx (QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2551 + emit_insn (gen_subqi3_carry (target, r0, r1));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2552 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2553 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2554 + case M6809_NOP:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2555 + emit_insn (target = gen_nop ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2556 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2557 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2558 + case M6809_BLOCKAGE:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2559 + emit_insn (target = gen_blockage ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2560 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2561 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2562 + case M6809_ADD_DECIMAL:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2563 + r0 = m6809_builtin_operand (arglist, QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2564 + r1 = m6809_builtin_operand (arglist, QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2565 + if (!target)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2566 + target = gen_reg_rtx (QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2567 + emit_insn (gen_addqi3_decimal (target, r0, r1));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2568 + return target;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2569 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2570 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2571 + warning (WARNING_OPT "unknown builtin expansion ignored");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2572 + return NULL_RTX;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2573 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2574 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2575 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2576 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2577 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2578 +/* Returns nonzero if 'x' represents a function that was declared
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2579 + * as __noreturn__. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2580 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2581 +noreturn_functionp (rtx x)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2582 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2583 + tree decl = call_target_decl (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2584 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2585 + if (decl == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2586 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2587 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2588 + return TREE_THIS_VOLATILE (decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2589 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2590 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2591 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2592 +const char *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2593 +far_function_type_p (tree type)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2594 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2595 + tree attr;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2596 + const char *page;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2597 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2598 + /* Return whether or not this decl has the far attribute */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2599 + attr = lookup_attribute ("far", TYPE_ATTRIBUTES (type));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2600 + if (attr == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2601 + return NULL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2602 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2603 + /* If it is far, check for a value */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2604 + attr = TREE_VALUE (attr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2605 + if (attr == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2606 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2607 + warning (WARNING_OPT "far code page not specified, using local value");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2608 + return far_code_page;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2609 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2610 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2611 + /* We have a TREE_LIST of attribute values, get the first one.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2612 + * It should be an INTEGER_CST. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2613 + attr = TREE_VALUE (attr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2614 + page = TREE_STRING_POINTER (attr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2615 + return page;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2616 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2617 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2618 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2619 +/* For a far function, returns the identifier that states which page
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2620 + * it resides in. Otherwise, returns NULL for ordinary functions. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2621 +const char *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2622 +far_functionp (rtx x)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2623 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2624 + tree decl, decl_type;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2625 + const char *page;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2626 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2627 + /* Find the FUNCTION_DECL corresponding to the rtx being called. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2628 + decl = call_target_decl (x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2629 + if (decl == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2630 + return NULL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2631 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2632 + /* See if the function has the new 'banked' attribute. These
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2633 + * are numeric instead of text */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2634 + page = m6809_get_decl_bank (decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2635 + if (page)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2636 + return page;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2637 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2638 + /* No, lookup the type of the function and see if the type
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2639 + * specifies far or not. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2640 + decl_type = TREE_TYPE (decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2641 + if (decl_type == NULL_TREE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2642 + return NULL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2643 + return far_function_type_p (decl_type);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2644 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2645 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2646 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2647 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2648 +/** Outputs the assembly language for a far call. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2649 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2650 +output_far_call_insn (rtx *operands, int has_return)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2651 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2652 + static char page_data[64];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2653 + const char *called_page;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2654 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2655 + /* The logic is the same for functions whether or not there
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2656 + * is a return value. Skip over the return value in this
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2657 + * case, so that the call location is always operands[0]. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2658 + if (has_return)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2659 + operands++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2660 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2661 + /* Get the name of the page being called */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2662 + called_page = far_functionp (operands[0]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2663 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2664 +#if 0 /* TODO : broken logic */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2665 + /* See if the called page name is a 'bank' */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2666 + if (isdigit (*called_page))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2667 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2668 + /* New style banking */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2669 + if (!strcmp (called_page, current_bank_name))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2670 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2671 + /* Same page */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2672 + output_asm_insn ("jsr\t%0", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2673 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2674 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2675 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2676 + /* Different page */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2677 + output_asm_insn ("jsr\t__far_call_handler\t;new style", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2678 + output_asm_insn ("\t.dw\t%0", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2679 + sprintf (page_data, "\t.db\t%s", called_page);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2680 + output_asm_insn (page_data, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2681 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2682 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2683 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2684 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2685 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2686 + /* Are we calling a different page than we are running in? */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2687 + if (!strcmp (called_page, far_code_page))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2688 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2689 + /* Same page : no need to execute a far call */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2690 + if (flag_pic)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2691 + output_asm_insn ("lbsr\t%C0", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2692 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2693 + output_asm_insn ("jsr\t%0", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2694 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2695 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2696 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2697 + /* Different page : need to emit far call thunk */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2698 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2699 + /* First output a call to the thunk for making far calls. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2700 + if (flag_pic)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2701 + output_asm_insn ("lbsr\t__far_call_handler", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2702 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2703 + output_asm_insn ("jsr\t__far_call_handler\t;old style", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2704 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2705 + /* Now output the name of the call site */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2706 + output_asm_insn ("\t.dw\t%C0", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2707 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2708 + /* Finally output the page number */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2709 + sprintf (page_data, "\t.db\t%s", far_functionp (operands[0]));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2710 + output_asm_insn (page_data, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2711 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2712 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2713 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2714 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2715 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2716 +m6809_init_cumulative_args (CUMULATIVE_ARGS cum ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2717 + tree fntype,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2718 + rtx libname ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2719 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2720 + cum = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2721 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2722 + /* For far functions, the current implementation does not allow for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2723 + * stack parameters. So note whenever the called function is far
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2724 + * and in a different page than the current one; such a function
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2725 + * should give an error if a stack parameter is generated. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2726 + if (fntype)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2727 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2728 + const char *called_page = far_function_type_p (fntype);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2729 + if (called_page && strcmp (called_page, far_code_page) && !TARGET_FAR_STACK_PARAM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2730 + cum |= CUM_STACK_INVALID;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2731 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2732 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2733 + if (fntype && TYPE_ARG_TYPES (fntype) != 0 &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2734 + (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) != void_type_node))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2735 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2736 + /* has variable arguments, cannot use registers */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2737 + cum |= (CUM_X_MASK | CUM_B_MASK | CUM_STACK_ONLY);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2738 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2739 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2740 + if (m6809_abi_version == M6809_ABI_VERSION_STACK)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2741 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2742 + /* cannot use registers ; only use the stack */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2743 + cum |= (CUM_STACK_ONLY | CUM_X_MASK | CUM_B_MASK);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2744 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2745 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2746 + return cum;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2747 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2748 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2749 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2750 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2751 +m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2752 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2753 + if (*cump & CUM_STACK_INVALID)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2754 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2755 + *cump &= ~CUM_STACK_INVALID;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2756 + error ("far function needs stack, will not work");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2757 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2758 + return NULL_RTX;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2759 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2760 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2761 +void m6809_asm_trampoline_template(FILE *f)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2762 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2763 + fprintf(f, "ldy #0000\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2764 + fprintf(f, "jmp 0x0000\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2765 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2766 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2767 +/*
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2768 + * Trampoline output:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2769 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2770 + * ldu #&cxt 4 bytes --LDY- ?? ??
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2771 + * jmp fnaddr 3 bytes JMP ?? ??
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2772 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2773 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2774 +m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2775 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2776 + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2777 + /* TODO - optimize by generating the entire trampoline code here,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2778 + * and removing the template altogether, since there are only two
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2779 + * bytes there that matter. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2780 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 2)), cxt);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2781 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 5)), fnaddr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2782 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2783 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2784 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2785 +/** Echo the version of the compiler and the name of the source file
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2786 + * at the beginning of each assembler output file. asm_out_file
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2787 + * is a global FILE * pointing to the output stream. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2788 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2789 +m6809_asm_file_start (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2790 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2791 + const char *module_name;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2792 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2793 + fprintf (asm_out_file, "\n;;; gcc for m6809 : %s %s\n",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2794 + __DATE__, __TIME__);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2795 + fprintf (asm_out_file, ";;; %s\n", version_string);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2796 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2797 + fprintf (asm_out_file, ";;; ABI version %d\n", m6809_abi_version);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2798 + fprintf (asm_out_file, ";;; %s\n",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2799 + (TARGET_BYTE_INT ? "-mint8" : "-mint16"));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2800 + if (TARGET_EXPERIMENT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2801 + fprintf (asm_out_file, ";;; -mexperiment\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2802 + if (TARGET_WPC)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2803 + fprintf (asm_out_file, ";;; -mwpc\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2804 + if (TARGET_6309)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2805 + fprintf (asm_out_file, ";;; -m6309\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2806 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2807 + /* Print the name of the module, which is taken as the base name
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2808 + * of the input file.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2809 + * See the 'User-Defined Symbols' section of the assembler
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2810 + * documentation for the rules on valid symbols.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2811 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2812 + module_name = lbasename (main_input_filename);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2813 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2814 + fprintf (asm_out_file, "\t.module\t");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2815 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2816 + if (*module_name >= '0' && *module_name <= '9')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2817 + fprintf (asm_out_file, "_");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2818 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2819 + while (*module_name)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2820 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2821 + if ((*module_name >= '0' && *module_name <= '9')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2822 + || (*module_name >= 'A' && *module_name <= 'Z')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2823 + || (*module_name >= 'a' && *module_name <= 'z')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2824 + || *module_name == '$'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2825 + || *module_name == '.'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2826 + || *module_name == '_')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2827 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2828 + fprintf (asm_out_file, "%c", *module_name);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2829 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2830 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2831 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2832 + fprintf (asm_out_file, "_");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2833 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2834 + module_name++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2835 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2836 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2837 + fprintf (asm_out_file, "\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2838 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2839 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2840 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2841 +/** Returns true if prologue/epilogue code is required for the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2842 + * current function being compiled.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2843 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2844 + * This is just the inverse of whether the function is declared as
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2845 + * 'naked'.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2846 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2847 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2848 +prologue_epilogue_required (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2849 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2850 + return !m6809_current_function_has_type_attr_p ("naked")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2851 + && !m6809_current_function_has_type_attr_p ("noreturn");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2852 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2853 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2854 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2855 +/** Expand RTL for function entry */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2856 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2857 +emit_prologue_insns (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2858 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2859 + rtx insn;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2860 + unsigned int live_regs = m6809_get_live_regs ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2861 + unsigned int frame_size = get_frame_size ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2862 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2863 + /* Save all registers used, including the frame pointer */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2864 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2865 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2866 + insn = emit_insn (
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2867 + gen_rtx_register_pushpop (UNSPEC_PUSH_RS, live_regs));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2868 + RTX_FRAME_RELATED_P (insn) = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2869 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2870 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2871 + /* Allocate space for local variables */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2872 + if (frame_size != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2873 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2874 + insn = emit_insn (gen_rtx_stack_adjust (MINUS, frame_size));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2875 + RTX_FRAME_RELATED_P (insn) = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2876 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2877 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2878 + /* Set the frame pointer if it is needed */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2879 + if (frame_pointer_needed)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2880 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2881 + insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2882 + RTX_FRAME_RELATED_P (insn) = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2883 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2884 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2885 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2886 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2887 +/** Expand RTL for function exit */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2888 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2889 +emit_epilogue_insns (bool sibcall_p)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2890 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2891 + unsigned int live_regs = m6809_get_live_regs ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2892 + unsigned int frame_size = get_frame_size ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2893 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2894 + if (frame_size != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2895 + emit_insn (gen_rtx_stack_adjust (PLUS, frame_size));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2896 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2897 + if (sibcall_p)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2898 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2899 + if (live_regs)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2900 + emit_insn (gen_rtx_register_pushpop (UNSPEC_POP_RS, live_regs));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2901 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2902 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2903 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2904 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2905 + emit_insn (
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2906 + gen_rtx_register_pushpop (UNSPEC_POP_RS, PC_REGBIT | live_regs));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2907 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2908 + if (m6809_current_function_has_type_attr_p ("interrupt"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2909 + emit_jump_insn (gen_return_rti ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2910 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2911 + emit_jump_insn (gen_return_rts ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2912 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2913 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2914 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2915 +#if 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2916 +/** Predefine some preprocessor names according to the currently
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2917 + * selected compiler options */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2918 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2919 +m6809_cpu_cpp_builtins (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2920 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2921 + if (TARGET_6309)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2922 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2923 + builtin_define_std ("__M6309__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2924 + builtin_define_std ("__m6309__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2925 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2926 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2927 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2928 + builtin_define_std ("__M6809__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2929 + builtin_define_std ("__m6809__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2930 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2931 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2932 + if (TARGET_BYTE_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2933 + builtin_define_std ("__int8__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2934 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2935 + builtin_define_std ("__int16__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2936 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2937 + switch (m6809_abi_version)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2938 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2939 + case M6809_ABI_VERSION_STACK:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2940 + builtin_define_std ("__regargs__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2941 + builtin_define_std ("__ABI_STACK__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2942 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2943 + case M6809_ABI_VERSION_REGS:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2944 + builtin_define_std ("__ABI_REGS__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2945 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2946 + case M6809_ABI_VERSION_BX:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2947 + builtin_define_std ("__ABI_BX__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2948 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2949 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2950 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2951 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2952 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2953 + if (TARGET_WPC)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2954 + builtin_define_std ("__WPC__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2955 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2956 + if (TARGET_DRET)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2957 + builtin_define_std ("__DRET__");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2958 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2959 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2960 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2961 +#define MAX_ASM_ASCII_STRING 48
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2962 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2963 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2964 +m6809_output_ascii (FILE *fp, const char *str, unsigned long size)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2965 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2966 + unsigned long i;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2967 + bool use_ascii = true;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2968 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2969 + /* If the size is too large, then break this up into multiple
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2970 + outputs. The assembler can only output roughly 48 bytes at a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2971 + time. Note that if there are lots of escape sequences in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2972 + the string, this may fail. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2973 + if (size > MAX_ASM_ASCII_STRING)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2974 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2975 + m6809_output_ascii (fp, str, MAX_ASM_ASCII_STRING);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2976 + m6809_output_ascii (fp, str + MAX_ASM_ASCII_STRING,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2977 + size - MAX_ASM_ASCII_STRING);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2978 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2979 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2980 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2981 + /* Check for 8-bit codes, which cannot be embedded in an .ascii */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2982 + for (i = 0; i < size; i++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2983 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2984 + int c = str[i] & 0377;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2985 + if (c >= 0x80)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2986 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2987 + use_ascii = false;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2988 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2989 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2990 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2991 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2992 + if (use_ascii)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2993 + fprintf (fp, "\t.ascii \"");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2994 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2995 + for (i = 0; i < size; i++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2996 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2997 + int c = str[i] & 0377;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2998 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
2999 + if (use_ascii)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3000 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3001 + /* Just output the plain character if it is printable,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3002 + otherwise output the escape code for the character.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3003 + The assembler recognizes the same C-style octal escape sequences,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3004 + except that it only supports 7-bit codes. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3005 + if (c >= ' ' && c < 0177 && c != '\\' && c != '"')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3006 + putc (c, fp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3007 + else switch (c)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3008 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3009 + case '\n':
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3010 +#ifndef TARGET_COCO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3011 + fputs ("\\n", fp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3012 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3013 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3014 + /* On the CoCo, we fallthrough and treat '\n' like '\r'. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3015 + case '\r':
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3016 + fputs ("\\r", fp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3017 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3018 + case '\t':
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3019 + fputs ("\\t", fp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3020 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3021 + case '\f':
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3022 + fputs ("\\f", fp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3023 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3024 + case 0:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3025 + fputs ("\\0", fp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3026 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3027 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3028 + fprintf (fp, "\\%03o", c);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3029 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3030 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3031 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3032 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3033 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3034 + fprintf (fp, "\t.byte\t0x%02X\n", c);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3035 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3036 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3037 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3038 + if (use_ascii)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3039 + fprintf (fp, "\"\n");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3040 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3041 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3042 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3043 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3044 +m6809_output_quoted_string (FILE *asm_file, const char *string)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3045 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3046 + char c;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3047 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3048 + if (strlen (string) > MAX_ASM_ASCII_STRING)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3049 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3050 + /* The string length is too large. We'll have to truncate it.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3051 + This is only called from debugging functions, so it's usually
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3052 + not critical. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3053 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3054 + char truncated_string[MAX_ASM_ASCII_STRING+1];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3055 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3056 + /* Copy as many characters as we can. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3057 + strncpy (truncated_string, string, MAX_ASM_ASCII_STRING);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3058 + truncated_string[MAX_ASM_ASCII_STRING] = '\0';
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3059 + string = truncated_string;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3060 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3061 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3062 + /* Copied from toplev.c */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3063 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3064 + putc ('\"', asm_file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3065 + while ((c = *string++) != 0) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3066 + if (ISPRINT (c)) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3067 + if (c == '\"' || c == '\\')
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3068 + putc ('\\', asm_file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3069 + putc (c, asm_file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3070 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3071 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3072 + fprintf (asm_file, "\\%03o", (unsigned char) c);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3073 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3074 + putc ('\"', asm_file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3075 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3076 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3077 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3078 +/** Output the assembly code for a shift instruction where the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3079 + * shift count is not constant. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3080 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3081 +m6809_output_shift_insn (int rtx_code, rtx *operands)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3082 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3083 + struct shift_opcode *op;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3084 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3085 + if (GET_CODE (operands[2]) == CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3086 + abort ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3087 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3088 + if (optimize_size && GET_MODE (operands[0]) == HImode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3089 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3090 + switch (rtx_code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3091 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3092 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3093 + output_asm_insn ("jsr\t_ashlhi3", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3094 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3095 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3096 + output_asm_insn ("jsr\t_ashrhi3", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3097 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3098 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3099 + output_asm_insn ("jsr\t_lshrhi3", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3100 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3101 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3102 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3103 + else if (GET_MODE (operands[0]) == HImode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3104 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3105 + switch (rtx_code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3106 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3107 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3108 + m6809_gen_register_shift (operands, "aslb", "rola");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3109 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3110 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3111 + m6809_gen_register_shift (operands, "asra", "rorb");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3112 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3113 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3114 + m6809_gen_register_shift (operands, "lsra", "rorb");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3115 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3116 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3117 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3118 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3119 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3120 + switch (rtx_code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3121 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3122 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3123 + m6809_gen_register_shift (operands, "aslb", NULL);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3124 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3125 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3126 + m6809_gen_register_shift (operands, "asrb", NULL);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3127 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3128 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3129 + m6809_gen_register_shift (operands, "lsrb", NULL);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3130 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3131 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3132 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3133 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3134 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3135 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3136 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3137 +m6809_emit_move_insn (rtx dst, rtx src)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3138 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3139 + emit_insn (gen_rtx_SET (VOIDmode, dst, src));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3140 + if (ACC_A_REG_P (dst))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3141 + emit_insn (gen_rtx_USE (VOIDmode, dst));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3142 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3143 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3144 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3145 +/** Split a complex shift instruction into multiple CPU
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3146 + * shift instructions. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3147 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3148 +m6809_split_shift (enum rtx_code code, rtx *operands)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3149 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3150 + enum machine_mode mode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3151 + int count;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3152 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3153 + mode = GET_MODE (operands[0]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3154 + count = INTVAL (operands[2]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3155 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3156 + /* Handle a shift count outside the range of 0 .. N-1, where
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3157 + * N is the mode size in bits. We normalize the count, and
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3158 + * for negative counts we also invert the direction of the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3159 + * shift. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3160 + if ((count < 0) || (count >= 8 * GET_MODE_SIZE (mode)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3161 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3162 + if (count < 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3163 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3164 + count = -count;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3165 + code = (code == ASHIFT) ? ASHIFTRT : ASHIFT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3166 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3167 + count %= (8 * GET_MODE_SIZE (mode));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3168 + m6809_emit_move_insn (operands[0],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3169 + gen_rtx_fmt_ee (code, mode, operands[1],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3170 + gen_rtx_CONST_INT (VOIDmode, count)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3171 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3172 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3173 + /* Handle shift by zero explicitly as a no-op. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3174 + if (count == 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3175 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3176 + emit_insn (gen_nop ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3177 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3178 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3179 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3180 + /* Decompose the shift by a constant N > 8 into two
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3181 + * shifts, first by 8 and then by N-8.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3182 + * This "speeds up" the process for large shifts that would be
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3183 + * handled below, but allows for some optimization.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3184 + * In some cases shift by 8 can be implemented fast. If an
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3185 + * instruction to shift by 8 is defined, it will be used here;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3186 + * otherwise it will be further decomposed as below. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3187 + if (mode == HImode && count > 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3188 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3189 + rtx output = operands[0];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3190 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3191 + m6809_emit_move_insn (operands[0],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3192 + gen_rtx_fmt_ee (code, mode, operands[1],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3193 + gen_rtx_CONST_INT (VOIDmode, 8)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3194 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3195 + /* Unsigned shifts always produce a zero in either the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3196 + * upper or lower half of the output; then, that part
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3197 + * does not need to be shifted anymore. We modify the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3198 + * output and the subsequent instructions to operate in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3199 + * QImode only on the relevant part. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3200 + if (REG_P (output))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3201 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3202 + if (code == ASHIFT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3203 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3204 + output = gen_rtx_REG (QImode, HARD_A_REGNUM);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3205 + mode = QImode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3206 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3207 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3208 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3209 + output = gen_rtx_REG (QImode, HARD_D_REGNUM);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3210 + mode = QImode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3211 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3212 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3213 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3214 + m6809_emit_move_insn (output,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3215 + gen_rtx_fmt_ee (code, mode, copy_rtx (output),
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3216 + gen_rtx_CONST_INT (VOIDmode, count-8)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3217 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3218 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3219 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3220 + /* Rewrite the unsigned shift of an 8-bit register by a large constant N
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3221 + * (near to the maximum of 8) as a rotate and mask. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3222 + if (mode == QImode && REG_P (operands[0]) && count >= ((code == ASHIFTRT) ? 7 : 6))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3223 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3224 + unsigned int mask;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3225 + unsigned int was_signed = (code == ASHIFTRT);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3226 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3227 + code = (code == ASHIFT) ? ROTATERT : ROTATE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3228 + if (code == ROTATE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3229 + mask = (count == 6) ? 0x03 : 0x01;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3230 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3231 + mask = (count == 6) ? 0xC0 - 0x100 : 0x80 - 0x100;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3232 + count = 9 - count;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3233 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3234 + do {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3235 + m6809_emit_move_insn (operands[0],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3236 + gen_rtx_fmt_ee (code, QImode, operands[1], const1_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3237 + } while (--count != 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3238 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3239 + m6809_emit_move_insn (operands[0],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3240 + gen_rtx_fmt_ee (AND, QImode, operands[1],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3241 + gen_rtx_CONST_INT (VOIDmode, mask)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3242 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3243 + if (was_signed)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3244 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3245 + emit_insn (gen_negqi2 (operands[0], copy_rtx (operands[0])));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3246 + if (ACC_A_REG_P (operands[0]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3247 + emit_insn (gen_rtx_USE (VOIDmode, operands[0]));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3248 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3249 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3250 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3251 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3252 + /* Decompose the shift by any constant N > 1 into a sequence
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3253 + * of N shifts.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3254 + * This is done recursively, by creating a shift by 1 and a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3255 + * shift by N-1, as long as N>1. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3256 + if (count > 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3257 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3258 + m6809_emit_move_insn (operands[0],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3259 + gen_rtx_fmt_ee (code, mode, operands[1], const1_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3260 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3261 + m6809_emit_move_insn (operands[0],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3262 + gen_rtx_fmt_ee (code, mode, operands[1],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3263 + gen_rtx_CONST_INT (VOIDmode, count-1)));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3264 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3265 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3266 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3267 + /* Decompose the single shift of a 16-bit quantity into two
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3268 + * CPU instructions, one for each 8-bit half.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3269 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3270 + if (mode == HImode && count == 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3271 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3272 + rtx first, second;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3273 + enum rtx_code rotate_code;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3274 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3275 + rotate_code = (code == ASHIFT) ? ROTATE : ROTATERT;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3276 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3277 + /* Split the operand into two 8-bit entities.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3278 + * FIRST is the one that will get shifted via a regular CPU
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3279 + * instruction.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3280 + * SECOND is the one that will have the result of the first shift
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3281 + * rotated in.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3282 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3283 + * We initialize first and second as if we are doing a left shift,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3284 + * then swap the operands if it's a right shift.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3285 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3286 + if (REG_P (operands[0]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3287 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3288 + first = gen_rtx_REG (QImode, HARD_D_REGNUM); /* HARD_B_REGNUM? */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3289 + second = gen_rtx_REG (QImode, HARD_A_REGNUM);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3290 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3291 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3292 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3293 + first = adjust_address (operands[0], QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3294 + second = adjust_address (operands[0], QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3295 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3296 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3297 + if (rotate_code == ROTATERT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3298 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3299 + rtx tmp; tmp = first; first = second; second = tmp;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3300 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3301 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3302 + /* Decompose into a shift and a rotate instruction. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3303 + m6809_emit_move_insn (first,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3304 + gen_rtx_fmt_ee (code, QImode, copy_rtx (first), const1_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3305 + m6809_emit_move_insn (second,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3306 + gen_rtx_fmt_ee (rotate_code, QImode, copy_rtx (second), const1_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3307 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3308 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3309 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3310 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3311 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3312 +/** Adjust register usage based on compile-time flags. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3313 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3314 +m6809_conditional_register_usage (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3315 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3316 + unsigned int soft_regno;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3317 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3318 +#ifdef CONFIG_SOFT_REGS_ALWAYS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3319 + m6809_soft_regs = CONFIG_SOFT_REGS_ALWAYS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3320 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3321 + if (!m6809_soft_reg_count)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3322 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3323 + m6809_soft_regs = atoi (m6809_soft_reg_count);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3324 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3325 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3326 + if (m6809_soft_regs == 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3327 + return;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3328 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3329 + if (m6809_soft_regs > NUM_M_REGS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3330 + m6809_soft_regs = NUM_M_REGS;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3331 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3332 + /* Registers are marked FIXED by default. Free up if
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3333 + the user wishes. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3334 + for (soft_regno = 1; soft_regno < m6809_soft_regs; soft_regno++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3335 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3336 + fixed_regs[SOFT_M0_REGNUM + soft_regno] = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3337 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3338 + /* Mark the softregs as call-clobbered, so that they need
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3339 + * not be saved/restored on function entry/exit. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3340 + call_used_regs[SOFT_M0_REGNUM + soft_regno] = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3341 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3342 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3343 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3344 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3345 +/** Return a RTX representing how to return a value from a function.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3346 + VALTYPE gives the type of the value, FUNC identifies the function
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3347 + itself.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3348 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3349 + In general, we only care about the width of the result. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3350 +rtx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3351 +m6809_function_value (const tree valtype, const tree func ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3352 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3353 + unsigned int regno;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3354 + enum machine_mode mode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3355 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3356 + /* Get the mode (i.e. width) of the result. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3357 + mode = TYPE_MODE (valtype);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3358 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3359 + if (lookup_attribute ("boolean", TYPE_ATTRIBUTES (valtype)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3360 + regno = HARD_Z_REGNUM;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3361 + else if (mode == QImode || (TARGET_DRET && mode == HImode))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3362 + regno = HARD_D_REGNUM;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3363 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3364 + regno = HARD_X_REGNUM;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3365 + return gen_rtx_REG (mode, regno);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3366 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3367 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3368 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3369 +/** Return 1 if REGNO is possibly needed to return the result
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3370 +of a function, 0 otherwise. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3371 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3372 +m6809_function_value_regno_p (unsigned int regno)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3373 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3374 + if (regno == HARD_Z_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3375 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3376 + else if ((TARGET_BYTE_INT || TARGET_DRET) && regno == HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3377 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3378 + else if (!TARGET_DRET && regno == HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3379 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3380 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3381 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3382 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3383 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3384 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3385 +#ifdef TRACE_PEEPHOLE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3386 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3387 +m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3388 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3389 + if (stage == PEEP_END)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3390 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3391 + printf ("%s: peephole %d pattern and predicate matched\n",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3392 + main_input_filename, peephole_id);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3393 + fflush (stdout);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3394 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3395 + else if (stage == PEEP_COND)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3396 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3397 + printf ("%s: peephole %d? at least pattern matched\n",
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3398 + main_input_filename, peephole_id);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3399 + fflush (stdout);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3400 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3401 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3402 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3403 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3404 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3405 +m6809_match_peephole2 (unsigned int peephole_id ATTRIBUTE_UNUSED,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3406 + unsigned int stage ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3407 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3408 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3409 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3410 +#endif /* TRACE_PEEPHOLE */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3411 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3412 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3413 +/** Return 1 if it is OK to store a value of MODE in REGNO. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3414 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3415 +m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3416 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3417 + /* Soft registers, as they are just memory, can really hold
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3418 + values of any type. However we restrict them to values of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3419 + size HImode or QImode to prevent exhausting them for larger
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3420 + values.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3421 + Word values cannot be placed into the first soft register,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3422 + as it is the low byte that is being placed there, which
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3423 + corrupts the (non-soft) register before it. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3424 + if (M_REGNO_P (regno))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3425 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3426 + switch (GET_MODE_SIZE (mode))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3427 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3428 + case 1:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3429 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3430 + case 2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3431 + return regno != SOFT_M0_REGNUM;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3432 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3433 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3434 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3435 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3436 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3437 + /* VOIDmode can be stored anywhere */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3438 + else if (mode == VOIDmode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3439 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3440 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3441 + /* Zero is a reserved register, but problems occur if we don't
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3442 + say yes here??? */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3443 + else if (regno == 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3444 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3445 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3446 + /* For other registers, return true only if the requested size
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3447 + exactly matches the hardware size. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3448 + else if ((G_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 2))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3449 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3450 + else if ((BYTE_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3451 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3452 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3453 + return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3454 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3455 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3456 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3457 +/* exp is the call expression. DECL is the called function,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3458 + * or NULL for an indirect call */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3459 +bool
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3460 +m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3461 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3462 + tree type, arg;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3463 + const char *name;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3464 + bool result = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3465 + int argcount = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3466 + int step = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3467 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3468 + /* If there is no DECL, it is an indirect call.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3469 + * Never optimize this??? */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3470 + if (decl == NULL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3471 + goto done;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3472 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3473 + /* Never allow an interrupt handler to be optimized this way. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3474 + if (m6809_function_has_type_attr_p (decl, "interrupt"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3475 + goto done;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3476 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3477 + /* Skip sibcall if the type can't be found for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3478 + * some reason */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3479 + step++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3480 + name = IDENTIFIER_POINTER (DECL_NAME (decl));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3481 + type = TREE_TYPE (decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3482 + if (type == NULL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3483 + goto done;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3484 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3485 + /* Skip sibcall if the target is a far function */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3486 + step++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3487 + if (far_function_type_p (type) != NULL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3488 + goto done;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3489 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3490 + /* Skip sibcall if the called function's arguments are
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3491 + * variable */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3492 + step++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3493 + if (TYPE_ARG_TYPES (type) == NULL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3494 + goto done;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3495 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3496 + /* Allow sibcalls in other cases. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3497 + result = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3498 +done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3499 + /* printf ("%s ok for sibcall? %s, step %d, args %d\n", name, result ? "yes" : "no", step, argcount); */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3500 + return result;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3501 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3502 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3503 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3504 +/** Emit code for the 'casesi' pattern.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3505 + * This pattern is only used in 8-bit mode, and can be disabled
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3506 + * with -mold-case there as well. The rationale for this is to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3507 + * do a better job than the simpler but well-tested 'tablejump'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3508 + * method.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3509 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3510 + * For small jumptables, where the switch expression is an
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3511 + * 8-bit value, the lookup can be done more efficiently
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3512 + * using the "B,X" style index mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3513 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3514 +m6809_do_casesi (rtx index, rtx lower_bound, rtx range,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3515 + rtx table_label, rtx default_label)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3516 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3517 + enum machine_mode mode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3518 + rtx scaled;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3519 + rtx table_in_reg;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3520 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3521 + /* expr.c has to be patched so that it does not promote
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3522 + * the expression to SImode, but rather to HImode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3523 + * Fail now if that isn't the case. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3524 + if (GET_MODE_SIZE (GET_MODE (index)) > GET_MODE_SIZE (HImode))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3525 + error ("try_casesi promotion bug");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3526 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3527 + /* Determine whether or not we are going to work primarily in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3528 + * QImode or HImode. This depends on the size of the index
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3529 + * into the lookup table. QImode can only be used when the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3530 + * index is less than 0x40, since it will be doubled but
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3531 + * must remain unsigned. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3532 + if ((GET_CODE (range) == CONST_INT) && (INTVAL (range) < 0x40))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3533 + mode = QImode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3534 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3535 + mode = HImode;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3536 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3537 + /* Convert to QImode if necessary */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3538 + if (mode == QImode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3539 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3540 + index = gen_lowpart_general (mode, index);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3541 + lower_bound = gen_lowpart_general (mode, lower_bound);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3542 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3543 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3544 + /* Translate from case value to table index by subtraction */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3545 + if (lower_bound != const0_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3546 + index = expand_binop (mode, sub_optab, index, lower_bound,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3547 + NULL_RTX, 0, OPTAB_LIB_WIDEN);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3548 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3549 + /* Emit compare-and-jump to test for index out-of-range */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3550 + emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3551 + default_label);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3552 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3553 + /* Put the table address is in a register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3554 + table_in_reg = gen_reg_rtx (Pmode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3555 + emit_move_insn (table_in_reg, gen_rtx_LABEL_REF (Pmode, table_label));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3556 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3557 + /* Emit table lookup and jump */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3558 + if (mode == QImode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3559 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3560 + /* Scale the index */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3561 + scaled = gen_reg_rtx (QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3562 + emit_insn (gen_ashlqi3 (scaled, index, const1_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3563 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3564 + /* Emit the jump */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3565 + emit_jump_insn (gen_tablejump_short_offset (scaled, table_in_reg));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3566 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3567 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3568 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3569 + /* Scale the index */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3570 + emit_insn (gen_ashlhi3 (index, index, const1_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3571 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3572 + /* Emit the jump */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3573 + emit_jump_insn (gen_tablejump_long_offset (index, table_in_reg));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3574 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3575 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3576 + /* Copied from expr.c */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3577 + if (!CASE_VECTOR_PC_RELATIVE && !flag_pic)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3578 + emit_barrier ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3579 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3580 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3581 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3582 +/** Output the assembly code for a 32-bit add/subtract. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3583 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3584 +m6809_output_addsi3 (int rtx_code, rtx *operands)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3585 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3586 + rtx xoperands[8];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3587 + rtx dst = operands[0];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3588 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3589 + /* Prepare the operands by splitting each SImode into two HImodes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3590 + that can be operated independently. The high word of operand 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3591 + is further divided into two QImode components for use with 'adc'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3592 + style instructions. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3593 + xoperands[7] = operands[3];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3594 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3595 + xoperands[0] = adjust_address (dst, HImode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3596 + xoperands[3] = adjust_address (dst, HImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3597 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3598 +#if 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3599 + xoperands[2] = adjust_address (operands[1], HImode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3600 + xoperands[6] = adjust_address (operands[1], HImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3601 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3602 + /* Operand 2 may be a MEM or a CONST_INT */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3603 + if (GET_CODE (operands[2]) == CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3604 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3605 + xoperands[1] = gen_int_mode (INTVAL (operands[2]) & 0xFFFF, HImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3606 + xoperands[4] = gen_int_mode ((INTVAL (operands[2]) >> 24) & 0xFF, QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3607 + xoperands[5] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFF, QImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3608 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3609 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3610 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3611 + xoperands[1] = adjust_address (operands[2], HImode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3612 + xoperands[4] = adjust_address (operands[2], QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3613 + xoperands[5] = adjust_address (operands[2], QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3614 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3615 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3616 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3617 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3618 +#if 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3619 + xoperands[1] = adjust_address (operands[1], HImode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3620 + xoperands[4] = adjust_address (operands[1], QImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3621 + xoperands[5] = adjust_address (operands[1], QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3622 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3623 + /* Operand 2 may be a MEM or a CONST_INT */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3624 + if (GET_CODE (operands[2]) == CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3625 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3626 + xoperands[2] = gen_int_mode ((INTVAL (operands[2])) & 0xFFFF, HImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3627 + xoperands[6] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFFFF, HImode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3628 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3629 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3630 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3631 + xoperands[2] = adjust_address (operands[2], HImode, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3632 + xoperands[6] = adjust_address (operands[2], HImode, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3633 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3634 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3635 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3636 + /* Output the assembly code. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3637 + if (rtx_code == PLUS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3638 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3639 + output_asm_insn ("ld%7\t%2", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3640 + output_asm_insn ("add%7\t%1", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3641 + output_asm_insn ("st%7\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3642 + output_asm_insn ("ld%7\t%6", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3643 + output_asm_insn ("adcb\t%5", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3644 + output_asm_insn ("adca\t%4", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3645 + output_asm_insn ("st%7\t%3", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3646 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3647 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3648 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3649 + output_asm_insn ("ld%7\t%2", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3650 + output_asm_insn ("sub%7\t%1", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3651 + output_asm_insn ("st%7\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3652 + output_asm_insn ("ld%7\t%6", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3653 + output_asm_insn ("sbcb\t%5", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3654 + output_asm_insn ("sbca\t%4", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3655 + output_asm_insn ("st%7\t%3", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3656 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3657 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3658 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3659 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3660 +#if 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3661 +/** Output the assembly code for a 32-bit shift.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3662 +Operands 0 and 1 must be the same rtx, forced by a matching
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3663 +constraint. Operand 2 must be a CONST_INT. Operand 3 is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3664 +"d" in case a temporary reg is needed. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3665 +void
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3666 +m6809_output_shiftsi3 (int rtx_code, rtx *operands)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3667 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3668 + unsigned int count = INTVAL (operands[2]) % 32;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3669 + unsigned int size = 4; /* sizeof (SImode) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3670 + int s;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3671 + rtx xoperands[4];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3672 + int op;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3673 + int start, end, step;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3674 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3675 + /* Initialize */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3676 + if (rtx_code == ASHIFT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3677 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3678 + start = size-1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3679 + end = -1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3680 + step = -1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3681 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3682 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3683 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3684 + start = 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3685 + end = size;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3686 + step = 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3687 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3688 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3689 + xoperands[2] = operands[2];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3690 + xoperands[3] = operands[3];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3691 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3692 + if (count <= 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3693 + abort ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3694 + if (rtx_code == ROTATE || rtx_code == ROTATERT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3695 + abort ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3696 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3697 + /* Extract bit shifts over 16 bits by HImode moves. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3698 + if (count >= 16)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3699 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3700 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3701 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3702 + /* Extract bit shifts over 8 bits by QImode moves. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3703 + if (count >= 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3704 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3705 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3706 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3707 + /* Iterate over the number of bits to be shifted. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3708 + while (count > 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3709 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3710 + /* Each bit to be shifted requires 1 proper bit shift
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3711 + and 3 rotates. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3712 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3713 + /* First, do the arithmetic/logical shift. Left shifts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3714 + start from the LSB; right shifts start from the MSB. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3715 + xoperands[0] = adjust_address (operands[0], QImode, start);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3716 + switch (rtx_code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3717 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3718 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3719 + output_asm_insn ("asl\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3720 + start--;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3721 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3722 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3723 + output_asm_insn ("asr\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3724 + start++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3725 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3726 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3727 + output_asm_insn ("lsr\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3728 + start++;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3729 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3730 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3731 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3732 + /* Next, rotate the other bytes */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3733 + for (s = start; s != end; s += step)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3734 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3735 + xoperands[0] = adjust_address (operands[0], QImode, s);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3736 + switch (rtx_code)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3737 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3738 + case ASHIFT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3739 + output_asm_insn ("rol\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3740 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3741 + case ASHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3742 + case LSHIFTRT:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3743 + output_asm_insn ("ror\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3744 + break;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3745 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3746 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3747 + count--;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3748 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3749 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3750 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3751 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3752 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3753 +power_of_two_p (unsigned int n)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3754 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3755 + return (n & (n-1)) == 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3756 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3757 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3758 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3759 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3760 +m6809_can_eliminate (int from, int to)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3761 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3762 + if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3763 + return !frame_pointer_needed;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3764 + return 1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3765 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3766 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3767 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3768 +int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3769 +m6809_initial_elimination_offset (int from, int to)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3770 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3771 + switch (from)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3772 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3773 + case ARG_POINTER_REGNUM:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3774 + return get_frame_size () + m6809_get_regs_size (m6809_get_live_regs ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3775 + case FRAME_POINTER_REGNUM:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3776 + return get_frame_size ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3777 + default:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3778 + gcc_unreachable ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3779 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3780 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3781 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3782 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3783 +bool
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3784 +m6809_frame_pointer_required (void)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3785 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3786 + return false;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3787 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3788 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3789 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3790 +/* Defines the target-specific hooks structure. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3791 +struct gcc_target targetm = TARGET_INITIALIZER;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3792 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.h gcc-4.6.4/gcc/config/m6809/m6809.h
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3793 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.h 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3794 +++ gcc-4.6.4/gcc/config/m6809/m6809.h 2017-11-28 21:17:43.127091341 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3795 @@ -0,0 +1,1336 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3796 +/* Definitions of target machine for GNU compiler. MC6809 version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3797 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3798 + MC6809 Version by Tom Jones (jones@sal.wisc.edu)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3799 + Space Astronomy Laboratory
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3800 + University of Wisconsin at Madison
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3801 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3802 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3803 + ( msdoerfe@informatik.uni-erlangen.de )
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3804 + also added #pragma interrupt (inspired by gcc-6811)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3805 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3806 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3807 + (ebotcazou@multimania.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3808 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3809 + minor changes to adapt it to egcs-1.1.2 by Eric Botcazou
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3810 + (ebotcazou@multimania.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3811 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3812 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3813 + (ebotcazou@multimania.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3814 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3815 + changes for gcc-3.1.1 by ???
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3816 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3817 + further changes for gcc-3.1.1 and beyond by Brian Dominy
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3818 + (brian@oddchange.com)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3819 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3820 + even more changes for gcc-4.6.1 by William Astle (lost@l-w.ca)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3821 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3822 +This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3823 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3824 +GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3825 +it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3826 +the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3827 +any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3828 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3829 +GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3830 +but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3831 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3832 +GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3833 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3834 +You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3835 +along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3836 +<http://www.gnu.org/licenses/>. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3837 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3838 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3839 +/* Helper macros for creating strings with macros */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3840 +#define C_STRING(x) C_STR(x)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3841 +#define C_STR(x) #x
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3842 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3843 +/* Certain parts of GCC include host-side includes, which is bad.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3844 + * Some things that get pulled in need to be undone.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3845 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3846 +#undef HAVE_GAS_HIDDEN
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3847 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3848 +/* Names to predefine in the preprocessor for this target machine. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3849 +/*#define TARGET_CPU_CPP_BUILTINS() m6809_cpu_cpp_builtins () */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3850 +#define TARGET_CPU_CPP_BUILTINS() do \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3851 + { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3852 + if (TARGET_6309) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3853 + { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3854 + builtin_define_std ("__M6309__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3855 + builtin_define_std ("__m6309__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3856 + } \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3857 + else \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3858 + { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3859 + builtin_define_std ("__M6809__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3860 + builtin_define_std ("__m6809__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3861 + } \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3862 + \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3863 + if (TARGET_BYTE_INT) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3864 + builtin_define_std ("__int8__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3865 + else \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3866 + builtin_define_std ("__int16__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3867 + \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3868 + switch (m6809_abi_version) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3869 + { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3870 + case M6809_ABI_VERSION_STACK: \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3871 + builtin_define_std ("__regargs__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3872 + builtin_define_std ("__ABI_STACK__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3873 + break; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3874 + case M6809_ABI_VERSION_REGS: \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3875 + builtin_define_std ("__ABI_REGS__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3876 + break; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3877 + case M6809_ABI_VERSION_BX: \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3878 + builtin_define_std ("__ABI_BX__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3879 + break; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3880 + default: \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3881 + break; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3882 + } \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3883 + \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3884 + if (TARGET_WPC) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3885 + builtin_define_std ("__WPC__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3886 + \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3887 + if (TARGET_DRET) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3888 + builtin_define_std ("__DRET__"); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3889 + } while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3890 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3891 +/* As an embedded target, we have no libc. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3892 +#ifndef inhibit_libc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3893 +#define inhibit_libc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3894 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3895 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3896 +/* Print subsidiary information on the compiler version in use. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3897 +#define TARGET_VERSION fprintf (stderr, " (MC6809)");
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3898 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3899 +/* Run-time compilation parameters selecting different hardware subsets. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3900 +/*extern int target_flags; */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3901 +extern short *reg_renumber; /* def in local_alloc.c */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3902 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3903 +/* Runtime current values of section names */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3904 +extern int section_changed;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3905 +extern char code_section_op[], data_section_op[], bss_section_op[];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3906 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3907 +#define WARNING_OPT 0,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3908 +/*extern const char *m6809_abi_version_ptr; */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3909 +extern unsigned int m6809_soft_regs;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3910 +extern unsigned int m6809_abi_version;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3911 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3912 +/* ABI versions */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3913 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3914 +#define M6809_ABI_VERSION_STACK 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3915 +#define M6809_ABI_VERSION_REGS 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3916 +#define M6809_ABI_VERSION_BX 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3917 +#define M6809_ABI_VERSION_LATEST (M6809_ABI_VERSION_BX)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3918 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3919 +/* Allow $ in identifiers */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3920 +#define DOLLARS_IN_IDENTIFIERS 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3921 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3922 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3923 + Target machine storage layout
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3924 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3925 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3926 +/* Define this if most significant bit is lowest numbered
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3927 + in instructions that operate on numbered bit-fields. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3928 +#define BITS_BIG_ENDIAN 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3929 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3930 +/* Define to 1 if most significant byte of a word is the lowest numbered. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3931 +#define BYTES_BIG_ENDIAN 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3932 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3933 +/* Define to 1 if most significant word of a multiword value is the lowest numbered. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3934 +#define WORDS_BIG_ENDIAN 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3935 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3936 +/* Number of bits in an addressible storage unit */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3937 +#define BITS_PER_UNIT 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3938 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3939 +/* Width in bits of a "word", or the contents of a machine register.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3940 + * Although the 6809 has a few byte registers, define this to 16-bits
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3941 + * since this is the natural size of most registers. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3942 +#define BITS_PER_WORD 16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3943 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3944 +/* Width of a word, in units (bytes). */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3945 +#define UNITS_PER_WORD (BITS_PER_WORD/8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3946 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3947 +/* Width in bits of a pointer. See also the macro `Pmode' defined below. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3948 +#define POINTER_SIZE 16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3949 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3950 +/* Allocation boundary (bits) for storing pointers in memory. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3951 +#define POINTER_BOUNDARY 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3952 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3953 +/* Allocation boundary (bits) for storing arguments in argument list. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3954 +/* PARM_BOUNDARY is divided by BITS_PER_WORD in expr.c -- tej */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3955 +#define PARM_BOUNDARY 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3956 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3957 +/* Boundary (bits) on which stack pointer should be aligned. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3958 +#define STACK_BOUNDARY 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3959 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3960 +/* Allocation boundary (bits) for the code of a function. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3961 +#define FUNCTION_BOUNDARY 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3962 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3963 +/* Alignment of field after `int : 0' in a structure. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3964 +#define EMPTY_FIELD_BOUNDARY 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3965 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3966 +/* Every structure's size must be a multiple of this. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3967 +#define STRUCTURE_SIZE_BOUNDARY 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3968 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3969 +/* Largest mode size to use when putting an object, including
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3970 + * a structure, into a register. By limiting this to 16, no
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3971 + * 32-bit objects will ever be allocated to a pair of hard
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3972 + * registers. This is a good thing, since there aren't that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3973 + * many of them. 32-bit objects are only needed for floats
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3974 + * and "long long"s. Larger values have been tried and did not
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3975 + * work. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3976 +#define MAX_FIXED_MODE_SIZE 16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3977 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3978 +/* No data type wants to be aligned rounder than this. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3979 +#define BIGGEST_ALIGNMENT 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3980 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3981 +/* Define this if move instructions will actually fail to work
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3982 + when given unaligned data. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3983 +#define STRICT_ALIGNMENT 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3984 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3985 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3986 + Standard register usage.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3987 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3988 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3989 +/* Register values as bitmasks.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3990 + * TODO : merge D_REGBIT and B_REGBIT, and treat this as the same
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3991 + * register. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3992 +#define RSVD1_REGBIT (1 << HARD_RSVD1_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3993 +#define D_REGBIT (1 << HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3994 +#define X_REGBIT (1 << HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3995 +#define Y_REGBIT (1 << HARD_Y_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3996 +#define U_REGBIT (1 << HARD_U_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3997 +#define S_REGBIT (1 << HARD_S_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3998 +#define PC_REGBIT (1 << HARD_PC_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
3999 +#define Z_REGBIT (1 << HARD_Z_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4000 +#define A_REGBIT (1 << HARD_A_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4001 +#define B_REGBIT (1 << HARD_B_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4002 +#define CC_REGBIT (1 << HARD_CC_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4003 +#define DP_REGBIT (1 << HARD_DP_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4004 +#define SOFT_FP_REGBIT (1 << SOFT_FP_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4005 +#define SOFT_AP_REGBIT (1 << SOFT_AP_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4006 +#define M_REGBIT(n) (1 << (SOFT_M0_REGNUM + n))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4007 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4008 +/* Macros for dealing with set of registers.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4009 + * A register set is just a bitwise-OR of all the register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4010 + * bitmask values. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4011 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4012 +/* Which registers can hold 8-bits */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4013 +#define BYTE_REGSET \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4014 + (Z_REGBIT | A_REGBIT | D_REGBIT | CC_REGBIT | DP_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4015 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4016 +/* Which registers can hold 16-bits.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4017 + * Note: D_REGBIT is defined as both an 8-bit and 16-bit register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4018 +#define WORD_REGSET \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4019 + (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT | SOFT_FP_REGBIT | SOFT_AP_REGBIT | RSVD1_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4020 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4021 +/* Returns nonzero if a given REGNO is in the REGSET. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4022 +#define REGSET_CONTAINS_P(regno, regset) (((1 << (regno)) & (regset)) != 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4023 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4024 +/* Defines related to the number of soft registers supported.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4025 + * The actual number used may be less depending on -msoft-reg-count.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4026 + * If you change one of these, you should change them all. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4027 +#define NUM_M_REGS 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4028 +#define M_REGS_FIXED 1, 1, 1, 1, 1, 1, 1, 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4029 +#define M_REGS_CALL_USED 1, 1, 1, 1, 1, 1, 1, 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4030 +#define HARD_M_REGNUMS \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4031 + SOFT_M0_REGNUM+0, SOFT_M0_REGNUM+1, SOFT_M0_REGNUM+2, SOFT_M0_REGNUM+3, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4032 + SOFT_M0_REGNUM+4, SOFT_M0_REGNUM+5, SOFT_M0_REGNUM+6, SOFT_M0_REGNUM+7
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4033 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4034 +#define SOFT_M_REGBITS (((1UL << NUM_M_REGS) - 1) << (SOFT_M0_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4035 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4036 +/* Number of actual hardware registers.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4037 + The hardware registers are assigned numbers for the compiler
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4038 + from 0 to just below FIRST_PSEUDO_REGISTER.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4039 + All registers that the compiler knows about must be given numbers,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4040 + even those that are not normally considered general registers.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4041 + Make sure the constant below matches the value of SOFT_M0_REGNUM;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4042 + for some reason, GCC won't compile if that name is used here directly. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4043 +#ifdef SOFT_M0_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4044 +#if (SOFT_M0_REGNUM != 14)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4045 +#error "bad register numbering"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4046 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4047 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4048 +#define FIRST_PSEUDO_REGISTER (14 + NUM_M_REGS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4049 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4050 +/* 1 for registers that have pervasive standard uses
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4051 + and are not available for the register allocator.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4052 + The psuedoregisters (M_REGS) are declared fixed here, but
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4053 + will be unfixed if -msoft-reg-count is seen later. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4054 +#define FIXED_REGISTERS \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4055 + {1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, M_REGS_FIXED, }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4056 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4057 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4058 +/* 1 for registers not available across function calls.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4059 + These must include the FIXED_REGISTERS and also any
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4060 + registers that can be used without being saved.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4061 + The latter must include the registers where values are returned
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4062 + and the register where structure-value addresses are passed.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4063 + Aside from that, you can include as many other registers as you like. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4064 +#define CALL_USED_REGISTERS \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4065 + {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, M_REGS_CALL_USED, }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4066 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4067 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4068 +/* Return number of consecutive hard regs needed starting at reg REGNO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4069 + to hold something of mode MODE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4070 + For the 6809, we distinguish between word-length and byte-length
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4071 + registers. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4072 +#define HARD_REGNO_NREGS(REGNO, MODE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4073 + (REGSET_CONTAINS_P (REGNO, WORD_REGSET) ? \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4074 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4075 + (GET_MODE_SIZE (MODE)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4076 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4077 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4078 +/* Value is 1 if hard register REGNO can hold a value
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4079 +of machine-mode MODE. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4080 +#define HARD_REGNO_MODE_OK(REGNO, MODE) m6809_hard_regno_mode_ok (REGNO, MODE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4081 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4082 +/* Value is 1 if it is a good idea to tie two pseudo registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4083 + when one has mode MODE1 and one has mode MODE2.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4084 + If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4085 + for any hard reg, then this must be 0 for correct output. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4086 +#define MODES_TIEABLE_P(MODE1, MODE2) 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4087 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4088 +/* Specify the registers used for certain standard purposes.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4089 + The values of these macros are register numbers. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4090 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4091 +/* program counter if referenced as a register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4092 +#define PC_REGNUM HARD_PC_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4093 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4094 +/* Register to use for pushing function arguments. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4095 +#define STACK_POINTER_REGNUM HARD_S_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4096 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4097 +/* Base register for access to local variables of the function.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4098 + * Before reload, FRAME_POINTER_REGNUM will be used. Later,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4099 + * the elimination pass will convert these to STACK_POINTER_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4100 + * if possible, or else HARD_FRAME_POINTER_REGNUM. The idea is to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4101 + * avoid tying up a hard register (U) for the frame pointer if
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4102 + * it can be eliminated entirely, making it available for use as
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4103 + * a general register. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4104 +#define FRAME_POINTER_REGNUM SOFT_FP_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4105 +#define HARD_FRAME_POINTER_REGNUM HARD_U_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4106 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4107 +/* Define a table of possible eliminations.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4108 + * The idea is to try to avoid using hard registers for the argument
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4109 + * and frame pointers if they can be derived from the stack pointer
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4110 + * instead, which already has a hard register reserved for it.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4111 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4112 + * The order of entries in this table will try to convert
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4113 + * ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM into stack pointer
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4114 + * references first, but if that fails, they will be converted to use
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4115 + * HARD_FRAME_POINTER_REGNUM.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4116 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4117 +#define ELIMINABLE_REGS \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4118 +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4119 + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4120 + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4121 + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4122 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4123 +/* #define CAN_ELIMINATE(FROM, TO) m6809_can_eliminate (FROM, TO) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4124 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4125 +/* Define how to offset the frame or argument pointer to turn it
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4126 + * into a stack pointer reference. This is based on the way that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4127 + * the frame is constructed in the function prologue. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4128 +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4129 + (OFFSET) = m6809_initial_elimination_offset (FROM, TO)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4130 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4131 +/* Base register for access to arguments of the function.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4132 + * This is only used prior to reload; no instructions will ever
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4133 + * be output referring to this register. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4134 +#define ARG_POINTER_REGNUM SOFT_AP_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4135 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4136 +/* Register in which static-chain is passed to a function. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4137 +#define STATIC_CHAIN_REGNUM HARD_Y_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4138 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4139 +/* #define CONDITIONAL_REGISTER_USAGE (m6809_conditional_register_usage ()) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4140 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4141 +/* Order in which hard registers are allocated to pseudos.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4142 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4143 + * Since the D register is the only valid reg for 8-bit values
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4144 + * now, avoid using it for 16-bit values by putting it after all
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4145 + * other 16-bits.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4146 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4147 + * Prefer X first since the first 16-bit function argument goes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4148 + * there. We may be able to pass in to a subroutine without
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4149 + * a copy.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4150 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4151 + * Prefer U over Y since instructions using Y take one extra
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4152 + * byte, and thus one extra cycle to execute.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4153 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4154 +#define REG_ALLOC_ORDER \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4155 + { HARD_X_REGNUM, HARD_U_REGNUM, HARD_Y_REGNUM, HARD_D_REGNUM, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4156 + HARD_M_REGNUMS, HARD_S_REGNUM, HARD_PC_REGNUM, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4157 + HARD_B_REGNUM, HARD_A_REGNUM, HARD_CC_REGNUM, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4158 + HARD_DP_REGNUM, SOFT_FP_REGNUM, SOFT_AP_REGNUM, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4159 + 6, HARD_Z_REGNUM }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4160 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4161 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4162 + classes of registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4163 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4164 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4165 +/* Define the classes of registers for register constraints in the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4166 + machine description. Also define ranges of constants.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4167 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4168 + One of the classes must always be named ALL_REGS and include all hard regs.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4169 + If there is more than one class, another class must be named NO_REGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4170 + and contain no registers.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4171 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4172 + The name GENERAL_REGS must be the name of a class (or an alias for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4173 + another name such as ALL_REGS). This is the class of registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4174 + that is allowed by "g" or "r" in a register constraint.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4175 + Also, registers outside this class are allocated only when
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4176 + instructions express preferences for them.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4177 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4178 + The classes must be numbered in nondecreasing order; that is,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4179 + a larger-numbered class must never be contained completely
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4180 + in a smaller-numbered class.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4181 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4182 + For any two classes, it is very desirable that there be another
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4183 + class that represents their union. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4184 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4185 +enum reg_class {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4186 + NO_REGS, /* The trivial class with no registers in it */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4187 + D_REGS, /* 16-bit (word (HI)) data (D) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4188 + ACC_A_REGS, /* The A register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4189 + ACC_B_REGS, /* The B register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4190 + X_REGS, /* The X register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4191 + Z_REGS, /* The Z (zero-bit) register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4192 + Q_REGS, /* 8-bit (byte (QI)) data (A,B) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4193 + M_REGS, /* 8-bit (byte (QI)) soft registers */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4194 + CC_REGS, /* 8-bit condition code register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4195 + I_REGS, /* An index register (A,B,D) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4196 + T_REGS, /* 16-bit addresses, not including stack or PC (X,Y,U) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4197 + A_REGS, /* 16-bit addresses (X,Y,U,S,PC) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4198 + S_REGS, /* 16-bit soft registers (FP, AP) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4199 + P_REGS, /* 16-bit pushable registers (D,X,Y,U); omit PC and S */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4200 + G_REGS, /* 16-bit data and address (D,X,Y,U,S,PC) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4201 + ALL_REGS, /* All registers */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4202 + LIM_REG_CLASSES
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4203 +};
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4204 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4205 +#define N_REG_CLASSES (int) LIM_REG_CLASSES
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4206 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4207 +/* Since GENERAL_REGS is a smaller class than ALL_REGS,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4208 + it is not an alias to ALL_REGS, but to G_REGS. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4209 +#define GENERAL_REGS G_REGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4210 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4211 +/* Give names of register classes as strings for dump file. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4212 +#define REG_CLASS_NAMES \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4213 + { "NO_REGS", "D_REGS", "ACC_A_REGS", "ACC_B_REGS", "X_REGS", "Z_REGS", "Q_REGS", "M_REGS", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4214 + "CC_REGS", "I_REGS", "T_REGS", "A_REGS", "S_REGS", "P_REGS", "G_REGS", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4215 + "ALL_REGS" }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4216 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4217 +/* Define which registers fit in which classes.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4218 + This is an initializer for a vector of HARD_REG_SET
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4219 + of length N_REG_CLASSES. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4220 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4221 +#define D_REGSET (D_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4222 +#define ACC_A_REGSET (A_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4223 +#define ACC_B_REGSET (D_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4224 +#define X_REGSET (X_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4225 +#define Z_REGSET (Z_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4226 +#define Q_REGSET (D_REGBIT | A_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4227 +#define M_REGSET (SOFT_M_REGBITS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4228 +#define CC_REGSET (CC_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4229 +#define I_REGSET (A_REGBIT | B_REGBIT | D_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4230 +#define T_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4231 +#define A_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4232 +#define S_REGSET (SOFT_FP_REGBIT | SOFT_AP_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4233 +#define P_REGSET (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4234 +#define G_REGSET \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4235 + (D_REGSET | Q_REGSET | I_REGSET | A_REGSET | M_REGSET | S_REGSET)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4236 +#define ALL_REGSET (G_REGSET)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4237 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4238 +#define REG_CLASS_CONTENTS { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4239 + {0}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4240 + {D_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4241 + {ACC_A_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4242 + {ACC_B_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4243 + {X_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4244 + {Z_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4245 + {Q_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4246 + {M_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4247 + {CC_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4248 + {I_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4249 + {T_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4250 + {A_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4251 + {S_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4252 + {P_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4253 + {G_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4254 + {ALL_REGSET}, \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4255 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4256 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4257 +/* The same information, inverted.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4258 + * This is defined to use the REG_CLASS_CONTENTS defines above, so that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4259 + * these two sets of definitions are always consistent. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4260 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4261 +#define REGNO_REG_CLASS(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4262 + (D_REGNO_P (REGNO) ? D_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4263 + (Z_REGNO_P (REGNO) ? Z_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4264 + (ACC_A_REGNO_P (REGNO) ? ACC_A_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4265 + (ACC_B_REGNO_P (REGNO) ? ACC_B_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4266 + (X_REGNO_P (REGNO) ? X_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4267 + (Q_REGNO_P (REGNO) ? Q_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4268 + (M_REGNO_P (REGNO) ? M_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4269 + (CC_REGNO_P (REGNO) ? CC_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4270 + (I_REGNO_P (REGNO) ? I_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4271 + (T_REGNO_P (REGNO) ? T_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4272 + (A_REGNO_P (REGNO) ? A_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4273 + (S_REGNO_P (REGNO) ? S_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4274 + (P_REGNO_P (REGNO) ? P_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4275 + (G_REGNO_P (REGNO) ? G_REGS : ALL_REGS))))))))))))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4276 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4277 +#define D_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, D_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4278 +#define ACC_A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_A_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4279 +#define ACC_B_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_B_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4280 +#define X_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, X_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4281 +#define Z_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Z_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4282 +#define Q_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Q_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4283 +#define M_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, M_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4284 +#define CC_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, CC_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4285 +#define I_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, I_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4286 +#define T_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, T_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4287 +#define A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, A_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4288 +#define S_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, S_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4289 +#define P_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, P_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4290 +#define G_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, G_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4291 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4292 +/* Macros that test an rtx 'X' to see if it's in a particular
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4293 + * register class. 'X' need not be a REG necessarily. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4294 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4295 +#define D_REG_P(X) (REG_P (X) && D_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4296 +#define ACC_A_REG_P(X) (REG_P (X) && ACC_A_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4297 +#define ACC_B_REG_P(X) (REG_P (X) && ACC_B_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4298 +#define X_REG_P(X) (REG_P (X) && X_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4299 +#define Z_REG_P(X) (REG_P (X) && Z_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4300 +#define I_REG_P(X) (REG_P (X) && I_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4301 +#define T_REG_P(X) (REG_P (X) && T_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4302 +#define A_REG_P(X) (REG_P (X) && A_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4303 +#define S_REG_P(X) (REG_P (X) && S_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4304 +#define P_REG_P(X) (REG_P (X) && P_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4305 +#define Q_REG_P(X) (REG_P (X) && Q_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4306 +#define M_REG_P(X) (REG_P (X) && M_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4307 +#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4308 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4309 +/* Redefine this in terms of BYTE_REGSET */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4310 +#define BYTE_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, BYTE_REGSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4311 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4312 +/* The class value for index registers, and the one for base regs. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4313 +#define INDEX_REG_CLASS I_REGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4314 +#define BASE_REG_CLASS A_REGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4315 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4316 +/* Get reg_class from a letter in the machine description. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4317 +#define REG_CLASS_FROM_LETTER(C) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4318 + (((C) == 'a' ? A_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4319 + ((C) == 'd' ? D_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4320 + ((C) == 'x' ? I_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4321 + ((C) == 't' ? M_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4322 + ((C) == 'c' ? CC_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4323 + ((C) == 'A' ? ACC_A_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4324 + ((C) == 'B' ? ACC_B_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4325 + ((C) == 'v' ? X_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4326 + ((C) == 'u' ? S_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4327 + ((C) == 'U' ? P_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4328 + ((C) == 'T' ? T_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4329 + ((C) == 'z' ? Z_REGS : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4330 + ((C) == 'q' ? Q_REGS : NO_REGS))))))))))))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4331 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4332 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4333 + The letters I through O in a register constraint string
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4334 + can be used to stand for particular ranges of immediate operands.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4335 + This macro defines what the ranges are.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4336 + C is the letter, and VALUE is a constant value.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4337 + Return 1 if VALUE is in the range specified by C.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4338 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4339 + For the 6809, J, K, L are used for indexed addressing.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4340 + `I' is used for the constant 1.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4341 + `J' is used for the 5-bit offsets.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4342 + `K' is used for the 8-bit offsets.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4343 + `L' is used for the range of signed numbers that fit in 16 bits.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4344 + `M' is used for the exact value '8'.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4345 + `N' is used for the constant -1.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4346 + `O' is used for the constant 0.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4347 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4348 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4349 +#define CONST_OK_FOR_LETTER_P(VALUE, C) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4350 + ((C) == 'I' ? ((VALUE) == 1) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4351 + (C) == 'J' ? ((VALUE) >= -16 && (VALUE) <= 15) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4352 + (C) == 'K' ? ((VALUE) >= -128 && (VALUE) <= 127) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4353 + (C) == 'L' ? ((VALUE) >= -32768 && (VALUE) <= 32767) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4354 + (C) == 'M' ? ((VALUE) == 8) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4355 + (C) == 'N' ? ((VALUE) == -1) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4356 + (C) == 'O' ? ((VALUE) == 0) : 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4357 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4358 +/* Similar, but for floating constants, and defining letters G and H.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4359 + No floating-point constants are valid on MC6809. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4360 +#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4361 + ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4362 + && VALUE == CONST0_RTX (GET_MODE (VALUE))) : 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4363 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4364 +/* Given an rtx X being reloaded into a reg required to be
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4365 + in class CLASS, return the class of reg to actually use.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4366 + In general this is just CLASS; but on some machines
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4367 + in some cases it is preferable to use a more restrictive class. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4368 +#define PREFERRED_RELOAD_CLASS(X,CLASS) m6809_preferred_reload_class(X,CLASS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4369 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4370 +#define SMALL_REGISTER_CLASSES 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4371 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4372 +/* Return the maximum number of consecutive registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4373 + needed to represent mode MODE in a register of class CLASS. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4374 +#define CLASS_MAX_NREGS(CLASS, MODE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4375 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4376 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4377 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4378 + Stack layout; function entry, exit and calling.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4379 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4380 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4381 +/* Define this if pushing a word on the stack
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4382 + makes the stack pointer a smaller address. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4383 +#define STACK_GROWS_DOWNWARD
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4384 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4385 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4386 +/* Define this if the nominal address of the stack frame
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4387 + is at the high-address end of the local variables;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4388 + that is, each additional local variable allocated
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4389 + goes at a more negative offset in the frame. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4390 +#define FRAME_GROWS_DOWNWARD 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4391 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4392 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4393 +/* Offset within stack frame to start allocating local variables at.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4394 + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4395 + first local allocated. Otherwise, it is the offset to the BEGINNING
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4396 + of the first local allocated. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4397 +#define STARTING_FRAME_OFFSET 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4398 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4399 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4400 +/* Always push stack arguments for now. Accumulation is not yet working. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4401 +#define PUSH_ROUNDING(BYTES) (BYTES)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4402 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4403 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4404 +/* Offset of first parameter from the argument pointer register value.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4405 + * ARG_POINTER_REGNUM is defined to point to the return address pushed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4406 + * onto the stack, so we must offset by 2 bytes to get to the arguments. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4407 +#define FIRST_PARM_OFFSET(FNDECL) 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4408 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4409 +/* Value is 1 if returning from a function call automatically
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4410 + pops the arguments described by the number-of-args field in the call.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4411 + FUNTYPE is the data type of the function (as a tree),
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4412 + or for a library call it is an identifier node for the subroutine name. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4413 +/* #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4414 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4415 +/* Define how to find the value returned by a function.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4416 + VALTYPE is the data type of the value (as a tree).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4417 + If the precise function being called is known, FUNC is its FUNCTION_DECL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4418 + otherwise, FUNC is 0. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4419 +#define FUNCTION_VALUE(VALTYPE, FUNC) m6809_function_value (VALTYPE, FUNC)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4420 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4421 +/* Define how to find the value returned by a library function
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4422 + assuming the value has mode MODE. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4423 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4424 +/* All return values are in the X-register. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4425 +#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4426 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4427 +/* Define this if using the nonreentrant convention for returning
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4428 + structure and union values. No; it is inefficient and buggy. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4429 +#undef PCC_STATIC_STRUCT_RETURN
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4430 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4431 +/* 1 if N is a possible register number for a function value. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4432 +#define FUNCTION_VALUE_REGNO_P(N) m6809_function_value_regno_p (N)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4433 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4434 +/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4435 + more than one register. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4436 +#define NEEDS_UNTYPED_CALL 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4437 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4438 +/* 1 if N is a possible register number for function argument passing. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4439 +#define FUNCTION_ARG_REGNO_P(N) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4440 + ((m6809_abi_version != M6809_ABI_VERSION_STACK) ? \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4441 + (((N) == HARD_D_REGNUM) || ((N) == HARD_X_REGNUM)) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4442 + 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4443 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4444 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4445 + Argument Lists
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4446 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4447 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4448 +/* Cumulative arguments are tracked in a single integer,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4449 + * which is the number of bytes of arguments scanned so far,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4450 + * plus which registers have already been used. The register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4451 + * info is kept in some of the upper bits */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4452 +#define CUMULATIVE_ARGS unsigned int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4453 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4454 +#define CUM_STACK_ONLY 0x80000000
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4455 +#define CUM_X_MASK 0x40000000
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4456 +#define CUM_B_MASK 0x20000000
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4457 +#define CUM_STACK_INVALID 0x10000000
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4458 +#define CUM_STACK_MASK 0xFFFFFFF
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4459 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4460 +#define CUM_ADVANCE_8BIT(cum) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4461 + (((cum) & CUM_B_MASK) ? (cum)++ : ((cum) |= CUM_B_MASK))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4462 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4463 +#define CUM_ADVANCE_16BIT(cum) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4464 + (((cum) & CUM_X_MASK) ? (cum) += 2 : ((cum) |= CUM_X_MASK))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4465 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4466 +/* Initialize a variable CUM of type CUMULATIVE_ARGS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4467 + for a call to a function whose data type is FNTYPE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4468 + For a library call, FNTYPE is 0.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4469 + N_NAMED was added in gcc 3.4 and is not used currently. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4470 +#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4471 + ((CUM) = m6809_init_cumulative_args (CUM, FNTYPE, LIBNAME))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4472 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4473 +#define FUNCTION_ARG_SIZE(MODE, TYPE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4474 + ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4475 + : (unsigned) int_size_in_bytes (TYPE))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4476 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4477 +/* Update the data in CUM to advance over an argument
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4478 + of mode MODE and data type TYPE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4479 + (TYPE is null for libcalls where that information may not be available.) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4480 +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4481 + (((MODE == QImode) && !((CUM) & CUM_STACK_ONLY)) ? \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4482 + CUM_ADVANCE_8BIT (CUM) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4483 + ((MODE == HImode) && !((CUM) & CUM_STACK_ONLY)) ? \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4484 + CUM_ADVANCE_16BIT (CUM) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4485 + ((CUM) = ((CUM) + (TYPE ? int_size_in_bytes (TYPE) : 2))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4486 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4487 +/* Define where to put the arguments to a function.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4488 + Value is zero to push the argument on the stack,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4489 + or a hard register rtx in which to store the argument.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4490 + This macro is used _before_ FUNCTION_ARG_ADVANCE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4491 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4492 + For the 6809, the first 8-bit function argument can be placed into B,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4493 + and the first 16-bit arg can go into X. All other arguments
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4494 + will be pushed onto the stack.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4495 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4496 + Command-line options can adjust this behavior somewhat.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4497 + */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4498 +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4499 + ((MODE == VOIDmode) ? NULL_RTX : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4500 + ((MODE == BLKmode) || (GET_MODE_SIZE (MODE) > 2)) ? NULL_RTX : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4501 + ((MODE == QImode) && !((CUM) & (CUM_STACK_ONLY | CUM_B_MASK))) ? \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4502 + gen_rtx_REG (QImode, HARD_D_REGNUM) : \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4503 + ((MODE == HImode) && !((CUM) & (CUM_STACK_ONLY | CUM_X_MASK))) ? \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4504 + gen_rtx_REG (HImode, HARD_X_REGNUM) : m6809_function_arg_on_stack (&CUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4505 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4506 +/* Output assembler code to FILE to increment profiler label # LABELNO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4507 + for profiling a function entry. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4508 +#define FUNCTION_PROFILER(FILE, LABELNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4509 + fprintf (FILE, "\tldd\t#LP%u\n\tjsr\tmcount\n", (LABELNO));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4510 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4511 +/* Stack pointer must be correct on function exit */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4512 +#define EXIT_IGNORE_STACK 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4513 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4514 +/*****************************************************************************
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4515 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4516 +** Trampolines for Nested Functions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4517 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4518 +*****************************************************************************/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4519 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4520 +/* Length in units of the trampoline for entering a nested function. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4521 +#define TRAMPOLINE_SIZE 7
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4522 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4523 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4524 + Addressing modes,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4525 + and classification of registers for them.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4526 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4527 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4528 +/* 6809 has postincrement and predecrement addressing modes */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4529 +#define HAVE_POST_INCREMENT 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4530 +#define HAVE_PRE_DECREMENT 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4531 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4532 +/* Whether or not to use index registers is configurable.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4533 + * Experiments show that things work better when this is off, so
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4534 + * that's the way it is for now. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4535 +#undef USE_INDEX_REGISTERS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4536 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4537 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4538 +/* Macros to check register numbers against specific register classes. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4539 +#define REG_VALID_FOR_BASE_P(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4540 + (((REGNO) < FIRST_PSEUDO_REGISTER) && A_REGNO_P (REGNO))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4541 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4542 +/* MC6809 index registers do not allow scaling, */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4543 +/* but there is "accumulator-offset" mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4544 +#ifdef USE_INDEX_REGISTERS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4545 +#define REG_VALID_FOR_INDEX_P(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4546 + (((REGNO) < FIRST_PSEUDO_REGISTER) && I_REGNO_P (REGNO))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4547 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4548 +#define REG_VALID_FOR_INDEX_P(REGNO) 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4549 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4550 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4551 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_BASE_P */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4552 +#define REGNO_OK_FOR_BASE_NONSTRICT_P(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4553 + ((REGNO) >= FIRST_PSEUDO_REGISTER \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4554 + || REG_VALID_FOR_BASE_P (REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4555 + || (REGNO) == FRAME_POINTER_REGNUM \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4556 + || (REGNO) == HARD_FRAME_POINTER_REGNUM \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4557 + || (REGNO) == ARG_POINTER_REGNUM \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4558 + || (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO])))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4559 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4560 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_INDEX_P */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4561 +#define REGNO_OK_FOR_INDEX_NONSTRICT_P(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4562 + ((REGNO) >= FIRST_PSEUDO_REGISTER \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4563 + || REG_VALID_FOR_INDEX_P (REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4564 + || (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO])))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4565 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4566 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4567 +/* Internal macro, the strict definition for REGNO_OK_FOR_BASE_P */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4568 +#define REGNO_OK_FOR_BASE_STRICT_P(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4569 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_BASE_P (REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4570 + : (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO])))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4571 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4572 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4573 +/* Internal macro, the strict definition for REGNO_OK_FOR_INDEX_P */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4574 +#define REGNO_OK_FOR_INDEX_STRICT_P(REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4575 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_INDEX_P (REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4576 + : (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO])))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4577 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4578 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4579 +#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_BASE_STRICT_P (REGNO)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4580 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4581 +#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_INDEX_STRICT_P (REGNO)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4582 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4583 +#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_STRICT_P (REGNO (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4584 +#define REG_OK_FOR_BASE_NONSTRICT_P(X) REGNO_OK_FOR_BASE_NONSTRICT_P (REGNO (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4585 +#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_STRICT_P (REGNO (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4586 +#define REG_OK_FOR_INDEX_NONSTRICT_P(X) REGNO_OK_FOR_INDEX_NONSTRICT_P (REGNO (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4587 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4588 +#ifndef REG_OK_STRICT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4589 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4590 +#ifdef USE_INDEX_REGISTERS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4591 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4592 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4593 +#define REG_OK_FOR_INDEX_P(X) 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4594 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4595 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4596 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4597 +#ifdef USE_INDEX_REGISTERS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4598 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4599 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4600 +#define REG_OK_FOR_INDEX_P(X) 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4601 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4602 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4603 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4604 +/* Maximum number of registers that can appear in a valid memory address */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4605 +#ifdef USE_INDEX_REGISTERS
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4606 +#define MAX_REGS_PER_ADDRESS 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4607 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4608 +#define MAX_REGS_PER_ADDRESS 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4609 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4610 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4611 +/* 1 if X is an rtx for a constant that is a valid address.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4612 + * We allow any constant, plus the sum of any two constants (this allows
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4613 + * offsetting a symbol ref) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4614 +#define CONSTANT_ADDRESS_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4615 + ((CONSTANT_P (X)) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4616 + || ((GET_CODE (X) == PLUS) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4617 + && (CONSTANT_P (XEXP (X, 0))) && (CONSTANT_P (XEXP (X, 1)))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4618 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4619 +/* Nonzero if the constant value X is a legitimate general operand.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4620 + It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4621 +/* Any single-word constant is ok; the only contexts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4622 + allowing general_operand of mode DI or DF are movdi and movdf. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4623 +#define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4624 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4625 +/* Nonzero if the X is a legitimate immediate operand in PIC mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4626 +#define LEGITIMATE_PIC_OPERAND_P(X) !symbolic_operand (X, VOIDmode)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4627 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4628 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4629 + Test for valid memory addresses
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4630 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4631 +/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4632 + that is a valid memory address for an instruction.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4633 + The MODE argument is the machine mode for the MEM expression
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4634 + that wants to use this address. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4635 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4636 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4637 + Valid addresses are either direct or indirect (MEM) versions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4638 + of the following forms.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4639 + constant N
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4640 + register ,X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4641 + constant indexed N,X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4642 + accumulator indexed D,X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4643 + auto_increment ,X++
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4644 + auto_decrement ,--X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4645 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4646 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4647 +#define REGISTER_ADDRESS_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4648 + (REG_P (X) && REG_OK_FOR_BASE_P (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4649 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4650 +#define EXTENDED_ADDRESS_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4651 + CONSTANT_ADDRESS_P (X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4652 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4653 +#define LEGITIMATE_BASE_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4654 + ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4655 + || (GET_CODE (X) == SIGN_EXTEND \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4656 + && GET_CODE (XEXP (X, 0)) == REG \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4657 + && GET_MODE (XEXP (X, 0)) == HImode \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4658 + && REG_OK_FOR_BASE_P (XEXP (X, 0))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4659 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4660 +#define LEGITIMATE_OFFSET_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4661 + (CONSTANT_ADDRESS_P (X) || (REG_P (X) && REG_OK_FOR_INDEX_P (X)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4662 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4663 +/* 1 if X is the sum of a base register and an offset. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4664 +#define INDEXED_ADDRESS(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4665 + ((GET_CODE (X) == PLUS \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4666 + && LEGITIMATE_BASE_P (XEXP (X, 0)) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4667 + && LEGITIMATE_OFFSET_P (XEXP (X, 1))) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4668 + || (GET_CODE (X) == PLUS \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4669 + && LEGITIMATE_BASE_P (XEXP (X, 1)) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4670 + && LEGITIMATE_OFFSET_P (XEXP (X, 0))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4671 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4672 +#define STACK_REG_P(X) (REG_P(X) && REGNO(X) == HARD_S_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4673 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4674 +#define STACK_PUSH_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4675 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == PRE_DEC && STACK_REG_P (XEXP (XEXP (X, 0), 0)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4676 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4677 +#define STACK_POP_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4678 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == POST_INC && STACK_REG_P (XEXP (XEXP (X, 0), 0)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4679 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4680 +#define PUSH_POP_ADDRESS_P(X) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4681 + (((GET_CODE (X) == PRE_DEC) || (GET_CODE (X) == POST_INC)) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4682 + && (LEGITIMATE_BASE_P (XEXP (X, 0))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4683 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4684 +/* Go to ADDR if X is a valid address. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4685 +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4686 +{ \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4687 + if (REGISTER_ADDRESS_P(X)) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4688 + if (PUSH_POP_ADDRESS_P (X)) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4689 + if (EXTENDED_ADDRESS_P (X)) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4690 + if (INDEXED_ADDRESS (X)) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4691 + if (MEM_P (X) && REGISTER_ADDRESS_P(XEXP (X, 0))) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4692 + if (MEM_P (X) && PUSH_POP_ADDRESS_P (XEXP (X, 0))) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4693 + if (MEM_P (X) && EXTENDED_ADDRESS_P (XEXP (X, 0))) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4694 + if (MEM_P (X) && INDEXED_ADDRESS (XEXP (X, 0))) goto ADDR; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4695 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4696 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4697 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4698 + Address Fix-up
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4699 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4700 +/* Go to LABEL if ADDR (a legitimate address expression)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4701 + has an effect that depends on the machine mode it is used for.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4702 + In the latest GCC, this case is already handled by the core code
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4703 + so no action is required here. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4704 +#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4705 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4706 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4707 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4708 + Miscellaneous Parameters
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4709 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4710 +/* Specify the machine mode that this machine uses
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4711 + for the index in the tablejump instruction. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4712 +#define CASE_VECTOR_MODE Pmode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4713 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4714 +/* Define this as 1 if `char' should by default be signed; else as 0. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4715 +#define DEFAULT_SIGNED_CHAR 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4716 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4717 +/* This flag, if defined, says the same insns that convert to a signed fixnum
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4718 + also convert validly to an unsigned one. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4719 +#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4720 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4721 +/* Max number of bytes we can move from memory to memory/register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4722 + in one reasonably fast instruction. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4723 +#define MOVE_MAX 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4724 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4725 +/* Int can be 8 or 16 bits (default is 16) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4726 +#define INT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4727 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4728 +/* Short is always 16 bits */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4729 +#define SHORT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4730 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4731 +/* Size (bits) of the type "long" on target machine */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4732 +#define LONG_TYPE_SIZE (TARGET_BYTE_INT ? 16 : 32)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4733 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4734 +/* Size (bits) of the type "long long" on target machine */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4735 +#define LONG_LONG_TYPE_SIZE 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4736 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4737 +/* Size (bits) of the type "char" on target machine */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4738 +#define CHAR_TYPE_SIZE 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4739 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4740 +/* Size (bits) of the type "float" on target machine */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4741 +#define FLOAT_TYPE_SIZE 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4742 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4743 +/* Size (bits) of the type "double" on target machine.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4744 + * Note that the C standard does not require that doubles
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4745 + * hold any more bits than float. Since the 6809 has so few
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4746 + * registers, we cannot really support more than 32-bits. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4747 +#define DOUBLE_TYPE_SIZE 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4748 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4749 +/* Size (bits) of the type "long double" on target machine */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4750 +#define LONG_DOUBLE_TYPE_SIZE 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4751 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4752 +/* Define the type used for "size_t". With a 64KB address space,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4753 + * only a 16-bit value here makes sense. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4754 +#define SIZE_TYPE (TARGET_BYTE_INT ? "long unsigned int" : "unsigned int")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4755 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4756 +/* Likewise, the difference between two pointers is also a 16-bit
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4757 + * signed value. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4758 +#define PTRDIFF_TYPE (TARGET_BYTE_INT ? "long int" : "int")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4759 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4760 +/* Nonzero if access to memory by bytes is slow and undesirable. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4761 +#define SLOW_BYTE_ACCESS 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4762 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4763 +/* Define if shifts truncate the shift count
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4764 + which implies one can omit a sign-extension or zero-extension
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4765 + of a shift count. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4766 +#define SHIFT_COUNT_TRUNCATED 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4767 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4768 +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4769 + is done just by pretending it is already truncated. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4770 +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4771 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4772 +/* It is as good to call a constant function address as to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4773 + call an address kept in a register. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4774 +#define NO_FUNCTION_CSE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4775 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4776 +/* Specify the machine mode that pointers have.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4777 + After generation of rtl, the compiler makes no further distinction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4778 + between pointers and any other objects of this machine mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4779 +#define Pmode HImode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4780 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4781 +/* A function address in a call instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4782 + is a byte address (for indexing purposes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4783 + so give the MEM rtx a byte's mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4784 +#define FUNCTION_MODE HImode
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4785 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4786 +/* Define the cost of moving a value from a register in CLASS1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4787 + * to CLASS2, of a given MODE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4788 + *
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4789 + * On the 6809, hard register transfers are all basically equivalent.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4790 + * But soft register moves are treated more like memory moves. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4791 +#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4792 + (((CLASS1 == M_REGS) || (CLASS2 == M_REGS)) ? 4 : 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4793 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4794 +/* Define the cost of moving a value between a register and memory. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4795 +#define MEMORY_MOVE_COST(MODE, CLASS, IN) 5
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4796 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4797 +/* Check a `double' value for validity for a particular machine mode. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4798 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4799 +#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4800 + ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4801 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4802 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4803 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4804 + machine-dependent
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4805 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4806 +/* Tell final.c how to eliminate redundant test instructions. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4807 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4808 +/* Here we define machine-dependent flags and fields in cc_status
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4809 + (see `conditions.h'). */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4810 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4811 +/* Store in cc_status the expressions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4812 + that the condition codes will describe
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4813 + after execution of an instruction whose pattern is EXP.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4814 + Do not alter them if the instruction would not alter the cc's. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4815 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4816 +/* On the 6809, most of the insns to store in an address register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4817 + fail to set the cc's. However, in some cases these instructions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4818 + can make it possibly invalid to use the saved cc's. In those
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4819 + cases we clear out some or all of the saved cc's so they won't be used. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4820 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4821 +#define NOTICE_UPDATE_CC(EXP, INSN) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4822 + notice_update_cc((EXP), (INSN))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4823 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4824 +/*****************************************************************************
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4825 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4826 +** pragma support
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4827 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4828 +*****************************************************************************/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4829 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4830 +#if 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4831 +#define REGISTER_TARGET_PRAGMAS() \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4832 +do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4833 + extern void pragma_section PARAMS ((cpp_reader *)); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4834 + c_register_pragma (0, "section", pragma_section); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4835 +} while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4836 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4837 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4838 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4839 +/*--------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4840 + ASSEMBLER FORMAT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4841 +--------------------------------------------------------------*/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4842 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4843 +#define FMT_HOST_WIDE_INT "%ld"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4844 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4845 +/* Output to assembler file text saying following lines
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4846 + may contain character constants, extra white space, comments, etc. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4847 +#define ASM_APP_ON ";----- asm -----\n"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4848 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4849 +/* Output to assembler file text saying following lines
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4850 + no longer contain unusual constructs. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4851 +#define ASM_APP_OFF ";--- end asm ---\n"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4852 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4853 +/* Use a semicolon to begin a comment. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4854 +#define ASM_COMMENT_START "; "
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4855 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4856 +/* Output assembly directives to switch to section 'name' */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4857 +#undef TARGET_ASM_NAMED_SECTION
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4858 +#define TARGET_ASM_NAMED_SECTION m6809_asm_named_section
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4859 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4860 +#undef TARGET_HAVE_NAMED_SECTION
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4861 +#define TARGET_HAVE_NAMED_SECTION m6809_have_named_section
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4862 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4863 +/* Output before read-only data. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4864 +#define TEXT_SECTION_ASM_OP (code_section_op)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4865 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4866 +/* Output before writable data. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4867 +#define DATA_SECTION_ASM_OP (data_section_op)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4868 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4869 +/* Output before uninitialized data. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4870 +#define BSS_SECTION_ASM_OP (bss_section_op)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4871 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4872 +/* Support the ctors and dtors sections for g++. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4873 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4874 +#undef CTORS_SECTION_ASM_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4875 +#define CTORS_SECTION_ASM_OP "\t.area .ctors"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4876 +#undef DTORS_SECTION_ASM_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4877 +#define DTORS_SECTION_ASM_OP "\t.area .dtors"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4878 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4879 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4880 +#undef DO_GLOBAL_CTORS_BODY
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4881 +#undef DO_GLOBAL_DTORS_BODY
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4882 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4883 +#define HAS_INIT_SECTION
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4884 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4885 +/* This is how to output an assembler line
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4886 + that says to advance the location counter
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4887 + to a multiple of 2**LOG bytes. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4888 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4889 +#define ASM_OUTPUT_ALIGN(FILE,LOG) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4890 + if ((LOG) > 1) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4891 + fprintf (FILE, "\t.bndry %u\n", 1 << (LOG))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4892 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4893 +/* The .set foo,bar construct doesn't work by default */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4894 +#undef SET_ASM_OP
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4895 +#define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4896 + do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4897 + assemble_name (FILE, LABEL1); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4898 + fputs ("\tequ\t", FILE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4899 + assemble_name (FILE, LABEL2); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4900 + fputc ('\n', FILE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4901 + } while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4902 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4903 +/* How to refer to registers in assembler output.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4904 + This sequence is indexed by compiler's hard-register-number (see above). */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4905 +#define MNAME(x) [SOFT_M0_REGNUM+(x)] = "*m" C_STRING(x) ,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4906 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4907 +#define REGISTER_NAMES { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4908 + [HARD_D_REGNUM]= "d", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4909 + [HARD_X_REGNUM]= "x", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4910 + [HARD_Y_REGNUM]= "y", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4911 + [HARD_U_REGNUM]= "u", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4912 + [HARD_S_REGNUM]= "s", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4913 + [HARD_PC_REGNUM]= "pc", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4914 + [HARD_A_REGNUM]= "a", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4915 + [HARD_B_REGNUM]= "b", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4916 + [HARD_CC_REGNUM]= "cc",\
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4917 + [HARD_DP_REGNUM]= "dp", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4918 + [SOFT_FP_REGNUM]= "soft_fp", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4919 + [SOFT_AP_REGNUM]= "soft_ap", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4920 + MNAME(0) MNAME(1) MNAME(2) MNAME(3) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4921 + MNAME(4) MNAME(5) MNAME(6) MNAME(7) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4922 + [HARD_RSVD1_REGNUM] = "-", \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4923 + [HARD_Z_REGNUM] = "z" /* bit 2 of CC */ }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4924 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4925 +/*****************************************************************************
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4926 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4927 +** Debug Support
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4928 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4929 +*****************************************************************************/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4930 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4931 +/* Default to DBX-style debugging */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4932 +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4933 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4934 +#define DBX_DEBUGGING_INFO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4935 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4936 +#define DEFAULT_GDB_EXTENSIONS 0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4937 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4938 +#define ASM_STABS_OP ";\t.stabs\t"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4939 +#define ASM_STABD_OP ";\t.stabd\t"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4940 +#define ASM_STABN_OP ";\t.stabn\t"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4941 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4942 +#define DBX_CONTIN_LENGTH 54
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4943 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4944 +#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(ASMFILE, FILENAME) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4945 +do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4946 + const char *p = FILENAME; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4947 + while ((p = strchr (p, '/')) != NULL) { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4948 + p = FILENAME = p+1; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4949 + } \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4950 + fprintf (ASMFILE, "%s", ASM_STABS_OP); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4951 + output_quoted_string (ASMFILE, FILENAME); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4952 + fprintf (ASMFILE, ",%d,0,0,", N_SO); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4953 + assemble_name (ASMFILE, ltext_label_name); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4954 + fputc ('\n', ASMFILE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4955 + switch_to_section (text_section); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4956 + (*targetm.asm_out.internal_label) (ASMFILE, "Ltext", 0); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4957 +} while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4958 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4959 +/* With -g, GCC sometimes outputs string literals that are longer than
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4960 + * the assembler can handle. Without actual debug support, these are
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4961 + * not really required. Redefine the function to output strings to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4962 + * output as much as possible. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4963 +#define OUTPUT_QUOTED_STRING(FILE, STR) m6809_output_quoted_string (FILE, STR)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4964 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4965 +/*****************************************************************************
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4966 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4967 +** Output and Generation of Labels
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4968 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4969 +*****************************************************************************/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4970 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4971 +/* Prefixes for various assembly-time objects */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4972 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4973 +#define REGISTER_PREFIX ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4974 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4975 +#define LOCAL_LABEL_PREFIX ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4976 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4977 +#define USER_LABEL_PREFIX "_"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4978 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4979 +#define IMMEDIATE_PREFIX "#"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4980 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4981 +/* This is how to output the definition of a user-level label named NAME,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4982 + such as the label on a static function or variable NAME. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4983 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4984 +#define ASM_OUTPUT_LABEL(FILE,NAME) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4985 +do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4986 + if (section_changed) { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4987 + fprintf (FILE, "\n%s\n\n", code_section_op); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4988 + section_changed = 0; \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4989 + } \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4990 + assemble_name (FILE, NAME); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4991 + fputs (":\n", FILE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4992 +} while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4993 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4994 +/* This is how to output the label for a function definition. It
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4995 + invokes ASM_OUTPUT_LABEL, but may examine the DECL tree node for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4996 + other properties. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4997 +#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4998 + m6809_declare_function_name (FILE,NAME,DECL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
4999 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5000 +/* This is how to output a command to make the user-level label
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5001 + named NAME defined for reference from other files. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5002 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5003 +#define GLOBAL_ASM_OP "\t.globl "
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5004 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5005 +/* This is how to output a reference to a user label named NAME. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5006 +#define ASM_OUTPUT_LABELREF(FILE,NAME) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5007 + fprintf (FILE, "_%s", NAME)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5008 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5009 +/* This is how to output a reference to a symbol ref
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5010 + * Check to see if the symbol is in the direct page */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5011 +#define ASM_OUTPUT_SYMBOL_REF(FILE,sym) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5012 +{ \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5013 + print_direct_prefix (FILE, sym); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5014 + assemble_name (FILE, XSTR (sym, 0)); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5015 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5016 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5017 +/* External references aren't necessary, so don't emit anything */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5018 +#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5019 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5020 +/* This is how to store into the string LABEL
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5021 + the symbol_ref name of an internal numbered label where
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5022 + PREFIX is the class of label and NUM is the number within the class.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5023 + This is suitable for output with `assemble_name'. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5024 +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5025 + sprintf (LABEL, "*%s%lu", PREFIX, (unsigned long int)NUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5026 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5027 +/* This is how to output an assembler line defining an `int' constant. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5028 +#define ASM_OUTPUT_INT(FILE,VALUE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5029 +( fprintf (FILE, "\t.word "), \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5030 + output_addr_const (FILE, (VALUE)), \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5031 + fprintf (FILE, "\n"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5032 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5033 +/* Likewise for `char' and `short' constants. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5034 +#define ASM_OUTPUT_SHORT(FILE,VALUE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5035 +( fprintf (FILE, "\t.word "), \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5036 + output_addr_const (FILE, (VALUE)), \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5037 + fprintf (FILE, "\n"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5038 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5039 +/* This is how to output a string. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5040 +#define ASM_OUTPUT_ASCII(FILE,STR,SIZE) m6809_output_ascii (FILE, STR, SIZE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5041 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5042 +/* This is how to output an insn to push a register on the stack.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5043 + It need not be very fast code. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5044 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5045 +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5046 + fprintf (FILE, "\tpshs\t%s\n", reg_names[REGNO])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5047 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5048 +/* This is how to output an insn to pop a register from the stack.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5049 + It need not be very fast code. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5050 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5051 +#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5052 + fprintf (FILE, "\tpuls\t%s\n", reg_names[REGNO])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5053 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5054 +/* This is how to output an element of a case-vector that is absolute. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5055 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5056 +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5057 + fprintf (FILE, "\t.word L%u\n", VALUE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5058 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5059 +/* This is how to output an element of a case-vector that is relative. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5060 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5061 +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5062 + fprintf (FILE, "\t.word L%u-L%u\n", VALUE, REL)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5063 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5064 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5065 +/*****************************************************************************
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5066 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5067 +** Assembler Commands for Alignment
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5068 +**
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5069 +*****************************************************************************/
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5070 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5071 +/* ASM_OUTPUT_SKIP is supposed to zero initialize the data. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5072 +#define ASM_OUTPUT_SKIP(FILE,SIZE) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5073 + do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5074 + fprintf (FILE, "\tzmb\t%d\t;skip space\n", SIZE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5075 + } while (0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5076 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5077 +/* This says how to output an assembler line
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5078 + to define a global common symbol. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5079 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5080 +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5081 + do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5082 + switch_to_section (bss_section); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5083 + fputs ("\t.globl\t", FILE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5084 + assemble_name ((FILE), (NAME)); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5085 + fputs ("\n", FILE); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5086 + assemble_name ((FILE), (NAME)); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5087 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5088 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5089 +/* This says how to output an assembler line
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5090 + to define a local common symbol. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5091 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5092 +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5093 +do { \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5094 + switch_to_section (bss_section); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5095 + assemble_name ((FILE), (NAME)); \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5096 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5097 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5098 +/* Store in OUTPUT a string (made with alloca) containing
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5099 + an assembler-name for a local static variable named NAME.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5100 + LABELNO is an integer which is different for each call. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5101 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5102 +#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5103 +( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5104 + sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long int)(LABELNO)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5105 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5106 +/* Print an instruction operand X on file FILE.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5107 + CODE is the code from the %-spec for printing this operand.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5108 + If `%z3' was used to print operand 3, then CODE is 'z'. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5109 +#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5110 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5111 +/* Print a memory operand whose address is X, on file FILE. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5112 +#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5113 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5114 +/* Don't let stack pushes build up too much. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5115 +#define MAX_PENDING_STACK 8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5116 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5117 +/* Define values for builtin operations */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5118 +enum m6809_builtins
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5119 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5120 + M6809_SWI,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5121 + M6809_SWI2,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5122 + M6809_SWI3,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5123 + M6809_CWAI,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5124 + M6809_SYNC,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5125 + M6809_ADD_CARRY,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5126 + M6809_SUB_CARRY,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5127 + M6809_ADD_DECIMAL,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5128 + M6809_NOP,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5129 + M6809_BLOCKAGE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5130 +};
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5131 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5132 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.md gcc-4.6.4/gcc/config/m6809/m6809.md
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5133 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.md 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5134 +++ gcc-4.6.4/gcc/config/m6809/m6809.md 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5135 @@ -0,0 +1,2358 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5136 +;; GCC machine description for Motorola 6809
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5137 +;; Copyright (C) 1989, 2005, 2006, 2007, 2008,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5138 +;; 2009 Free Software Foundation, Inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5139 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5140 +;; Mostly by Brian Dominy (brian@oddchange.com) with substantial renovations
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5141 +;; by William Astle (lost@l-w.ca).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5142 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5143 +;; Based on earlier work by Tom Jones (jones@sal.wisc.edu) and
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5144 +;; Matthias Doerfel (msdoerfe@informatik.uni-erlangen.de)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5145 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5146 +;; This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5147 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5148 +;; GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5149 +;; it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5150 +;; the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5151 +;; any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5152 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5153 +;; GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5154 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5155 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5156 +;; GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5157 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5158 +;; You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5159 +;; along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5160 +;; <http://www.gnu.org/licenses/>.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5161 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5162 +;; General information:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5163 +;; --------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5164 +;; * This backend is mostly a rewrite from earlier (3.1.1 and before)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5165 +;; versions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5166 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5167 +;; * The 'A' and 'B' registers are treated as a single register by the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5168 +;; register allocator; hence, the instruction templates assume that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5169 +;; both can be modified if either one is available for use. No
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5170 +;; attempt is made to split instructions to refer to a particular half
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5171 +;; of the register. It is always referred to as the 'D' register, even
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5172 +;; in QImode (when it will be displayed as 'B').
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5173 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5174 +;; * There is full support for proper branch instruction generation,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5175 +;; based on instruction lengths. However, many instruction patterns
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5176 +;; are still overloaded to emit lots of real instructions, which can
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5177 +;; make the length calculation difficult; in those cases, I've tried
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5178 +;; to be pessimistic and assume the worst-case.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5179 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5180 +;; * The instruction type attributes are only defined for branch
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5181 +;; vs. non branch instructions for now, since there is seemingly no
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5182 +;; reason to define these for other types anyway.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5183 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5184 +;; * The limited number of total registers presents the greatest
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5185 +;; challenge. There are 'soft registers' -- memory locations
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5186 +;; used to simulate real regs -- which can be helpful.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5187 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5188 +;; * Position-independent code (PIC) is supported and has been tested
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5189 +;; but not to the extent of absolute code generation.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5190 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5191 +;; * All of the 6809 special opcodes, e.g. SWI and SYNC, are defined
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5192 +;; as UNSPEC instructions, and can be accessed from C code using
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5193 +;; __builtin_xxxx() style functions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5194 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5195 +;; What still needs to be done:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5196 +;; ----------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5197 +;; * Replace remaining instances of (define_peephole) with
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5198 +;; (define_peephole2), or remove them completely if they are not
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5199 +;; matching anyway. Add more peepholes for things actually encountered.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5200 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5201 +;; * Indexing addressing can lead to crashes in complex functions when
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5202 +;; register pressure is high. Only the 'D' register can actually be
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5203 +;; used as an index register, and its demand by other instructions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5204 +;; can sometimes mean that it is impossible to satisfy constraints.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5205 +;; Currently, indexing is completely disabled to avoid these types
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5206 +;; of problems, although code is slightly more inefficient in some
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5207 +;; working cases.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5208 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5209 +;; * 32-bit math is terribly inefficient.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5210 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5211 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5212 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5213 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5214 +;;- Constants
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5215 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5216 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5217 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5218 +; Define constants for hard register numbers.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5219 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5220 +(define_constants [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5221 + (HARD_RSVD1_REGNUM 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5222 + (HARD_X_REGNUM 1) (HARD_Y_REGNUM 2) (HARD_U_REGNUM 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5223 + (HARD_S_REGNUM 4) (HARD_PC_REGNUM 5) (HARD_D_REGNUM 6)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5224 + (HARD_Z_REGNUM 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5225 + (HARD_A_REGNUM 8) (HARD_B_REGNUM 9)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5226 + (HARD_CC_REGNUM 10) (HARD_DP_REGNUM 11)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5227 + (SOFT_FP_REGNUM 12) (SOFT_AP_REGNUM 13)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5228 + (SOFT_M0_REGNUM 14) (SOFT_M1_REGNUM 15)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5229 + (SOFT_M2_REGNUM 16) (SOFT_M3_REGNUM 17)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5230 +])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5231 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5232 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5233 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5234 +; The range in which a short branch insn can be used.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5235 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5236 +(define_constants [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5237 + (MIN_SHORT_BRANCH_OFFSET -127)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5238 + (MAX_SHORT_BRANCH_OFFSET 128)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5239 +])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5240 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5241 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5242 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5243 +; The lengths of various types of real 6809 instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5244 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5245 +; By default, ordinary insns are 4 bytes long. This is often not
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5246 +; right, and the insn patterns below will redefine this to the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5247 +; correct value.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5248 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5249 +; Branch instruction lengths (conditional and unconditionals) are
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5250 +; well known and declared here. The short insns are used when the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5251 +; offset is within the range declared above (between MIN_SHORT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5252 +; and MAX_SHORT) ; otherwise the long form is used.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5253 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5254 +(define_constants [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5255 + (DEFAULT_INSN_LENGTH 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5256 + (SHORT_CBRANCH_LENGTH 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5257 + (LONG_CBRANCH_LENGTH 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5258 + (SHORT_BRANCH_LENGTH 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5259 + (LONG_BRANCH_LENGTH 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5260 +])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5261 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5262 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5263 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5264 +; Constants for insn cycle counts.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5265 +; Note that these counts all assume 1-byte opcodes. 2-byte
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5266 +; opcodes require 1 extra cycles for fetching the extra byte.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5267 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5268 +(define_constants [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5269 + ;; The default insn length, when it cannot be calculated.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5270 + ;; Take a conservative approach and estimate high.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5271 + (DEFAULT_INSN_CYCLES 10)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5272 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5273 + ;; Cycle counts for ALU and load operations.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5274 + (ALU_INHERENT_CYCLES 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5275 + (ALU_IMMED_CYCLES 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5276 + (ALU_DIRECT_CYCLES 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5277 + (ALU_INDEXED_BASE_CYCLES 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5278 + (ALU_EXTENDED_CYCLES 5)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5279 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5280 + ;; If an ALU operation is on a 16-bit register (D), then
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5281 + ;; add this number of cycles to the total count.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5282 + (ALU_16BIT_CYCLES 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5283 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5284 + ;; A load of a 16-bit register incurs this extra amount.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5285 + (LOAD_16BIT_CYCLES 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5286 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5287 + ;; Cycle counts for memory-only operations (bit shifts, clear, test)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5288 + (MEM_DIRECT_CYCLES 6)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5289 + (MEM_INDEXED_BASE_CYCLES 6)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5290 + (MEM_EXTENDED_CYCLES 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5291 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5292 + ;; Cycle count for any reg-reg transfer (regardless of size)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5293 + (EXG_CYCLES 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5294 + (TFR_CYCLES 6)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5295 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5296 + ;; Cycle count for a condition code update (andcc/orcc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5297 + (CC_CYCLES 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5298 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5299 + (JMP_DIRECT_CYCLES 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5300 + (JMP_INDEXED_BASE_CYCLES 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5301 + (JMP_EXTENDED_CYCLES 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5302 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5303 + (JSR_DIRECT_CYCLES 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5304 + (JSR_INDEXED_BASE_CYCLES 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5305 + (JSR_EXTENDED_CYCLES 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5306 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5307 + (LEA_BASE_CYCLES 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5308 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5309 + ;; Cycle count for a psh/pul operations. Add to this the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5310 + ;; total number of bytes moved for the correct count.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5311 + (PSH_PUL_CYCLES 5)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5312 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5313 + ;; Miscellaneous cycle counts
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5314 + (CWAI_CYCLES 20)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5315 + (MUL_CYCLES 11)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5316 + (NOP_CYCLES 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5317 + (RTI_CYCLES 15)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5318 + (RTS_CYCLES 5)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5319 + (SWI_CYCLES 20)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5320 + (SYNC_CYCLES 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5321 +])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5322 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5323 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5324 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5325 +; An enumeration of values for each "unspec"; i.e. unspecified
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5326 +; instruction. These represent insns that are meaningful on the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5327 +; 6809 but which have no intrinsic meaning to GCC itself.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5328 +; These insns can be generated explicitly using the __builtin_xxx
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5329 +; syntax; they are also implicitly generated by the backend
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5330 +; as needed to implement other insns.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5331 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5332 +(define_constants [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5333 + (UNSPEC_BLOCKAGE 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5334 + (UNSPEC_PUSH_RS 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5335 + (UNSPEC_POP_RS 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5336 + (UNSPEC_SWI 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5337 + (UNSPEC_CWAI 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5338 + (UNSPEC_ADD_CARRY 5)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5339 + (UNSPEC_SUB_CARRY 6)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5340 + (UNSPEC_SYNC 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5341 + (UNSPEC_ADD_DECIMAL 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5342 +])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5343 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5344 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5345 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5346 +;;- Predicates
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5347 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5348 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5349 +(include "predicates.md")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5350 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5351 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5352 +;;- Attributes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5353 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5354 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5355 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5356 +;; The type attribute is used to distinguish between different
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5357 +;; types of branch instructions, so that their lengths can be
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5358 +;; calculated correctly.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5359 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5360 +(define_attr "type" "branch,cbranch,unknown" (const_string "unknown"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5361 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5362 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5363 +;; The length of a branch instruction is calculated based on how
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5364 +;; far away the branch target is. Lengths of other insns default
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5365 +;; to 4. set_attr is used in instruction templates to specify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5366 +;; the length when it is known exactly. When not sure, err on
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5367 +;; the high side to avoid compile errors.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5368 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5369 +(define_attr "length" ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5370 + (cond [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5371 + (eq_attr "type" "branch")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5372 + (if_then_else (lt (minus (match_dup 0) (pc))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5373 + (const_int MIN_SHORT_BRANCH_OFFSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5374 + (const_int LONG_BRANCH_LENGTH)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5375 + (if_then_else (gt (minus (match_dup 0) (pc))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5376 + (const_int MAX_SHORT_BRANCH_OFFSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5377 + (const_int LONG_BRANCH_LENGTH)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5378 + (const_int SHORT_BRANCH_LENGTH)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5379 + (eq_attr "type" "cbranch")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5380 + (if_then_else (lt (minus (match_dup 0) (pc))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5381 + (const_int MIN_SHORT_BRANCH_OFFSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5382 + (const_int LONG_CBRANCH_LENGTH)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5383 + (if_then_else (gt (minus (match_dup 0) (pc))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5384 + (const_int MAX_SHORT_BRANCH_OFFSET))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5385 + (const_int LONG_CBRANCH_LENGTH)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5386 + (const_int SHORT_CBRANCH_LENGTH)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5387 + ] (const_int DEFAULT_INSN_LENGTH)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5388 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5389 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5390 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5391 +;; The default attributes for 'asm' statements.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5392 +;; The default length is the longest possible single 6809 instruction,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5393 +;; which is 5 bytes. GCC will automatically multiply this by the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5394 +;; number of real insns contained in an asm statement.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5395 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5396 +(define_asm_attributes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5397 + [(set_attr "length" "5")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5398 + (set_attr "type" "unknown")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5399 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5400 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5401 +;; An attribute for the number of cycles that it takes an instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5402 +;; to execute.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5403 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5404 +(define_attr "cycles" "" (const_int DEFAULT_INSN_CYCLES))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5405 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5406 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5407 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5408 +;;- Instruction patterns. When multiple patterns apply,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5409 +;;- the first one in the file is chosen.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5410 +;;-
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5411 +;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5412 +;;-
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5413 +;;- Note: NOTICE_UPDATE_CC in m6809.h handles condition code updates
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5414 +;;- for most instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5415 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5416 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5417 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5418 +;;- Test
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5419 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5420 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5421 +;; cmpx is 3 bytes, not 4
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5422 +(define_insn "*tsthi_x"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5423 + [(set (cc0) (match_operand:HI 0 "register_operand_x" "v"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5424 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5425 + "cmpx\t#0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5426 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5427 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5428 +;; subd #0 is 3 bytes, better than cmpd #0 which is 4 bytes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5429 +(define_insn "*tsthi_d"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5430 + [(set (cc0) (match_operand:HI 0 "register_operand_d" "d"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5431 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5432 + "subd\t#0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5433 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5434 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5435 +(define_insn "*tsthi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5436 + [(set (cc0) (match_operand:HI 0 "register_operand" "a"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5437 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5438 + "cmp%0\t#0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5439 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5440 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5441 +(define_insn "*bitqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5442 + [(set (cc0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5443 + (and:QI (match_operand:QI 0 "register_operand" "%q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5444 + (match_operand:QI 1 "general_operand" "mi")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5445 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5446 + "bit%0\t%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5447 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5448 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5449 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5450 +(define_insn "tstqi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5451 + [(set (cc0) (match_operand:QI 0 "nonimmediate_operand" "q,mt"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5452 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5453 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5454 + tst%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5455 + tst\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5456 + [(set_attr "length" "1,3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5457 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5458 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5459 +;;- Compare instructions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5460 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5461 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5462 +;; - cmphi for register to memory or register compares
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5463 +(define_insn "cmphi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5464 + [(set (cc0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5465 + (compare
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5466 + (match_operand:HI 0 "general_operand" "da, mi, ??Ud")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5467 + (match_operand:HI 1 "general_operand" "mi, da, dU")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5468 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5469 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5470 + if ((REG_P (operands[0])) && (REG_P (operands[1]))) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5471 + output_asm_insn ("pshs\t%1\t;cmphi: R:%1 with R:%0", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5472 + return "cmp%0\t,s++\t;cmphi:";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5473 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5474 + if (GET_CODE (operands[0]) == REG)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5475 + return "cmp%0\t%1\t;cmphi:";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5476 + else {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5477 + cc_status.flags |= CC_REVERSED;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5478 + return "cmp%1\t%0\t;cmphi:(R)";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5479 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5480 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5481 + [(set_attr "length" "5,5,7")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5482 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5483 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5484 +(define_insn "cmpqi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5485 + [(set (cc0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5486 + (compare (match_operand:QI 0 "whole_general_operand" "q,q, q,O,mt,K")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5487 + (match_operand:QI 1 "whole_general_operand" "O,mt,K,q,q, q")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5488 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5489 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5490 + if (REG_P (operands[0]) && !M_REG_P (operands[0]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5491 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5492 + if (operands[1] == const0_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5493 + return "tst%0\t;cmpqi:(ZERO)";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5494 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5495 + return "cmp%0\t%1\t;cmpqi:";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5496 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5497 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5498 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5499 + cc_status.flags |= CC_REVERSED;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5500 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5501 + if (operands[0] == const0_rtx)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5502 + return "tst%1\t;cmpqi:(RZERO)";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5503 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5504 + return "cmp%1\t%0\t;cmpqi:(R)";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5505 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5506 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5507 + [(set_attr "length" "1,3,2,1,3,2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5508 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5509 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5510 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5511 +;;- Compare/branch pattern
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5512 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5513 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5514 +(define_expand "cbranchhi4"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5515 + [(set (cc0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5516 + (compare
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5517 + (match_operand:HI 1 "general_operand" "da, mi, ??Ud")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5518 + (match_operand:HI 2 "general_operand" "mi, da, dU")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5519 + (set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5520 + (if_then_else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5521 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5522 + (label_ref (match_operand 3 "" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5523 + (pc)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5524 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5525 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5526 +)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5527 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5528 +(define_expand "cbranchqi4"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5529 + [(set (cc0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5530 + (compare
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5531 + (match_operand:QI 1 "whole_general_operand" "q,q, q,O,mt,K")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5532 + (match_operand:QI 2 "whole_general_operand" "O,mt,K,q,q, q")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5533 + (set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5534 + (if_then_else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5535 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5536 + (label_ref (match_operand 3 "" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5537 + (pc)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5538 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5539 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5540 +)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5541 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5542 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5543 +;;- Move
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5544 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5545 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5546 +; this looks good (obviously not finished) but I still see 'movsi'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5547 +; places in udivsi3 where it's broken
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5548 +; (define_insn "pushsi1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5549 +; [(set (mem:SI (pre_dec (reg:HI HARD_S_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5550 +; (match_operand:SI 0 "general_operand" "o"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5551 +; (set (reg:HI HARD_S_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5552 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int -4))) ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5553 +; ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5554 +; "; pushsi %0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5555 +; [(set_attr "length" "12")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5556 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5557 +; (define_insn "popsi1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5558 +; [(set (match_operand:SI 0 "general_operand" "=o")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5559 +; (mem:SI (post_inc (reg:HI HARD_S_REGNUM))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5560 +; (set (reg:HI HARD_S_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5561 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int 4))) ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5562 +; ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5563 +; "; popsi %0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5564 +; [(set_attr "length" "12")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5565 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5566 +; (define_insn "movsi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5567 +; [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5568 +; (match_operand:SI 1 "general_operand" " oi"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5569 +; ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5570 +; "; movsi %0 <- %1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5571 +; [(set_attr "length" "1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5572 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5573 +; this doesn't work
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5574 +; (define_expand "movsi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5575 +; [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5576 +; (set (match_operand:SI 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5577 +; (match_operand:SI 1 "general_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5578 +; (clobber (match_scratch:HI 2 ""))])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5579 +; ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5580 +; {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5581 +; rtx insn;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5582 +; if (STACK_PUSH_P (operands[0]) || STACK_POP_P (operands[1]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5583 +; {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5584 +; REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC, stack_pointer_rtx, REG_NOTES (insn));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5585 +; }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5586 +; insn = emit_move_multi_word (SImode, operands[0], operands[1]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5587 +; DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5588 +; })
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5589 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5590 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5591 +(define_expand "movhi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5592 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5593 + (match_operand:HI 1 "general_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5594 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5595 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5596 + /* One of the ops has to be in a register prior to reload */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5597 + if (!register_operand (operand0, HImode) &&
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5598 + !register_operand (operand1, HImode))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5599 + operands[1] = copy_to_mode_reg (HImode, operand1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5600 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5601 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5602 +;;; Try a splitter to handle failure cases where we try to move
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5603 +;;; an immediate constant (zero usually) directly to memory.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5604 +;;; This absolutely requires an intermediate register.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5605 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5606 + [(set (match_operand:HI 0 "memory_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5607 + (match_operand:HI 1 "immediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5608 + (clobber (match_operand:HI 2 "register_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5609 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5610 + [(set (match_dup 2) (match_dup 1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5611 + (set (match_dup 0) (match_dup 2))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5612 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5613 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5614 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5615 +;;; This would be a nice method for loading from a word array,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5616 +;;; but it is never generated because the combiner cannot merge
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5617 +;;; more than 3 instructions (there are four here). This is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5618 +;;; perhaps better done via a peephole.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5619 +(define_insn "*movhi_array_load"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5620 + [(set (match_operand:HI 0 "nonimmediate_operand" "=da")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5621 + (mem:HI (plus:HI (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B")) (const_int 1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5622 + (match_operand:HI 2 "immediate_operand" "i"))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5623 + (clobber (match_scratch:HI 3 "=X"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5624 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5625 + "ldx\t%2\;abx\;abx\;ld%0\t,x"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5626 + [(set_attr "length" "7")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5627 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5628 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5629 +;;; Optimize the move of a byte to the stack using the pshs instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5630 +;;; instead of a store with pre-increment.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5631 +(define_insn "movhi_push"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5632 + [(set (match_operand:HI 0 "push_operand" "=m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5633 + (match_operand:HI 1 "register_operand" "U"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5634 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5635 + "pshs\t%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5636 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5637 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5638 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5639 +(define_insn "*movhi_pic_symbolref"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5640 + [(set (match_operand:HI 0 "register_operand" "=a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5641 + (match_operand:HI 1 "symbolic_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5642 + "flag_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5643 + "lea%0\t%c1,pcr"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5644 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5645 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5646 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5647 +(define_insn "*movhi_1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5648 + [(set (match_operand:HI 0 "nonimmediate_operand" "=a,d,a,ad,mu")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5649 + (match_operand:HI 1 "general_operand" " a,a,d,miu,ad"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5650 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5651 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5652 + lea%0\t,%1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5653 + tfr\t%1,%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5654 + tfr\t%1,%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5655 + ld%0\t%1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5656 + st%1\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5657 + [(set_attr "length" "2,2,2,*,*")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5658 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5659 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5660 +;;; Generated by the combiner to merge an address calculation with
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5661 +;;; a byte load. We can use the 'abx' instruction here.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5662 +(define_insn "*movqi_array_load"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5663 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5664 + (mem:QI (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5665 + (match_operand:HI 2 "immediate_operand" "i"))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5666 + (clobber (match_scratch:HI 3 "=X"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5667 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5668 + "ldx\t%2\;abx\;ld%0\t,x"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5669 + [(set_attr "length" "6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5670 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5671 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5672 +;;; Optimize the move of a byte to the stack using the pshs instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5673 +;;; instead of a store with pre-increment.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5674 +(define_insn "movqi_push"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5675 + [(set (match_operand:QI 0 "push_operand" "=m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5676 + (match_operand:QI 1 "register_operand" " q"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5677 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5678 + "pshs\t%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5679 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5680 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5681 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5682 +;;; Optimize the move of a byte from the stack using the puls instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5683 +;;; instead of a store with post-decrement.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5684 +(define_insn "movqi_pop"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5685 + [(set (match_operand:QI 0 "register_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5686 + (match_operand:QI 1 "pop_operand" "m"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5687 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5688 + "puls\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5689 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5690 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5691 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5692 +;;- load low byte of 16-bit data into 8-bit register/memory
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5693 +(define_insn "*mov_lsb"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5694 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,!q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5695 + (subreg:QI (match_operand:HI 1 "general_operand" "d,m,a,d, U") 1))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5696 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5697 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5698 + \t;movlsbqihi: D->B
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5699 + ld%0\t%L1\t;movlsbqihi: msb:%1 -> R:%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5700 + tfr\t%1,d\t;movlsbqihi: R:%1 -> R:%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5701 + stb\t%0\t;movlsbqihi: R:%1 -> %0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5702 + pshs\t%1\t;movlsbqihi: R:%1 -> R:%0\;leas\t1,s\;puls\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5703 + [(set_attr "length" "0,*,2,*,6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5704 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5705 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5706 +;;- load high byte of 16-bit data into 8-bit register/memory
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5707 +(define_insn "*mov_msb"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5708 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,q,m,!q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5709 + (subreg:QI (match_operand:HI 1 "general_operand" "d,O,a,m,d, U") 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5710 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5711 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5712 + tfr\ta,b\t;movmsbqihi: D->B
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5713 + clr%0\t\t;movmsbqihi: ZERO -> R:%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5714 + tfr\t%1,d\t;movmsbqihi: R:%1 -> R:%0\;tfr\ta,b
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5715 + ld%0\t%L1\t;movmsbqihi: lsb:%1 -> R:%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5716 + sta\t%0\t;movmsbqihi: R:%1 -> %0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5717 + pshs\t%1\t;movmsbqihi: R:%1 -> R:%0\;puls\t%0\;leas\t1,s"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5718 + [(set_attr "length" "2,1,4,*,*,6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5719 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5720 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5721 +(define_insn "*movqi_boolean"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5722 + [(set (reg:QI HARD_Z_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5723 + (match_operand:QI 0 "general_operand" "q,O,i,m"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5724 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5725 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5726 + tst%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5727 + andcc\t#~4
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5728 + orcc\t#4
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5729 + tst\t%0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5730 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5731 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5732 +(define_insn "movqi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5733 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,m,q,m,q,z")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5734 + (match_operand:QI 1 "general_operand" " q,O,O,mi,q,z,q"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5735 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5736 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5737 + tfr\t%1,%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5738 + clr%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5739 + clr\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5740 + ld%0\t%1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5741 + st%1\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5742 + tfr\tcc,%0\;and%0\t#4
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5743 + tst%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5744 + [(set_attr "length" "2,1,3,*,*,4,1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5745 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5746 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5747 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5748 +;;- Swap registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5749 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5750 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5751 +; Note: 8-bit swap is never needed so it is not defined.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5752 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5753 +(define_insn "swaphi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5754 + [(set (match_operand:HI 0 "register_operand" "+r")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5755 + (match_operand:HI 1 "register_operand" "+r"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5756 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5757 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5758 + "exg\t%1,%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5759 + [(set_attr "length" "2")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5760 + (set (attr "cycles") (const_int EXG_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5761 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5762 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5763 +(define_insn "bswaphi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5764 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5765 + (bswap:HI (match_operand:HI 1 "register_operand" "0")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5766 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5767 + "exg\ta,b"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5768 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5769 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5770 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5771 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5772 +;;- Extension and truncation insns.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5773 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5774 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5775 +(define_insn "extendqihi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5776 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5777 + (sign_extend:HI (match_operand:QI 1 "general_operand" "B")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5778 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5779 + "sex\t\t;extendqihi2: R:%1 -> R:%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5780 + [(set_attr "length" "1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5781 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5782 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5783 +(define_insn "zero_extendqihi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5784 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5785 + (zero_extend:HI (match_operand:QI 1 "general_operand" "B")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5786 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5787 + "clra\t\t;zero_extendqihi: R:%1 -> R:%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5788 + [(set_attr "length" "1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5789 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5790 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5791 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5792 +;;- All kinds of add instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5793 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5794 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5795 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5796 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5797 +;; gcc's automatic version of addsi3 doesn't know about adcb,adca
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5798 +;; so it is MUCH less efficient. Define this one ourselves.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5799 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5800 +;; TODO - can't always get 'd' for the clobber... allow other registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5801 +;; as well and use exg d,R ... exg R,d around the code sequence to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5802 +;; use others, at a price. Also consider libcall for this when
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5803 +;; optimizing for size.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5804 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5805 +(define_insn "addsi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5806 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5807 + (plus:SI (match_operand:SI 1 "general_operand" "%o")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5808 + (match_operand:SI 2 "general_operand" " oi")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5809 + (clobber (match_scratch:HI 3 "=d"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5810 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5811 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5812 + m6809_output_addsi3 (PLUS, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5813 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5814 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5815 + [(set_attr "length" "21")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5816 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5817 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5818 +; Increment of a 16-bit MEM by 1 can be done without a register.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5819 +(define_insn "*addhi_mem_1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5820 + [(set (match_operand:HI 0 "memory_operand" "=m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5821 + (plus:HI (match_dup 0) (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5822 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5823 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5824 + rtx xoperands[2];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5825 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5826 + xoperands[0] = operands[0];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5827 + xoperands[1] = adjust_address (operands[0], QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5828 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5829 + output_asm_insn ("inc\t%1", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5830 + output_asm_insn ("bne\t__IL%=", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5831 + output_asm_insn ("inc\t%0\;__IL%=:", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5832 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5833 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5834 + [(set_attr "length" "7")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5835 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5836 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5837 +; Decrement of a 16-bit MEM by 1 can be done without a register.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5838 +(define_insn "*addhi_mem_minus1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5839 + [(set (match_operand:HI 0 "memory_operand" "=m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5840 + (plus:HI (match_dup 0) (const_int -1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5841 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5842 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5843 + rtx xoperands[2];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5844 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5845 + xoperands[0] = operands[0];
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5846 + xoperands[1] = adjust_address (operands[0], QImode, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5847 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5848 + output_asm_insn ("tst\t%1", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5849 + output_asm_insn ("bne\t__IL%=", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5850 + output_asm_insn ("dec\t%0", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5851 + output_asm_insn ("__IL%=:", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5852 + output_asm_insn ("dec\t%1", xoperands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5853 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5854 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5855 + [(set_attr "length" "7")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5856 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5857 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5858 +; Allow the addition of an 8-bit quantity to a 16-bit quantity
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5859 +; using the LEAX B,Y addressing mode, where X and Y are both
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5860 +; index registers. This will only get generated via the peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5861 +; which removes a sign extension.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5862 +(define_insn "*addhi_b"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5863 + [(set (match_operand:HI 0 "index_register_operand" "=a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5864 + (plus:HI(match_operand:HI 1 "index_register_operand" "%a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5865 + (match_operand:QI 2 "register_operand" "q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5866 + ))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5867 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5868 + "lea%0\t%2,%1\t;addhi_b: R:%0 = R:%2 + R:%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5869 + [(set_attr "length" "*")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5870 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5871 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5872 +; Splitter for addhi pattern #5 below
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5873 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5874 + [(set (match_operand:HI 0 "index_register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5875 + (plus:HI (match_dup 0) (match_operand:HI 1 "memory_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5876 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5877 + [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5878 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5879 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5880 + (set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5881 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5882 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5883 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5884 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5885 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5886 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5887 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5888 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5889 +; Splitter for addhi pattern #7 below
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5890 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5891 + [(set (match_operand:HI 0 "index_register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5892 + (plus:HI (match_dup 0) (match_operand:HI 1 "index_register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5893 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5894 + [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5895 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5896 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5897 + (set (match_dup 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5898 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 0)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5899 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5900 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5901 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5902 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5903 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5904 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5905 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5906 +; TODO - this is ugly. During RTL generation, we don't know what registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5907 +; are available, so the multiple-insn sequences can only be solved
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5908 +; via 'define_split's during matching. See andhi3 for an example.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5909 +; Keep the constraints with ? modifiers to help reload pick the right
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5910 +; registers.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5911 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5912 +; The forms are:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5913 +; 1. D += D, expand this into a shift instead. (rtx costs should be corrected
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5914 +; to avoid this even happening...)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5915 +; 2. D += U, require U to be pushed to memory. (Lots of patterns do this
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5916 +; now, is this a better way?)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5917 +; 3. Best choice: 'addd'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5918 +; 4. Next best choice: 'lea'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5919 +; 5. Hybrid of 3 and 4
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5920 +; 6. Same as 4, not bad
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5921 +; 7. BAD, no D register at all
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5922 +; 8. 'lea', as good as 4.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5923 +(define_insn "addhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5924 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d, d, a,?a, a,???T,a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5925 + (plus:HI(match_operand:HI 1 "add_general_operand" "%0, 0, 0, d, 0, a, 0, a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5926 + (match_operand:HI 2 "general_operand" " 0, !U, mi, a, m, d, T, i")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5927 + ))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5928 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5929 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5930 + lslb\t\t;addhi: R:%0 += R:%2\;rola\t\t;also R:%0 *= 2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5931 + pshs\t%2\t;addhi: R:%0 += R:%2\;add%0\t,s++
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5932 + add%0\t%2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5933 + lea%0\t%1,%2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5934 + #
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5935 + lea%0\t%2,%1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5936 + #
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5937 + lea%0\t%a2,%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5938 + [(set_attr "length" "2,6,*,*,7,*,7,*")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5939 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5940 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5941 +(define_insn "addqi3_carry"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5942 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5943 + (unspec:QI [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5944 + (match_operand:QI 1 "whole_general_operand" "%0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5945 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_ADD_CARRY))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5946 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5947 + "adc%0\t%2\t;addqi_carry: R:%0 += %2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5948 + [(set_attr "length" "*")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5949 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5950 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5951 +; TODO: specifying 'A' for the first constraint, to force into the A register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5952 +; is not working because of the way registers are currently set up. This will
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5953 +; take some work to get right. Thus the second alternative as a backup.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5954 +(define_insn "addqi3_decimal"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5955 + [(set (match_operand:QI 0 "nonimmediate_operand" "=A,?q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5956 + (unspec:QI [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5957 + (match_operand:QI 1 "general_operand" "%0,0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5958 + (match_operand:QI 2 "general_operand" "mi,mi")] UNSPEC_ADD_DECIMAL))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5959 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5960 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5961 + adda\t%2\;daa
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5962 + tfr\t%0,a\;adda\t%2\;daa\;tfr\ta,%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5963 + [(set_attr "length" "5,9")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5964 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5965 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5966 +(define_insn "addqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5967 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,m,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5968 + (plus:QI (match_operand:QI 1 "whole_general_operand" "%0,0,0,0,0,0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5969 + (match_operand:QI 2 "whole_general_operand" " 0,I,N,I,N,mi")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5970 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5971 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5972 + asl%0\t\t;addqi: R:%0 = R:%0 + R:%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5973 + inc%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5974 + dec%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5975 + inc\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5976 + dec\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5977 + add%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5978 + [(set_attr "length" "1,1,1,3,3,*")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5979 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5980 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5981 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5982 +;;- Subtract instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5983 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5984 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5985 +(define_insn "subsi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5986 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5987 + (minus:SI (match_operand:SI 1 "general_operand" " o")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5988 + (match_operand:SI 2 "general_operand" " oi")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5989 + (clobber (match_scratch:HI 3 "=d"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5990 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5991 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5992 + m6809_output_addsi3 (MINUS, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5993 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5994 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5995 + [(set_attr "length" "21")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5996 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5997 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5998 +(define_insn "subhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
5999 + [(set (match_operand:HI 0 "register_operand" "=d, d, a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6000 + (minus:HI (match_operand:HI 1 "register_operand" "0, 0, 0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6001 + (match_operand:HI 2 "general_operand" "mi, ?U,n")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6002 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6003 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6004 + sub%0\t%2\t;subhi: R:%0 -= %2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6005 + pshs\t%2\t;subhi: R:%0 -= R:%2\;sub%0\t,s++
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6006 + lea%0\t%n2,%1\t;subhi: R:%0 = R:%1 + %n2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6007 + [(set_attr "length" "*,5,3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6008 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6009 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6010 +(define_insn "subqi3_carry"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6011 + [(set (match_operand:QI 0 "register_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6012 + (unspec:QI [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6013 + (match_operand:QI 1 "whole_general_operand" "%0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6014 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_SUB_CARRY))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6015 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6016 + "sbc%0\t%2\t;subqi_carry: R:%0 += %2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6017 + [(set_attr "length" "*")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6018 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6019 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6020 +(define_insn "subqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6021 + [(set (match_operand:QI 0 "register_operand" "=q, q, !q, q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6022 + (minus:QI (match_operand:QI 1 "whole_register_operand" "0, 0, I, 0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6023 + (match_operand:QI 2 "whole_general_operand" "I, mi, 0, t")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6024 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6025 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6026 + dec%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6027 + sub%0\t%2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6028 + dec%0\;neg%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6029 + sub%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6030 + [(set_attr "length" "1,3,2,3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6031 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6032 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6033 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6034 +;;- Multiply instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6035 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6036 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6037 +; TODO - merge these two instructions, using 'extend_operator' to match
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6038 +; either signed or zero extension. Everything else is the same.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6039 +(define_insn "mulqihi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6040 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6041 + (mult:HI (sign_extend:HI (match_operand:QI 1 "general_operand" "%q"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6042 + (match_operand:QI 2 "general_operand" "tmK")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6043 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6044 + "lda\t%2\t;mulqihi3\;mul"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6045 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6046 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6047 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6048 +(define_insn "umulqihi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6049 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6050 + (mult:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%q"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6051 + (match_operand:QI 2 "general_operand" "tmK")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6052 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6053 + "lda\t%2\t;umulqihi3\;mul"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6054 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6055 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6056 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6057 +; Expand a 16x16 multiplication into either a libcall or a shift.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6058 +; If the second operand is a small constant, use the above form.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6059 +; Otherwise, do a libcall.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6060 +(define_expand "mulhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6061 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6062 + (mult:HI (match_operand:HI 1 "general_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6063 + (match_operand:HI 2 "nonmemory_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6064 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6065 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6066 + emit_libcall_insns (HImode, "mulhi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6067 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6068 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6069 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6070 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6071 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6072 +;;- Divide instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6073 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6074 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6075 +(define_expand "divhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6076 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6077 + (div:HI (match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6078 + (match_operand:HI 2 "register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6079 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6080 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6081 + emit_libcall_insns (HImode, "divhi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6082 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6083 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6084 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6085 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6086 +(define_expand "divqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6087 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6088 + (div:QI (match_operand:QI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6089 + (match_operand:QI 2 "register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6090 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6091 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6092 + emit_libcall_insns (QImode, "divqi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6093 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6094 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6095 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6096 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6097 +(define_expand "udivhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6098 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6099 + (udiv:HI (match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6100 + (match_operand:HI 2 "register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6101 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6102 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6103 + emit_libcall_insns (HImode, "udivhi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6104 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6105 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6106 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6107 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6108 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6109 +;;- mod
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6110 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6111 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6112 +(define_expand "modhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6113 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6114 + (mod:HI (match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6115 + (match_operand:HI 2 "register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6116 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6117 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6118 + emit_libcall_insns (HImode, "modhi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6119 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6120 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6121 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6122 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6123 +(define_expand "modqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6124 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6125 + (mod:QI (match_operand:QI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6126 + (match_operand:QI 2 "register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6127 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6128 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6129 + emit_libcall_insns (QImode, "modqi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6130 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6131 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6132 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6133 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6134 +(define_expand "umodhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6135 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6136 + (umod:HI (match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6137 + (match_operand:HI 2 "register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6138 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6139 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6140 + emit_libcall_insns (HImode, "umodhi3", operands, 2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6141 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6142 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6143 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6144 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6145 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6146 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6147 +;;- and, or, xor common patterns
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6148 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6149 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6150 +; Split a bitwise HImode into two QImode instructions, with one of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6151 +; the sources in a pushable register. The register is pushed onto
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6152 +; the stack and memory pop operands (,s+) are used in the QI forms.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6153 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6154 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6155 + (match_operator:HI 3 "logical_bit_operator"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6156 + [(match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6157 + (match_operand:HI 2 "register_operand" "")]))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6158 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6159 + [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 2))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6160 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6161 + [(reg:QI HARD_A_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6162 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6163 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6164 + [(reg:QI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6165 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6166 + (use (reg:QI HARD_A_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6167 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6168 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6169 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6170 +; Split a bitwise HImode into two QImode instructions, with one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6171 +; of the sources being a (MEM (MEM (...)); i.e. an indirect memory
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6172 +; reference. This requires dereferencing the pointer into a
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6173 +; temporary register (X), which must be saved/restored around the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6174 +; compute instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6175 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6176 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6177 + (match_operator:HI 3 "logical_bit_operator"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6178 + [(match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6179 + (mem:HI (match_operand:HI 2 "memory_operand" ""))]))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6180 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6181 + [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6182 + (set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 4))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6183 + (set (match_dup 4) (match_dup 2))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6184 + (set (match_dup 4) (mem:HI (match_dup 4)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6185 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6186 + [(reg:QI HARD_A_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6187 + (mem:QI (post_inc:QI (match_dup 4)))]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6188 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6189 + [(reg:QI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6190 + (mem:QI (post_inc:QI (match_dup 4)))]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6191 + (use (reg:QI HARD_A_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6192 + (set (match_dup 4) (mem:HI (post_inc:HI (reg:HI HARD_S_REGNUM))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6193 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6194 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6195 + /* Use X for a temporary index register */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6196 + operands[4] = gen_rtx_REG (HImode, HARD_X_REGNUM);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6197 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6198 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6199 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6200 +; Split a bitwise HImode into two QImode instructions. This is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6201 +; the common case. This handles splitting when neither of the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6202 +; above two cases applies.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6203 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6204 + [(set (match_operand:HI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6205 + (match_operator:HI 3 "logical_bit_operator"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6206 + [(match_operand:HI 1 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6207 + (match_operand:HI 2 "general_operand" "")]))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6208 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6209 + [(set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6210 + [(reg:QI HARD_A_REGNUM) (match_dup 4)]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6211 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6212 + [(reg:QI HARD_D_REGNUM) (match_dup 5)]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6213 + (use (reg:QI HARD_A_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6214 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6215 + if (GET_CODE (operands[2]) == CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6216 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6217 + operands[4] = gen_rtx_const_high (operands[2]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6218 + operands[5] = gen_rtx_const_low (operands[2]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6219 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6220 + else if ((GET_CODE (operands[2]) == MEM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6221 + && (GET_CODE (XEXP (operands[2], 0)) == MEM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6222 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6223 + FAIL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6224 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6225 + else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6226 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6227 + operands[4] = gen_highpart (QImode, operands[2]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6228 + operands[5] = gen_lowpart (QImode, operands[2]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6229 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6230 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6231 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6232 +; Below are the specific cases for each of the operators.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6233 +; The QImode versions are the simplest and can be implemented
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6234 +; directly on the hardware. The HImode cases are all output
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6235 +; using one of the above splitting techniques.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6236 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6237 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6238 +;;- and
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6239 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6240 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6241 +(define_insn "andhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6242 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6243 + (and:HI (match_operand:HI 1 "register_operand" "%0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6244 + (match_operand:HI 2 "general_operand" "mnU")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6245 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6246 + "#")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6247 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6248 +;; it is not clear that this is correct
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6249 +(define_insn "*andqi_2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6250 + [(set
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6251 + (match_operand:QI 0 "register_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6252 + (and:QI (match_operand:QI 1 "register_operand" "q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6253 + (match_operand 2 "const_int_operand" "i")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6254 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6255 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6256 + if (GET_CODE (operands[2]) == CONST_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6257 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6258 + operands[3] = GEN_INT(INTVAL(operands[2]) & 0xff);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6259 + return "and%0 %3";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6260 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6261 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6262 + return "and%0 %2";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6263 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6264 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6265 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6266 +(define_insn "andqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6267 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,qc")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6268 + (and:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6269 + (match_operand:QI 2 "whole_general_operand" " O,N,m,i")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6270 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6271 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6272 + clr%0\t;andqi(ZERO)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6273 + \t;andqi(-1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6274 + and%0\t%2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6275 + and%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6276 + [(set_attr "length" "1,0,3,2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6277 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6278 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6279 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6280 +;;- or
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6281 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6282 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6283 +(define_insn "iorhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6284 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6285 + (ior:HI (match_operand:HI 1 "register_operand" "%0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6286 + (match_operand:HI 2 "general_operand" "mnU")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6287 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6288 + "#")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6289 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6290 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6291 +(define_insn "iorqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6292 + [(set (match_operand:QI 0 "register_operand" "=q,q, qc")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6293 + (ior:QI (match_operand:QI 1 "whole_register_operand" "%0,0, 0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6294 + (match_operand:QI 2 "whole_general_operand" " O,m,i")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6295 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6296 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6297 + \t;iorqi(ZERO)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6298 + or%0\t%2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6299 + or%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6300 + [(set_attr "length" "0,3,2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6301 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6302 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6303 +;;- xor
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6304 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6305 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6306 +(define_insn "xorhi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6307 + [(set (match_operand:HI 0 "register_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6308 + (xor:HI (match_operand:HI 1 "register_operand" "%0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6309 + (match_operand:HI 2 "general_operand" "mnU")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6310 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6311 + "#")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6312 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6313 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6314 +(define_insn "xorqi3"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6315 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6316 + (xor:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6317 + (match_operand:QI 2 "whole_general_operand" " O,N,m,i")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6318 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6319 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6320 + \t;xorqi(ZERO)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6321 + com%0\t;xorqi(-1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6322 + eor%0\t%2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6323 + eor%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6324 + [(set_attr "length" "0,1,3,2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6325 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6326 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6327 +;;- Two's Complements
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6328 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6329 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6330 +(define_insn "neghi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6331 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,!a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6332 + (neg:HI (match_operand:HI 1 "general_operand" "0, 0")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6333 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6334 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6335 + nega\;negb\;sbca\t#0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6336 + exg\td,%0\;nega\;negb\;sbca\t#0\;exg\td,%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6337 + [(set_attr "length" "5,9")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6338 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6339 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6340 +(define_insn "negqi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6341 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6342 + (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6343 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6344 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6345 + neg%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6346 + neg\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6347 + [(set_attr "length" "1,3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6348 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6349 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6350 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6351 +;;- One's Complements
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6352 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6353 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6354 +(define_insn "one_cmplhi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6355 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,?tm,???a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6356 + (not:HI (match_operand:HI 1 "general_operand" "0, 0, 0")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6357 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6358 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6359 + coma\;comb
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6360 + com\t%0\;com\t%L0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6361 + exg\td,%0\;coma\;comb\;exg\td,%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6362 + [(set_attr "length" "2,6,6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6363 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6364 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6365 +(define_insn "one_cmplqi2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6366 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6367 + (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6368 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6369 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6370 + com%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6371 + com\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6372 + [(set_attr "length" "1,3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6373 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6374 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6375 +;;- Shifts/rotates
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6376 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6377 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6378 +(define_code_iterator bit_code [ashift ashiftrt lshiftrt])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6379 +(define_code_attr bit_code_name [(ashift "ashl") (ashiftrt "ashr") (lshiftrt "lshr")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6380 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6381 +(define_mode_iterator bit_mode [QI HI])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6382 +(define_mode_attr bit_mode_name [(QI "qi3") (HI "hi3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6383 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6384 +;; Emit RTL for any shift (handles all 3 opcodes and 2 mode sizes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6385 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6386 +(define_expand "<bit_code:bit_code_name><bit_mode:bit_mode_name>"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6387 + [(set (match_operand:bit_mode 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6388 + (bit_code:bit_mode (match_operand:bit_mode 1 "general_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6389 + (match_operand:bit_mode 2 "nonmemory_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6390 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6391 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6392 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6393 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6394 +; Individual instructions implemented in the CPU.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6395 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6396 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6397 +(define_insn "*ashift1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6398 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6399 + (ashift:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6400 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6401 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6402 + asl\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6403 + asl%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6404 + [(set_attr "length" "3,1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6405 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6406 +(define_insn "*lshiftrt1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6407 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6408 + (lshiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6409 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6410 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6411 + lsr\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6412 + lsr%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6413 + [(set_attr "length" "3,1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6414 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6415 +(define_insn "*ashiftrt1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6416 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6417 + (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6418 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6419 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6420 + asr\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6421 + asr%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6422 + [(set_attr "length" "3,1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6423 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6424 +(define_insn "*rotate1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6425 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6426 + (rotate:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6427 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6428 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6429 + rol\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6430 + rol%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6431 + [(set_attr "length" "3,1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6432 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6433 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6434 +(define_insn "*rotatert1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6435 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6436 + (rotatert:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6437 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6438 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6439 + ror\t%0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6440 + ror%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6441 + [(set_attr "length" "3,1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6442 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6443 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6444 +; A shift by 8 for D reg can be optimized by just moving
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6445 +; between the A/B halves, and then zero/sign extending or
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6446 +; filling in zeroes.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6447 +; Because GCC does not understand that 'A' and 'D' refer to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6448 +; the same storage location, we must use 'USE' throughout
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6449 +; to prevent deletion of 'unnecessary' instructions.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6450 +; Similar optimization for MEM would require a scratch register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6451 +; so is not done here.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6452 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6453 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6454 + [(set (reg:HI HARD_D_REGNUM) (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6455 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6456 + [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6457 + (use (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6458 + (set (reg:QI HARD_A_REGNUM) (reg:QI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6459 + (use (reg:QI HARD_A_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6460 + (set (reg:QI HARD_D_REGNUM) (const_int 0))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6461 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6462 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6463 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6464 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6465 + [(set (reg:HI HARD_D_REGNUM) (lshiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6466 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6467 + [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6468 + (use (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6469 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6470 + (use (reg:QI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6471 + (set (reg:HI HARD_D_REGNUM) (zero_extend:HI (reg:QI HARD_D_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6472 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6473 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6474 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6475 +(define_split
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6476 + [(set (reg:HI HARD_D_REGNUM) (ashiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6477 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6478 + [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6479 + (use (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6480 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6481 + (use (reg:QI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6482 + (set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6483 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6484 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6485 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6486 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6487 +; On the WPC hardware, there is a shift register that can be used
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6488 +; to compute (1<<n) efficiently in two instructions. Note that this
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6489 +; form only works when using -mint8 though, because C will promote
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6490 +; to 'int' when doing this operation. TODO : we need a 16-bit form too.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6491 +(define_insn "ashlqi3_wpc"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6492 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6493 + (ashift:QI (match_operand:QI 1 "immediate_operand" "I")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6494 + (match_operand:QI 2 "general_operand" "q")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6495 + "TARGET_WPC"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6496 + "st%2\t0x3FF7\;ld%0\t0x3FF7"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6497 + [(set_attr "length" "6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6498 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6499 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6500 +; Internal instructions for shifting by a constant.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6501 +; Two forms are provided, one for QImode, one for HImode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6502 +; These are always split into the above instructions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6503 +; (except for QImode forms that directly match one of the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6504 +; above instructions, in which the condition will not
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6505 +; allow the splitter to match).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6506 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6507 +(define_insn_and_split "<bit_code:bit_code_name>hi3_const"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6508 + [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6509 + (bit_code:HI (match_operand:HI 1 "general_operand" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6510 + (match_operand:HI 2 "immediate_operand" "n")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6511 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6512 + "#"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6513 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6514 + [(const_int 0)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6515 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6516 + m6809_split_shift (<bit_code:CODE>, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6517 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6518 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6519 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6520 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6521 +(define_insn_and_split "<bit_code:bit_code_name>qi3_const"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6522 + [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6523 + (bit_code:QI (match_operand:QI 1 "general_operand" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6524 + (match_operand:QI 2 "immediate_operand" "n")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6525 + "INTVAL (operands[2]) > 1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6526 + "#"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6527 + "&& reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6528 + [(const_int 0)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6529 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6530 + m6809_split_shift (<bit_code:CODE>, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6531 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6532 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6533 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6534 +; Internal instructions for shifting by a nonconstant.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6535 +; These expand into complex assembly.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6536 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6537 +(define_insn "<bit_code:bit_code_name>hi3_reg"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6538 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6539 + (bit_code:HI (match_operand:HI 1 "general_operand" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6540 + (match_operand:HI 2 "nonimmediate_operand" "v")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6541 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6542 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6543 + m6809_output_shift_insn (<bit_code:CODE>, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6544 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6545 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6546 + [(set_attr "length" "20")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6547 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6548 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6549 +(define_insn "<bit_code:bit_code_name>qi3_reg"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6550 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6551 + (bit_code:QI (match_operand:QI 1 "general_operand" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6552 + (match_operand:QI 2 "nonimmediate_operand" "v")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6553 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6554 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6555 + m6809_output_shift_insn (<bit_code:CODE>, operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6556 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6557 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6558 + [(set_attr "length" "16")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6559 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6560 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6561 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6562 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6563 +;;- Jumps and transfers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6564 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6565 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6566 +;;; The casesi pattern is normally *not* defined; see 'tablejump' instead.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6567 +(define_expand "casesi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6568 + [(match_operand:HI 0 "register_operand" "") ; index to jump on
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6569 + (match_operand:HI 1 "immediate_operand" "") ; lower bound
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6570 + (match_operand:HI 2 "immediate_operand" "") ; total range
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6571 + (match_operand 3 "" "") ; table label
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6572 + (match_operand 4 "" "")] ; out of range label
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6573 + "TARGET_BYTE_INT && TARGET_CASESI"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6574 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6575 + m6809_do_casesi (operands[0], operands[1], operands[2],
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6576 + operands[3], operands[4]);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6577 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6578 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6579 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6580 +(define_insn "tablejump_short_offset"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6581 + [(set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6582 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6583 + (zero_extend:HI (match_operand:QI 0 "register_operand" "q")))))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6584 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6585 + "jmp\t[b,x]\t;tablejump_short_offset"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6586 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6587 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6588 +(define_insn "tablejump_long_offset"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6589 + [(set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6590 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6591 + (match_operand:HI 0 "register_operand" "d"))))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6592 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6593 + "jmp\t[d,x]\t;tablejump_long_offset"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6594 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6595 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6596 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6597 + ;; A tablejump operation gives the address in operand 0, with the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6598 + ;; CODE_LABEL for the table in operand 1. The 'define_expand'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6599 + ;; shows the arguments as GCC presents them. For a register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6600 + ;; operand, the assembly code is straightforward. For a MEM,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6601 + ;; assumed to be a SYMBOL_REF, two forms are given, one normal
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6602 + ;; and one for PIC mode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6603 + (define_expand "tablejump"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6604 + [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6605 + (set (pc) (match_operand:HI 0 "" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6606 + (use (label_ref (match_operand 1 "" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6607 + (clobber (match_scratch:HI 2 ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6608 + ])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6609 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6610 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6611 + })
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6612 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6613 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6614 +(define_insn "*tablejump_reg"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6615 + [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6616 + (set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6617 + (match_operand:HI 0 "register_operand" "a"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6618 + (use (label_ref (match_operand 1 "" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6619 + (clobber (match_scratch:HI 2 ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6620 + ])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6621 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6622 + "jmp\t,%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6623 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6624 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6625 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6626 +(define_insn "*tablejump_symbol"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6627 + [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6628 + (set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6629 + (mem:HI
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6630 + (plus:HI (match_operand:HI 0 "register_operand" "a")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6631 + (label_ref (match_operand 1 "" "")))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6632 + (use (label_ref (match_dup 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6633 + (clobber (match_scratch:HI 2 ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6634 + ])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6635 + "!flag_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6636 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6637 + output_asm_insn ("jmp\t[%a1,%0]", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6638 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6639 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6640 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6641 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6642 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6643 +(define_insn "*tablejump_symbol_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6644 + [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6645 + (set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6646 + (mem:HI
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6647 + (plus:HI (match_operand:HI 0 "register_operand" "d")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6648 + (label_ref (match_operand 1 "" "")))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6649 + (use (label_ref (match_dup 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6650 + (clobber (match_scratch:HI 2 "=&a"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6651 + ])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6652 + "flag_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6653 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6654 + output_asm_insn ("lea%2\t%a1,pcr", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6655 + output_asm_insn ("ld%0\t%0,%2", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6656 + output_asm_insn ("jmp\t%0,%2", operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6657 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6658 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6659 + [(set_attr "length" "8")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6660 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6661 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6662 +(define_insn "indirect_jump"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6663 + [(set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6664 + (match_operand:HI 0 "register_operand" "a"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6665 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6666 + "jmp\t,%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6667 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6668 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6669 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6670 +(define_insn "jump"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6671 + [(set (pc) (label_ref (match_operand 0 "" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6672 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6673 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6674 + return output_branch_insn ( LABEL_REF, operands, get_attr_length (insn));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6675 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6676 + [(set (attr "type") (const_string "branch"))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6677 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6678 +; Output assembly for a condition branch instruction.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6679 +(define_insn "*cond_branch"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6680 + [(set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6681 + (if_then_else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6682 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6683 + (label_ref (match_operand 0 "" "")) (pc)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6684 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6685 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6686 + return output_branch_insn ( GET_CODE(operands[1]),
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6687 + operands, get_attr_length (insn));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6688 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6689 + [(set (attr "type") (const_string "cbranch"))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6690 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6691 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6692 +; Similar to above, but for a condition branch instruction that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6693 +; had its operands reversed at some point.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6694 +(define_insn "*cond_branch_reverse"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6695 + [(set (pc)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6696 + (if_then_else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6697 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6698 + (pc) (label_ref (match_operand 0 "" ""))))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6699 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6700 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6701 + return output_branch_insn ( reverse_condition (GET_CODE(operands[1])),
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6702 + operands, get_attr_length (insn));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6703 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6704 + [(set (attr "type") (const_string "cbranch"))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6705 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6706 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6707 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6708 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6709 +;;- Calls
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6710 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6711 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6712 +;; Generate a call instruction for a function that does not
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6713 +;; return a value. The expander is used during RTL generation.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6714 +;; The instructions below are used during matching; only one
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6715 +;; of them will be used, depending on the type of function
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6716 +;; being called. The different conditions are:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6717 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6718 +;; 1) far_functionp - is this a far function? Those need
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6719 +;; to be output as indirect calls through a far-function
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6720 +;; handler.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6721 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6722 +;; 2) noreturn_functionp - if the function does not return,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6723 +;; we can use a 'jmp' instead of a 'jsr' to call it.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6724 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6725 +;; 3) is PIC mode enabled? If so, we'll always use
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6726 +;; relative calls (lbsr or lbra).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6727 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6728 +;; Note: not all combinations are fully supported, especially
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6729 +;; relating to PIC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6730 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6731 +;; The 'bsr' instruction is never generated.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6732 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6733 +(define_expand "call"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6734 + [(call (match_operand:HI 0 "memory_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6735 + (match_operand:HI 1 "general_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6736 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6737 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6738 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6739 +(define_insn "*call_nopic_far"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6740 + [(call (match_operand:HI 0 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6741 + (match_operand:HI 1 "general_operand" "g"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6742 + "far_functionp (operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6743 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6744 + output_far_call_insn (operands, 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6745 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6746 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6747 + [(set_attr "length" "6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6748 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6749 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6750 +; PIC forms come first, and should only match
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6751 +; (MEM (SYMBOL_REF)). Other MEM forms are treated as usual.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6752 +(define_insn "*call_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6753 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6754 + (match_operand:HI 1 "general_operand" "g"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6755 + "flag_pic && !noreturn_functionp (operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6756 + "lbsr\t%C0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6757 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6758 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6759 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6760 +(define_insn "*call_nopic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6761 + [(call (match_operand:HI 0 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6762 + (match_operand:HI 1 "general_operand" "g"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6763 + "!noreturn_functionp (operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6764 + "jsr\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6765 + [(set_attr "length" "3")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6766 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6767 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6768 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6769 +(define_insn "*call_noreturn_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6770 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6771 + (match_operand:HI 1 "general_operand" "g"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6772 + "flag_pic && noreturn_functionp (operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6773 + "lbra\t%C0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6774 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6775 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6776 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6777 +(define_insn "*call_noreturn_nopic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6778 + [(call (match_operand:HI 0 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6779 + (match_operand:HI 1 "general_operand" "g"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6780 + "noreturn_functionp (operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6781 + "jmp\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6782 + [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6783 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6784 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6785 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6786 +;; Same as above, but for functions that do return a value.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6787 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6788 +(define_expand "call_value"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6789 + [(set (match_operand 0 "" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6790 + (call (match_operand:HI 1 "memory_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6791 + (match_operand:HI 2 "general_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6792 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6793 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6794 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6795 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6796 +(define_insn "*call_value_far"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6797 + [(set (match_operand 0 "" "=gz")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6798 + (call (match_operand:HI 1 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6799 + (match_operand:HI 2 "general_operand" "g")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6800 + "far_functionp (operands[1])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6801 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6802 + output_far_call_insn (operands, 1);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6803 + return "";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6804 +}
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6805 + [(set_attr "length" "6")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6806 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6807 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6808 +(define_insn "*call_value_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6809 + [(set (match_operand 0 "" "=gz")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6810 + (call (mem:HI (match_operand:HI 1 "symbolic_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6811 + (match_operand:HI 2 "general_operand" "g")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6812 + "flag_pic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6813 + "lbsr\t%C1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6814 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6815 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6816 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6817 +(define_insn "*call_value_nopic"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6818 + [(set (match_operand 0 "" "=gz")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6819 + (call (match_operand:HI 1 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6820 + (match_operand:HI 2 "general_operand" "g")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6821 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6822 + "jsr\t%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6823 + [(set_attr "length" "3")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6824 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6825 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6826 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6827 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6828 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6829 +;; How to generate an untyped call.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6830 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6831 +(define_expand "untyped_call"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6832 + [(parallel [(call (match_operand 0 "" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6833 + (const_int 0))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6834 + (match_operand 1 "" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6835 + (match_operand 2 "" "")])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6836 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6837 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6838 + int i;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6839 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6840 + emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6841 + for (i=0; i < XVECLEN (operands[2], 0); i++)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6842 + {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6843 + rtx set = XVECEXP (operands[2], 0, i);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6844 + emit_move_insn (SET_DEST (set), SET_SRC (set));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6845 + }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6846 + emit_insn (gen_blockage ());
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6847 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6848 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6849 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6850 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6851 +(define_expand "sibcall"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6852 + [(parallel
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6853 + [(call (match_operand:HI 0 "memory_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6854 + (match_operand:HI 1 "immediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6855 + (use (reg:HI HARD_PC_REGNUM))])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6856 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6857 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6858 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6859 +(define_insn "*sibcall_1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6860 + [(parallel
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6861 + [(call (match_operand:HI 0 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6862 + (match_operand:HI 1 "immediate_operand" "i"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6863 + (use (reg:HI HARD_PC_REGNUM))])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6864 + "SIBLING_CALL_P(insn)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6865 + "jmp\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6866 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6867 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6868 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6869 +(define_expand "sibcall_value"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6870 + [(parallel
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6871 + [(set (match_operand 0 "" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6872 + (call (match_operand:HI 1 "memory_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6873 + (match_operand:HI 2 "immediate_operand" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6874 + (use (reg:HI HARD_PC_REGNUM))])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6875 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6876 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6877 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6878 +(define_insn "*sibcall_value_1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6879 + [(parallel
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6880 + [(set (match_operand 0 "" "=gz")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6881 + (call (match_operand:HI 1 "memory_operand" "m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6882 + (match_operand:HI 2 "immediate_operand" "i")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6883 + (use (reg:HI HARD_PC_REGNUM))])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6884 + "SIBLING_CALL_P(insn)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6885 + "jmp\t%1"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6886 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6887 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6888 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6889 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6890 +;;- Function Entry and Exit
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6891 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6892 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6893 +;; On entry to a function, the stack frame looks as follows:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6894 +;; - return address (pushed by the caller)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6895 +;; - saved registers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6896 +;; - local variable storage
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6897 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6898 +;; If the function does not modify the stack after that, then
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6899 +;; any of these can be accessed directly as an offset from
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6900 +;; STACK_POINTER_REGNUM. Otherwise, a frame pointer is required.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6901 +;; In that case, the prologue must also initialize HARD_FRAME_POINTER_REGNUM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6902 +;; and all references to the stack frame will use that as a base instead.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6903 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6904 +(define_expand "prologue"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6905 + [(const_int 0)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6906 + "prologue_epilogue_required ()"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6907 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6908 + emit_prologue_insns ();
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6909 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6910 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6911 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6912 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6913 +;; The function epilogue does exactly the reverse of the prologue,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6914 +;; deallocating local variable space, restoring saved registers,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6915 +;; and returning.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6916 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6917 +;; For the 6809, the return may be 'rti' if the function was
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6918 +;; declared as an interrupt function, but is normally 'rts'.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6919 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6920 +;; Also, as an optimization, the register restore and the 'rts'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6921 +;; can be combined into a single instruction, by adding 'PC' to the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6922 +;; list of registers to be restored. This is only done if there are
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6923 +;; any saved registers, as 'rts' is more efficient by itself.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6924 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6925 +(define_expand "epilogue"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6926 + [(const_int 0)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6927 + "prologue_epilogue_required ()"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6928 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6929 + emit_epilogue_insns (false);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6930 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6931 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6932 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6933 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6934 +(define_expand "sibcall_epilogue"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6935 + [(const_int 0)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6936 + "prologue_epilogue_required ()"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6937 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6938 + emit_epilogue_insns (true);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6939 + DONE;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6940 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6941 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6942 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6943 +;; The RTS instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6944 +(define_insn "return_rts"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6945 + [(return)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6946 + (use (reg:HI HARD_PC_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6947 + "!m6809_current_function_has_type_attr_p (\"interrupt\")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6948 + && m6809_get_live_regs () == 0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6949 + "rts"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6950 + [(set_attr "length" "1")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6951 + (set (attr "cycles") (const_int RTS_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6952 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6953 +(define_insn "return_puls_pc"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6954 + [(return)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6955 + (use (reg:HI HARD_PC_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6956 + "!m6809_current_function_has_type_attr_p (\"interrupt\")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6957 + && m6809_get_live_regs () != 0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6958 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6959 + [(set_attr "length" "1")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6960 + (set (attr "cycles") (const_int RTS_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6961 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6962 +;; The RTI instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6963 +(define_insn "return_rti"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6964 + [(return)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6965 + (use (reg:HI HARD_PC_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6966 + "m6809_current_function_has_type_attr_p (\"interrupt\")"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6967 + "rti"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6968 + [(set_attr "length" "1")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6969 + (set (attr "cycles") (const_int RTI_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6970 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6971 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6972 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6973 +;;- Unspecified instructions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6974 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6975 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6976 +;; An instruction that has the effect of an unspec_volatile, but
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6977 +;; which doesn't require emitting any assembly code.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6978 +(define_insn "blockage"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6979 + [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6980 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6981 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6982 + [(set_attr "length" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6983 + (set (attr "cycles") (const_int 0))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6984 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6985 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6986 +;; Say how to push multiple registers onto the stack, using
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6987 +;; the 6809 'pshs' instruction. The operand is a regset
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6988 +;; specifying which registers to push.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6989 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6990 +;; The operand mode is not given intentionally, so as to allow
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6991 +;; any possible integer mode for the regset.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6992 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6993 +;; See below for a peephole that can combine consecutive push
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6994 +;; instructions that qualify for merging.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6995 +(define_insn "register_push"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6996 + [(use (reg:HI HARD_S_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6997 + (unspec_volatile
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6998 + [(match_operand 0 "immediate_operand" "")] UNSPEC_PUSH_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
6999 + (clobber (reg:HI HARD_S_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7000 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7001 + "pshs\t%R0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7002 + [(set_attr "length" "2")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7003 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7004 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7005 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7006 +;; Say how to pop multiple registers from the stack, using
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7007 +;; the 6809 'puls' instruction. The operand is the register
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7008 +;; bitset value.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7009 +(define_insn "register_pop"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7010 + [(use (reg:HI HARD_S_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7011 + (unspec_volatile
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7012 + [(match_operand 0 "immediate_operand" "")] UNSPEC_POP_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7013 + (clobber (reg:HI HARD_S_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7014 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7015 + "puls\t%R0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7016 + [(set_attr "length" "2")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7017 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7018 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7019 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7020 +(define_insn "m6809_swi"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7021 + [(unspec_volatile
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7022 + [(match_operand:QI 0 "immediate_operand" "I,n")] UNSPEC_SWI)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7023 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7024 + "@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7025 + swi
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7026 + swi%c0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7027 + [(set_attr "length" "1,2")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7028 + (set (attr "cycles") (const_int SWI_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7029 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7030 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7031 +;; Generate the CWAI instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7032 +(define_insn "m6809_cwai"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7033 + [(unspec_volatile
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7034 + [(match_operand:QI 0 "immediate_operand" "")] UNSPEC_CWAI)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7035 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7036 + "cwai\t%0"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7037 + [(set_attr "length" "2")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7038 + (set (attr "cycles") (const_int CWAI_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7039 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7040 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7041 +;; Generate the SYNC instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7042 +(define_insn "m6809_sync"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7043 + [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7044 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7045 + "sync"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7046 + [(set_attr "length" "1")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7047 + (set (attr "cycles") (const_int SYNC_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7048 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7049 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7050 +;; Generate the NOP instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7051 +(define_insn "nop"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7052 + [(const_int 0)]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7053 + ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7054 + "nop"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7055 + [(set_attr "length" "1")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7056 + (set (attr "cycles") (const_int NOP_CYCLES))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7057 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7058 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7059 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7060 +;;- Peepholes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7061 +;;--------------------------------------------------------------------
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7062 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7063 +;;; Each peephole has an ID that is used for debugging.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7064 +;;; Each peephole condition is bracketed by calls to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7065 +;;; m6809_match_peephole2() also for debugging.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7066 +(define_constants [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7067 + (PEEP_END 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7068 + (PEEP_COND 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7069 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7070 + (PEEP_STACK_STORE_INC 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7071 + (PEEP_STACK_CLEAR_INC 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7072 + (PEEP_LSRB_ADCB 2)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7073 + (PEEP_ABX 3)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7074 + (PEEP_ABX2 4)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7075 + (PEEP_INDEXED_INC 5)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7076 + (PEEP_MEM_DEC 6)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7077 + (PEEP_MEM_INC 7)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7078 + (PEEP_MEM_DEC_CMP 8)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7079 + (PEEP_PUSH2 9)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7080 + (PEEP_STORE_IMPLIES_CC 10)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7081 + (PEEP_DEC_IMPLIES_CC 11)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7082 + (PEEP_LEAB 12)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7083 + (PEEP_LDX_INDIRECT 13)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7084 + (PEEP_POP_JUNK 14)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7085 +])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7086 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7087 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7088 +;;; Optimize 'leas -1,s' followed by 'stb ,s'. This can happen if the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7089 +;;; function prologue needs to allocate stack space and 'b' is placed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7090 +;;; into that local right away. Combine the stack allocation with the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7091 +;;; store using preincrement mode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7092 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7093 + [(set (reg:HI HARD_S_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7094 + (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7095 + (set (mem:QI (reg:HI HARD_S_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7096 + (match_operand:QI 0 "register_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7097 + "m6809_match_peephole2 (PEEP_STACK_STORE_INC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7098 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7099 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7100 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7101 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7102 +;;; Same as above, but for a 'clr ,s' that follows the prologue.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7103 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7104 + [(set (reg:HI HARD_S_REGNUM) (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7105 + (set (mem:QI (reg:HI HARD_S_REGNUM)) (const_int 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7106 + "m6809_match_peephole2 (PEEP_STACK_CLEAR_INC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7107 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (const_int 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7108 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7109 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7110 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7111 +;;; Merge two consecutive push instructions into a single register_push.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7112 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7113 + [(set (match_operand 0 "push_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7114 + (match_operand 1 "register_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7115 + (set (match_operand 2 "push_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7116 + (match_operand 3 "register_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7117 + "m6809_match_peephole2 (PEEP_PUSH2, PEEP_COND)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7118 + && reload_completed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7119 + && GET_MODE (operands[1]) == GET_MODE (operands[3])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7120 + && m6809_can_merge_pushpop_p (UNSPEC_PUSH_RS, 1 << REGNO (operands[1]), 1 << REGNO (operands[3]))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7121 + && m6809_match_peephole2 (PEEP_PUSH2, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7122 + [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7123 + (use (reg:HI HARD_S_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7124 + (unspec_volatile [(match_dup 4)] UNSPEC_PUSH_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7125 + (clobber (reg:HI HARD_S_REGNUM))])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7126 + (use (match_dup 1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7127 + (use (match_dup 3))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7128 +{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7129 + operands[4] = gen_rtx_CONST_INT (QImode,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7130 + (1 << REGNO (operands[1])) | (1 << REGNO (operands[3])));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7131 +})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7132 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7133 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7134 +;;; Convert 'stX ,--s' into a push instruction. Use the regset
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7135 +;;; notation, so that it may be combined with an adjacent regset.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7136 +;;; TBD - this doesn't compile some code cleanly.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7137 +;(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7138 +; [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7139 +; (reg:HI HARD_X_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7140 +; "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7141 +; [(parallel [
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7142 +; (use (reg:HI HARD_S_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7143 +; (unspec_volatile [(match_dup 0)] UNSPEC_PUSH_RS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7144 +; (clobber (reg:HI HARD_S_REGNUM))])]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7145 +;{
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7146 +; operands[0] = gen_rtx_CONST_INT (HImode, X_REGBIT);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7147 +;})
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7148 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7149 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7150 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7151 +;;; q = (q+1)/2 can be optimized as "lsrb; adcb". This also
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7152 +;;; won't overflow when q=0xFF.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7153 +;;; TODO : this form isn't accounting for promotion when
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7154 +;;; using 16-bit ints.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7155 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7156 +(define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7157 + [(set (reg:QI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7158 + (lshiftrt:QI (plus:HI (match_dup 0) (const_int 1)) (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7159 + "m6809_match_peephole2 (PEEP_LSRB_ADCB, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7160 + "lsrb\;adcb\t#0; peephole"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7161 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7162 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7163 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7164 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7165 +;; Optimize the case of following a register store with a test
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7166 +;; of reg or mem just moved.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7167 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7168 +(define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7169 + [(set (match_operand:HI 0 "memory_operand" "=m")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7170 + (match_operand:HI 1 "register_operand" "r"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7171 + (set (cc0) (match_operand:HI 2 "general_operand" "g"))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7172 + "m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_COND)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7173 + && (operands[2] == operands[0] || operands[2] == operands[1])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7174 + && m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7175 + "st%1\t%0\t;movhi: R:%1 -> %0 w/ implied test of %2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7176 + [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7177 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7178 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7179 +;; Optimize a pair of SET instructions in which the second insn
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7180 +;; is the reverse of the first one. I.e.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7181 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7182 +;; A = B
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7183 +;; ----> A = B
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7184 +;; B = A
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7185 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7186 +;; The second insn is redundant. Define two patterns, one for QI, one for HI.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7187 +;; But don't do this if either is a VOLATILE MEM.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7188 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7189 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7190 + (match_operand:HI 1 "nonimmediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7191 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7192 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7193 + [(set (match_dup 0) (match_dup 1))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7194 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7195 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7196 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7197 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7198 + (match_operand:QI 1 "nonimmediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7199 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7200 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7201 + [(set (match_dup 0) (match_dup 1))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7202 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7203 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7204 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7205 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7206 +;; Optimize the sum of an 8-bit and 16-bit using the 'abx' instruction
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7207 +;; if B and X can be used. Two patterns are provided to catch both
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7208 +;; X=X+D and X=D+X.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7209 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7210 +(define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7211 + [(set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7212 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7213 + (set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7214 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7215 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7216 + "abx"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7217 + [(set_attr "length" "1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7218 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7219 +(define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7220 + [(set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7221 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7222 + (set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7223 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7224 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7225 + "abx"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7226 + [(set_attr "length" "1")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7227 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7228 +;;; Likewise, handle when B is scaled by 2 prior to the add.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7229 +;;; Instead of shifting B in 4 cycles, just do the ABX a second
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7230 +;;; time, in only 3 cycles.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7231 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7232 +(define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7233 + [(set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7234 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7235 + (set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7236 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7237 + (set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7238 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7239 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7240 + "abx\;abx"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7241 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7242 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7243 +(define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7244 + [(set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7245 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7246 + (set (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7247 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7248 + (set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7249 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7250 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7251 + "abx\;abx"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7252 + [(set_attr "length" "2")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7253 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7254 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7255 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7256 +;; Work around a compiler bug that generates bad code when copying
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7257 +;; between 32-bit memory addresses after a libcall. The problem seen is
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7258 +;; that the source is MEM (REG X), but X is used as the reload register.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7259 +;; The second half of the copy therefore fails.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7260 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7261 +;; The solution is to switch the reload register to D, since that is guaranteed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7262 +;; not to be in use right after a libcall.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7263 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7264 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7265 + [(set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7266 + (set (match_operand:HI 0 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7267 + (set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7268 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7269 + (set (match_operand:HI 1 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7270 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7271 + [(set (reg:HI HARD_D_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7272 + (set (match_dup 0) (reg:HI HARD_D_REGNUM))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7273 + (set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7274 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7275 + (set (match_dup 1) (reg:HI HARD_X_REGNUM))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7276 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7277 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7278 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7279 +;; Turn "and then test" into a "bit test" operation.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7280 +;; Provide variants for immediate and memory sources
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7281 +;; This is the most used peephople.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7282 +; (define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7283 +; [(set (match_operand:QI 0 "register_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7284 +; (and:QI (match_operand:QI 1 "register_operand" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7285 +; (match_operand:QI 2 "immediate_operand" "i")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7286 +; (set (cc0) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7287 +; ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7288 +; "bit%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7289 +; [(set_attr "length" "3")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7290 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7291 +; (define_peephole
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7292 +; [(set (match_operand:QI 0 "register_operand" "=q")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7293 +; (and:QI (match_operand:QI 1 "register_operand" "0")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7294 +; (match_operand:QI 2 "memory_operand" "m")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7295 +; (set (cc0) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7296 +; ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7297 +; "bit%0\t%2"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7298 +; [(set_attr "length" "4")])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7299 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7300 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7301 +;; Turn a "decrement, then test" sequence into just a "decrement".
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7302 +;; The test can be omitted, since it is implicitly done.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7303 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7304 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7305 + (plus:QI (match_operand:QI 1 "whole_general_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7306 + (match_operand:QI 2 "immediate_operand" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7307 + (set (cc0) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7308 + "m6809_match_peephole2 (PEEP_DEC_IMPLIES_CC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7309 + [(set (match_dup 0) (plus:QI (match_dup 1) (match_dup 2)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7310 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7311 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7312 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7313 +;; Merge an indexed register increment with a previous usage.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7314 +;; This is usually done automatically, but not always
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7315 +;; The 'use' should be optional; in all cases where this has been
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7316 +;; seen, it is required though.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7317 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7318 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7319 + (mem:QI (match_operand:HI 1 "index_register_operand" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7320 + (use (match_dup 0))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7321 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7322 + "m6809_match_peephole2 (PEEP_INDEXED_INC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7323 + [(set (match_dup 0) (mem:QI (post_inc:HI (match_dup 1))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7324 + (use (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7325 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7326 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7327 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7328 +;;; Merge "ldX MEM; ldX ,X" into a single instruction using
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7329 +;;; the indirect mode.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7330 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7331 + [(set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7332 + (mem:HI (match_operand:HI 0 "general_operand" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7333 + (set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7334 + "reload_completed && m6809_match_peephole2 (PEEP_LDX_INDIRECT, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7335 + [(set (reg:HI HARD_X_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7336 + (mem:HI (mem:HI (match_dup 0))))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7337 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7338 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7339 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7340 +;;; Reorder a store followed by a unary operation on that memory
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7341 +;;; so that the unary is performed and then the store. Consider
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7342 +;;; a binary shift operation, which will be decomposed into
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7343 +;;; identical single shifts, also.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7344 +;;; TODO - recognize more than just 'ashift' here.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7345 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7346 + [(set (match_operand:QI 0 "memory_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7347 + (match_operand:QI 1 "register_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7348 + (set (match_dup 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7349 + (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7350 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7351 + [(set (match_dup 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7352 + (ashift:QI (match_dup 1) (match_operand:QI 2 "immediate_operand")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7353 + (set (match_dup 0) (match_dup 1))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7354 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7355 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7356 +;;; Likewise, reorder a unary MEM followed by a load, so that the load
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7357 +;;; is done first, then use the REG instead of the MEM.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7358 +;;;(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7359 +;;; [(set (match_dup 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7360 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7361 +;;; (set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7362 +;;; (match_operand:QI 1 "memory_operand" ""))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7363 +;;; "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7364 +;;; [(set (match_dup 0) (match_dup 1))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7365 +;;; (set (match_dup 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7366 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7367 +;;; "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7368 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7369 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7370 +;;; Replace sex; leaX d,Y with leaX b,Y.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7371 +;;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7372 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7373 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7374 + (set (match_operand:HI 0 "index_register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7375 + (plus:HI (match_operand:HI 1 "index_register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7376 + (reg:HI HARD_D_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7377 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7378 + [(set (match_dup 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7379 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7380 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7381 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7382 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7383 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7384 + (set (match_operand:HI 0 "index_register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7385 + (plus:HI (reg:HI HARD_D_REGNUM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7386 + (match_operand:HI 1 "index_register_operand" "")))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7387 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7388 + [(set (match_dup 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7389 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7390 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7391 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7392 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7393 +;;; Replace ldb; decb; stb; tstb with dec(mem). If the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7394 +;;; register is not needed, then the load will get deleted
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7395 +;;; automatically, but it may be needed for comparisons.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7396 +;;; Same for incb/inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7397 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7398 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7399 + (match_operand:QI 1 "nonimmediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7400 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7401 + (set (match_dup 1) (match_dup 0))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7402 + (set (cc0) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7403 + "m6809_match_peephole2 (PEEP_MEM_DEC_CMP, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7404 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7405 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7406 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7407 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7408 +;;; Replace ldb; decb; stb with dec(mem); ldb. If the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7409 +;;; register is not needed, then the load will get deleted
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7410 +;;; automatically, but it may be needed for comparisons.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7411 +;;; Same for incb/inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7412 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7413 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7414 + (match_operand:QI 1 "nonimmediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7415 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7416 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7417 + "m6809_match_peephole2 (PEEP_MEM_DEC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7418 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7419 + (set (match_dup 0) (match_dup 1))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7420 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7421 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7422 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7423 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7424 + (match_operand:QI 1 "nonimmediate_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7425 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7426 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7427 + "m6809_match_peephole2 (PEEP_MEM_INC, PEEP_END)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7428 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7429 + (set (match_dup 0) (match_dup 1))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7430 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7431 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7432 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7433 +;;; Replace "andb #N; cmpb #N; bhi" with "andb #N", if it can be proven
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7434 +;;; that the branch can never occur because of the limited range of B.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7435 +;;; N must be a power of two for this to make sense. This helps with
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7436 +;;; the default cases of switch statements on a value (x & N).
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7437 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7438 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7439 + (and:QI (match_dup 0) (match_operand:QI 1 "immediate_operand" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7440 + (set (cc0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7441 + (compare (match_dup 0) (match_dup 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7442 + (set (pc) (if_then_else (gtu (cc0) (const_int 0)) (match_operand 2 "" "") (match_operand 3 "" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7443 + ]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7444 + "reload_completed && power_of_two_p (INTVAL (operands[1]) + 1)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7445 + [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7446 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7447 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7448 +;;; Replace ldd <mem>; addd #1; std <mem> with 16-bit increment
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7449 +;;; of the mem, but only if D is dead. Same for 16-bit decrement.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7450 +;;; <mem> must be offsettable for the instruction to match.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7451 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7452 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7453 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int 1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7454 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7455 + "reload_completed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7456 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7457 + && peep2_reg_dead_p (3, operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7458 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7459 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7460 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7461 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7462 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" ""))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7463 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int -1)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7464 + (set (match_dup 1) (match_dup 0))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7465 + "reload_completed
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7466 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7467 + && peep2_reg_dead_p (3, operands[0])"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7468 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int -1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7469 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7470 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7471 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7472 +;;; Replace a load or store using an indexed register, followed by an increment of that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7473 +;;; register, with the combined form using autoincrement.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7474 +(define_peephole2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7475 + [(set (match_operand:QI 0 "register_operand" "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7476 + (mem:QI (match_operand:HI 1 "index_register_operand" "")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7477 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7478 + "reload_completed"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7479 + [(set (match_dup 0) (mem:QI (post_inc (match_dup 1))))]
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7480 + "")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7481 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7482 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7483 +;;- mode:emacs-lisp
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7484 +;;- comment-start: ";;- "
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7485 +;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7486 +;;- eval: (modify-syntax-entry ?[ "(]")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7487 +;;- eval: (modify-syntax-entry ?] ")[")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7488 +;;- eval: (modify-syntax-entry ?{ "(}")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7489 +;;- eval: (modify-syntax-entry ?} "){")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7490 +;-; vim: set ts=2:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7491 +;-; vim: set expandtab:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7492 +;-; vim: set filetype=lisp:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7493 +;;- End:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7494 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.opt gcc-4.6.4/gcc/config/m6809/m6809.opt
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7495 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.opt 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7496 +++ gcc-4.6.4/gcc/config/m6809/m6809.opt 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7497 @@ -0,0 +1,98 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7498 +; Options for the M6809 port of the compiler
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7499 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7500 +; Copyright (C) 2005 Free Software Foundation, Inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7501 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7502 +; This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7503 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7504 +; GCC is free software; you can redistribute it and/or modify it under
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7505 +; the terms of the GNU General Public License as published by the Free
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7506 +; Software Foundation; either version 2, or (at your option) any later
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7507 +; version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7508 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7509 +; GCC is distributed in the hope that it will be useful, but WITHOUT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7510 +; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7511 +; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7512 +; License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7513 +;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7514 +; You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7515 +; along with GCC; see the file COPYING. If not, write to the Free
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7516 +; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7517 +; 02110-1301, USA.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7518 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7519 +margcount
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7520 +Target Mask(ARGCOUNT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7521 +Push argument count
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7522 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7523 +mint8
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7524 +Target RejectNegative Mask(BYTE_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7525 +Use 8-bit integers
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7526 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7527 +mint16
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7528 +Target RejectNegative
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7529 +Use 16-bit integers InverseMask(BYTE_INT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7530 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7531 +mreg-args
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7532 +Target Mask(REG_ARGS)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7533 +Use registers for function arguments
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7534 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7535 +mshort_size
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7536 +Target RejectNegative Mask(SMALL_SIZE_T)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7537 +Use 8-bit size_t
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7538 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7539 +mlong_size
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7540 +Target RejectNegative InverseMask(SMALL_SIZE_T)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7541 +Use 16-bit size_t
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7542 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7543 +mdirect
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7544 +Target Mask(DIRECT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7545 +Enable direct addressing
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7546 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7547 +mwpc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7548 +Target RejectNegative Mask(WPC)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7549 +Enable WPC platform extensions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7550 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7551 +mexperiment
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7552 +Target RejectNegative Mask(EXPERIMENT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7553 +Enable current experimental feature
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7554 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7555 +m6309
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7556 +Target RejectNegative Mask(6309)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7557 +Enable Hitachi 6309 extensions
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7558 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7559 +mcasesi
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7560 +Target RejectNegative Mask(CASESI)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7561 +Enable the casesi pattern
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7562 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7563 +mfar-code-page=
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7564 +Target RejectNegative Joined Var(far_code_page_option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7565 +Sets the far code page value for this compilation unit
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7566 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7567 +mcode-section=
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7568 +Target RejectNegative Joined Var(code_section_ptr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7569 +Sets the name of the section for code
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7570 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7571 +mdata-section=
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7572 +Target RejectNegative Joined Var(data_section_ptr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7573 +Sets the name of the section for initialized data
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7574 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7575 +mbss-section=
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7576 +Target RejectNegative Joined Var(bss_section_ptr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7577 +Sets the name of the section for uninitialized data
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7578 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7579 +mabi_version=
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7580 +Target RejectNegative Joined Var(m6809_abi_version_ptr)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7581 +Sets the calling convention
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7582 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7583 +msoft-reg-count=
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7584 +Target RejectNegative Joined Var(m6809_soft_reg_count)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7585 +Sets the number of soft registers that can be used
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7586 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7587 +mdret
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7588 +Target RejectNegative Mask(DRET)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7589 +Put function call results in D, not X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7590 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7591 +mfar-stack-param
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7592 +Target Mask(FAR_STACK_PARAM)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7593 +Enable stack parameters to a farcall
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7594 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7595 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7596 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809-protos.h gcc-4.6.4/gcc/config/m6809/m6809-protos.h
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7597 --- gcc-4.6.4-clean/gcc/config/m6809/m6809-protos.h 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7598 +++ gcc-4.6.4/gcc/config/m6809/m6809-protos.h 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7599 @@ -0,0 +1,94 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7600 +/* GCC for 6809 : machine-specific function prototypes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7601 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7602 +This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7603 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7604 +GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7605 +it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7606 +the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7607 +any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7608 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7609 +GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7610 +but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7611 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7612 +GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7613 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7614 +You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7615 +along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7616 +<http://www.gnu.org/licenses/>. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7617 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7618 +#ifndef __M6809_PROTOS_H__
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7619 +#define __M6809_PROTOS_H__
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7620 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7621 +void print_options (FILE *file);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7622 +void m6809_cpu_cpp_builtins (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7623 +void m6809_override_options (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7624 +void m6809_init_builtins (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7625 +unsigned int m6809_get_live_regs (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7626 +const char * m6809_get_regs_printable (unsigned int regs);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7627 +unsigned int m6809_get_regs_size (unsigned int regs);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7628 +int m6809_function_has_type_attr_p (tree decl, const char *);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7629 +int m6809_current_function_has_type_attr_p (const char *);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7630 +int prologue_epilogue_required (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7631 +int noreturn_functionp (rtx x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7632 +void output_function_prologue (FILE *file, int size);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7633 +void output_function_epilogue (FILE *file, int size);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7634 +int check_float_value (enum machine_mode mode, double *d, int overflow);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7635 +void m6809_asm_named_section (const char *name, unsigned int flags, tree decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7636 +void m6809_asm_file_start (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7637 +void m6809_output_ascii (FILE *fp, const char *str, unsigned long size);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7638 +void m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7639 +void m6809_reorg (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7640 +int m6809_current_function_is_void (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7641 +int m6809_can_merge_pushpop_p (int op, int regs1, int regs2);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7642 +int m6809_function_value_regno_p (unsigned int regno);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7643 +void emit_prologue_insns (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7644 +void emit_epilogue_insns (bool);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7645 +void m6809_conditional_register_usage (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7646 +void m6809_output_quoted_string (FILE *asm_file, const char *string);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7647 +int m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7648 +int m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7649 +int power_of_two_p (unsigned int n);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7650 +void m6809_do_casesi (rtx index, rtx lower_bound, rtx range, rtx table_label, rtx default_label);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7651 +void m6809_output_addsi3 (int rtx_code, rtx *operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7652 +rtx m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7653 +void expand_constant_shift (int code, rtx dst, rtx src, rtx count);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7654 +int m6809_single_operand_operator (rtx exp);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7655 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7656 +#ifdef TREE_CODE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7657 +int m6809_init_cumulative_args (CUMULATIVE_ARGS cum, tree fntype, rtx libname);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7658 +#endif /* TREE_CODE */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7659 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7660 +#ifdef RTX_CODE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7661 +void print_direct_prefix (FILE *file, rtx addr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7662 +void print_operand (FILE *file, rtx x, int code);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7663 +void print_operand_address (FILE *file, rtx addr);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7664 +void notice_update_cc (rtx exp, rtx insn);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7665 +enum reg_class m6809_preferred_reload_class (rtx x, enum reg_class regclass);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7666 +rtx gen_rtx_const_high (rtx r);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7667 +rtx gen_rtx_const_low (rtx r);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7668 +rtx gen_rtx_register_pushpop (int pop_flag, int regs);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7669 +void emit_libcall_insns (enum machine_mode mode, const char *name, rtx *operands, int count);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7670 +const char * output_branch_insn (enum rtx_code code, rtx *operands, int length);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7671 +void output_far_call_insn (rtx *operands, int has_return);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7672 +void m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7673 +rtx m6809_expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7674 +const char * far_functionp (rtx x);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7675 +rtx m6809_function_value (const tree valtype, const tree func);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7676 +void m6809_output_shift_insn (int rtx_code, rtx *operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7677 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7678 +const char * m6809_get_decl_bank (tree decl);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7679 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7680 +rtx m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7681 +const char * far_function_type_p (tree type);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7682 +void m6809_asm_trampoline_template(FILE *f);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7683 +bool m6809_frame_pointer_required (void);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7684 +int m6809_can_eliminate (int from, int to);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7685 +int m6809_initial_elimination_offset (int from, int to);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7686 +void m6809_emit_move_insn (rtx dst, rtx src);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7687 +void m6809_split_shift (enum rtx_code code, rtx *operands);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7688 +bool m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7689 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7690 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7691 +#endif /* RTX_CODE */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7692 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7693 +#endif /* __M6809_PROTOS_H__ */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7694 diff -urN gcc-4.6.4-clean/gcc/config/m6809/predicates.md gcc-4.6.4/gcc/config/m6809/predicates.md
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7695 --- gcc-4.6.4-clean/gcc/config/m6809/predicates.md 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7696 +++ gcc-4.6.4/gcc/config/m6809/predicates.md 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7697 @@ -0,0 +1,78 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7698 +;; Predicate definitions for Motorola 6809
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7699 +;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7700 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7701 +;; This file is part of GCC.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7702 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7703 +;; GCC is free software; you can redistribute it and/or modify
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7704 +;; it under the terms of the GNU General Public License as published by
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7705 +;; the Free Software Foundation; either version 3, or (at your option)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7706 +;; any later version.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7707 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7708 +;; GCC is distributed in the hope that it will be useful,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7709 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7710 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7711 +;; GNU General Public License for more details.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7712 +;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7713 +;; You should have received a copy of the GNU General Public License
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7714 +;; along with GCC; see the file COPYING3. If not see
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7715 +;; <http://www.gnu.org/licenses/>.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7716 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7717 +;; whole_register_operand is like register_operand, but it
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7718 +;; does not allow SUBREGs.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7719 +(define_predicate "whole_register_operand"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7720 + (and (match_code "reg")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7721 + (match_operand 0 "register_operand")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7722 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7723 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7724 +;; A predicate that matches any index register. This can be used in nameless
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7725 +;; patterns and peepholes which need a 16-bit reg, but not D.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7726 +(define_predicate "index_register_operand"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7727 + (and (match_code "reg")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7728 + (match_test "REGNO (op) == HARD_X_REGNUM || REGNO (op) == HARD_Y_REGNUM || REGNO (op) == HARD_U_REGNUM")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7729 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7730 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7731 +;; match only X
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7732 +(define_predicate "register_operand_x"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7733 + (and (match_code "reg")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7734 + (match_test "REGNO (op) == HARD_X_REGNUM")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7735 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7736 +;; match only D
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7737 +(define_predicate "register_operand_d"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7738 + (and (match_code "reg")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7739 + (match_test "REGNO (op) == HARD_D_REGNUM")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7740 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7741 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7742 +;; Likwise, a replacement for general_operand which excludes
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7743 +;; SUBREGs.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7744 +(define_predicate "whole_general_operand"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7745 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7746 + (match_operand 0 "general_operand")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7747 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7748 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7749 +(define_predicate "add_general_operand"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7750 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7751 + (match_operand 0 "general_operand")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7752 + (match_test "REGNO (op) != SOFT_AP_REGNUM")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7753 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7754 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7755 +(define_predicate "shift_count_operand"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7756 + (and (match_code "const_int")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7757 + (and (match_operand 0 "const_int_operand")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7758 + (match_test "INTVAL (op) == 1 || INTVAL (op) == 8"))))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7759 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7760 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7761 +;; A predicate that matches any bitwise logical operator. This
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7762 +;; allows for a single RTL pattern to be used for multiple operations.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7763 +(define_predicate "logical_bit_operator"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7764 + (ior (match_code "and") (match_code "ior") (match_code "xor")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7765 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7766 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7767 +;; A predicate that matches any shift or rotate operator. This
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7768 +;; allows for a single RTL pattern to be used for multiple operations.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7769 +(define_predicate "shift_rotate_operator"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7770 + (ior (match_code "ashift") (match_code "ashiftrt") (match_code "lshiftrt")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7771 + (match_code "rotate") (match_code "rotatert")))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7772 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7773 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7774 +(define_predicate "symbolic_operand" (match_code "symbol_ref"))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7775 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7776 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-coco gcc-4.6.4/gcc/config/m6809/t-coco
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7777 --- gcc-4.6.4-clean/gcc/config/m6809/t-coco 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7778 +++ gcc-4.6.4/gcc/config/m6809/t-coco 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7779 @@ -0,0 +1,6 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7780 +# For a few minor differences in code generation on the CoCo...
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7781 +T_CFLAGS = -DTARGET_COCO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7782 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7783 +# For doing the startup differently on the CoCo...
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7784 +CRT0STUFF_T_CFLAGS += -Wa,--globalize-symbols -DTARGET_COCO
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7785 +# vim: set filetype=make:
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7786 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-m6809 gcc-4.6.4/gcc/config/m6809/t-m6809
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7787 --- gcc-4.6.4-clean/gcc/config/m6809/t-m6809 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7788 +++ gcc-4.6.4/gcc/config/m6809/t-m6809 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7789 @@ -0,0 +1,64 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7790 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7791 +# ranlib doesn't exist, so define it to 'true' to make it a no-op
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7792 +RANLIB_FOR_TARGET = true
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7793 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7794 +# Stubs for libgcc defined by m6809 are here
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7795 +LIB1ASMSRC = m6809/libgcc1.s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7796 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7797 +# Here are the functions that are implemented within libgcc1.s
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7798 +LIB1ASMFUNCS = _mulhi3 _divhi3 _modhi3 _udivhi3 _umodhi3 \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7799 + _euclid _seuclid _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _softregs \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7800 + _ashlhi3 _ashrhi3 _lshrhi3
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7801 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7802 +# Flags to use when building libgcc. IN_GCC does not seem necessary,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7803 +# although the compile breaks without it. -DDF=SF is required to set
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7804 +# the size of "double" to the same as the size of a "float".
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7805 +TARGET_LIBGCC2_CFLAGS =-DIN_GCC -Dinhibit_libc -DDF=SF -DLIBGCC2_HAS_SF_MODE=0 -DLIBGCC2_HAS_DF_MODE=0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7806 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7807 +LIB2ADDEH =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7808 +LIB2ADDEHSTATIC =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7809 +LIB2ADDEHSHARED =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7810 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7811 +LIBGCC2_DEBUG_CFLAGS =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7812 +LIBGCC2_CFLAGS = -Os $(LIBGCC2_INCLUDES) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7813 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7814 +# Multilib information
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7815 +# This creates multiple versions of libgcc.a for each set of incompatible
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7816 +# -mxxx options.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7817 +MULTILIB_OPTIONS = fpic mdret
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7818 +MULTILIB_DIRNAMES =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7819 +MULTILIB_MATCHES =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7820 +MULTILIB_EXCEPTIONS =
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7821 +EXTRA_MULTILIB_PARTS = crt0.o
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7822 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7823 +LIBGCC = stmp-multilib
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7824 +INSTALL_LIBGCC = install-multilib
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7825 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7826 +# We want fine grained libraries, so use the new code to build the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7827 +# floating point emulation libraries.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7828 +FPBIT = fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7829 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7830 +fp-bit.c: $(srcdir)/config/fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7831 + echo '#define FLOAT' > fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7832 + echo '#define FLOAT_ONLY' >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7833 + echo '#define CMPtype HItype' >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7834 + echo '#define SMALL_MACHINE' >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7835 + echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7836 + echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7837 + echo '#endif' >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7838 + echo '#define DI SI' >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7839 + cat $(srcdir)/config/fp-bit.c >> fp-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7840 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7841 +# crt0.o is built from the following source file
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7842 +CRT0_S = $(srcdir)/config/m6809/crt0.S
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7843 +MCRT0_S = $(srcdir)/config/m6809/crt0.S
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7844 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7845 +# Flags to use when building crt0.o
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7846 +CRT0STUFF_T_CFLAGS += -fno-builtin -nostartfiles -nostdlib
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7847 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7848 +# Assemble startup files.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7849 +$(T)crt0.o: $(CRT0_S) $(GCC_PASSES)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7850 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)crt0.o -x assembler-with-cpp $(CRT0_S)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7851 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7852 +$(T)mcrt0.o: $(MCRT0_S) $(GCC_PASSES)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7853 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)mcrt0.o -x assembler-with-cpp $(MCRT0_S)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7854 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-sim gcc-4.6.4/gcc/config/m6809/t-sim
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7855 --- gcc-4.6.4-clean/gcc/config/m6809/t-sim 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7856 +++ gcc-4.6.4/gcc/config/m6809/t-sim 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7857 @@ -0,0 +1 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7858 +CRT0STUFF_T_CFLAGS += -DTARGET_SIM
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7859 diff -urN gcc-4.6.4-clean/gcc/config.gcc gcc-4.6.4/gcc/config.gcc
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7860 --- gcc-4.6.4-clean/gcc/config.gcc 2013-03-06 10:40:07.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7861 +++ gcc-4.6.4/gcc/config.gcc 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7862 @@ -375,6 +375,9 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7863 cpu_type=m32r
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7864 extra_options="${extra_options} g.opt"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7865 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7866 +m6809-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7867 + cpu_type=m6809
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7868 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7869 m68k-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7870 extra_headers=math-68881.h
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7871 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7872 @@ -1706,6 +1709,12 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7873 thread_file='posix'
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7874 fi
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7875 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7876 +m6809-coco-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7877 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-coco"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7878 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7879 +m6809-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7880 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-sim"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7881 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7882 # m68hc11 and m68hc12 share the same machine description.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7883 m68hc11-*-*|m6811-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7884 tm_file="dbxelf.h elfos.h usegas.h newlib-stdint.h m68hc11/m68hc11.h"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7885 diff -urN gcc-4.6.4-clean/gcc/gcse.c gcc-4.6.4/gcc/gcse.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7886 --- gcc-4.6.4-clean/gcc/gcse.c 2011-02-02 23:04:04.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7887 +++ gcc-4.6.4/gcc/gcse.c 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7888 @@ -833,7 +833,6 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7889 max_distance = (GCSE_COST_DISTANCE_RATIO * cost) / 10;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7890 if (max_distance == 0)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7891 return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7892 -
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7893 gcc_assert (max_distance > 0);
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7894 }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7895 else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7896 diff -urN gcc-4.6.4-clean/gcc/libgcc2.c gcc-4.6.4/gcc/libgcc2.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7897 --- gcc-4.6.4-clean/gcc/libgcc2.c 2011-01-03 13:52:22.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7898 +++ gcc-4.6.4/gcc/libgcc2.c 2017-11-28 21:12:11.156911596 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7899 @@ -485,6 +485,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7900 #endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7901
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7902 #ifdef L_bswapsi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7903 +#if MIN_UNITS_PER_WORD > 1
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7904 SItype
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7905 __bswapsi2 (SItype u)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7906 {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7907 @@ -494,7 +495,9 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7908 | (((u) & 0x000000ff) << 24));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7909 }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7910 #endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7911 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7912 #ifdef L_bswapdi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7913 +#if LONG_LONG_TYPE_SIZE > 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7914 DItype
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7915 __bswapdi2 (DItype u)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7916 {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7917 @@ -508,6 +511,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7918 | (((u) & 0x00000000000000ffull) << 56));
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7919 }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7920 #endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7921 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7922 #ifdef L_ffssi2
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7923 #undef int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7924 int
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7925 @@ -1280,7 +1284,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7926 UDWtype
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7927 __fixunssfDI (SFtype a)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7928 {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7929 -#if LIBGCC2_HAS_DF_MODE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7930 +#if LIBGCC2_HAS_DF_MODE || (FLT_MANT_DIG >= W_TYPE_SIZE)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7931 /* Convert the SFtype to a DFtype, because that is surely not going
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7932 to lose any bits. Some day someone else can write a faster version
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7933 that avoids converting to DFtype, and verify it really works right. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7934 @@ -1298,7 +1302,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7935
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7936 /* Assemble result from the two parts. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7937 return ((UDWtype) hi << W_TYPE_SIZE) | lo;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7938 -#elif FLT_MANT_DIG < W_TYPE_SIZE
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7939 +#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7940 if (a < 1)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7941 return 0;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7942 if (a < Wtype_MAXp1_F)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7943 @@ -1334,8 +1338,6 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7944 return (DWtype)counter << shift;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7945 }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7946 return -1;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7947 -#else
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7948 -# error
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7949 #endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7950 }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7951 #endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7952 diff -urN gcc-4.6.4-clean/gcc/longlong.h gcc-4.6.4/gcc/longlong.h
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7953 --- gcc-4.6.4-clean/gcc/longlong.h 2011-10-04 01:28:50.000000000 -0600
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7954 +++ gcc-4.6.4/gcc/longlong.h 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7955 @@ -528,6 +528,11 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7956 : "cbit")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7957 #endif /* __M32R__ */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7958
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7959 +#if defined (__m6309__) || defined (__m6809__)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7960 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7961 +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7962 +#endif
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7963 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7964 #if defined (__mc68000__) && W_TYPE_SIZE == 32
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7965 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7966 __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7967 diff -urN gcc-4.6.4-clean/gcc/Makefile.in gcc-4.6.4/gcc/Makefile.in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7968 --- gcc-4.6.4-clean/gcc/Makefile.in 2013-04-01 02:32:34.000000000 -0600
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7969 +++ gcc-4.6.4/gcc/Makefile.in 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7970 @@ -2003,14 +2003,14 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7971
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7972 # Compile the start modules crt0.o and mcrt0.o that are linked with
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7973 # every program
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7974 -$(T)crt0.o: s-crt0 ; @true
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7975 -$(T)mcrt0.o: s-crt0; @true
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7976 +crt0.o: s-crt0 ; @true
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7977 +mcrt0.o: s-crt0; @true
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7978
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7979 s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7980 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7981 - -o $(T)crt0.o -c $(CRT0_S)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7982 + -o crt0.o -c $(CRT0_S)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7983 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7984 - -o $(T)mcrt0.o -c $(MCRT0_S)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7985 + -o mcrt0.o -c $(MCRT0_S)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7986 $(STAMP) s-crt0
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7987 #
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7988 # Compiling object files from source files.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7989 diff -urN gcc-4.6.4-clean/gcc/opth-gen.awk gcc-4.6.4/gcc/opth-gen.awk
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7990 --- gcc-4.6.4-clean/gcc/opth-gen.awk 2011-02-08 10:41:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7991 +++ gcc-4.6.4/gcc/opth-gen.awk 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7992 @@ -121,7 +121,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7993 END {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7994 print "/* This file is auto-generated by opth-gen.awk. */"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7995 print ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7996 -print "#ifndef OPTIONS_H"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7997 +print "#if !defined(OPTIONS_H) && !defined(IN_LIBGCC2)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7998 print "#define OPTIONS_H"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
7999 print ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8000 print "#include \"flag-types.h\""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8001 @@ -432,18 +432,9 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8002
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8003 for (i = 0; i < n_opts; i++) {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8004 opt = opt_args("InverseMask", flags[i])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8005 - if (opt ~ ",") {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8006 - vname = var_name(flags[i])
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8007 - macro = "OPTION_"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8008 - mask = "OPTION_MASK_"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8009 - if (vname == "") {
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8010 - vname = "target_flags"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8011 - macro = "TARGET_"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8012 - mask = "MASK_"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8013 - }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8014 - print "#define " macro nth_arg(1, opt) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8015 - " ((" vname " & " mask nth_arg(0, opt) ") == 0)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8016 - }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8017 + if (opt ~ ",")
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8018 + print "#define TARGET_" nth_arg(1, opt) \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8019 + " ((target_flags & MASK_" nth_arg(0, opt) ") == 0)"
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8020 }
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8021 print ""
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8022
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8023 diff -urN gcc-4.6.4-clean/gcc/tree.h gcc-4.6.4/gcc/tree.h
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8024 --- gcc-4.6.4-clean/gcc/tree.h 2011-10-06 13:57:52.000000000 -0600
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8025 +++ gcc-4.6.4/gcc/tree.h 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8026 @@ -3563,6 +3563,8 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8027 TI_UINTDI_TYPE,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8028 TI_UINTTI_TYPE,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8029
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8030 + TI_UINT8_TYPE,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8031 + TI_UINT16_TYPE,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8032 TI_UINT32_TYPE,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8033 TI_UINT64_TYPE,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8034
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8035 diff -urN gcc-4.6.4-clean/gcc/version.c gcc-4.6.4/gcc/version.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8036 --- gcc-4.6.4-clean/gcc/version.c 2009-04-21 13:03:23.000000000 -0600
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8037 +++ gcc-4.6.4/gcc/version.c 2017-11-28 21:20:44.918095673 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8038 @@ -21,16 +21,16 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8039
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8040 /* This is the location of the online document giving instructions for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8041 reporting bugs. If you distribute a modified version of GCC,
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8042 - please configure with --with-bugurl pointing to a document giving
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8043 - instructions for reporting bugs to you, not us. (You are of course
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8044 - welcome to forward us bugs reported to you, if you determine that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8045 - they are not bugs in your modifications.) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8046 + please change this to refer to a document giving instructions for
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8047 + reporting bugs to you, not us. (You are of course welcome to
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8048 + forward us bugs reported to you, if you determine that they are
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8049 + not bugs in your modifications.) */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8050
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8051 -const char bug_report_url[] = BUGURL;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8052 +const char bug_report_url[] = "<URL:http://lost.l-w.ca/coco/lwtools/>";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8053
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8054 /* The complete version string, assembled from several pieces.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8055 BASEVER, DATESTAMP, DEVPHASE, and REVISION are defined by the
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8056 Makefile. */
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8057
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8058 -const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8059 +const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION " (gcc6809lw pl8)";
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8060 const char pkgversion_string[] = PKGVERSION;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8061 diff -urN gcc-4.6.4-clean/libgcc/config.host gcc-4.6.4/libgcc/config.host
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8062 --- gcc-4.6.4-clean/libgcc/config.host 2011-11-23 15:15:54.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8063 +++ gcc-4.6.4/libgcc/config.host 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8064 @@ -371,6 +371,8 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8065 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8066 m32rle-*-linux*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8067 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8068 +m6809*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8069 + ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8070 m68hc11-*-*|m6811-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8071 ;;
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8072 m68hc12-*-*|m6812-*-*)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8073 diff -urN gcc-4.6.4-clean/libgcc/fixed-obj.mk gcc-4.6.4/libgcc/fixed-obj.mk
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8074 --- gcc-4.6.4-clean/libgcc/fixed-obj.mk 2007-09-17 16:18:13.000000000 -0600
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8075 +++ gcc-4.6.4/libgcc/fixed-obj.mk 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8076 @@ -23,7 +23,7 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8077 #$(info $o$(objext): -DL$($o-label) $($o-opt))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8078
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8079 $o$(objext): %$(objext): $(gcc_srcdir)/config/fixed-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8080 - $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8081 + $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide) -save-temps
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8082
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8083 ifeq ($(enable_shared),yes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8084 $(o)_s$(objext): %_s$(objext): $(gcc_srcdir)/config/fixed-bit.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8085 diff -urN gcc-4.6.4-clean/libgcc/Makefile.in gcc-4.6.4/libgcc/Makefile.in
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8086 --- gcc-4.6.4-clean/libgcc/Makefile.in 2012-12-04 12:11:33.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8087 +++ gcc-4.6.4/libgcc/Makefile.in 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8088 @@ -374,8 +374,8 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8089 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8090 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8091 $(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8092 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8093 - $(vis_hide)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8094 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8095 + $(gcc_compile) -DL$* -c $*.c $(vis_hide) -save-temps
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8096 libgcc-objects += $(lib2funcs-o)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8097
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8098 ifeq ($(enable_shared),yes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8099 @@ -410,8 +410,9 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8100 # Build LIB2_DIVMOD_FUNCS.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8101 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8102 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8103 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8104 - -fexceptions -fnon-call-exceptions $(vis_hide)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8105 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8106 + $(gcc_compile) -DL$* -c $*.c \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8107 + -fexceptions -fnon-call-exceptions $(vis_hide) -save-temps
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8108 libgcc-objects += $(lib2-divmod-o)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8109
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8110 ifeq ($(enable_shared),yes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8111 @@ -443,7 +444,8 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8112 ifneq ($(FPBIT),)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8113 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8114 $(fpbit-o): %$(objext): $(FPBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8115 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8116 + ln -sf $(FPBIT) $*.c && \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8117 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8118 libgcc-objects += $(fpbit-o)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8119
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8120 ifeq ($(enable_shared),yes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8121 @@ -458,7 +460,8 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8122 ifneq ($(DPBIT),)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8123 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8124 $(dpbit-o): %$(objext): $(DPBIT)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8125 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8126 + ln -sf $(DPBIT) $*.c && \
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8127 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8128 libgcc-objects += $(dpbit-o)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8129
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8130 ifeq ($(enable_shared),yes)
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8131 diff -urN gcc-4.6.4-clean/README.LW gcc-4.6.4/README.LW
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8132 --- gcc-4.6.4-clean/README.LW 1969-12-31 17:00:00.000000000 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8133 +++ gcc-4.6.4/README.LW 2017-11-28 21:12:11.160911575 -0700
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8134 @@ -0,0 +1,14 @@
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8135 +This is a port of gcc6809 which is designed to work with the lwtools
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8136 +cross-assembler and linker package. You will need several scripts from that
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8137 +package, available at http://lost.l-w.ca/coco/lwtools/, in order to use
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8138 +this. Instructions for building are present in the lwtools package.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8139 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8140 +This work is based extensively on the gcc6809 4.3.4-3 release by Brian
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8141 +Dominy (brian@oddchange.com) with some significant renovations to make it
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8142 +work with gcc 4.6.1.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8143 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8144 +There is no guarantee that it will work for any particular purpose you
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8145 +choose to put it to.
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8146 +
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8147 +If you run into any problems, contact William Astle (lost@l-w.ca). DO NOT
818b096ac128 Add a fix and an improvement to gcc6809 patch
William Astle <lost@l-w.ca>
parents:
diff changeset
8148 +contact the main GCC developers!