1 ;; Machine Descriptions for R8C/M16C/M32C
2 ;; Copyright (C) 2005, 2007
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Red Hat.
6 ;; This file is part of GCC.
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 3, or (at your
11 ;; option) any later version.
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.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
25 [(set (match_operand:QI 0 "mra_or_sp_operand"
26 "=SdRhl,SdRhl,??Rmm,??Rmm, *Raa,*Raa,SdRhl,??Rmm")
27 (plus:QI (match_operand:QI 1 "mra_operand"
29 (match_operand:QI 2 "mrai_operand"
30 "iSdRhl,?Rmm,iSdRhl,?Rmm, iSdRhl,?Rmm,*Raa,*Raa")))]
33 [(set_attr "flags" "oszc")]
37 [(set (match_operand:HI 0 "m32c_nonimmediate_operand"
38 "=SdRhi,SdRhi,??Rmm,??Rmm, SdRhi,??Rmm, Rhi, Raw, Raw, !Rsp")
39 (plus:HI (match_operand:HI 1 "m32c_any_operand"
40 "%0,0,0,0, 0,0, Raw, Rfb, Rfb, 0")
41 (match_operand:HI 2 "m32c_any_operand"
42 "IU2sSdRhi,?Rmm,IU2sSdRhi,?Rmm, IM2,IM2, IS2IU2, I00, IS1, i")))]
55 [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,oszc,n,n,n,oszc")]
58 (define_insn "addpsi3"
59 [(set (match_operand:PSI 0 "m32c_nonimmediate_operand" "=Rpi,Raa,SdRpi,SdRpi,Rsp*Rmm, Rpi,Rpi")
60 (plus:PSI (match_operand:PSI 1 "m32c_nonimmediate_operand" "0,0,0,0,0, Raa,Rad")
61 (match_operand:PSI 2 "m32c_any_operand" "Is3,IS1,iSdRpi,?Rmm,i, i,IS2")))]
71 [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,n,n")]
74 (define_expand "addsi3"
75 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
76 (plus:SI (match_operand:SI 1 "mra_operand" "%0,0,0,0")
77 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
78 "TARGET_A24 ||TARGET_A16"
82 (define_insn "addsi3_1"
83 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,??Rmm,RsiSd,RsiSd,??Rmm,??Rmm,??Rmm,RsiSd")
84 (plus:SI (match_operand:SI 1 "mra_operand" "%0,0,0,0,0,0,0,0")
85 (match_operand 2 "mrai_operand" "IU2,IU2,i,?Rmm,i,RsiSd,?Rmm,RsiSd")))]
89 switch (which_alternative)
92 return \"add.w %X2,%h0\;adcf.w %H0\";
94 return \"add.w %X2,%h0\;adcf.w %H0\";
96 if (GET_CODE (operands[2]) == SYMBOL_REF)
98 output_asm_insn (\"add.w #%%lo(%d2),%h0\",operands);
99 return \"adc.w #%%hi(%d2),%H0\";
103 output_asm_insn (\"add.w %X2,%h0\",operands);
104 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
105 return \"adc.w %X2,%H0\";
108 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
110 output_asm_insn (\"add.w %X2,%h0\",operands);
111 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
112 return \"adc.w %X2,%H0\";
114 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
116 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
118 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
120 [(set_attr "flags" "x,x,x,x,x,x,x,x")]
123 (define_insn "addsi3_2"
124 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
125 (plus:SI (match_operand:SI 1 "mra_operand" "%0,0,0,0")
126 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
129 [(set_attr "flags" "oszc")]
132 (define_insn "subqi3"
133 [(set (match_operand:QI 0 "mra_or_sp_operand"
134 "=SdRhl,SdRhl,??Rmm,??Rmm, Raa,Raa,SdRhl,??Rmm, *Rsp")
135 (minus:QI (match_operand:QI 1 "mra_operand"
136 "0,0,0,0, 0,0,0,0, 0")
137 (match_operand:QI 2 "mrai_operand"
138 "iSdRhl,?Rmm,iSdRhl,?Rmm, iSdRhl,?Rmm,Raa,Raa, i")))]
141 [(set_attr "flags" "oszc")]
144 (define_insn "subhi3"
145 [(set (match_operand:HI 0 "mra_operand"
146 "=SdRhi,SdRhi,??Rmm,??Rmm, SdRhi,??Rmm")
147 (minus:HI (match_operand:HI 1 "mras_operand"
149 (match_operand:HI 2 "mrai_operand"
150 "IU2SdRhi,?Rmm,IU2SdRhi,?Rmm, IM2,IM2")))]
159 [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,oszc")]
162 (define_insn "subpsi3"
163 [(set (match_operand:PSI 0 "mra_operand" "=RpiSd,RpiSd,??Rmm,??Rmm")
164 (minus:PSI (match_operand:PSI 1 "mra_operand" "0,0,0,0")
165 (match_operand:PSI 2 "mrai_operand" "iRpiSd,?Rmm,iRpiSd,?Rmm")))]
168 [(set_attr "flags" "oszc")]
171 (define_expand "subsi3"
172 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
173 (minus:SI (match_operand:SI 1 "mra_operand" "0,0,0,0")
174 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
175 "TARGET_A24 ||TARGET_A16"
179 (define_insn "subsi3_1"
180 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm,??Rmm,RsiSd")
181 (minus:SI (match_operand:SI 1 "mra_operand" "0,0,0,0,0,0")
182 (match_operand:SI 2 "mrai_operand" "i,?Rmm,i,RsiSd,?Rmm,RsiSd")))]
185 switch (which_alternative)
188 output_asm_insn (\"sub.w %X2,%h0\",operands);
189 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
190 return \"sbb.w %X2,%H0\";
192 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
194 output_asm_insn (\"sub.w %X2,%h0\",operands);
195 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
196 return \"sbb.w %X2,%H0\";
198 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
200 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
202 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
204 [(set_attr "flags" "x,x,x,x,x,x")]
207 (define_insn "subsi3_2"
208 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
209 (minus:SI (match_operand:SI 1 "mra_operand" "0,0,0,0")
210 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
213 [(set_attr "flags" "oszc,oszc,oszc,oszc")]
216 (define_insn "negqi2"
217 [(set (match_operand:QI 0 "mra_operand" "=SdRhl,??Rmm")
218 (neg:QI (match_operand:QI 1 "mra_operand" "0,0")))]
221 [(set_attr "flags" "oszc,oszc")]
224 (define_insn "neghi2"
225 [(set (match_operand:HI 0 "mra_operand" "=SdRhi,??Rmm")
226 (neg:HI (match_operand:HI 1 "mra_operand" "0,0")))]
229 [(set_attr "flags" "oszc,oszc")]
232 ; We can negate an SImode by operating on the subparts. GCC deals
233 ; with this itself for larger modes, but not SI.
234 (define_insn "negsi2"
235 [(set (match_operand:SI 0 "mra_operand" "=SdR03,??Rmm")
236 (neg:SI (match_operand:SI 1 "mra_operand" "0,0")))]
238 "not.w %h0 | not.w %H0 | add.w #1,%h0 | adcf.w %H0"
239 [(set_attr "flags" "x")]
242 (define_insn "absqi2"
243 [(set (match_operand:QI 0 "mra_operand" "=RhlSd,??Rmm")
244 (abs:QI (match_operand:QI 1 "mra_operand" "0,0")))]
247 [(set_attr "flags" "oszc")]
250 (define_insn "abshi2"
251 [(set (match_operand:HI 0 "mra_operand" "=RhiSd,??Rmm")
252 (abs:HI (match_operand:HI 1 "mra_operand" "0,0")))]
255 [(set_attr "flags" "oszc")]