1 ;; Machine Descriptions for R8C/M16C/M32C
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 2, 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 COPYING. If not, write to the Free
20 ;; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
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"
30 (match_operand:QI 2 "mrai_operand"
31 "iSdRhl,?Rmm,iSdRhl,?Rmm, iSdRhl,?Rmm,*Raa,*Raa")))]
34 [(set_attr "flags" "oszc")]
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")))]
56 [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,oszc,n,n,n,oszc")]
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")))]
72 [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,n,n")]
75 (define_expand "addsi3"
76 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
77 (plus:SI (match_operand:SI 1 "mra_operand" "%0,0,0,0")
78 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
79 "TARGET_A24 ||TARGET_A16"
83 (define_insn "addsi3_1"
84 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,??Rmm,RsiSd,RsiSd,??Rmm,??Rmm,??Rmm,RsiSd")
85 (plus:SI (match_operand:SI 1 "mra_operand" "%0,0,0,0,0,0,0,0")
86 (match_operand 2 "mrai_operand" "IU2,IU2,i,?Rmm,i,RsiSd,?Rmm,RsiSd")))]
90 switch (which_alternative)
93 return \"add.w %X2,%h0\;adcf.w %H0\";
95 return \"add.w %X2,%h0\;adcf.w %H0\";
97 output_asm_insn (\"add.w %X2,%h0\",operands);
98 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
99 return \"adc.w %X2,%H0\";
101 return \"add.w %h2,%h0\;adc.w %H2,%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\";
107 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
109 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
111 return \"add.w %h2,%h0\;adc.w %H2,%H0\";
113 [(set_attr "flags" "x,x,x,x,x,x,x,x")]
116 (define_insn "addsi3_2"
117 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
118 (plus:SI (match_operand:SI 1 "mra_operand" "%0,0,0,0")
119 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
122 [(set_attr "flags" "oszc")]
125 (define_insn "subqi3"
126 [(set (match_operand:QI 0 "mra_or_sp_operand"
127 "=SdRhl,SdRhl,??Rmm,??Rmm, Raa,Raa,SdRhl,??Rmm, *Rsp")
128 (minus:QI (match_operand:QI 1 "mra_operand"
129 "0,0,0,0, 0,0,0,0, 0")
130 (match_operand:QI 2 "mrai_operand"
131 "iSdRhl,?Rmm,iSdRhl,?Rmm, iSdRhl,?Rmm,Raa,Raa, i")))]
134 [(set_attr "flags" "oszc")]
137 (define_insn "subhi3"
138 [(set (match_operand:HI 0 "mra_operand"
139 "=SdRhi,SdRhi,??Rmm,??Rmm, SdRhi,??Rmm")
140 (minus:HI (match_operand:HI 1 "mras_operand"
142 (match_operand:HI 2 "mrai_operand"
143 "IU2SdRhi,?Rmm,IU2SdRhi,?Rmm, IM2,IM2")))]
152 [(set_attr "flags" "oszc,oszc,oszc,oszc,oszc,oszc")]
155 (define_insn "subpsi3"
156 [(set (match_operand:PSI 0 "mra_operand" "=RpiSd,RpiSd,??Rmm,??Rmm")
157 (minus:PSI (match_operand:PSI 1 "mra_operand" "0,0,0,0")
158 (match_operand:PSI 2 "mrai_operand" "iRpiSd,?Rmm,iRpiSd,?Rmm")))]
161 [(set_attr "flags" "oszc")]
164 (define_expand "subsi3"
165 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
166 (minus:SI (match_operand:SI 1 "mra_operand" "0,0,0,0")
167 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
168 "TARGET_A24 ||TARGET_A16"
172 (define_insn "subsi3_1"
173 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm,??Rmm,RsiSd")
174 (minus:SI (match_operand:SI 1 "mra_operand" "0,0,0,0,0,0")
175 (match_operand:SI 2 "mrai_operand" "i,?Rmm,i,RsiSd,?Rmm,RsiSd")))]
178 switch (which_alternative)
181 output_asm_insn (\"sub.w %X2,%h0\",operands);
182 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
183 return \"sbb.w %X2,%H0\";
185 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
187 output_asm_insn (\"sub.w %X2,%h0\",operands);
188 operands[2]= GEN_INT (INTVAL (operands[2]) >> 16);
189 return \"sbb.w %X2,%H0\";
191 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
193 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
195 return \"sub.w %h2,%h0\;sbb.w %H2,%H0\";
197 [(set_attr "flags" "x,x,x,x,x,x")]
200 (define_insn "subsi3_2"
201 [(set (match_operand:SI 0 "mra_operand" "=RsiSd,RsiSd,??Rmm,??Rmm")
202 (minus:SI (match_operand:SI 1 "mra_operand" "0,0,0,0")
203 (match_operand:SI 2 "mrai_operand" "iRsiSd,?Rmm,iRsiSd,?Rmm")))]
206 [(set_attr "flags" "oszc,oszc,oszc,oszc")]
209 (define_insn "negqi2"
210 [(set (match_operand:QI 0 "mra_operand" "=SdRhl,??Rmm")
211 (neg:QI (match_operand:QI 1 "mra_operand" "0,0")))]
214 [(set_attr "flags" "oszc,oszc")]
217 (define_insn "neghi2"
218 [(set (match_operand:HI 0 "mra_operand" "=SdRhi,??Rmm")
219 (neg:HI (match_operand:HI 1 "mra_operand" "0,0")))]
222 [(set_attr "flags" "oszc,oszc")]
225 ; We can negate an SImode by operating on the subparts. GCC deals
226 ; with this itself for larger modes, but not SI.
227 (define_insn "negsi2"
228 [(set (match_operand:SI 0 "mra_operand" "=SdR03,??Rmm")
229 (neg:SI (match_operand:SI 1 "mra_operand" "0,0")))]
231 "not.w %h0 | not.w %H0 | add.w #1,%h0 | adcf.w %H0"
232 [(set_attr "flags" "x")]
235 (define_insn "absqi2"
236 [(set (match_operand:QI 0 "mra_operand" "=RhlSd,??Rmm")
237 (abs:QI (match_operand:QI 1 "mra_operand" "0,0")))]
240 [(set_attr "flags" "oszc")]
243 (define_insn "abshi2"
244 [(set (match_operand:HI 0 "mra_operand" "=RhiSd,??Rmm")
245 (abs:HI (match_operand:HI 1 "mra_operand" "0,0")))]
248 [(set_attr "flags" "oszc")]