OSDN Git Service

* config/m32c/addsub.md (addqi3): Disparage a0/a1.
[pf3gnuchains/gcc-fork.git] / gcc / config / m32c / addsub.md
1 ;; Machine Descriptions for R8C/M16C/M32C
2 ;; Copyright (C) 2005
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Red Hat.
5 ;;
6 ;; This file is part of GCC.
7 ;;
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
12 ;;
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16 ;; License for more details.
17 ;;
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING.  If not, write to the Free
20 ;; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21 ;; 02110-1301, USA.
22
23 ;; add, sub
24
25 (define_insn "addqi3"
26   [(set (match_operand:QI 0 "mra_or_sp_operand"
27                   "=SdRhl,SdRhl,??Rmm,??Rmm, *Raa,*Raa,SdRhl,??Rmm")
28         (plus:QI (match_operand:QI 1 "mra_operand"
29                   "%0,0,0,0, 0,0,0,0")
30                  (match_operand:QI 2 "mrai_operand"
31                   "iSdRhl,?Rmm,iSdRhl,?Rmm, iSdRhl,?Rmm,*Raa,*Raa")))]
32   ""
33   "add.b\t%2,%0"
34   [(set_attr "flags" "oszc")]
35   )
36
37 (define_insn "addhi3"
38   [(set (match_operand:HI 0 "m32c_nonimmediate_operand"
39                   "=SdRhi,SdRhi,??Rmm,??Rmm, SdRhi,??Rmm, Rhi, Raw, Raw, !Rsp")
40         (plus:HI (match_operand:HI 1 "m32c_any_operand"
41                   "%0,0,0,0, 0,0, Raw, Rfb, Rfb, 0")
42                  (match_operand:HI 2 "m32c_any_operand"
43                   "IU2sSdRhi,?Rmm,IU2sSdRhi,?Rmm, IM2,IM2, IS2IU2, I00, IS1, i")))]
44   ""
45   "@
46    add.w\t%2,%0
47    add.w\t%2,%0
48    add.w\t%2,%0
49    add.w\t%2,%0
50    sub.w\t%m2,%0
51    sub.w\t%m2,%0
52    mova\t%d2[%1],%0
53    stc\t%1,%0
54    mova\t%D2[%1],%0
55    add.w\t%2,%0"
56   [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,oszc,oszc,oszc,oszc,oszc")]
57   )
58
59 (define_insn "addpsi3"
60   [(set (match_operand:PSI 0 "m32c_nonimmediate_operand" "=Rpi,Raa,SdRpi,SdRpi,Rsp*Rmm, Rpi,Rpi")
61         (plus:PSI (match_operand:PSI 1 "m32c_nonimmediate_operand" "0,0,0,0,0, Raa,Rad")
62                   (match_operand:PSI 2 "m32c_any_operand" "Is3,IS1,iSdRpi,?Rmm,i, i,IS2")))]
63   "TARGET_A24"
64   "@
65    add.l:q\t%2,%0
66    addx\t%2,%0
67    add.l\t%2,%0
68    add.l\t%2,%0
69    add.l\t%2,%0
70    mova\t%d2[%1],%0
71    mova\t%D2[%1],%0"
72   [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,*,*")]
73   )
74
75 (define_insn "subqi3"
76   [(set (match_operand:QI 0 "mra_or_sp_operand"
77                    "=SdRhl,SdRhl,??Rmm,??Rmm, Raa,Raa,SdRhl,??Rmm, *Rsp")
78         (minus:QI (match_operand:QI 1 "mra_operand"
79                    "0,0,0,0, 0,0,0,0, 0")
80                   (match_operand:QI 2 "mrai_operand"
81                    "iSdRhl,?Rmm,iSdRhl,?Rmm, iSdRhl,?Rmm,Raa,Raa, i")))]
82   ""
83   "sub.b\t%2,%0"
84   [(set_attr "flags" "oszc")]
85   )
86
87 (define_insn "subhi3"
88   [(set (match_operand:HI 0 "mra_operand"
89                    "=SdRhi,SdRhi,??Rmm,??Rmm, SdRhi,??Rmm")
90         (minus:HI (match_operand:HI 1 "mras_operand"
91                    "0,0,0,0, 0,0")
92                   (match_operand:HI 2 "mrai_operand"
93                    "IU2SdRhi,?Rmm,IU2SdRhi,?Rmm, IM2,IM2")))]
94   ""
95   "@
96    sub.w\t%2,%0
97    sub.w\t%2,%0
98    sub.w\t%2,%0
99    sub.w\t%2,%0
100    add.w\t%m2,%0
101    add.w\t%m2,%0"
102   [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,oszc")]
103   )
104
105 (define_insn "subpsi3"
106   [(set (match_operand:PSI 0 "mra_operand" "=RpiSd,RpiSd,??Rmm,??Rmm")
107         (minus:PSI (match_operand:PSI 1 "mra_operand" "0,0,0,0")
108                    (match_operand:PSI 2 "mrai_operand" "iRpiSd,?Rmm,iRpiSd,?Rmm")))]
109   "TARGET_A24"
110   "sub.%&\t%2,%0"
111   [(set_attr "flags" "oszc")]
112   )
113
114 (define_insn "negqi2"
115   [(set (match_operand:QI 0 "mra_operand" "=SdRhl,??Rmm")
116         (neg:QI (match_operand:QI 1 "mra_operand" "0,0")))]
117   ""
118   "neg.b\t%0"
119   [(set_attr "flags" "oszc,oszc")]
120   )
121
122 (define_insn "neghi2"
123   [(set (match_operand:HI 0 "mra_operand" "=SdRhi,??Rmm")
124         (neg:HI (match_operand:HI 1 "mra_operand" "0,0")))]
125   ""
126   "neg.w\t%0"
127   [(set_attr "flags" "oszc,oszc")]
128   )
129
130 ; We can negate an SImode by operating on the subparts.  GCC deals
131 ; with this itself for larger modes, but not SI.
132 (define_insn "negsi2"
133   [(set (match_operand:SI 0 "mra_operand" "=SdR03,??Rmm")
134         (neg:SI (match_operand:SI 1 "mra_operand" "0,0")))]
135   ""
136   "not.w %h0 | not.w %H0 | add.w #1,%h0 | adcf.w %H0"
137   [(set_attr "flags" "oszc,oszc")]
138   )
139
140 (define_insn "absqi2"
141   [(set (match_operand:QI 0 "mra_operand" "=RhlSd,??Rmm")
142         (abs:QI (match_operand:QI 1 "mra_operand" "0,0")))]
143   ""
144   "abs.b\t%0"
145   [(set_attr "flags" "oszc")]
146   )
147
148 (define_insn "abshi2"
149   [(set (match_operand:HI 0 "mra_operand" "=RhiSd,??Rmm")
150         (abs:HI (match_operand:HI 1 "mra_operand" "0,0")))]
151   ""
152   "abs.w\t%0"
153   [(set_attr "flags" "oszc")]
154   )