| 1 |
;; GCC machine description for NEC V850 |
| 2 |
;; Copyright (C) 1996-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Jeff Law ([email protected]). |
| 4 |
|
| 5 |
;; This file is part of GCC. |
| 6 |
|
| 7 |
;; GCC is free software; you can redistribute it and/or modify |
| 8 |
;; it under the terms of the GNU General Public License as published by |
| 9 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 10 |
;; any later version. |
| 11 |
|
| 12 |
;; GCC is distributed in the hope that it will be useful, |
| 13 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
;; GNU General Public License for more details. |
| 16 |
|
| 17 |
;; You should have received a copy of the GNU General Public License |
| 18 |
;; along with GCC; see the file COPYING3. If not see |
| 19 |
;; <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
;; The original PO technology requires these to be ordered by speed, |
| 22 |
;; so that assigner will pick the fastest. |
| 23 |
|
| 24 |
;; See file "rtl.def" for documentation on define_insn, match_*, et. al. |
| 25 |
|
| 26 |
;; The V851 manual states that the instruction address space is 16M; |
| 27 |
;; the various branch/call instructions only have a 22bit offset (4M range). |
| 28 |
;; |
| 29 |
;; One day we'll probably need to handle calls to targets more than 4M |
| 30 |
;; away. |
| 31 |
;; |
| 32 |
|
| 33 |
;; Condition codes |
| 34 |
;; |
| 35 |
;; Data movement (load, store, register copy) does not modify condition |
| 36 |
;; codes. But there is no way to add two registers together without |
| 37 |
;; modifying the condition codes. |
| 38 |
;; |
| 39 |
;; So we do not expose the condition codes until after reload. The |
| 40 |
;; general approach is to have a define_insn_and_split for the basic |
| 41 |
;; operation with no condition codes in the pattern (to give the |
| 42 |
;; optimizers maximal freedom). The splitter adds a clobber of the |
| 43 |
;; condition codes after reload. There is a distinct pattern which |
| 44 |
;; sets the condition codes. |
| 45 |
;; |
| 46 |
;; As noted, data movement does not affect condition codes. |
| 47 |
;; |
| 48 |
;; Arithmetic generally set the codes in the expected ways, with mul |
| 49 |
;; instructions being a notable outlier. div instructions generally |
| 50 |
;; do the right thing, except when the output registers are the same |
| 51 |
;; when the flags do not get set. We just assume they're clobbered |
| 52 |
;; for div instructions to avoid MD bloat with marginal benefit |
| 53 |
;; |
| 54 |
;; The bit manipulation instructions (clr1, not1, set1) set condition |
| 55 |
;; codes, but not in a useful way (they're set to the prior status of |
| 56 |
;; the bit). So we just model those as clobbers. tst1 does set the |
| 57 |
;; condition codes in a useful way. We could perhaps do better with |
| 58 |
;; these by noting they only modify the Z flag, it doesn't seem worth |
| 59 |
;; the effort. |
| 60 |
;; |
| 61 |
;; Byte swaps seem to change the condition codes, but I haven't tried |
| 62 |
;; to describe how. |
| 63 |
;; |
| 64 |
;; I have no documentation on the rotate instructions. They likely |
| 65 |
;; set the condition codes, but I've left them as clobbers for now. |
| 66 |
|
| 67 |
|
| 68 |
;; The size of instructions in bytes. |
| 69 |
|
| 70 |
;;--------------------------------------------------------------------------- |
| 71 |
;; Constants |
| 72 |
|
| 73 |
;; |
| 74 |
(define_constants |
| 75 |
[(ZERO_REGNUM 0) ; constant zero |
| 76 |
(SP_REGNUM 3) ; Stack Pointer |
| 77 |
(GP_REGNUM 4) ; GP Pointer |
| 78 |
(RV_REGNUM 10) ; Return value register |
| 79 |
(EP_REGNUM 30) ; EP pointer |
| 80 |
(LP_REGNUM 31) ; Return address register |
| 81 |
(CC_REGNUM 32) ; Condition code pseudo register |
| 82 |
(FCC_REGNUM 33) ; Floating Condition code pseudo register |
| 83 |
] |
| 84 |
) |
| 85 |
|
| 86 |
(define_c_enum "unspec" [ |
| 87 |
UNSPEC_LOOP |
| 88 |
UNSPEC_RCP |
| 89 |
UNSPEC_RSQRT |
| 90 |
]) |
| 91 |
|
| 92 |
(define_attr "length" "" |
| 93 |
(const_int 4)) |
| 94 |
|
| 95 |
(define_attr "long_calls" "yes,no" |
| 96 |
(const (if_then_else (symbol_ref "TARGET_LONG_CALLS") |
| 97 |
(const_string "yes") |
| 98 |
(const_string "no")))) |
| 99 |
|
| 100 |
;; Types of instructions (for scheduling purposes). |
| 101 |
|
| 102 |
(define_attr "type" "load,store,bit1,mult,macc,div,fpu,single,other" |
| 103 |
(const_string "other")) |
| 104 |
|
| 105 |
(define_attr "cpu" "none,v850,v850e,v850e1,v850e2,v850e2v3,v850e3v5" |
| 106 |
(cond [(match_test "TARGET_V850") |
| 107 |
(const_string "v850") |
| 108 |
(match_test "TARGET_V850E") |
| 109 |
(const_string "v850e") |
| 110 |
(match_test "TARGET_V850E1") |
| 111 |
(const_string "v850e1") |
| 112 |
(match_test "TARGET_V850E2") |
| 113 |
(const_string "v850e2") |
| 114 |
(match_test "TARGET_V850E2V3") |
| 115 |
(const_string "v850e2v3") |
| 116 |
(match_test "TARGET_V850E3V5") |
| 117 |
(const_string "v850e3v5")] |
| 118 |
(const_string "none"))) |
| 119 |
|
| 120 |
|
| 121 |
;; Function units for the V850. As best as I can tell, there's |
| 122 |
;; a traditional memory load/use stall as well as a stall if |
| 123 |
;; the result of a multiply is used too early. |
| 124 |
|
| 125 |
(define_insn_reservation "v850_other" 1 |
| 126 |
(eq_attr "type" "other") |
| 127 |
"nothing") |
| 128 |
(define_insn_reservation "v850_mult" 2 |
| 129 |
(eq_attr "type" "mult") |
| 130 |
"nothing") |
| 131 |
(define_insn_reservation "v850_memory" 2 |
| 132 |
(eq_attr "type" "load") |
| 133 |
"nothing") |
| 134 |
|
| 135 |
(include "predicates.md") |
| 136 |
(include "constraints.md") |
| 137 |
|
| 138 |
;; ---------------------------------------------------------------------- |
| 139 |
;; MOVE INSTRUCTIONS |
| 140 |
;; ---------------------------------------------------------------------- |
| 141 |
;; movdi |
| 142 |
|
| 143 |
(define_expand "movdi" |
| 144 |
[(set (match_operand:DI 0 "general_operand") |
| 145 |
(match_operand:DI 1 "general_operand"))] |
| 146 |
"TARGET_V850E3V5_UP" |
| 147 |
{ |
| 148 |
/* One of the ops has to be in a register or 0. */ |
| 149 |
if (!register_operand (operand0, DImode) |
| 150 |
&& !register_operand (operand1, DImode)) |
| 151 |
operands[1] = copy_to_mode_reg (DImode, operand1); |
| 152 |
|
| 153 |
if (register_operand (operand0, DImode) |
| 154 |
&& (CONST_INT_P (operands[1]) || CONST_DOUBLE_P (operands[1]))) |
| 155 |
{ |
| 156 |
int i; |
| 157 |
|
| 158 |
for (i = 0; i < UNITS_PER_WORD * 2; i += UNITS_PER_WORD) |
| 159 |
emit_move_insn (simplify_gen_subreg (SImode, operands[0], DImode, i), |
| 160 |
simplify_gen_subreg (SImode, operands[1], DImode, i)); |
| 161 |
DONE; |
| 162 |
} |
| 163 |
} |
| 164 |
) |
| 165 |
|
| 166 |
(define_insn "*movdi_internal" |
| 167 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,e!r,m") |
| 168 |
(match_operand:DI 1 "nonimmediate_operand" "r,m,e!r"))] |
| 169 |
"TARGET_V850E3V5_UP |
| 170 |
|| (register_operand (operands[0], DImode) && register_operand (operands[1], DImode))" |
| 171 |
{ return v850_gen_movdi (operands); } |
| 172 |
[(set_attr "length" "4,12,12") |
| 173 |
(set_attr "type" "other,load,store")]) |
| 174 |
|
| 175 |
;; movqi |
| 176 |
|
| 177 |
(define_expand "movqi" |
| 178 |
[(set (match_operand:QI 0 "general_operand" "") |
| 179 |
(match_operand:QI 1 "general_operand" ""))] |
| 180 |
"" |
| 181 |
{ |
| 182 |
/* One of the ops has to be in a register or 0 */ |
| 183 |
if (!register_operand (operand0, QImode) |
| 184 |
&& !reg_or_0_operand (operand1, QImode)) |
| 185 |
operands[1] = copy_to_mode_reg (QImode, operand1); |
| 186 |
}) |
| 187 |
|
| 188 |
(define_insn "*movqi_internal" |
| 189 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,Q,r,m,m") |
| 190 |
(match_operand:QI 1 "general_operand" "Jr,n,Q,Ir,m,r,I"))] |
| 191 |
"register_operand (operands[0], QImode) |
| 192 |
|| reg_or_0_operand (operands[1], QImode)" |
| 193 |
{ |
| 194 |
return output_move_single (operands); |
| 195 |
} |
| 196 |
[(set_attr "length" "2,4,2,2,4,4,4") |
| 197 |
(set_attr "type" "other,other,load,other,load,store,store")]) |
| 198 |
|
| 199 |
;; movhi |
| 200 |
|
| 201 |
(define_expand "movhi" |
| 202 |
[(set (match_operand:HI 0 "general_operand" "") |
| 203 |
(match_operand:HI 1 "general_operand" ""))] |
| 204 |
"" |
| 205 |
{ |
| 206 |
/* One of the ops has to be in a register or 0 */ |
| 207 |
if (!register_operand (operand0, HImode) |
| 208 |
&& !reg_or_0_operand (operand1, HImode)) |
| 209 |
operands[1] = copy_to_mode_reg (HImode, operand1); |
| 210 |
}) |
| 211 |
|
| 212 |
(define_insn "*movhi_internal" |
| 213 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,Q,r,m,m") |
| 214 |
(match_operand:HI 1 "general_operand" "Jr,n,Q,Ir,m,r,I"))] |
| 215 |
"register_operand (operands[0], HImode) |
| 216 |
|| reg_or_0_operand (operands[1], HImode)" |
| 217 |
{ |
| 218 |
return output_move_single (operands); |
| 219 |
} |
| 220 |
[(set_attr "length" "2,4,2,2,4,4,4") |
| 221 |
(set_attr "type" "other,other,load,other,load,store,store")]) |
| 222 |
|
| 223 |
;; movsi and helpers |
| 224 |
|
| 225 |
(define_insn "*movsi_high" |
| 226 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 227 |
(high:SI (match_operand 1 "immediate_operand" "i")))] |
| 228 |
"" |
| 229 |
"movhi hi(%1),%.,%0" |
| 230 |
[(set_attr "length" "4") |
| 231 |
(set_attr "type" "other")]) |
| 232 |
|
| 233 |
(define_insn "*movsi_lo" |
| 234 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 235 |
(lo_sum:SI (match_operand:SI 1 "register_operand" "r") |
| 236 |
(match_operand:SI 2 "immediate_operand" "i")))] |
| 237 |
"" |
| 238 |
"movea lo(%2),%1,%0" |
| 239 |
[(set_attr "length" "4") |
| 240 |
(set_attr "type" "other")]) |
| 241 |
|
| 242 |
(define_expand "movsi" |
| 243 |
[(set (match_operand:SI 0 "general_operand" "") |
| 244 |
(match_operand:SI 1 "general_operand" ""))] |
| 245 |
"" |
| 246 |
{ |
| 247 |
/* One of the ops has to be in a register or 0 */ |
| 248 |
if (!register_operand (operand0, SImode) |
| 249 |
&& !reg_or_0_operand (operand1, SImode)) |
| 250 |
operands[1] = copy_to_mode_reg (SImode, operand1); |
| 251 |
|
| 252 |
/* Some constants, as well as symbolic operands |
| 253 |
must be done with HIGH & LO_SUM patterns. */ |
| 254 |
if (CONSTANT_P (operands[1]) |
| 255 |
&& GET_CODE (operands[1]) != HIGH |
| 256 |
&& ! (TARGET_V850E_UP) |
| 257 |
&& !special_symbolref_operand (operands[1], VOIDmode) |
| 258 |
&& !(GET_CODE (operands[1]) == CONST_INT |
| 259 |
&& (CONST_OK_FOR_J (INTVAL (operands[1])) |
| 260 |
|| CONST_OK_FOR_K (INTVAL (operands[1])) |
| 261 |
|| CONST_OK_FOR_L (INTVAL (operands[1]))))) |
| 262 |
{ |
| 263 |
rtx temp; |
| 264 |
|
| 265 |
if (reload_in_progress || reload_completed) |
| 266 |
temp = operands[0]; |
| 267 |
else |
| 268 |
temp = gen_reg_rtx (SImode); |
| 269 |
|
| 270 |
emit_insn (gen_rtx_SET (temp, gen_rtx_HIGH (SImode, operand1))); |
| 271 |
emit_insn (gen_rtx_SET (operand0, |
| 272 |
gen_rtx_LO_SUM (SImode, temp, operand1))); |
| 273 |
DONE; |
| 274 |
} |
| 275 |
}) |
| 276 |
|
| 277 |
;; This is the same as the following pattern, except that it includes |
| 278 |
;; support for arbitrary 32-bit immediates. |
| 279 |
|
| 280 |
;; ??? This always loads addresses using hilo. If the only use of this address |
| 281 |
;; was in a load/store, then we would get smaller code if we only loaded the |
| 282 |
;; upper part with hi, and then put the lower part in the load/store insn. |
| 283 |
|
| 284 |
(define_insn "*movsi_internal_v850e" |
| 285 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,Q,r,r,m,m,r") |
| 286 |
(match_operand:SI 1 "general_operand" "Jr,K,L,Q,Ir,m,R,r,I,i"))] |
| 287 |
"(TARGET_V850E_UP) |
| 288 |
&& (register_operand (operands[0], SImode) |
| 289 |
|| reg_or_0_operand (operands[1], SImode))" |
| 290 |
{ |
| 291 |
return output_move_single (operands); |
| 292 |
} |
| 293 |
[(set_attr "length" "2,4,4,2,2,4,4,4,4,6") |
| 294 |
(set_attr "type" "other,other,other,load,other,load,other,store,store,other")]) |
| 295 |
|
| 296 |
(define_insn "*movsi_internal" |
| 297 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,Q,r,r,m,m") |
| 298 |
(match_operand:SI 1 "movsi_source_operand" "Jr,K,L,Q,Ir,m,R,r,I"))] |
| 299 |
"register_operand (operands[0], SImode) |
| 300 |
|| reg_or_0_operand (operands[1], SImode)" |
| 301 |
{ |
| 302 |
return output_move_single (operands); |
| 303 |
} |
| 304 |
[(set_attr "length" "2,4,4,2,2,4,4,4,4") |
| 305 |
(set_attr "type" "other,other,other,load,other,load,store,store,other")]) |
| 306 |
|
| 307 |
(define_insn "*movsf_internal" |
| 308 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,r,r,r,Q,r,m,m,r") |
| 309 |
(match_operand:SF 1 "general_operand" "Jr,K,L,n,Q,Ir,m,r,IG,iF"))] |
| 310 |
"register_operand (operands[0], SFmode) |
| 311 |
|| reg_or_0_operand (operands[1], SFmode)" |
| 312 |
{ |
| 313 |
return output_move_single (operands); |
| 314 |
} |
| 315 |
[(set_attr "length" "2,4,4,8,2,2,4,4,4,8") |
| 316 |
(set_attr "type" "other,other,other,other,load,other,load,store,store,other")]) |
| 317 |
|
| 318 |
;; ---------------------------------------------------------------------- |
| 319 |
;; TEST INSTRUCTIONS |
| 320 |
;; ---------------------------------------------------------------------- |
| 321 |
|
| 322 |
(define_insn "*v850_tst1" |
| 323 |
[(set (reg:CCZ CC_REGNUM) |
| 324 |
(compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "m") |
| 325 |
(const_int 1) |
| 326 |
(match_operand:QI 1 "const_int_operand" "n")) |
| 327 |
(const_int 0)))] |
| 328 |
"reload_completed" |
| 329 |
"tst1 %1,%0" |
| 330 |
[(set_attr "length" "4")]) |
| 331 |
|
| 332 |
;; This replaces ld.b;sar;andi with tst1;setf nz. |
| 333 |
;; Should there be variants for HI or SI modes? |
| 334 |
|
| 335 |
(define_insn_and_split "" |
| 336 |
[(set (match_operand:SI 0 "register_operand" "") |
| 337 |
(compare (zero_extract:SI (match_operand:QI 1 "memory_operand" "") |
| 338 |
(const_int 1) |
| 339 |
(match_operand 2 "const_int_operand" "")) |
| 340 |
(const_int 0)))] |
| 341 |
"" |
| 342 |
"#" |
| 343 |
"reload_completed" |
| 344 |
[(set (reg:CCZ CC_REGNUM) (compare (zero_extract:SI (match_dup 1) |
| 345 |
(const_int 1) |
| 346 |
(match_dup 2)) |
| 347 |
(const_int 0))) |
| 348 |
(set (match_dup 0) (ne:SI (reg:CCZ CC_REGNUM) (const_int 0)))]) |
| 349 |
|
| 350 |
(define_expand "cbranchsi4" |
| 351 |
[(set (pc) |
| 352 |
(if_then_else |
| 353 |
(match_operator 0 "comparison_operator" |
| 354 |
[(match_operand:SI 1 "register_operand") |
| 355 |
(match_operand:SI 2 "reg_or_int5_operand")]) |
| 356 |
(label_ref (match_operand 3 "" "")) |
| 357 |
(pc)))] |
| 358 |
"") |
| 359 |
|
| 360 |
(define_insn "cmpsi_insn" |
| 361 |
[(set (reg:CC CC_REGNUM) |
| 362 |
(compare (match_operand:SI 0 "register_operand" "r,r") |
| 363 |
(match_operand:SI 1 "reg_or_int5_operand" "r,J")))] |
| 364 |
"reload_completed" |
| 365 |
"cmp %1,%0" |
| 366 |
[(set_attr "length" "2,2")]) |
| 367 |
|
| 368 |
(define_insn_and_split "cbranchsf4" |
| 369 |
[(set (pc) |
| 370 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 371 |
[(match_operand:SF 1 "register_operand" "r") |
| 372 |
(match_operand:SF 2 "register_operand" "r")]) |
| 373 |
(label_ref (match_operand 3 "")) |
| 374 |
(pc)))] |
| 375 |
"TARGET_USE_FPU" |
| 376 |
"#" |
| 377 |
"reload_completed" |
| 378 |
[(set (match_dup 4) (match_dup 5)) |
| 379 |
(set (pc) |
| 380 |
(if_then_else (match_dup 6) |
| 381 |
(label_ref (match_dup 3)) |
| 382 |
(pc)))] |
| 383 |
"{ |
| 384 |
/* This will generate the comparison insn at the start of |
| 385 |
the sequence and get us the right mode to use for our |
| 386 |
condition code registers. */ |
| 387 |
enum machine_mode mode |
| 388 |
= v850_gen_float_compare (GET_CODE (operands[0]), |
| 389 |
GET_MODE (operands[1]), |
| 390 |
operands[1], operands[2]); |
| 391 |
/* We want operands referring to CC_REGNUM and FCC_REGNUM |
| 392 |
in mode MODE. */ |
| 393 |
operands[4] = gen_rtx_REG (mode, CC_REGNUM); |
| 394 |
operands[5] = gen_rtx_REG (mode, FCC_REGNUM); |
| 395 |
if (mode == CC_FPU_NEmode) |
| 396 |
operands[6] = gen_rtx_NE (mode, operands[4], const0_rtx); |
| 397 |
else |
| 398 |
operands[6] = gen_rtx_EQ (mode, operands[4], const0_rtx); |
| 399 |
}") |
| 400 |
|
| 401 |
(define_insn "cstoresf4" |
| 402 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 403 |
(match_operator:SI 1 "ordered_comparison_operator" |
| 404 |
[(match_operand:SF 2 "register_operand" "r") |
| 405 |
(match_operand:SF 3 "register_operand" "r")])) |
| 406 |
(clobber (reg:CC CC_REGNUM))] |
| 407 |
"TARGET_USE_FPU" |
| 408 |
{ |
| 409 |
if (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE) |
| 410 |
return "cmpf.s %c1, %z2, %z3 ; trfsr ; setf nz, %0"; |
| 411 |
if (GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE) |
| 412 |
return "cmpf.s %c1, %z2, %z3 ; trfsr ; setf z, %0"; |
| 413 |
if (GET_CODE (operands[1]) == EQ) |
| 414 |
return "cmpf.s eq, %z2, %z3 ; trfsr ; setf z, %0"; |
| 415 |
if (GET_CODE (operands[1]) == NE) |
| 416 |
return "cmpf.s neq, %z2, %z3 ; trfsr ; setf nz, %0"; |
| 417 |
gcc_unreachable (); |
| 418 |
} |
| 419 |
[(set_attr "length" "12") |
| 420 |
(set_attr "type" "fpu")]) |
| 421 |
|
| 422 |
(define_insn_and_split "cbranchdf4" |
| 423 |
[(set (pc) |
| 424 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 425 |
[(match_operand:DF 1 "even_reg_operand" "r") |
| 426 |
(match_operand:DF 2 "even_reg_operand" "r")]) |
| 427 |
(label_ref (match_operand 3 "")) |
| 428 |
(pc)))] |
| 429 |
"TARGET_USE_FPU" |
| 430 |
"#" |
| 431 |
"reload_completed" |
| 432 |
;; How to get the mode here? |
| 433 |
[(set (match_dup 4) (match_dup 5)) |
| 434 |
(set (pc) |
| 435 |
(if_then_else (match_dup 6) |
| 436 |
(label_ref (match_dup 3)) |
| 437 |
(pc)))] |
| 438 |
"{ |
| 439 |
/* This will generate the comparison insn at the start of |
| 440 |
the sequence and get us the right mode to use for our |
| 441 |
condition code registers. */ |
| 442 |
enum machine_mode mode |
| 443 |
= v850_gen_float_compare (GET_CODE (operands[0]), |
| 444 |
GET_MODE (operands[1]), |
| 445 |
operands[1], operands[2]); |
| 446 |
PUT_MODE (operands[0], mode); |
| 447 |
/* We want operands referring to CC_REGNUM and FCC_REGNUM |
| 448 |
in mode MODE. */ |
| 449 |
operands[4] = gen_rtx_REG (mode, CC_REGNUM); |
| 450 |
operands[5] = gen_rtx_REG (mode, FCC_REGNUM); |
| 451 |
if (mode == CC_FPU_NEmode) |
| 452 |
operands[6] = gen_rtx_NE (mode, operands[4], const0_rtx); |
| 453 |
else |
| 454 |
operands[6] = gen_rtx_EQ (mode, operands[4], const0_rtx); |
| 455 |
}") |
| 456 |
|
| 457 |
(define_insn "cstoredf4" |
| 458 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 459 |
(match_operator:SI 1 "ordered_comparison_operator" |
| 460 |
[(match_operand:DF 2 "even_reg_operand" "r") |
| 461 |
(match_operand:DF 3 "even_reg_operand" "r")])) |
| 462 |
(clobber (reg:CC CC_REGNUM))] |
| 463 |
"TARGET_USE_FPU" |
| 464 |
{ |
| 465 |
if (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE) |
| 466 |
return "cmpf.d %c1, %z2, %z3 ; trfsr ; setf nz, %0"; |
| 467 |
if (GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE) |
| 468 |
return "cmpf.d %c1, %z2, %z3 ; trfsr ; setf z, %0"; |
| 469 |
if (GET_CODE (operands[1]) == EQ) |
| 470 |
return "cmpf.d eq, %z2, %z3 ; trfsr ; setf z ,%0"; |
| 471 |
if (GET_CODE (operands[1]) == NE) |
| 472 |
return "cmpf.d neq, %z2, %z3 ; trfsr ; setf nz, %0"; |
| 473 |
gcc_unreachable (); |
| 474 |
} |
| 475 |
[(set_attr "length" "12") |
| 476 |
(set_attr "type" "fpu")]) |
| 477 |
|
| 478 |
;; ---------------------------------------------------------------------- |
| 479 |
;; ADD INSTRUCTIONS |
| 480 |
;; ---------------------------------------------------------------------- |
| 481 |
|
| 482 |
(define_insn_and_split "addsi3" |
| 483 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 484 |
(plus:SI (match_operand:SI 1 "register_operand" "%0,r,r") |
| 485 |
(match_operand:SI 2 "nonmemory_operand" "rJ,K,U")))] |
| 486 |
"" |
| 487 |
"#" |
| 488 |
"reload_completed" |
| 489 |
[(parallel [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2))) |
| 490 |
(clobber (reg:CC CC_REGNUM))])]) |
| 491 |
|
| 492 |
(define_insn "addsi3_clobber_flags" |
| 493 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 494 |
(plus:SI (match_operand:SI 1 "register_operand" "%0,r,r") |
| 495 |
(match_operand:SI 2 "nonmemory_operand" "rJ,K,U"))) |
| 496 |
(clobber (reg:CC CC_REGNUM))] |
| 497 |
"" |
| 498 |
"@ |
| 499 |
add %2,%0 |
| 500 |
addi %2,%1,%0 |
| 501 |
addi %O2(%P2),%1,%0" |
| 502 |
[(set_attr "length" "2,4,4")]) |
| 503 |
|
| 504 |
(define_insn "addsi3_set_flags" |
| 505 |
[(set (reg:CCNZ CC_REGNUM) |
| 506 |
(compare:CCNZ (plus:SI (match_operand:SI 1 "register_operand" "%0,r,r") |
| 507 |
(match_operand:SI 2 "nonmemory_operand" "rJ,K,U")) |
| 508 |
(const_int 0))) |
| 509 |
(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 510 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 511 |
"reload_completed" |
| 512 |
"@ |
| 513 |
add %2,%0 |
| 514 |
addi %2,%1,%0 |
| 515 |
addi %O2(%P2),%1,%0" |
| 516 |
[(set_attr "length" "2,4,4")]) |
| 517 |
|
| 518 |
;; ---------------------------------------------------------------------- |
| 519 |
;; SUBTRACT INSTRUCTIONS |
| 520 |
;; ---------------------------------------------------------------------- |
| 521 |
(define_insn_and_split "subsi3" |
| 522 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 523 |
(minus:SI (match_operand:SI 1 "register_operand" "0,r") |
| 524 |
(match_operand:SI 2 "register_operand" "r,0")))] |
| 525 |
"" |
| 526 |
"#" |
| 527 |
"reload_completed" |
| 528 |
[(parallel [(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2))) |
| 529 |
(clobber (reg:CC CC_REGNUM))])]) |
| 530 |
|
| 531 |
(define_insn "subsi3_clobber_flags" |
| 532 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 533 |
(minus:SI (match_operand:SI 1 "register_operand" "0,r") |
| 534 |
(match_operand:SI 2 "register_operand" "r,0"))) |
| 535 |
(clobber (reg:CC CC_REGNUM))] |
| 536 |
"" |
| 537 |
"@ |
| 538 |
sub %2,%0 |
| 539 |
subr %1,%0" |
| 540 |
[(set_attr "length" "2,2")]) |
| 541 |
|
| 542 |
(define_insn "*subsi3_set_flags" |
| 543 |
[(set (reg:CCNZ CC_REGNUM) |
| 544 |
(compare:CCNZ (minus:SI (match_operand:SI 1 "register_operand" "0,r") |
| 545 |
(match_operand:SI 2 "nonmemory_operand" "r,0")) |
| 546 |
(const_int 0))) |
| 547 |
(set (match_operand:SI 0 "register_operand" "=r,r") |
| 548 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 549 |
"reload_completed" |
| 550 |
"@ |
| 551 |
sub %2,%0 |
| 552 |
subr %1,%0" |
| 553 |
[(set_attr "length" "2,2")]) |
| 554 |
|
| 555 |
(define_insn_and_split "negsi2" |
| 556 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 557 |
(neg:SI (match_operand:SI 1 "register_operand" "0")))] |
| 558 |
"" |
| 559 |
"#" |
| 560 |
"reload_completed" |
| 561 |
[(parallel [(set (match_dup 0) (neg:SI (match_dup 1))) |
| 562 |
(clobber (reg:CC CC_REGNUM))])]) |
| 563 |
|
| 564 |
(define_insn "negsi2_clobber_flags" |
| 565 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 566 |
(neg:SI (match_operand:SI 1 "register_operand" "0"))) |
| 567 |
(clobber (reg:CC CC_REGNUM))] |
| 568 |
"" |
| 569 |
"subr %.,%0" |
| 570 |
[(set_attr "length" "2")]) |
| 571 |
|
| 572 |
(define_insn "*negsi2_set_flags" |
| 573 |
[(set (reg:CCNZ CC_REGNUM) |
| 574 |
(compare:CCNZ (neg:SI (match_operand:SI 1 "register_operand" "0")) |
| 575 |
(const_int 0))) |
| 576 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 577 |
(neg:SI (match_dup 1)))] |
| 578 |
"reload_completed" |
| 579 |
"subr %.,%0" |
| 580 |
[(set_attr "length" "2")]) |
| 581 |
|
| 582 |
;; ---------------------------------------------------------------------- |
| 583 |
;; MULTIPLY INSTRUCTIONS |
| 584 |
;; ---------------------------------------------------------------------- |
| 585 |
|
| 586 |
(define_expand "mulhisi3" |
| 587 |
[(set (match_operand:SI 0 "register_operand" "") |
| 588 |
(mult:SI |
| 589 |
(sign_extend:SI (match_operand:HI 1 "register_operand" "")) |
| 590 |
(sign_extend:SI (match_operand:HI 2 "nonmemory_operand" ""))))] |
| 591 |
"" |
| 592 |
{ |
| 593 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 594 |
{ |
| 595 |
emit_insn (gen_mulhisi3_internal2 (operands[0], operands[1], operands[2])); |
| 596 |
DONE; |
| 597 |
} |
| 598 |
}) |
| 599 |
|
| 600 |
(define_insn "*mulhisi3_internal1" |
| 601 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 602 |
(mult:SI |
| 603 |
(sign_extend:SI (match_operand:HI 1 "register_operand" "%0")) |
| 604 |
(sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))] |
| 605 |
"" |
| 606 |
"mulh %2,%0" |
| 607 |
[(set_attr "length" "2") |
| 608 |
(set_attr "type" "mult")]) |
| 609 |
|
| 610 |
(define_insn "mulhisi3_internal2" |
| 611 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 612 |
(mult:SI |
| 613 |
(sign_extend:SI (match_operand:HI 1 "register_operand" "%0,r")) |
| 614 |
(match_operand:HI 2 "const_int_operand" "J,K")))] |
| 615 |
"" |
| 616 |
"@ |
| 617 |
mulh %2,%0 |
| 618 |
mulhi %2,%1,%0" |
| 619 |
[(set_attr "length" "2,4") |
| 620 |
(set_attr "type" "mult")]) |
| 621 |
|
| 622 |
;; ??? The scheduling info is probably wrong. |
| 623 |
|
| 624 |
;; ??? This instruction can also generate the 32-bit highpart, but using it |
| 625 |
;; may increase code size counter to the desired result. |
| 626 |
|
| 627 |
;; ??? This instructions can also give a DImode result. |
| 628 |
|
| 629 |
;; ??? There is unsigned version, but it matters only for the DImode/highpart |
| 630 |
;; results. |
| 631 |
|
| 632 |
(define_insn "mulsi3" |
| 633 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 634 |
(mult:SI (match_operand:SI 1 "register_operand" "%0") |
| 635 |
(match_operand:SI 2 "reg_or_int9_operand" "rO")))] |
| 636 |
"(TARGET_V850E_UP)" |
| 637 |
"mul %2,%1,%." |
| 638 |
[(set_attr "length" "4") |
| 639 |
(set_attr "type" "mult")]) |
| 640 |
|
| 641 |
;; ---------------------------------------------------------------------- |
| 642 |
;; DIVIDE INSTRUCTIONS |
| 643 |
;; ---------------------------------------------------------------------- |
| 644 |
|
| 645 |
;; ??? These insns do set the Z/N condition codes, except that they are based |
| 646 |
;; on only one of the two results, so it doesn't seem to make sense to use |
| 647 |
;; them. |
| 648 |
|
| 649 |
;; ??? The scheduling info is probably wrong. |
| 650 |
|
| 651 |
(define_insn "divmodsi4" |
| 652 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 653 |
(div:SI (match_operand:SI 1 "register_operand" "0") |
| 654 |
(match_operand:SI 2 "register_operand" "r"))) |
| 655 |
(set (match_operand:SI 3 "register_operand" "=r") |
| 656 |
(mod:SI (match_dup 1) |
| 657 |
(match_dup 2))) |
| 658 |
(clobber (reg:CC CC_REGNUM))] |
| 659 |
"TARGET_V850E_UP" |
| 660 |
{ |
| 661 |
if (TARGET_V850E2_UP) |
| 662 |
return "divq %2,%0,%3"; |
| 663 |
else |
| 664 |
return "div %2,%0,%3"; |
| 665 |
} |
| 666 |
[(set_attr "length" "4") |
| 667 |
(set_attr "type" "div")]) |
| 668 |
|
| 669 |
(define_insn "udivmodsi4" |
| 670 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 671 |
(udiv:SI (match_operand:SI 1 "register_operand" "0") |
| 672 |
(match_operand:SI 2 "register_operand" "r"))) |
| 673 |
(set (match_operand:SI 3 "register_operand" "=r") |
| 674 |
(umod:SI (match_dup 1) |
| 675 |
(match_dup 2))) |
| 676 |
(clobber (reg:CC CC_REGNUM))] |
| 677 |
"TARGET_V850E_UP" |
| 678 |
{ |
| 679 |
if (TARGET_V850E2_UP) |
| 680 |
return "divqu %2,%0,%3"; |
| 681 |
else |
| 682 |
return "divu %2,%0,%3"; |
| 683 |
} |
| 684 |
[(set_attr "length" "4") |
| 685 |
(set_attr "type" "div")]) |
| 686 |
|
| 687 |
;; ??? There is a 2 byte instruction for generating only the quotient. |
| 688 |
;; However, it isn't clear how to compute the length field correctly. |
| 689 |
|
| 690 |
(define_insn "divmodhi4" |
| 691 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 692 |
(div:HI (match_operand:HI 1 "register_operand" "0") |
| 693 |
(match_operand:HI 2 "register_operand" "r"))) |
| 694 |
(set (match_operand:HI 3 "register_operand" "=r") |
| 695 |
(mod:HI (match_dup 1) |
| 696 |
(match_dup 2))) |
| 697 |
(clobber (reg:CC CC_REGNUM))] |
| 698 |
"TARGET_V850E_UP" |
| 699 |
"sxh %0\\n\\tdivh %2,%0,%3" |
| 700 |
[(set_attr "length" "6") |
| 701 |
(set_attr "type" "div")]) |
| 702 |
|
| 703 |
;; The half word needs to be zero/sign extended to 32 bits before doing |
| 704 |
;; the division/modulo operation. |
| 705 |
|
| 706 |
(define_insn "udivmodhi4" |
| 707 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 708 |
(udiv:HI (match_operand:HI 1 "register_operand" "0") |
| 709 |
(match_operand:HI 2 "register_operand" "r"))) |
| 710 |
(set (match_operand:HI 3 "register_operand" "=r") |
| 711 |
(umod:HI (match_dup 1) |
| 712 |
(match_dup 2))) |
| 713 |
(clobber (reg:CC CC_REGNUM))] |
| 714 |
"TARGET_V850E_UP" |
| 715 |
"zxh %0\\n\\ndivhu %2,%0,%3" |
| 716 |
[(set_attr "length" "6") |
| 717 |
(set_attr "type" "div")]) |
| 718 |
|
| 719 |
;; ---------------------------------------------------------------------- |
| 720 |
;; AND INSTRUCTIONS |
| 721 |
;; ---------------------------------------------------------------------- |
| 722 |
|
| 723 |
(define_insn "*v850_clr1_1" |
| 724 |
[(set (match_operand:QI 0 "memory_operand" "=m") |
| 725 |
(subreg:QI |
| 726 |
(and:SI (subreg:SI (match_dup 0) 0) |
| 727 |
(match_operand:QI 1 "not_power_of_two_operand" "")) 0)) |
| 728 |
(clobber (reg:CC CC_REGNUM))] |
| 729 |
"" |
| 730 |
{ |
| 731 |
rtx xoperands[2]; |
| 732 |
xoperands[0] = operands[0]; |
| 733 |
xoperands[1] = GEN_INT (~INTVAL (operands[1]) & 0xff); |
| 734 |
output_asm_insn ("clr1 %M1,%0", xoperands); |
| 735 |
return ""; |
| 736 |
} |
| 737 |
[(set_attr "length" "4") |
| 738 |
(set_attr "type" "bit1")]) |
| 739 |
|
| 740 |
(define_insn "*v850_clr1_2" |
| 741 |
[(set (match_operand:HI 0 "indirect_operand" "=m") |
| 742 |
(subreg:HI |
| 743 |
(and:SI (subreg:SI (match_dup 0) 0) |
| 744 |
(match_operand:HI 1 "not_power_of_two_operand" "")) 0)) |
| 745 |
(clobber (reg:CC CC_REGNUM))] |
| 746 |
"" |
| 747 |
{ |
| 748 |
int log2 = exact_log2 (~INTVAL (operands[1]) & 0xffff); |
| 749 |
|
| 750 |
rtx xoperands[2]; |
| 751 |
xoperands[0] = gen_rtx_MEM (QImode, |
| 752 |
plus_constant (Pmode, XEXP (operands[0], 0), |
| 753 |
log2 / 8)); |
| 754 |
xoperands[1] = GEN_INT (log2 % 8); |
| 755 |
output_asm_insn ("clr1 %1,%0", xoperands); |
| 756 |
return ""; |
| 757 |
} |
| 758 |
[(set_attr "length" "4") |
| 759 |
(set_attr "type" "bit1")]) |
| 760 |
|
| 761 |
(define_insn "*v850_clr1_3" |
| 762 |
[(set (match_operand:SI 0 "indirect_operand" "=m") |
| 763 |
(and:SI (match_dup 0) |
| 764 |
(match_operand:SI 1 "not_power_of_two_operand" ""))) |
| 765 |
(clobber (reg:CC CC_REGNUM))] |
| 766 |
"" |
| 767 |
{ |
| 768 |
int log2 = exact_log2 (~INTVAL (operands[1]) & 0xffffffff); |
| 769 |
|
| 770 |
rtx xoperands[2]; |
| 771 |
xoperands[0] = gen_rtx_MEM (QImode, |
| 772 |
plus_constant (Pmode, XEXP (operands[0], 0), |
| 773 |
log2 / 8)); |
| 774 |
xoperands[1] = GEN_INT (log2 % 8); |
| 775 |
output_asm_insn ("clr1 %1,%0", xoperands); |
| 776 |
return ""; |
| 777 |
} |
| 778 |
[(set_attr "length" "4") |
| 779 |
(set_attr "type" "bit1")]) |
| 780 |
|
| 781 |
(define_insn_and_split "andsi3" |
| 782 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 783 |
(and:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 784 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M")))] |
| 785 |
"" |
| 786 |
"#" |
| 787 |
"reload_completed" |
| 788 |
[(parallel [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 2))) |
| 789 |
(clobber (reg:CC CC_REGNUM))])]) |
| 790 |
|
| 791 |
(define_insn "andsi3_clobber_flags" |
| 792 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 793 |
(and:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 794 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M"))) |
| 795 |
(clobber (reg:CC CC_REGNUM))] |
| 796 |
"reload_completed" |
| 797 |
"@ |
| 798 |
and %2,%0 |
| 799 |
and %.,%0 |
| 800 |
andi %2,%1,%0" |
| 801 |
[(set_attr "length" "2,2,4")]) |
| 802 |
|
| 803 |
(define_insn "andsi3_set_flags" |
| 804 |
[(set (reg:CC CC_REGNUM) |
| 805 |
(compare:CC (and:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 806 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M")) |
| 807 |
(const_int 0))) |
| 808 |
(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 809 |
(and:SI (match_dup 1) (match_dup 2)))] |
| 810 |
"reload_completed" |
| 811 |
"@ |
| 812 |
and %2,%0 |
| 813 |
and %.,%0 |
| 814 |
andi %2,%1,%0" |
| 815 |
[(set_attr "length" "2,2,4")]) |
| 816 |
|
| 817 |
;; ---------------------------------------------------------------------- |
| 818 |
;; OR INSTRUCTIONS |
| 819 |
;; ---------------------------------------------------------------------- |
| 820 |
|
| 821 |
(define_insn "*v850_set1_1" |
| 822 |
[(set (match_operand:QI 0 "memory_operand" "=m") |
| 823 |
(subreg:QI (ior:SI (subreg:SI (match_dup 0) 0) |
| 824 |
(match_operand 1 "power_of_two_operand" "")) 0)) |
| 825 |
(clobber (reg:CC CC_REGNUM))] |
| 826 |
"" |
| 827 |
"set1 %M1,%0" |
| 828 |
[(set_attr "length" "4") |
| 829 |
(set_attr "type" "bit1")]) |
| 830 |
|
| 831 |
(define_insn "*v850_set1_2" |
| 832 |
[(set (match_operand:HI 0 "indirect_operand" "=m") |
| 833 |
(subreg:HI (ior:SI (subreg:SI (match_dup 0) 0) |
| 834 |
(match_operand 1 "power_of_two_operand" "")) 0))] |
| 835 |
"" |
| 836 |
{ |
| 837 |
int log2 = exact_log2 (INTVAL (operands[1])); |
| 838 |
|
| 839 |
if (log2 < 8) |
| 840 |
return "set1 %M1,%0"; |
| 841 |
else |
| 842 |
{ |
| 843 |
rtx xoperands[2]; |
| 844 |
xoperands[0] = gen_rtx_MEM (QImode, |
| 845 |
plus_constant (Pmode, XEXP (operands[0], 0), |
| 846 |
log2 / 8)); |
| 847 |
xoperands[1] = GEN_INT (log2 % 8); |
| 848 |
output_asm_insn ("set1 %1,%0", xoperands); |
| 849 |
} |
| 850 |
return ""; |
| 851 |
} |
| 852 |
[(set_attr "length" "4") |
| 853 |
(set_attr "type" "bit1")]) |
| 854 |
|
| 855 |
(define_insn "*v850_set1_3" |
| 856 |
[(set (match_operand:SI 0 "indirect_operand" "=m") |
| 857 |
(ior:SI (match_dup 0) |
| 858 |
(match_operand 1 "power_of_two_operand" ""))) |
| 859 |
(clobber (reg:CC CC_REGNUM))] |
| 860 |
"" |
| 861 |
{ |
| 862 |
int log2 = exact_log2 (INTVAL (operands[1])); |
| 863 |
|
| 864 |
if (log2 < 8) |
| 865 |
return "set1 %M1,%0"; |
| 866 |
else |
| 867 |
{ |
| 868 |
rtx xoperands[2]; |
| 869 |
xoperands[0] = gen_rtx_MEM (QImode, |
| 870 |
plus_constant (Pmode, XEXP (operands[0], 0), |
| 871 |
log2 / 8)); |
| 872 |
xoperands[1] = GEN_INT (log2 % 8); |
| 873 |
output_asm_insn ("set1 %1,%0", xoperands); |
| 874 |
} |
| 875 |
return ""; |
| 876 |
} |
| 877 |
[(set_attr "length" "4") |
| 878 |
(set_attr "type" "bit1")]) |
| 879 |
|
| 880 |
(define_insn_and_split "iorsi3" |
| 881 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 882 |
(ior:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 883 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M")))] |
| 884 |
"" |
| 885 |
"#" |
| 886 |
"reload_completed" |
| 887 |
[(parallel [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 2))) |
| 888 |
(clobber (reg:CC CC_REGNUM))])]) |
| 889 |
|
| 890 |
(define_insn "iorsi3_clobber_flags" |
| 891 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 892 |
(ior:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 893 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M"))) |
| 894 |
(clobber (reg:CC CC_REGNUM))] |
| 895 |
"" |
| 896 |
"@ |
| 897 |
or %2,%0 |
| 898 |
or %.,%0 |
| 899 |
ori %2,%1,%0" |
| 900 |
[(set_attr "length" "2,2,4")]) |
| 901 |
|
| 902 |
(define_insn "*iorsi3_set_flags" |
| 903 |
[(set (reg:CC CC_REGNUM) |
| 904 |
(compare:CC (ior:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 905 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M")) |
| 906 |
(const_int 0))) |
| 907 |
(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 908 |
(ior:SI (match_dup 1) (match_dup 2)))] |
| 909 |
"reload_completed" |
| 910 |
"@ |
| 911 |
or %2,%0 |
| 912 |
or %.,%0 |
| 913 |
ori %2,%1,%0" |
| 914 |
[(set_attr "length" "2,2,4")]) |
| 915 |
|
| 916 |
;; ---------------------------------------------------------------------- |
| 917 |
;; XOR INSTRUCTIONS |
| 918 |
;; ---------------------------------------------------------------------- |
| 919 |
|
| 920 |
(define_insn "*v850_not1_1" |
| 921 |
[(set (match_operand:QI 0 "memory_operand" "=m") |
| 922 |
(subreg:QI (xor:SI (subreg:SI (match_dup 0) 0) |
| 923 |
(match_operand 1 "power_of_two_operand" "")) 0)) |
| 924 |
(clobber (reg:CC CC_REGNUM))] |
| 925 |
"" |
| 926 |
"not1 %M1,%0" |
| 927 |
[(set_attr "length" "4") |
| 928 |
(set_attr "type" "bit1")]) |
| 929 |
|
| 930 |
(define_insn "*v850_not1_2" |
| 931 |
[(set (match_operand:HI 0 "indirect_operand" "=m") |
| 932 |
(subreg:HI (xor:SI (subreg:SI (match_dup 0) 0) |
| 933 |
(match_operand 1 "power_of_two_operand" "")) 0))] |
| 934 |
"" |
| 935 |
{ |
| 936 |
int log2 = exact_log2 (INTVAL (operands[1])); |
| 937 |
|
| 938 |
if (log2 < 8) |
| 939 |
return "not1 %M1,%0"; |
| 940 |
else |
| 941 |
{ |
| 942 |
rtx xoperands[2]; |
| 943 |
xoperands[0] = gen_rtx_MEM (QImode, |
| 944 |
plus_constant (Pmode, XEXP (operands[0], 0), |
| 945 |
log2 / 8)); |
| 946 |
xoperands[1] = GEN_INT (log2 % 8); |
| 947 |
output_asm_insn ("not1 %1,%0", xoperands); |
| 948 |
} |
| 949 |
return ""; |
| 950 |
} |
| 951 |
[(set_attr "length" "4") |
| 952 |
(set_attr "type" "bit1")]) |
| 953 |
|
| 954 |
(define_insn "*v850_not1_3" |
| 955 |
[(set (match_operand:SI 0 "indirect_operand" "=m") |
| 956 |
(xor:SI (match_dup 0) |
| 957 |
(match_operand 1 "power_of_two_operand" ""))) |
| 958 |
(clobber (reg:CC CC_REGNUM))] |
| 959 |
"" |
| 960 |
{ |
| 961 |
int log2 = exact_log2 (INTVAL (operands[1])); |
| 962 |
|
| 963 |
if (log2 < 8) |
| 964 |
return "not1 %M1,%0"; |
| 965 |
else |
| 966 |
{ |
| 967 |
rtx xoperands[2]; |
| 968 |
xoperands[0] = gen_rtx_MEM (QImode, |
| 969 |
plus_constant (Pmode, XEXP (operands[0], 0), |
| 970 |
log2 / 8)); |
| 971 |
xoperands[1] = GEN_INT (log2 % 8); |
| 972 |
output_asm_insn ("not1 %1,%0", xoperands); |
| 973 |
} |
| 974 |
return ""; |
| 975 |
} |
| 976 |
[(set_attr "length" "4") |
| 977 |
(set_attr "type" "bit1")]) |
| 978 |
|
| 979 |
(define_insn_and_split "xorsi3" |
| 980 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 981 |
(xor:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 982 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M")))] |
| 983 |
"" |
| 984 |
"#" |
| 985 |
"reload_completed" |
| 986 |
[(parallel [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 2))) |
| 987 |
(clobber (reg:CC CC_REGNUM))])]) |
| 988 |
|
| 989 |
(define_insn "xorsi3_clobber_flags" |
| 990 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 991 |
(xor:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 992 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M"))) |
| 993 |
(clobber (reg:CC CC_REGNUM))] |
| 994 |
"" |
| 995 |
"@ |
| 996 |
xor %2,%0 |
| 997 |
xor %.,%0 |
| 998 |
xori %2,%1,%0" |
| 999 |
[(set_attr "length" "2,2,4")]) |
| 1000 |
|
| 1001 |
(define_insn "*xorsi3_set_flags" |
| 1002 |
[(set (reg:CC CC_REGNUM) |
| 1003 |
(compare:CC (xor:SI (match_operand:SI 1 "register_operand" "%0,0,r") |
| 1004 |
(match_operand:SI 2 "nonmemory_operand" "r,I,M")) |
| 1005 |
(const_int 0))) |
| 1006 |
(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 1007 |
(xor:SI (match_dup 1) (match_dup 2)))] |
| 1008 |
"reload_completed" |
| 1009 |
"@ |
| 1010 |
xor %2,%0 |
| 1011 |
xor %.,%0 |
| 1012 |
xori %2,%1,%0" |
| 1013 |
[(set_attr "length" "2,2,4")]) |
| 1014 |
|
| 1015 |
|
| 1016 |
;; ---------------------------------------------------------------------- |
| 1017 |
;; NOT INSTRUCTIONS |
| 1018 |
;; ---------------------------------------------------------------------- |
| 1019 |
|
| 1020 |
(define_insn_and_split "one_cmplsi2" |
| 1021 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1022 |
(not:SI (match_operand:SI 1 "register_operand" "r")))] |
| 1023 |
"" |
| 1024 |
"#" |
| 1025 |
"reload_completed" |
| 1026 |
[(parallel [(set (match_dup 0) (not:SI (match_dup 1))) |
| 1027 |
(clobber (reg:CC CC_REGNUM))])]) |
| 1028 |
|
| 1029 |
|
| 1030 |
(define_insn "one_cmplsi2_clobber_flags" |
| 1031 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1032 |
(not:SI (match_operand:SI 1 "register_operand" "r"))) |
| 1033 |
(clobber (reg:CC CC_REGNUM))] |
| 1034 |
"" |
| 1035 |
"not %1,%0" |
| 1036 |
[(set_attr "length" "2")]) |
| 1037 |
|
| 1038 |
(define_insn "*one_cmplsi2_set_flags" |
| 1039 |
[(set (reg:CC CC_REGNUM) |
| 1040 |
(compare:CC (not:SI (match_operand:SI 1 "register_operand" "r")) |
| 1041 |
(const_int 0))) |
| 1042 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 1043 |
(not:SI (match_dup 1)))] |
| 1044 |
"reload_completed" |
| 1045 |
"not %1,%0" |
| 1046 |
[(set_attr "length" "2")]) |
| 1047 |
|
| 1048 |
;; ----------------------------------------------------------------- |
| 1049 |
;; BIT FIELDS |
| 1050 |
;; ----------------------------------------------------------------- |
| 1051 |
|
| 1052 |
;; ??? Is it worth defining insv and extv for the V850 series?!? |
| 1053 |
|
| 1054 |
;; An insv pattern would be useful, but does not get used because |
| 1055 |
;; store_bit_field never calls insv when storing a constant value into a |
| 1056 |
;; single-bit bitfield. |
| 1057 |
|
| 1058 |
;; extv/extzv patterns would be useful, but do not get used because |
| 1059 |
;; optimize_bitfield_compare in fold-const usually converts single |
| 1060 |
;; bit extracts into an AND with a mask. |
| 1061 |
|
| 1062 |
(define_insn "insv" |
| 1063 |
[(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r") |
| 1064 |
(match_operand:SI 1 "immediate_operand" "n") |
| 1065 |
(match_operand:SI 2 "immediate_operand" "n")) |
| 1066 |
(match_operand:SI 3 "register_operand" "r")) |
| 1067 |
(clobber (reg:CC CC_REGNUM))] |
| 1068 |
"TARGET_V850E3V5_UP" |
| 1069 |
"bins %3, %2, %1, %0" |
| 1070 |
[(set_attr "length" "4")]) |
| 1071 |
|
| 1072 |
;; ----------------------------------------------------------------- |
| 1073 |
;; Scc INSTRUCTIONS |
| 1074 |
;; ----------------------------------------------------------------- |
| 1075 |
|
| 1076 |
(define_insn_and_split "*cbranchsi4_insn" |
| 1077 |
[(set (pc) |
| 1078 |
(if_then_else (match_operator 0 "comparison_operator" |
| 1079 |
[(match_operand:SI 1 "register_operand" "r") |
| 1080 |
(match_operand:SI 2 "reg_or_int5_operand" "rJ")]) |
| 1081 |
(label_ref (match_operand 3 "" "")) |
| 1082 |
(pc)))] |
| 1083 |
"" |
| 1084 |
"#" |
| 1085 |
"reload_completed" |
| 1086 |
[(set (reg:CC CC_REGNUM) |
| 1087 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 1088 |
(set (pc) |
| 1089 |
(if_then_else (match_op_dup 0 |
| 1090 |
[(reg:CC CC_REGNUM) (const_int 0)]) |
| 1091 |
(label_ref (match_dup 3)) |
| 1092 |
(pc)))] |
| 1093 |
"") |
| 1094 |
|
| 1095 |
|
| 1096 |
(define_insn_and_split "cstoresi4" |
| 1097 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1098 |
(match_operator:SI 1 "comparison_operator" |
| 1099 |
[(match_operand:SI 2 "register_operand" "r") |
| 1100 |
(match_operand:SI 3 "reg_or_int5_operand" "rJ")]))] |
| 1101 |
"" |
| 1102 |
"#" |
| 1103 |
"reload_completed" |
| 1104 |
[(set (reg:CC CC_REGNUM) |
| 1105 |
(compare:CC (match_dup 2) (match_dup 3))) |
| 1106 |
(set (match_dup 0) (match_op_dup 1 |
| 1107 |
[(reg:CC CC_REGNUM) (const_int 0)]))] |
| 1108 |
"") |
| 1109 |
|
| 1110 |
(define_insn "*setcc_insn" |
| 1111 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1112 |
(match_operator:SI 1 "comparison_operator" |
| 1113 |
[(reg:CC CC_REGNUM) (const_int 0)]))] |
| 1114 |
"reload_completed" |
| 1115 |
"setf %c1,%0" |
| 1116 |
[(set_attr "length" "4")]) |
| 1117 |
|
| 1118 |
(define_insn "set_z_insn" |
| 1119 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1120 |
(match_operand 1 "v850_float_z_comparison_operator" ""))] |
| 1121 |
"TARGET_V850E2V3_UP" |
| 1122 |
"setf z,%0" |
| 1123 |
[(set_attr "length" "4")]) |
| 1124 |
|
| 1125 |
(define_insn "set_nz_insn" |
| 1126 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1127 |
(match_operand 1 "v850_float_nz_comparison_operator" ""))] |
| 1128 |
"TARGET_V850E2V3_UP" |
| 1129 |
"setf nz,%0" |
| 1130 |
[(set_attr "length" "4")]) |
| 1131 |
|
| 1132 |
;; ---------------------------------------------------------------------- |
| 1133 |
;; CONDITIONAL MOVE INSTRUCTIONS |
| 1134 |
;; ---------------------------------------------------------------------- |
| 1135 |
|
| 1136 |
;; Instructions using cc0 aren't allowed to have input reloads, so we must |
| 1137 |
;; hide the fact that this instruction uses cc0. We do so by including the |
| 1138 |
;; compare instruction inside it. |
| 1139 |
|
| 1140 |
(define_expand "movsicc" |
| 1141 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1142 |
(if_then_else:SI |
| 1143 |
(match_operand 1 "comparison_operator") |
| 1144 |
(match_operand:SI 2 "reg_or_const_operand" "rJ") |
| 1145 |
(match_operand:SI 3 "reg_or_const_operand" "rI")))] |
| 1146 |
"(TARGET_V850E_UP)" |
| 1147 |
{ |
| 1148 |
/* Make sure that we have an integer comparison... */ |
| 1149 |
if (GET_MODE (XEXP (operands[1], 0)) != CCmode |
| 1150 |
&& GET_MODE (XEXP (operands[1], 0)) != SImode) |
| 1151 |
FAIL; |
| 1152 |
|
| 1153 |
if ((GET_CODE (operands[2]) == CONST_INT |
| 1154 |
&& GET_CODE (operands[3]) == CONST_INT)) |
| 1155 |
{ |
| 1156 |
int o2 = INTVAL (operands[2]); |
| 1157 |
int o3 = INTVAL (operands[3]); |
| 1158 |
|
| 1159 |
if (o2 == 1 && o3 == 0) |
| 1160 |
FAIL; /* setf */ |
| 1161 |
if (o3 == 1 && o2 == 0) |
| 1162 |
FAIL; /* setf */ |
| 1163 |
if (o2 == 0 && (o3 < -16 || o3 > 15) && exact_log2 (o3) >= 0) |
| 1164 |
FAIL; /* setf + shift */ |
| 1165 |
if (o3 == 0 && (o2 < -16 || o2 > 15) && exact_log2 (o2) >=0) |
| 1166 |
FAIL; /* setf + shift */ |
| 1167 |
if (o2 != 0) |
| 1168 |
operands[2] = copy_to_mode_reg (SImode, operands[2]); |
| 1169 |
if (o3 !=0 ) |
| 1170 |
operands[3] = copy_to_mode_reg (SImode, operands[3]); |
| 1171 |
} |
| 1172 |
else |
| 1173 |
{ |
| 1174 |
if (GET_CODE (operands[2]) != REG) |
| 1175 |
operands[2] = copy_to_mode_reg (SImode,operands[2]); |
| 1176 |
if (GET_CODE (operands[3]) != REG) |
| 1177 |
operands[3] = copy_to_mode_reg (SImode, operands[3]); |
| 1178 |
} |
| 1179 |
}) |
| 1180 |
|
| 1181 |
(define_insn "movsicc_normal_cc" |
| 1182 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1183 |
(if_then_else:SI |
| 1184 |
(match_operator 1 "comparison_operator" |
| 1185 |
[(reg:CC CC_REGNUM) (const_int 0)]) |
| 1186 |
(match_operand:SI 2 "reg_or_int5_operand" "rJ") |
| 1187 |
(match_operand:SI 3 "reg_or_0_operand" "rI")))] |
| 1188 |
"reload_completed && (TARGET_V850E_UP)" |
| 1189 |
"cmov %c1,%2,%z3,%0"; |
| 1190 |
[(set_attr "length" "6")]) |
| 1191 |
|
| 1192 |
(define_insn "movsicc_reversed_cc" |
| 1193 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1194 |
(if_then_else:SI |
| 1195 |
(match_operator 1 "comparison_operator" |
| 1196 |
[(reg:CC CC_REGNUM) (const_int 0)]) |
| 1197 |
(match_operand:SI 2 "reg_or_0_operand" "rI") |
| 1198 |
(match_operand:SI 3 "reg_or_int5_operand" "rJ")))] |
| 1199 |
"reload_completed && (TARGET_V850E_UP)" |
| 1200 |
"cmov %C1,%3,%z2,%0" |
| 1201 |
[(set_attr "length" "6")]) |
| 1202 |
|
| 1203 |
(define_insn_and_split "*movsicc_normal" |
| 1204 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1205 |
(if_then_else:SI |
| 1206 |
(match_operator 1 "comparison_operator" |
| 1207 |
[(match_operand:SI 4 "register_operand" "r") |
| 1208 |
(match_operand:SI 5 "reg_or_int5_operand" "rJ")]) |
| 1209 |
(match_operand:SI 2 "reg_or_int5_operand" "rJ") |
| 1210 |
(match_operand:SI 3 "reg_or_0_operand" "rI")))] |
| 1211 |
"(TARGET_V850E_UP)" |
| 1212 |
"#" |
| 1213 |
"reload_completed" |
| 1214 |
[(set (reg:CC CC_REGNUM) |
| 1215 |
(compare:CC (match_dup 4) (match_dup 5))) |
| 1216 |
(set (match_dup 0) |
| 1217 |
(if_then_else:SI (match_op_dup 1 |
| 1218 |
[(reg:CC CC_REGNUM) (const_int 0)]) |
| 1219 |
(match_dup 2) (match_dup 3)))]) |
| 1220 |
|
| 1221 |
|
| 1222 |
(define_insn_and_split "*movsicc_reversed" |
| 1223 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1224 |
(if_then_else:SI |
| 1225 |
(match_operator 1 "comparison_operator" |
| 1226 |
[(match_operand:SI 4 "register_operand" "r") |
| 1227 |
(match_operand:SI 5 "reg_or_int5_operand" "rJ")]) |
| 1228 |
(match_operand:SI 2 "reg_or_int5_operand" "rI") |
| 1229 |
(match_operand:SI 3 "reg_or_0_operand" "rJ")))] |
| 1230 |
"(TARGET_V850E_UP)" |
| 1231 |
"#" |
| 1232 |
"reload_completed" |
| 1233 |
[(set (reg:CC CC_REGNUM) |
| 1234 |
(compare:CC (match_dup 4) (match_dup 5))) |
| 1235 |
(set (match_dup 0) |
| 1236 |
(if_then_else:SI (match_op_dup 1 |
| 1237 |
[(reg:CC CC_REGNUM) (const_int 0)]) |
| 1238 |
(match_dup 2) (match_dup 3)))]) |
| 1239 |
|
| 1240 |
;; We could expose the setting of the condition codes here. |
| 1241 |
(define_insn "*movsicc_tst1" |
| 1242 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1243 |
(if_then_else:SI |
| 1244 |
(match_operator 1 "comparison_operator" |
| 1245 |
[(zero_extract:SI |
| 1246 |
(match_operand:QI 2 "memory_operand" "m") |
| 1247 |
(const_int 1) |
| 1248 |
(match_operand 3 "const_int_operand" "n")) |
| 1249 |
(const_int 0)]) |
| 1250 |
(match_operand:SI 4 "reg_or_int5_operand" "rJ") |
| 1251 |
(match_operand:SI 5 "reg_or_0_operand" "rI"))) |
| 1252 |
(clobber (reg:CC CC_REGNUM))] |
| 1253 |
"(TARGET_V850E_UP)" |
| 1254 |
"tst1 %3,%2 ; cmov %c1,%4,%z5,%0" |
| 1255 |
[(set_attr "length" "8")]) |
| 1256 |
|
| 1257 |
;; We could expose the setting of the condition codes here. |
| 1258 |
(define_insn "*movsicc_tst1_reversed" |
| 1259 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1260 |
(if_then_else:SI |
| 1261 |
(match_operator 1 "comparison_operator" |
| 1262 |
[(zero_extract:SI |
| 1263 |
(match_operand:QI 2 "memory_operand" "m") |
| 1264 |
(const_int 1) |
| 1265 |
(match_operand 3 "const_int_operand" "n")) |
| 1266 |
(const_int 0)]) |
| 1267 |
(match_operand:SI 4 "reg_or_0_operand" "rI") |
| 1268 |
(match_operand:SI 5 "reg_or_int5_operand" "rJ"))) |
| 1269 |
(clobber (reg:CC CC_REGNUM))] |
| 1270 |
"(TARGET_V850E_UP)" |
| 1271 |
"tst1 %3,%2 ; cmov %C1,%5,%z4,%0" |
| 1272 |
[(set_attr "length" "8")]) |
| 1273 |
|
| 1274 |
;; Matching for sasf requires combining 4 instructions, so we provide a |
| 1275 |
;; dummy pattern to match the first 3, which will always be turned into the |
| 1276 |
;; second pattern by subsequent combining. As above, we must include the |
| 1277 |
;; comparison to avoid input reloads in an insn using cc0. |
| 1278 |
|
| 1279 |
;; We could expose the setting of the condition codes here. |
| 1280 |
;; However, I haven't seen this pattern used, so I'm not going |
| 1281 |
;; to bother. |
| 1282 |
(define_insn "*sasf" |
| 1283 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1284 |
(ior:SI |
| 1285 |
(match_operator 1 "comparison_operator" |
| 1286 |
[(match_operand:SI 3 "register_operand" "r") |
| 1287 |
(match_operand:SI 4 "reg_or_int5_operand" "rJ")]) |
| 1288 |
(ashift:SI (match_operand:SI 2 "register_operand" "0") |
| 1289 |
(const_int 1)))) |
| 1290 |
(clobber (reg:CC CC_REGNUM))] |
| 1291 |
"(TARGET_V850E_UP)" |
| 1292 |
"cmp %4,%3 ; sasf %c1,%0" |
| 1293 |
[(set_attr "length" "6")]) |
| 1294 |
|
| 1295 |
(define_split |
| 1296 |
[(set (match_operand:SI 0 "register_operand" "") |
| 1297 |
(if_then_else:SI |
| 1298 |
(match_operator 1 "comparison_operator" |
| 1299 |
[(match_operand:SI 4 "register_operand" "") |
| 1300 |
(match_operand:SI 5 "reg_or_int5_operand" "")]) |
| 1301 |
(match_operand:SI 2 "const_int_operand" "") |
| 1302 |
(match_operand:SI 3 "const_int_operand" ""))) |
| 1303 |
(clobber (reg:CC CC_REGNUM))] |
| 1304 |
"(TARGET_V850E_UP) |
| 1305 |
&& ((INTVAL (operands[2]) ^ INTVAL (operands[3])) == 1) |
| 1306 |
&& ((INTVAL (operands[2]) + INTVAL (operands[3])) != 1) |
| 1307 |
&& (GET_CODE (operands[5]) == CONST_INT |
| 1308 |
|| REGNO (operands[0]) != REGNO (operands[5])) |
| 1309 |
&& REGNO (operands[0]) != REGNO (operands[4])" |
| 1310 |
[(set (match_dup 0) (match_dup 6)) |
| 1311 |
(parallel [(set (match_dup 0) |
| 1312 |
(ior:SI (match_op_dup 7 [(match_dup 4) (match_dup 5)]) |
| 1313 |
(ashift:SI (match_dup 0) (const_int 1)))) |
| 1314 |
(clobber (reg:CC CC_REGNUM))])] |
| 1315 |
{ |
| 1316 |
operands[6] = GEN_INT (INTVAL (operands[2]) >> 1); |
| 1317 |
if (INTVAL (operands[2]) & 0x1) |
| 1318 |
operands[7] = operands[1]; |
| 1319 |
else |
| 1320 |
operands[7] = gen_rtx_fmt_ee (reverse_condition (GET_CODE (operands[1])), |
| 1321 |
GET_MODE (operands[1]), |
| 1322 |
XEXP (operands[1], 0), XEXP (operands[1], 1)); |
| 1323 |
}) |
| 1324 |
|
| 1325 |
;; --------------------------------------------------------------------- |
| 1326 |
;; BYTE SWAP INSTRUCTIONS |
| 1327 |
;; --------------------------------------------------------------------- |
| 1328 |
(define_expand "rotlhi3" |
| 1329 |
[(parallel [(set (match_operand:HI 0 "register_operand" "") |
| 1330 |
(rotate:HI (match_operand:HI 1 "register_operand" "") |
| 1331 |
(match_operand:HI 2 "const_int_operand" ""))) |
| 1332 |
(clobber (reg:CC CC_REGNUM))])] |
| 1333 |
"(TARGET_V850E_UP)" |
| 1334 |
{ |
| 1335 |
if (INTVAL (operands[2]) != 8) |
| 1336 |
FAIL; |
| 1337 |
}) |
| 1338 |
|
| 1339 |
(define_insn "*rotlhi3_8" |
| 1340 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1341 |
(rotate:HI (match_operand:HI 1 "register_operand" "r") |
| 1342 |
(const_int 8))) |
| 1343 |
(clobber (reg:CC CC_REGNUM))] |
| 1344 |
"(TARGET_V850E_UP)" |
| 1345 |
"bsh %1,%0" |
| 1346 |
[(set_attr "length" "4")]) |
| 1347 |
|
| 1348 |
(define_expand "rotlsi3" |
| 1349 |
[(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 1350 |
(rotate:SI (match_operand:SI 1 "register_operand" "") |
| 1351 |
(match_operand:SI 2 "const_int_operand" ""))) |
| 1352 |
(clobber (reg:CC CC_REGNUM))])] |
| 1353 |
"(TARGET_V850E_UP)" |
| 1354 |
{ |
| 1355 |
if (TARGET_V850E3V5_UP && e3v5_shift_operand (operands[2], SImode)) |
| 1356 |
; |
| 1357 |
else if (INTVAL (operands[2]) != 16) |
| 1358 |
FAIL; |
| 1359 |
}) |
| 1360 |
|
| 1361 |
(define_insn "rotlsi3_a" |
| 1362 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1363 |
(match_operator:SI 4 "ior_operator" |
| 1364 |
[(ashift:SI (match_operand:SI 1 "register_operand" "r") |
| 1365 |
(match_operand:SI 2 "const_int_operand" "n")) |
| 1366 |
(lshiftrt:SI (match_dup 1) |
| 1367 |
(match_operand:SI 3 "const_int_operand" "n"))])) |
| 1368 |
(clobber (reg:CC CC_REGNUM))] |
| 1369 |
"TARGET_V850E3V5_UP && (INTVAL (operands[2]) + INTVAL (operands[3]) == 32)" |
| 1370 |
"rotl %2, %1, %0" |
| 1371 |
[(set_attr "length" "4")]) |
| 1372 |
|
| 1373 |
(define_insn "rotlsi3_b" |
| 1374 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1375 |
(match_operator:SI 4 "ior_operator" |
| 1376 |
[(lshiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 1377 |
(match_operand:SI 3 "const_int_operand" "n")) |
| 1378 |
(ashift:SI (match_dup 1) |
| 1379 |
(match_operand:SI 2 "const_int_operand" "n"))])) |
| 1380 |
(clobber (reg:CC CC_REGNUM))] |
| 1381 |
"TARGET_V850E3V5_UP && (INTVAL (operands[2]) + INTVAL (operands[3]) == 32)" |
| 1382 |
"rotl %2, %1, %0" |
| 1383 |
[(set_attr "length" "4")]) |
| 1384 |
|
| 1385 |
(define_insn "rotlsi3_v850e3v5" |
| 1386 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1387 |
(rotate:SI (match_operand:SI 1 "register_operand" "r") |
| 1388 |
(match_operand:SI 2 "e3v5_shift_operand" "rn"))) |
| 1389 |
(clobber (reg:CC CC_REGNUM))] |
| 1390 |
"TARGET_V850E3V5_UP" |
| 1391 |
"rotl %2, %1, %0" |
| 1392 |
[(set_attr "length" "4")]) |
| 1393 |
|
| 1394 |
(define_insn "*rotlsi3_16" |
| 1395 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1396 |
(rotate:SI (match_operand:SI 1 "register_operand" "r") |
| 1397 |
(const_int 16))) |
| 1398 |
(clobber (reg:CC CC_REGNUM))] |
| 1399 |
"(TARGET_V850E_UP)" |
| 1400 |
"hsw %1,%0" |
| 1401 |
[(set_attr "length" "4")]) |
| 1402 |
|
| 1403 |
;; ---------------------------------------------------------------------- |
| 1404 |
;; JUMP INSTRUCTIONS |
| 1405 |
;; ---------------------------------------------------------------------- |
| 1406 |
|
| 1407 |
;; Doloop |
| 1408 |
|
| 1409 |
(define_expand "doloop_begin" |
| 1410 |
[(use (match_operand 0 "" "")) ; loop pseudo |
| 1411 |
(use (match_operand 1 "" ""))] ; doloop_end pattern |
| 1412 |
"TARGET_V850E3V5_UP && TARGET_LOOP" |
| 1413 |
{ |
| 1414 |
rtx loop_cnt = operands[0]; |
| 1415 |
gcc_assert (GET_MODE (loop_cnt) == SImode); |
| 1416 |
emit_insn (gen_fix_loop_counter (loop_cnt)); |
| 1417 |
DONE; |
| 1418 |
} |
| 1419 |
) |
| 1420 |
|
| 1421 |
;; Note the embedded arithmetic. That affects the condition codes! |
| 1422 |
(define_insn "fix_loop_counter" |
| 1423 |
[(unspec:SI [(match_operand:SI 0 "register_operand" "+r,!m") |
| 1424 |
(clobber (match_scratch:SI 1 "=X,r"))] UNSPEC_LOOP) |
| 1425 |
(clobber (reg:CC CC_REGNUM))] |
| 1426 |
"TARGET_V850E3V5_UP && TARGET_LOOP" |
| 1427 |
{ |
| 1428 |
switch (which_alternative) |
| 1429 |
{ |
| 1430 |
case 0: return "add 1, %0 # LOOP_BEGIN"; |
| 1431 |
case 1: return "ld.w %0, %1; add 1, %1; st.w %1, %0 # LOOP_BEGIN"; |
| 1432 |
default: gcc_unreachable (); |
| 1433 |
} |
| 1434 |
} |
| 1435 |
[(set_attr "length" "2,6")]) |
| 1436 |
|
| 1437 |
(define_expand "doloop_end" |
| 1438 |
[(use (match_operand 0 "" "")) ; loop pseudo |
| 1439 |
(use (match_operand 1 "" ""))] ; label |
| 1440 |
"TARGET_V850E3V5_UP && TARGET_LOOP" |
| 1441 |
{ |
| 1442 |
rtx loop_cnt = operands[0]; |
| 1443 |
rtx label = operands[1]; |
| 1444 |
|
| 1445 |
if (GET_MODE (loop_cnt) != SImode) |
| 1446 |
FAIL; |
| 1447 |
|
| 1448 |
emit_jump_insn (gen_doloop_end_internal_loop (label, loop_cnt)); |
| 1449 |
DONE; |
| 1450 |
} |
| 1451 |
) |
| 1452 |
|
| 1453 |
(define_insn "doloop_end_internal_loop" |
| 1454 |
[(set (pc) |
| 1455 |
(if_then_else (ne (match_operand:SI 1 "register_operand" "+r,!m") |
| 1456 |
(const_int 0)) |
| 1457 |
(label_ref (match_operand 0 "" "")) |
| 1458 |
(pc))) |
| 1459 |
(set (match_dup 1) (plus:SI (match_dup 1) (const_int -1))) |
| 1460 |
(clobber (match_scratch:SI 2 "=X,r")) |
| 1461 |
(clobber (reg:CC CC_REGNUM))] |
| 1462 |
"TARGET_V850E3V5_UP && TARGET_LOOP" |
| 1463 |
{ |
| 1464 |
switch (which_alternative) |
| 1465 |
{ |
| 1466 |
case 0: |
| 1467 |
if (get_attr_length (insn) == 4) |
| 1468 |
return "loop %1, %0 # LOOP.1.0"; |
| 1469 |
|
| 1470 |
return "add -1, %1; bne %l0 # LOOP.1.1"; |
| 1471 |
case 1: |
| 1472 |
return "ld.w %1, %2; add -1, %2; st.w %2, %1; bne %l0 # LOOP.2.1"; |
| 1473 |
default: |
| 1474 |
gcc_unreachable (); |
| 1475 |
} |
| 1476 |
} |
| 1477 |
[(set (attr "length") |
| 1478 |
(if_then_else (lt (abs (minus (match_dup 0) (pc))) |
| 1479 |
(const_int 65534)) |
| 1480 |
(const_int 4) |
| 1481 |
(const_int 14)))]) |
| 1482 |
|
| 1483 |
;; Conditional jump instructions |
| 1484 |
|
| 1485 |
(define_insn_and_split "*cbranchsi4_insn" |
| 1486 |
[(set (pc) |
| 1487 |
(if_then_else (match_operator 0 "comparison_operator" |
| 1488 |
[(match_operand:SI 1 "register_operand" "r") |
| 1489 |
(match_operand:SI 2 "reg_or_int5_operand" "rJ")]) |
| 1490 |
(label_ref (match_operand 3 "" "")) |
| 1491 |
(pc)))] |
| 1492 |
"" |
| 1493 |
"#" |
| 1494 |
"reload_completed" |
| 1495 |
[(set (reg:CC CC_REGNUM) |
| 1496 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 1497 |
(set (pc) |
| 1498 |
(if_then_else (match_op_dup 0 |
| 1499 |
[(reg:CC CC_REGNUM) (const_int 0)]) |
| 1500 |
(label_ref (match_dup 3)) |
| 1501 |
(pc)))] |
| 1502 |
"") |
| 1503 |
|
| 1504 |
(define_insn "*branch_normal" |
| 1505 |
[(set (pc) |
| 1506 |
(if_then_else (match_operator 1 "comparison_operator" |
| 1507 |
[(reg CC_REGNUM) (const_int 0)]) |
| 1508 |
(label_ref (match_operand 0 "" "")) |
| 1509 |
(pc)))] |
| 1510 |
"reload_completed" |
| 1511 |
{ |
| 1512 |
bool nzmode = GET_MODE (XEXP (operands[1], 0)) == CCNZmode; |
| 1513 |
if (get_attr_length (insn) == 2) |
| 1514 |
{ |
| 1515 |
if (nzmode) |
| 1516 |
return "b%d1 %l0"; |
| 1517 |
else |
| 1518 |
return "b%b1 %l0"; |
| 1519 |
} |
| 1520 |
if (TARGET_V850E3V5_UP && get_attr_length (insn) == 4) |
| 1521 |
{ |
| 1522 |
if (nzmode) |
| 1523 |
return "b%d1 %l0"; |
| 1524 |
else |
| 1525 |
return "b%b1 %l0"; |
| 1526 |
} |
| 1527 |
if (nzmode) |
| 1528 |
return "b%D1 .+6 ; jr %l0"; |
| 1529 |
else |
| 1530 |
return "b%B1 .+6 ; jr %l0"; |
| 1531 |
} |
| 1532 |
[(set (attr "length") |
| 1533 |
(if_then_else (lt (abs (minus (match_dup 0) (pc))) |
| 1534 |
(const_int 256)) |
| 1535 |
(const_int 2) |
| 1536 |
(if_then_else (lt (abs (minus (match_dup 0) (pc))) |
| 1537 |
(const_int 65536)) |
| 1538 |
(const_int 4) |
| 1539 |
(const_int 6))))]) |
| 1540 |
|
| 1541 |
(define_insn "*branch_invert" |
| 1542 |
[(set (pc) |
| 1543 |
(if_then_else (match_operator 1 "comparison_operator" |
| 1544 |
[(reg CC_REGNUM) (const_int 0)]) |
| 1545 |
(pc) |
| 1546 |
(label_ref (match_operand 0 "" ""))))] |
| 1547 |
"reload_completed" |
| 1548 |
{ |
| 1549 |
bool nzmode = GET_MODE (XEXP (operands[1], 0)) == CCNZmode; |
| 1550 |
|
| 1551 |
if (get_attr_length (insn) == 2) |
| 1552 |
{ |
| 1553 |
if (nzmode) |
| 1554 |
return "b%D1 %l0"; |
| 1555 |
else |
| 1556 |
return "b%B1 %l0"; |
| 1557 |
} |
| 1558 |
|
| 1559 |
if (TARGET_V850E3V5_UP && get_attr_length (insn) == 4) |
| 1560 |
{ |
| 1561 |
if (nzmode) |
| 1562 |
return "b%D1 %l0"; |
| 1563 |
else |
| 1564 |
return "b%B1 %l0"; |
| 1565 |
} |
| 1566 |
|
| 1567 |
if (nzmode) |
| 1568 |
return "b%d1 .+6 ; jr %l0"; |
| 1569 |
else |
| 1570 |
return "b%b1 .+6 ; jr %l0"; |
| 1571 |
} |
| 1572 |
[(set (attr "length") |
| 1573 |
(if_then_else (lt (abs (minus (match_dup 0) (pc))) |
| 1574 |
(const_int 256)) |
| 1575 |
(const_int 2) |
| 1576 |
(if_then_else (lt (abs (minus (match_dup 0) (pc))) |
| 1577 |
(const_int 65536)) |
| 1578 |
(const_int 4) |
| 1579 |
(const_int 6))))]) |
| 1580 |
|
| 1581 |
;; Unconditional and other jump instructions. |
| 1582 |
|
| 1583 |
(define_insn "jump" |
| 1584 |
[(set (pc) |
| 1585 |
(label_ref (match_operand 0 "" "")))] |
| 1586 |
"" |
| 1587 |
{ |
| 1588 |
if (get_attr_length (insn) == 2) |
| 1589 |
return "br %0"; |
| 1590 |
else |
| 1591 |
return "jr %0"; |
| 1592 |
} |
| 1593 |
[(set (attr "length") |
| 1594 |
(if_then_else (lt (abs (minus (match_dup 0) (pc))) |
| 1595 |
(const_int 256)) |
| 1596 |
(const_int 2) |
| 1597 |
(const_int 4)))]) |
| 1598 |
|
| 1599 |
(define_insn "indirect_jump" |
| 1600 |
[(set (pc) (match_operand:SI 0 "register_operand" "r"))] |
| 1601 |
"" |
| 1602 |
"jmp %0" |
| 1603 |
[(set_attr "length" "2")]) |
| 1604 |
|
| 1605 |
(define_insn "tablejump" |
| 1606 |
[(set (pc) (match_operand:SI 0 "register_operand" "r")) |
| 1607 |
(use (label_ref (match_operand 1 "" "")))] |
| 1608 |
"" |
| 1609 |
"jmp %0" |
| 1610 |
[(set_attr "length" "2")]) |
| 1611 |
|
| 1612 |
(define_insn "switch" |
| 1613 |
[(set (pc) |
| 1614 |
(plus:SI |
| 1615 |
(sign_extend:SI |
| 1616 |
(mem:HI |
| 1617 |
(plus:SI (ashift:SI (match_operand:SI 0 "register_operand" "r") |
| 1618 |
(const_int 1)) |
| 1619 |
(label_ref (match_operand 1 "" ""))))) |
| 1620 |
(label_ref (match_dup 1))))] |
| 1621 |
"(TARGET_V850E_UP)" |
| 1622 |
"switch %0" |
| 1623 |
[(set_attr "length" "2")]) |
| 1624 |
|
| 1625 |
(define_expand "casesi" |
| 1626 |
[(match_operand:SI 0 "register_operand" "") |
| 1627 |
(match_operand:SI 1 "register_operand" "") |
| 1628 |
(match_operand:SI 2 "register_operand" "") |
| 1629 |
(match_operand 3 "" "") (match_operand 4 "" "")] |
| 1630 |
"" |
| 1631 |
{ |
| 1632 |
rtx reg = gen_reg_rtx (SImode); |
| 1633 |
rtx tableaddress = gen_reg_rtx (SImode); |
| 1634 |
rtx test; |
| 1635 |
rtx mem; |
| 1636 |
|
| 1637 |
/* Subtract the lower bound from the index. */ |
| 1638 |
emit_insn (gen_subsi3 (reg, operands[0], operands[1])); |
| 1639 |
|
| 1640 |
/* Compare the result against the number of table entries; |
| 1641 |
branch to the default label if out of range of the table. */ |
| 1642 |
test = gen_rtx_fmt_ee (GTU, VOIDmode, reg, operands[2]); |
| 1643 |
emit_jump_insn (gen_cbranchsi4 (test, reg, operands[2], operands[4])); |
| 1644 |
|
| 1645 |
/* Shift index for the table array access. */ |
| 1646 |
emit_insn (gen_ashlsi3 (reg, reg, GEN_INT (TARGET_BIG_SWITCH ? 2 : 1))); |
| 1647 |
/* Load the table address into a pseudo. */ |
| 1648 |
emit_insn (gen_movsi (tableaddress, |
| 1649 |
gen_rtx_LABEL_REF (Pmode, operands[3]))); |
| 1650 |
/* Add the table address to the index. */ |
| 1651 |
emit_insn (gen_addsi3 (reg, reg, tableaddress)); |
| 1652 |
/* Load the table entry. */ |
| 1653 |
mem = gen_const_mem (CASE_VECTOR_MODE, reg); |
| 1654 |
if (! TARGET_BIG_SWITCH) |
| 1655 |
{ |
| 1656 |
rtx reg2 = gen_reg_rtx (HImode); |
| 1657 |
emit_insn (gen_movhi (reg2, mem)); |
| 1658 |
emit_insn (gen_extendhisi2 (reg, reg2)); |
| 1659 |
} |
| 1660 |
else |
| 1661 |
emit_insn (gen_movsi (reg, mem)); |
| 1662 |
/* Add the table address. */ |
| 1663 |
emit_insn (gen_addsi3 (reg, reg, tableaddress)); |
| 1664 |
/* Branch to the switch label. */ |
| 1665 |
emit_jump_insn (gen_tablejump (reg, operands[3])); |
| 1666 |
DONE; |
| 1667 |
}) |
| 1668 |
|
| 1669 |
;; Call subroutine with no return value. |
| 1670 |
|
| 1671 |
(define_expand "call" |
| 1672 |
[(call (match_operand:QI 0 "general_operand" "") |
| 1673 |
(match_operand:SI 1 "general_operand" ""))] |
| 1674 |
"" |
| 1675 |
{ |
| 1676 |
if (! call_address_operand (XEXP (operands[0], 0), QImode) |
| 1677 |
|| TARGET_LONG_CALLS) |
| 1678 |
XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0)); |
| 1679 |
if (TARGET_LONG_CALLS) |
| 1680 |
emit_call_insn (gen_call_internal_long (XEXP (operands[0], 0), operands[1])); |
| 1681 |
else |
| 1682 |
emit_call_insn (gen_call_internal_short (XEXP (operands[0], 0), operands[1])); |
| 1683 |
|
| 1684 |
DONE; |
| 1685 |
}) |
| 1686 |
|
| 1687 |
(define_insn "call_internal_short" |
| 1688 |
[(call (mem:QI (match_operand:SI 0 "call_address_operand" "S,r")) |
| 1689 |
(match_operand:SI 1 "general_operand" "g,g")) |
| 1690 |
(clobber (reg:CC CC_REGNUM)) |
| 1691 |
(clobber (reg:SI 31))] |
| 1692 |
"! TARGET_LONG_CALLS" |
| 1693 |
{ |
| 1694 |
if (which_alternative == 1) |
| 1695 |
{ |
| 1696 |
if (TARGET_V850E3V5_UP) |
| 1697 |
return "jarl [%0], r31"; |
| 1698 |
|
| 1699 |
return "jarl .+4, r31 ; add 4, r31 ; jmp %0"; |
| 1700 |
} |
| 1701 |
|
| 1702 |
return "jarl %0, r31"; |
| 1703 |
} |
| 1704 |
[(set_attr "length" "4,8")]) |
| 1705 |
|
| 1706 |
(define_insn "call_internal_long" |
| 1707 |
[(call (mem:QI (match_operand:SI 0 "call_address_operand" "S,r")) |
| 1708 |
(match_operand:SI 1 "general_operand" "g,g")) |
| 1709 |
(clobber (reg:CC CC_REGNUM)) |
| 1710 |
(clobber (reg:SI 31))] |
| 1711 |
"TARGET_LONG_CALLS" |
| 1712 |
{ |
| 1713 |
if (which_alternative == 0) |
| 1714 |
{ |
| 1715 |
if (GET_CODE (operands[0]) == REG) |
| 1716 |
return "jarl %0,r31"; |
| 1717 |
|
| 1718 |
if (TARGET_V850E3V5_UP) |
| 1719 |
return "mov hilo(%0), r11 ; jarl [r11], r31"; |
| 1720 |
|
| 1721 |
return "movhi hi(%0), r0, r11 ; movea lo(%0), r11, r11 ; jarl .+4,r31 ; add 4, r31 ; jmp r11"; |
| 1722 |
} |
| 1723 |
|
| 1724 |
if (TARGET_V850E3V5_UP) |
| 1725 |
return "jarl [%0], r31"; |
| 1726 |
|
| 1727 |
return "jarl .+4,r31 ; add 4,r31 ; jmp %0"; |
| 1728 |
} |
| 1729 |
[(set_attr "length" "16,8")]) |
| 1730 |
|
| 1731 |
;; Call subroutine, returning value in operand 0 |
| 1732 |
;; (which must be a hard register). |
| 1733 |
|
| 1734 |
(define_expand "call_value" |
| 1735 |
[(set (match_operand 0 "" "") |
| 1736 |
(call (match_operand:QI 1 "general_operand" "") |
| 1737 |
(match_operand:SI 2 "general_operand" "")))] |
| 1738 |
"" |
| 1739 |
{ |
| 1740 |
if (! call_address_operand (XEXP (operands[1], 0), QImode) |
| 1741 |
|| TARGET_LONG_CALLS) |
| 1742 |
XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0)); |
| 1743 |
if (TARGET_LONG_CALLS) |
| 1744 |
emit_call_insn (gen_call_value_internal_long (operands[0], |
| 1745 |
XEXP (operands[1], 0), |
| 1746 |
operands[2])); |
| 1747 |
else |
| 1748 |
emit_call_insn (gen_call_value_internal_short (operands[0], |
| 1749 |
XEXP (operands[1], 0), |
| 1750 |
operands[2])); |
| 1751 |
DONE; |
| 1752 |
}) |
| 1753 |
|
| 1754 |
(define_insn "call_value_internal_short" |
| 1755 |
[(set (match_operand 0 "" "=r,r") |
| 1756 |
(call (mem:QI (match_operand:SI 1 "call_address_operand" "S,r")) |
| 1757 |
(match_operand:SI 2 "general_operand" "g,g"))) |
| 1758 |
(clobber (reg:CC CC_REGNUM)) |
| 1759 |
(clobber (reg:SI 31))] |
| 1760 |
"! TARGET_LONG_CALLS" |
| 1761 |
{ |
| 1762 |
if (which_alternative == 1) |
| 1763 |
{ |
| 1764 |
if (TARGET_V850E3V5_UP) |
| 1765 |
return "jarl [%1], r31"; |
| 1766 |
|
| 1767 |
return "jarl .+4, r31 ; add 4, r31 ; jmp %1"; |
| 1768 |
} |
| 1769 |
|
| 1770 |
return "jarl %1, r31"; |
| 1771 |
} |
| 1772 |
[(set_attr "length" "4,8")]) |
| 1773 |
|
| 1774 |
(define_insn "call_value_internal_long" |
| 1775 |
[(set (match_operand 0 "" "=r,r") |
| 1776 |
(call (mem:QI (match_operand:SI 1 "call_address_operand" "S,r")) |
| 1777 |
(match_operand:SI 2 "general_operand" "g,g"))) |
| 1778 |
(clobber (reg:CC CC_REGNUM)) |
| 1779 |
(clobber (reg:SI 31))] |
| 1780 |
"TARGET_LONG_CALLS" |
| 1781 |
{ |
| 1782 |
if (which_alternative == 0) |
| 1783 |
{ |
| 1784 |
if (GET_CODE (operands[1]) == REG) |
| 1785 |
return "jarl %1, r31"; |
| 1786 |
|
| 1787 |
/* Reload can generate this pattern.... */ |
| 1788 |
if (TARGET_V850E3V5_UP) |
| 1789 |
return "mov hilo(%1), r11 ; jarl [r11], r31"; |
| 1790 |
|
| 1791 |
return "movhi hi(%1), r0, r11 ; movea lo(%1), r11, r11 ; jarl .+4, r31 ; add 4, r31 ; jmp r11"; |
| 1792 |
} |
| 1793 |
|
| 1794 |
if (TARGET_V850E3V5_UP) |
| 1795 |
return "jarl [%1], r31"; |
| 1796 |
|
| 1797 |
return "jarl .+4, r31 ; add 4, r31 ; jmp %1"; |
| 1798 |
} |
| 1799 |
[(set_attr "length" "16,8")]) |
| 1800 |
|
| 1801 |
(define_insn "nop" |
| 1802 |
[(const_int 0)] |
| 1803 |
"" |
| 1804 |
"nop" |
| 1805 |
[(set_attr "length" "2")]) |
| 1806 |
|
| 1807 |
;; ---------------------------------------------------------------------- |
| 1808 |
;; EXTEND INSTRUCTIONS |
| 1809 |
;; ---------------------------------------------------------------------- |
| 1810 |
|
| 1811 |
;; We only need the CC clobber because of the andi alternative |
| 1812 |
(define_insn "*zero_extendhisi2_v850e" |
| 1813 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r") |
| 1814 |
(zero_extend:SI |
| 1815 |
(match_operand:HI 1 "nonimmediate_operand" "0,r,T,m"))) |
| 1816 |
(clobber (reg:CC CC_REGNUM))] |
| 1817 |
"(TARGET_V850E_UP)" |
| 1818 |
"@ |
| 1819 |
zxh %0 |
| 1820 |
andi 65535,%1,%0 |
| 1821 |
sld.hu %1,%0 |
| 1822 |
ld.hu %1,%0" |
| 1823 |
[(set_attr "length" "2,4,2,4")]) |
| 1824 |
|
| 1825 |
(define_insn "*zero_extendhisi2_v850" |
| 1826 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1827 |
(zero_extend:SI |
| 1828 |
(match_operand:HI 1 "register_operand" "r"))) |
| 1829 |
(clobber (reg:CC CC_REGNUM))] ;; A lie, but we have to match the expander |
| 1830 |
"" |
| 1831 |
"andi 65535,%1,%0" |
| 1832 |
[(set_attr "length" "4")]) |
| 1833 |
|
| 1834 |
(define_insn "*zero_extendhisi2_v850_set_flags" |
| 1835 |
[(set (reg:CCNZ CC_REGNUM) |
| 1836 |
(compare:CCNZ (zero_extend:SI (match_operand:HI 1 "register_operand" "r")) |
| 1837 |
(const_int 0))) |
| 1838 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 1839 |
(zero_extend:SI (match_dup 1)))] |
| 1840 |
"reload_completed" |
| 1841 |
"andi 65535,%1,%0" |
| 1842 |
[(set_attr "length" "4")]) |
| 1843 |
|
| 1844 |
(define_expand "zero_extendhisi2" |
| 1845 |
[(parallel [(set (match_operand:SI 0 "register_operand") |
| 1846 |
(zero_extend:SI |
| 1847 |
(match_operand:HI 1 "nonimmediate_operand"))) |
| 1848 |
(clobber (reg:CC CC_REGNUM))])] |
| 1849 |
"" |
| 1850 |
{ |
| 1851 |
if (! (TARGET_V850E_UP)) |
| 1852 |
operands[1] = force_reg (HImode, operands[1]); |
| 1853 |
}) |
| 1854 |
|
| 1855 |
(define_insn "*zero_extendqisi2_v850e" |
| 1856 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r") |
| 1857 |
(zero_extend:SI |
| 1858 |
(match_operand:QI 1 "nonimmediate_operand" "0,r,T,m"))) |
| 1859 |
(clobber (reg:CC CC_REGNUM))] |
| 1860 |
"(TARGET_V850E_UP)" |
| 1861 |
"@ |
| 1862 |
zxb %0 |
| 1863 |
andi 255,%1,%0 |
| 1864 |
sld.bu %1,%0 |
| 1865 |
ld.bu %1,%0" |
| 1866 |
[(set_attr "length" "2,4,2,4")]) |
| 1867 |
|
| 1868 |
(define_insn "*zero_extendqisi2_v850" |
| 1869 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1870 |
(zero_extend:SI |
| 1871 |
(match_operand:QI 1 "register_operand" "r"))) |
| 1872 |
(clobber (reg:CC CC_REGNUM))] ;; A lie, but we have to match the expander |
| 1873 |
"" |
| 1874 |
"andi 255,%1,%0" |
| 1875 |
[(set_attr "length" "4")]) |
| 1876 |
|
| 1877 |
(define_insn "*zero_extendqisi2_v850_set_flags" |
| 1878 |
[(set (reg:CCNZ CC_REGNUM) |
| 1879 |
(compare:CCNZ (zero_extend:SI (match_operand:QI 1 "register_operand" "r")) |
| 1880 |
(const_int 0))) |
| 1881 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 1882 |
(zero_extend:SI (match_dup 1)))] |
| 1883 |
"reload_completed" |
| 1884 |
"andi 255,%1,%0" |
| 1885 |
[(set_attr "length" "4")]) |
| 1886 |
|
| 1887 |
(define_expand "zero_extendqisi2" |
| 1888 |
[(parallel [(set (match_operand:SI 0 "register_operand") |
| 1889 |
(zero_extend:SI |
| 1890 |
(match_operand:QI 1 "nonimmediate_operand"))) |
| 1891 |
(clobber (reg:CC CC_REGNUM))])] |
| 1892 |
"" |
| 1893 |
{ |
| 1894 |
if (! (TARGET_V850E_UP)) |
| 1895 |
operands[1] = force_reg (QImode, operands[1]); |
| 1896 |
}) |
| 1897 |
|
| 1898 |
;;- sign extension instructions |
| 1899 |
|
| 1900 |
;; ??? The extendhisi2 pattern should not emit shifts for v850e? |
| 1901 |
|
| 1902 |
(define_insn "*extendhisi_insn" |
| 1903 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 1904 |
(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,Q,m")))] |
| 1905 |
"(TARGET_V850E_UP)" |
| 1906 |
"@ |
| 1907 |
sxh %0 |
| 1908 |
sld.h %1,%0 |
| 1909 |
ld.h %1,%0" |
| 1910 |
[(set_attr "length" "2,2,4")]) |
| 1911 |
|
| 1912 |
;; ??? This is missing a sign extend from memory pattern to match the ld.h |
| 1913 |
;; instruction. |
| 1914 |
|
| 1915 |
(define_expand "extendhisi2" |
| 1916 |
[(parallel [(set (match_dup 2) |
| 1917 |
(ashift:SI (match_operand:HI 1 "register_operand" "") |
| 1918 |
(const_int 16))) |
| 1919 |
(clobber (reg:CC CC_REGNUM))]) |
| 1920 |
(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 1921 |
(ashiftrt:SI (match_dup 2) |
| 1922 |
(const_int 16))) |
| 1923 |
(clobber (reg:CC CC_REGNUM))])] |
| 1924 |
"" |
| 1925 |
{ |
| 1926 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 1927 |
operands[2] = gen_reg_rtx (SImode); |
| 1928 |
}) |
| 1929 |
|
| 1930 |
;; ??? The extendqisi2 pattern should not emit shifts for v850e? |
| 1931 |
|
| 1932 |
(define_insn "*extendqisi_insn" |
| 1933 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 1934 |
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,Q,m")))] |
| 1935 |
"(TARGET_V850E_UP)" |
| 1936 |
"@ |
| 1937 |
sxb %0 |
| 1938 |
sld.b %1,%0 |
| 1939 |
ld.b %1,%0" |
| 1940 |
[(set_attr "length" "2,2,4")]) |
| 1941 |
|
| 1942 |
;; ??? This is missing a sign extend from memory pattern to match the ld.b |
| 1943 |
;; instruction. |
| 1944 |
|
| 1945 |
(define_expand "extendqisi2" |
| 1946 |
[(parallel [(set (match_dup 2) |
| 1947 |
(ashift:SI (match_operand:QI 1 "register_operand" "") |
| 1948 |
(const_int 24))) |
| 1949 |
(clobber (reg:CC CC_REGNUM))]) |
| 1950 |
(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 1951 |
(ashiftrt:SI (match_dup 2) |
| 1952 |
(const_int 24))) |
| 1953 |
(clobber (reg:CC CC_REGNUM))])] |
| 1954 |
"" |
| 1955 |
{ |
| 1956 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 1957 |
operands[2] = gen_reg_rtx (SImode); |
| 1958 |
}) |
| 1959 |
|
| 1960 |
;; ---------------------------------------------------------------------- |
| 1961 |
;; SHIFTS |
| 1962 |
;; ---------------------------------------------------------------------- |
| 1963 |
|
| 1964 |
(define_insn_and_split "ashlsi3" |
| 1965 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 1966 |
(ashift:SI |
| 1967 |
(match_operand:SI 1 "register_operand" "0,0") |
| 1968 |
(match_operand:SI 2 "nonmemory_operand" "r,N")))] |
| 1969 |
"" |
| 1970 |
"#" |
| 1971 |
"reload_completed" |
| 1972 |
[(parallel [(set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2))) |
| 1973 |
(clobber (reg:CC CC_REGNUM))])]) |
| 1974 |
|
| 1975 |
(define_insn "ashlsi3_clobber_flags" |
| 1976 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 1977 |
(ashift:SI |
| 1978 |
(match_operand:SI 1 "register_operand" "0,0") |
| 1979 |
(match_operand:SI 2 "nonmemory_operand" "r,N"))) |
| 1980 |
(clobber (reg:CC CC_REGNUM))] |
| 1981 |
"" |
| 1982 |
"@ |
| 1983 |
shl %2,%0 |
| 1984 |
shl %2,%0" |
| 1985 |
[(set_attr "length" "4,2")]) |
| 1986 |
|
| 1987 |
(define_insn "ashlsi3_set_flags" |
| 1988 |
[(set (reg:CCNZ CC_REGNUM) |
| 1989 |
(compare:CCNZ (ashift:SI (match_operand:SI 1 "register_operand" "0,0") |
| 1990 |
(match_operand:SI 2 "nonmemory_operand" "r,N")) |
| 1991 |
(const_int 0))) |
| 1992 |
(set (match_operand:SI 0 "register_operand" "=r,r") |
| 1993 |
(ashift:SI (match_dup 1) (match_dup 2)))] |
| 1994 |
"reload_completed" |
| 1995 |
"@ |
| 1996 |
shl %2,%0 |
| 1997 |
shl %2,%0" |
| 1998 |
[(set_attr "length" "4,2")]) |
| 1999 |
|
| 2000 |
(define_insn "ashlsi3_v850e2_clobber_flags" |
| 2001 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2002 |
(ashift:SI |
| 2003 |
(match_operand:SI 1 "register_operand" "r") |
| 2004 |
(match_operand:SI 2 "nonmemory_operand" "r"))) |
| 2005 |
(clobber (reg:CC CC_REGNUM))] |
| 2006 |
"TARGET_V850E2_UP" |
| 2007 |
"shl %2,%1,%0" |
| 2008 |
[(set_attr "length" "4")]) |
| 2009 |
|
| 2010 |
(define_insn "ashlsi3_v850e2_set_flags" |
| 2011 |
[(set (reg:CCNZ CC_REGNUM) |
| 2012 |
(compare:CCNZ (ashift:SI (match_operand:SI 1 "register_operand" "r") |
| 2013 |
(match_operand:SI 2 "nonmemory_operand" "r")) |
| 2014 |
(const_int 0))) |
| 2015 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 2016 |
(ashift:SI (match_dup 1) (match_dup 2)))] |
| 2017 |
"reload_completed && TARGET_V850E2_UP" |
| 2018 |
"shl %2,%1,%0" |
| 2019 |
[(set_attr "length" "4")]) |
| 2020 |
|
| 2021 |
(define_insn_and_split "lshrsi3" |
| 2022 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 2023 |
(lshiftrt:SI |
| 2024 |
(match_operand:SI 1 "register_operand" "0,0") |
| 2025 |
(match_operand:SI 2 "nonmemory_operand" "r,N")))] |
| 2026 |
"" |
| 2027 |
"#" |
| 2028 |
"reload_completed" |
| 2029 |
[(parallel [(set (match_dup 0) (lshiftrt:SI (match_dup 1) (match_dup 2))) |
| 2030 |
(clobber (reg:CC CC_REGNUM))])]) |
| 2031 |
|
| 2032 |
(define_insn "lshrsi3_clobber_flags" |
| 2033 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 2034 |
(lshiftrt:SI |
| 2035 |
(match_operand:SI 1 "register_operand" "0,0") |
| 2036 |
(match_operand:SI 2 "nonmemory_operand" "r,N"))) |
| 2037 |
(clobber (reg:CC CC_REGNUM))] |
| 2038 |
"" |
| 2039 |
"@ |
| 2040 |
shr %2,%0 |
| 2041 |
shr %2,%0" |
| 2042 |
[(set_attr "length" "4,2")]) |
| 2043 |
|
| 2044 |
(define_insn "lshrsi3_set_flags" |
| 2045 |
[(set (reg:CC CC_REGNUM) |
| 2046 |
(compare:CC (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0") |
| 2047 |
(match_operand:SI 2 "nonmemory_operand" "r,N")) |
| 2048 |
(const_int 0))) |
| 2049 |
(set (match_operand:SI 0 "register_operand" "=r,r") |
| 2050 |
(lshiftrt:SI (match_dup 1) (match_dup 2)))] |
| 2051 |
"reload_completed" |
| 2052 |
"@ |
| 2053 |
shr %2,%0 |
| 2054 |
shr %2,%0" |
| 2055 |
[(set_attr "length" "4,2")]) |
| 2056 |
|
| 2057 |
(define_insn "lshrsi3_v850e2_clobber_flags" |
| 2058 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2059 |
(lshiftrt:SI |
| 2060 |
(match_operand:SI 1 "register_operand" "r") |
| 2061 |
(match_operand:SI 2 "nonmemory_operand" "r"))) |
| 2062 |
(clobber (reg:CC CC_REGNUM))] |
| 2063 |
"TARGET_V850E2_UP" |
| 2064 |
"shr %2,%1,%0" |
| 2065 |
[(set_attr "length" "4")]) |
| 2066 |
|
| 2067 |
(define_insn "lshrsi3_v850e2_set_flags" |
| 2068 |
[(set (reg:CC CC_REGNUM) |
| 2069 |
(compare:CC (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 2070 |
(match_operand:SI 2 "nonmemory_operand" "r")) |
| 2071 |
(const_int 0))) |
| 2072 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 2073 |
(lshiftrt:SI (match_dup 1) (match_dup 2)))] |
| 2074 |
"reload_completed && TARGET_V850E2_UP" |
| 2075 |
"shr %2,%1,%0" |
| 2076 |
[(set_attr "length" "4")]) |
| 2077 |
|
| 2078 |
(define_insn_and_split "ashrsi3" |
| 2079 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 2080 |
(ashiftrt:SI |
| 2081 |
(match_operand:SI 1 "register_operand" "0,0") |
| 2082 |
(match_operand:SI 2 "nonmemory_operand" "r,N")))] |
| 2083 |
"" |
| 2084 |
"#" |
| 2085 |
"reload_completed" |
| 2086 |
[(parallel [(set (match_dup 0) (ashiftrt:SI (match_dup 1) (match_dup 2))) |
| 2087 |
(clobber (reg:CC CC_REGNUM))])]) |
| 2088 |
|
| 2089 |
(define_insn "ashrsi3_clobber_flags" |
| 2090 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 2091 |
(ashiftrt:SI |
| 2092 |
(match_operand:SI 1 "register_operand" "0,0") |
| 2093 |
(match_operand:SI 2 "nonmemory_operand" "r,N"))) |
| 2094 |
(clobber (reg:CC CC_REGNUM))] |
| 2095 |
"" |
| 2096 |
"@ |
| 2097 |
sar %2,%0 |
| 2098 |
sar %2,%0" |
| 2099 |
[(set_attr "length" "4,2")]) |
| 2100 |
|
| 2101 |
(define_insn "ashrsi3_set_flags" |
| 2102 |
[(set (reg:CC CC_REGNUM) |
| 2103 |
(compare:CC (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0") |
| 2104 |
(match_operand:SI 2 "nonmemory_operand" "r,N")) |
| 2105 |
(const_int 0))) |
| 2106 |
(set (match_operand:SI 0 "register_operand" "=r,r") |
| 2107 |
(ashiftrt:SI (match_dup 1) (match_dup 2)))] |
| 2108 |
"reload_completed" |
| 2109 |
"@ |
| 2110 |
sar %2,%0 |
| 2111 |
sar %2,%0" |
| 2112 |
[(set_attr "length" "4,2")]) |
| 2113 |
|
| 2114 |
(define_insn "ashrsi3_v850e2_clobber_flags" |
| 2115 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2116 |
(ashiftrt:SI |
| 2117 |
(match_operand:SI 1 "register_operand" "r") |
| 2118 |
(match_operand:SI 2 "nonmemory_operand" "r"))) |
| 2119 |
(clobber (reg:CC CC_REGNUM))] |
| 2120 |
"TARGET_V850E2_UP" |
| 2121 |
"sar %2,%1,%0" |
| 2122 |
[(set_attr "length" "4")]) |
| 2123 |
|
| 2124 |
(define_insn "ashrsi3_v850e2_set_flags" |
| 2125 |
[(set (reg:CC CC_REGNUM) |
| 2126 |
(compare:CC (ashiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 2127 |
(match_operand:SI 2 "nonmemory_operand" "r")) |
| 2128 |
(const_int 0))) |
| 2129 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 2130 |
(ashiftrt:SI (match_dup 1) (match_dup 2)))] |
| 2131 |
"reload_completed && TARGET_V850E2_UP" |
| 2132 |
"sar %2,%1,%0" |
| 2133 |
[(set_attr "length" "4")]) |
| 2134 |
|
| 2135 |
;; ---------------------------------------------------------------------- |
| 2136 |
;; FIND FIRST BIT INSTRUCTION |
| 2137 |
;; ---------------------------------------------------------------------- |
| 2138 |
|
| 2139 |
(define_insn "ffssi2" |
| 2140 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2141 |
(ffs:SI (match_operand:SI 1 "register_operand" "r"))) |
| 2142 |
(clobber (reg:CC CC_REGNUM))] |
| 2143 |
"TARGET_V850E2_UP" |
| 2144 |
"sch1r %1,%0" |
| 2145 |
[(set_attr "length" "4")]) |
| 2146 |
|
| 2147 |
;; ---------------------------------------------------------------------- |
| 2148 |
;; PROLOGUE/EPILOGUE |
| 2149 |
;; ---------------------------------------------------------------------- |
| 2150 |
(define_expand "prologue" |
| 2151 |
[(const_int 0)] |
| 2152 |
"" |
| 2153 |
{ |
| 2154 |
expand_prologue (); |
| 2155 |
DONE; |
| 2156 |
}) |
| 2157 |
|
| 2158 |
(define_expand "epilogue" |
| 2159 |
[(return)] |
| 2160 |
"" |
| 2161 |
{ |
| 2162 |
expand_epilogue (); |
| 2163 |
DONE; |
| 2164 |
}) |
| 2165 |
|
| 2166 |
(define_insn "return_simple" |
| 2167 |
[(return)] |
| 2168 |
"reload_completed" |
| 2169 |
"jmp [r31]" |
| 2170 |
[(set_attr "length" "2")]) |
| 2171 |
|
| 2172 |
(define_insn "return_internal" |
| 2173 |
[(return) |
| 2174 |
(use (reg:SI 31))] |
| 2175 |
"" |
| 2176 |
"jmp [r31]" |
| 2177 |
[(set_attr "length" "2")]) |
| 2178 |
|
| 2179 |
;; ---------------------------------------------------------------------- |
| 2180 |
;; v850e2V3 floating-point hardware support |
| 2181 |
;; ---------------------------------------------------------------------- |
| 2182 |
|
| 2183 |
|
| 2184 |
(define_insn "addsf3" |
| 2185 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2186 |
(plus:SF (match_operand:SF 1 "register_operand" "r") |
| 2187 |
(match_operand:SF 2 "register_operand" "r")))] |
| 2188 |
"TARGET_USE_FPU" |
| 2189 |
"addf.s %1,%2,%0" |
| 2190 |
[(set_attr "length" "4") |
| 2191 |
(set_attr "type" "fpu")]) |
| 2192 |
|
| 2193 |
(define_insn "adddf3" |
| 2194 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2195 |
(plus:DF (match_operand:DF 1 "even_reg_operand" "r") |
| 2196 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2197 |
"TARGET_USE_FPU" |
| 2198 |
"addf.d %1,%2,%0" |
| 2199 |
[(set_attr "length" "4") |
| 2200 |
(set_attr "type" "fpu")]) |
| 2201 |
|
| 2202 |
(define_insn "subsf3" |
| 2203 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2204 |
(minus:SF (match_operand:SF 1 "register_operand" "r") |
| 2205 |
(match_operand:SF 2 "register_operand" "r")))] |
| 2206 |
"TARGET_USE_FPU" |
| 2207 |
"subf.s %2,%1,%0" |
| 2208 |
[(set_attr "length" "4") |
| 2209 |
(set_attr "type" "fpu")]) |
| 2210 |
|
| 2211 |
(define_insn "subdf3" |
| 2212 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2213 |
(minus:DF (match_operand:DF 1 "even_reg_operand" "r") |
| 2214 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2215 |
"TARGET_USE_FPU" |
| 2216 |
"subf.d %2,%1,%0" |
| 2217 |
[(set_attr "length" "4") |
| 2218 |
(set_attr "type" "fpu")]) |
| 2219 |
|
| 2220 |
(define_insn "mulsf3" |
| 2221 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2222 |
(mult:SF (match_operand:SF 1 "register_operand" "r") |
| 2223 |
(match_operand:SF 2 "register_operand" "r")))] |
| 2224 |
"TARGET_USE_FPU" |
| 2225 |
"mulf.s %1,%2,%0" |
| 2226 |
[(set_attr "length" "4") |
| 2227 |
(set_attr "type" "fpu")]) |
| 2228 |
|
| 2229 |
(define_insn "muldf3" |
| 2230 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2231 |
(mult:DF (match_operand:DF 1 "even_reg_operand" "r") |
| 2232 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2233 |
"TARGET_USE_FPU" |
| 2234 |
"mulf.d %1,%2,%0" |
| 2235 |
[(set_attr "length" "4") |
| 2236 |
(set_attr "type" "fpu")]) |
| 2237 |
|
| 2238 |
(define_insn "divsf3" |
| 2239 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2240 |
(div:SF (match_operand:SF 1 "register_operand" "r") |
| 2241 |
(match_operand:SF 2 "register_operand" "r")))] |
| 2242 |
"TARGET_USE_FPU" |
| 2243 |
"divf.s %2,%1,%0" |
| 2244 |
[(set_attr "length" "4") |
| 2245 |
(set_attr "type" "fpu")]) |
| 2246 |
|
| 2247 |
(define_insn "divdf3" |
| 2248 |
[(set (match_operand:DF 0 "register_operand" "=r") |
| 2249 |
(div:DF (match_operand:DF 1 "even_reg_operand" "r") |
| 2250 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2251 |
"TARGET_USE_FPU" |
| 2252 |
"divf.d %2,%1,%0" |
| 2253 |
[(set_attr "length" "4") |
| 2254 |
(set_attr "type" "fpu")]) |
| 2255 |
|
| 2256 |
(define_insn "minsf3" |
| 2257 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2258 |
(smin:SF (match_operand:SF 1 "reg_or_0_operand" "r") |
| 2259 |
(match_operand:SF 2 "reg_or_0_operand" "r")))] |
| 2260 |
"TARGET_USE_FPU" |
| 2261 |
"minf.s %z1,%z2,%0" |
| 2262 |
[(set_attr "length" "4") |
| 2263 |
(set_attr "type" "fpu")]) |
| 2264 |
|
| 2265 |
(define_insn "mindf3" |
| 2266 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2267 |
(smin:DF (match_operand:DF 1 "even_reg_operand" "r") |
| 2268 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2269 |
"TARGET_USE_FPU" |
| 2270 |
"minf.d %1,%2,%0" |
| 2271 |
[(set_attr "length" "4") |
| 2272 |
(set_attr "type" "fpu")]) |
| 2273 |
|
| 2274 |
(define_insn "maxsf3" |
| 2275 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2276 |
(smax:SF (match_operand:SF 1 "reg_or_0_operand" "r") |
| 2277 |
(match_operand:SF 2 "reg_or_0_operand" "r")))] |
| 2278 |
"TARGET_USE_FPU" |
| 2279 |
"maxf.s %z1,%z2,%0" |
| 2280 |
[(set_attr "length" "4") |
| 2281 |
(set_attr "type" "fpu")]) |
| 2282 |
|
| 2283 |
(define_insn "maxdf3" |
| 2284 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2285 |
(smax:DF (match_operand:DF 1 "even_reg_operand" "r") |
| 2286 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2287 |
"TARGET_USE_FPU" |
| 2288 |
"maxf.d %1,%2,%0" |
| 2289 |
[(set_attr "length" "4") |
| 2290 |
(set_attr "type" "fpu")]) |
| 2291 |
|
| 2292 |
(define_insn "abssf2" |
| 2293 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2294 |
(abs:SF (match_operand:SF 1 "register_operand" "r")))] |
| 2295 |
"TARGET_USE_FPU" |
| 2296 |
"absf.s %1,%0" |
| 2297 |
[(set_attr "length" "4") |
| 2298 |
(set_attr "type" "fpu")]) |
| 2299 |
|
| 2300 |
(define_insn "absdf2" |
| 2301 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2302 |
(abs:DF (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2303 |
"TARGET_USE_FPU" |
| 2304 |
"absf.d %1,%0" |
| 2305 |
[(set_attr "length" "4") |
| 2306 |
(set_attr "type" "fpu")]) |
| 2307 |
|
| 2308 |
(define_insn "negsf2" |
| 2309 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2310 |
(neg:SF (match_operand:SF 1 "register_operand" "r")))] |
| 2311 |
"TARGET_USE_FPU" |
| 2312 |
"negf.s %1,%0" |
| 2313 |
[(set_attr "length" "4") |
| 2314 |
(set_attr "type" "fpu")]) |
| 2315 |
|
| 2316 |
(define_insn "negdf2" |
| 2317 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2318 |
(neg:DF (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2319 |
"TARGET_USE_FPU" |
| 2320 |
"negf.d %1,%0" |
| 2321 |
[(set_attr "length" "4") |
| 2322 |
(set_attr "type" "fpu")]) |
| 2323 |
|
| 2324 |
;; square-root |
| 2325 |
(define_insn "sqrtsf2" |
| 2326 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2327 |
(sqrt:SF (match_operand:SF 1 "register_operand" "r")))] |
| 2328 |
"TARGET_USE_FPU" |
| 2329 |
"sqrtf.s %1,%0" |
| 2330 |
[(set_attr "length" "4") |
| 2331 |
(set_attr "type" "fpu")]) |
| 2332 |
|
| 2333 |
(define_insn "sqrtdf2" |
| 2334 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2335 |
(sqrt:DF (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2336 |
"TARGET_USE_FPU" |
| 2337 |
"sqrtf.d %1,%0" |
| 2338 |
[(set_attr "length" "4") |
| 2339 |
(set_attr "type" "fpu")]) |
| 2340 |
|
| 2341 |
;; float -> int |
| 2342 |
(define_insn "fix_truncsfsi2" |
| 2343 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2344 |
(fix:SI (match_operand:SF 1 "register_operand" "r")))] |
| 2345 |
"TARGET_USE_FPU" |
| 2346 |
"trncf.sw %1,%0" |
| 2347 |
[(set_attr "length" "4") |
| 2348 |
(set_attr "type" "fpu")]) |
| 2349 |
|
| 2350 |
(define_insn "fixuns_truncsfsi2" |
| 2351 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2352 |
(unsigned_fix:SI (match_operand:SF 1 "register_operand" "r")))] |
| 2353 |
"TARGET_USE_FPU" |
| 2354 |
"trncf.suw %1, %0" |
| 2355 |
[(set_attr "length" "4") |
| 2356 |
(set_attr "type" "fpu")]) |
| 2357 |
|
| 2358 |
(define_insn "fix_truncdfsi2" |
| 2359 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2360 |
(fix:SI (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2361 |
"TARGET_USE_FPU" |
| 2362 |
"trncf.dw %1,%0" |
| 2363 |
[(set_attr "length" "4") |
| 2364 |
(set_attr "type" "fpu")]) |
| 2365 |
|
| 2366 |
(define_insn "fixuns_truncdfsi2" |
| 2367 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 2368 |
(unsigned_fix:SI (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2369 |
"TARGET_USE_FPU" |
| 2370 |
"trncf.duw %1, %0" |
| 2371 |
[(set_attr "length" "4") |
| 2372 |
(set_attr "type" "fpu")]) |
| 2373 |
|
| 2374 |
(define_insn "fix_truncsfdi2" |
| 2375 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2376 |
(fix:DI (match_operand:SF 1 "register_operand" "r")))] |
| 2377 |
"TARGET_USE_FPU" |
| 2378 |
"trncf.sl %1, %0" |
| 2379 |
[(set_attr "length" "4") |
| 2380 |
(set_attr "type" "fpu")]) |
| 2381 |
|
| 2382 |
(define_insn "fixuns_truncsfdi2" |
| 2383 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2384 |
(unsigned_fix:DI (match_operand:SF 1 "register_operand" "r")))] |
| 2385 |
"TARGET_USE_FPU" |
| 2386 |
"trncf.sul %1, %0" |
| 2387 |
[(set_attr "length" "4") |
| 2388 |
(set_attr "type" "fpu")]) |
| 2389 |
|
| 2390 |
(define_insn "fix_truncdfdi2" |
| 2391 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2392 |
(fix:DI (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2393 |
"TARGET_USE_FPU" |
| 2394 |
"trncf.dl %1, %0" |
| 2395 |
[(set_attr "length" "4") |
| 2396 |
(set_attr "type" "fpu")]) |
| 2397 |
|
| 2398 |
(define_insn "fixuns_truncdfdi2" |
| 2399 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2400 |
(unsigned_fix:DI (match_operand:DF 1 "even_reg_operand" "r")))] |
| 2401 |
"TARGET_USE_FPU" |
| 2402 |
"trncf.dul %1, %0" |
| 2403 |
[(set_attr "length" "4") |
| 2404 |
(set_attr "type" "fpu")]) |
| 2405 |
|
| 2406 |
;; int -> float |
| 2407 |
(define_insn "floatsisf2" |
| 2408 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2409 |
(float:SF (match_operand:SI 1 "reg_or_0_operand" "rI")))] |
| 2410 |
"TARGET_USE_FPU" |
| 2411 |
"cvtf.ws %z1, %0" |
| 2412 |
[(set_attr "length" "4") |
| 2413 |
(set_attr "type" "fpu")]) |
| 2414 |
|
| 2415 |
(define_insn "unsfloatsisf2" |
| 2416 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2417 |
(unsigned_float:SF (match_operand:SI 1 "reg_or_0_operand" "rI")))] |
| 2418 |
"TARGET_USE_FPU" |
| 2419 |
"cvtf.uws %z1, %0" |
| 2420 |
[(set_attr "length" "4") |
| 2421 |
(set_attr "type" "fpu")]) |
| 2422 |
|
| 2423 |
(define_insn "floatsidf2" |
| 2424 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2425 |
(float:DF (match_operand:SI 1 "reg_or_0_operand" "rI")))] |
| 2426 |
"TARGET_USE_FPU" |
| 2427 |
"cvtf.wd %z1,%0" |
| 2428 |
[(set_attr "length" "4") |
| 2429 |
(set_attr "type" "fpu")]) |
| 2430 |
|
| 2431 |
(define_insn "unsfloatsidf2" |
| 2432 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2433 |
(unsigned_float:DF (match_operand:SI 1 "reg_or_0_operand" "rI")))] |
| 2434 |
"TARGET_USE_FPU" |
| 2435 |
"cvtf.uwd %z1, %0" |
| 2436 |
[(set_attr "length" "4") |
| 2437 |
(set_attr "type" "fpu")]) |
| 2438 |
|
| 2439 |
(define_insn "floatdisf2" |
| 2440 |
[(set (match_operand:SF 0 "even_reg_operand" "=r") |
| 2441 |
(float:SF (match_operand:DI 1 "reg_or_0_operand" "rI")))] |
| 2442 |
"TARGET_USE_FPU" |
| 2443 |
"cvtf.ls %z1, %0" |
| 2444 |
[(set_attr "length" "4") |
| 2445 |
(set_attr "type" "fpu")]) |
| 2446 |
|
| 2447 |
(define_insn "unsfloatdisf2" |
| 2448 |
[(set (match_operand:SF 0 "even_reg_operand" "=r") |
| 2449 |
(unsigned_float:SF (match_operand:DI 1 "reg_or_0_operand" "rI")))] |
| 2450 |
"TARGET_USE_FPU" |
| 2451 |
"cvtf.uls %z1, %0" |
| 2452 |
[(set_attr "length" "4") |
| 2453 |
(set_attr "type" "fpu")]) |
| 2454 |
|
| 2455 |
(define_insn "floatdidf2" |
| 2456 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2457 |
(float:DF (match_operand:DI 1 "reg_or_0_operand" "rI")))] |
| 2458 |
"TARGET_USE_FPU" |
| 2459 |
"cvtf.ld %z1, %0" |
| 2460 |
[(set_attr "length" "4") |
| 2461 |
(set_attr "type" "fpu")]) |
| 2462 |
|
| 2463 |
(define_insn "unsfloatdidf2" |
| 2464 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2465 |
(unsigned_float:DF (match_operand:DI 1 "reg_or_0_operand" "rI")))] |
| 2466 |
"TARGET_USE_FPU" |
| 2467 |
"cvtf.uld %z1, %0" |
| 2468 |
[(set_attr "length" "4") |
| 2469 |
(set_attr "type" "fpu")]) |
| 2470 |
|
| 2471 |
;; single-float -> double-float |
| 2472 |
(define_insn "extendsfdf2" |
| 2473 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2474 |
(float_extend:DF |
| 2475 |
(match_operand:SF 1 "reg_or_0_operand" "rI")))] |
| 2476 |
"TARGET_USE_FPU" |
| 2477 |
"cvtf.sd %z1,%0" |
| 2478 |
[(set_attr "length" "4") |
| 2479 |
(set_attr "type" "fpu")]) |
| 2480 |
|
| 2481 |
;; double-float -> single-float |
| 2482 |
(define_insn "truncdfsf2" |
| 2483 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2484 |
(float_truncate:SF |
| 2485 |
(match_operand:DF 1 "even_reg_operand" "r")))] |
| 2486 |
"TARGET_USE_FPU" |
| 2487 |
"cvtf.ds %1,%0" |
| 2488 |
[(set_attr "length" "4") |
| 2489 |
(set_attr "type" "fpu")]) |
| 2490 |
|
| 2491 |
;; |
| 2492 |
;; ---------------- special insns |
| 2493 |
;; |
| 2494 |
|
| 2495 |
;; reciprocal |
| 2496 |
|
| 2497 |
;; Generic code demands that the recip and rsqrt named patterns |
| 2498 |
;; have precisely one operand. So that's what we expose in the |
| 2499 |
;; expander via the strange UNSPEC. However, those expanders |
| 2500 |
;; generate normal looking recip and rsqrt patterns. |
| 2501 |
|
| 2502 |
(define_expand "recipsf2" |
| 2503 |
[(set (match_operand:SF 0 "register_operand" "") |
| 2504 |
(unspec:SF [(match_operand:SF 1 "register_operand" "")] |
| 2505 |
UNSPEC_RCP))] |
| 2506 |
"TARGET_USE_FPU" |
| 2507 |
{ |
| 2508 |
emit_insn (gen_recipsf2_insn (operands[0], CONST1_RTX (SFmode), operands[1])); |
| 2509 |
DONE; |
| 2510 |
}) |
| 2511 |
|
| 2512 |
(define_insn "recipsf2_insn" |
| 2513 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2514 |
(div:SF (match_operand:SF 1 "const_float_1_operand" "") |
| 2515 |
(match_operand:SF 2 "register_operand" "r")))] |
| 2516 |
"TARGET_USE_FPU" |
| 2517 |
"recipf.s %2,%0" |
| 2518 |
[(set_attr "length" "4") |
| 2519 |
(set_attr "type" "fpu")]) |
| 2520 |
|
| 2521 |
(define_expand "recipdf2" |
| 2522 |
[(set (match_operand:DF 0 "even_reg_operand" "") |
| 2523 |
(unspec:DF [(match_operand:SF 1 "even_reg_operand" "")] |
| 2524 |
UNSPEC_RCP))] |
| 2525 |
"TARGET_USE_FPU" |
| 2526 |
{ |
| 2527 |
emit_insn (gen_recipdf2_insn (operands[0], CONST1_RTX (DFmode), operands[1])); |
| 2528 |
DONE; |
| 2529 |
}) |
| 2530 |
|
| 2531 |
(define_insn "recipdf2_insn" |
| 2532 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2533 |
(div:DF (match_operand:DF 1 "const_float_1_operand" "") |
| 2534 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2535 |
"TARGET_USE_FPU" |
| 2536 |
"recipf.d %2,%0" |
| 2537 |
[(set_attr "length" "4") |
| 2538 |
(set_attr "type" "fpu")]) |
| 2539 |
|
| 2540 |
;;; reciprocal of square-root |
| 2541 |
(define_expand "rsqrtsf2" |
| 2542 |
[(set (match_operand:SF 0 "register_operand" "=") |
| 2543 |
(unspec:SF [(match_operand:SF 1 "register_operand" "")] |
| 2544 |
UNSPEC_RSQRT))] |
| 2545 |
"TARGET_USE_FPU" |
| 2546 |
{ |
| 2547 |
emit_insn (gen_rsqrtsf2_insn (operands[0], CONST1_RTX (SFmode), operands[1])); |
| 2548 |
DONE; |
| 2549 |
}) |
| 2550 |
|
| 2551 |
(define_insn "rsqrtsf2_insn" |
| 2552 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2553 |
(div:SF (match_operand:SF 1 "const_float_1_operand" "") |
| 2554 |
(sqrt:SF (match_operand:SF 2 "register_operand" "r"))))] |
| 2555 |
"TARGET_USE_FPU" |
| 2556 |
"rsqrtf.s %2,%0" |
| 2557 |
[(set_attr "length" "4") |
| 2558 |
(set_attr "type" "fpu")]) |
| 2559 |
|
| 2560 |
(define_expand "rsqrtdf2" |
| 2561 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2562 |
(unspec:DF [(match_operand:DF 1 "even_reg_operand" "r")] |
| 2563 |
UNSPEC_RSQRT))] |
| 2564 |
"TARGET_USE_FPU" |
| 2565 |
{ |
| 2566 |
emit_insn (gen_rsqrtdf2_insn (operands[0], CONST1_RTX (DFmode), operands[1])); |
| 2567 |
DONE; |
| 2568 |
}) |
| 2569 |
|
| 2570 |
(define_insn "rsqrtdf2_insn" |
| 2571 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2572 |
(div:DF (match_operand:DF 1 "const_float_1_operand" "") |
| 2573 |
(sqrt:DF (match_operand:DF 2 "even_reg_operand" "r"))))] |
| 2574 |
"TARGET_USE_FPU" |
| 2575 |
"rsqrtf.d %2,%0" |
| 2576 |
[(set_attr "length" "4") |
| 2577 |
(set_attr "type" "fpu")]) |
| 2578 |
|
| 2579 |
;; Note: The FPU-2.0 (ie pre e3v5) versions of these routines do not actually |
| 2580 |
;; need operand 4 to be the same as operand 0. But the FPU-2.0 versions are |
| 2581 |
;; also deprecated so the loss of flexibility is unimportant. |
| 2582 |
|
| 2583 |
;;; multiply-add |
| 2584 |
(define_insn "fmasf4" |
| 2585 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2586 |
(fma:SF (match_operand:SF 1 "register_operand" "r") |
| 2587 |
(match_operand:SF 2 "register_operand" "r") |
| 2588 |
(match_operand:SF 3 "register_operand" "0")))] |
| 2589 |
"TARGET_USE_FPU" |
| 2590 |
{ return TARGET_V850E3V5_UP ? "fmaf.s %1, %2, %0" : "maddf.s %2, %1, %3, %0"; } |
| 2591 |
[(set_attr "length" "4") |
| 2592 |
(set_attr "type" "fpu")]) |
| 2593 |
|
| 2594 |
;;; multiply-subtract |
| 2595 |
(define_insn "fmssf4" |
| 2596 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2597 |
(fma:SF (match_operand:SF 1 "register_operand" "r") |
| 2598 |
(match_operand:SF 2 "register_operand" "r") |
| 2599 |
(neg:SF (match_operand:SF 3 "register_operand" "0"))))] |
| 2600 |
"TARGET_USE_FPU" |
| 2601 |
{ return TARGET_V850E3V5_UP ? "fmsf.s %1, %2, %0" : "msubf.s %2, %1, %3, %0"; } |
| 2602 |
[(set_attr "length" "4") |
| 2603 |
(set_attr "type" "fpu")]) |
| 2604 |
|
| 2605 |
;;; negative-multiply-add |
| 2606 |
;; Note the name on this and the following insn were previously fnmasf4 |
| 2607 |
;; and fnmssf4. Those names are known to the gimple->rtl expanders and |
| 2608 |
;; must implement specific semantics (negating one of the inputs to the |
| 2609 |
;; multiplication). The v850 instructions actually negate the entire |
| 2610 |
;; result. Thus the names have been changed and hidden. |
| 2611 |
(define_insn "*v850_fnmasf4" |
| 2612 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2613 |
(neg:SF (fma:SF (match_operand:SF 1 "register_operand" "r") |
| 2614 |
(match_operand:SF 2 "register_operand" "r") |
| 2615 |
(match_operand:SF 3 "register_operand" "0"))))] |
| 2616 |
"TARGET_USE_FPU" |
| 2617 |
{ return TARGET_V850E3V5_UP ? "fnmaf.s %1, %2, %0" : "nmaddf.s %2, %1, %3, %0"; } |
| 2618 |
[(set_attr "length" "4") |
| 2619 |
(set_attr "type" "fpu")]) |
| 2620 |
|
| 2621 |
;; negative-multiply-subtract |
| 2622 |
(define_insn "*v850_fnmssf4" |
| 2623 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2624 |
(neg:SF (fma:SF (match_operand:SF 1 "register_operand" "r") |
| 2625 |
(match_operand:SF 2 "register_operand" "r") |
| 2626 |
(neg:SF (match_operand:SF 3 "register_operand" "0")))))] |
| 2627 |
"TARGET_USE_FPU" |
| 2628 |
{ return TARGET_V850E3V5_UP ? "fnmsf.s %1, %2, %0" : "nmsubf.s %2, %1, %3, %0"; } |
| 2629 |
[(set_attr "length" "4") |
| 2630 |
(set_attr "type" "fpu")]) |
| 2631 |
; |
| 2632 |
; ---------------- comparison/conditionals |
| 2633 |
; |
| 2634 |
; SF |
| 2635 |
|
| 2636 |
(define_insn "cmpsf_le_insn" |
| 2637 |
[(set (reg:CC_FPU_LE FCC_REGNUM) |
| 2638 |
(compare:CC_FPU_LE (match_operand:SF 0 "register_operand" "r") |
| 2639 |
(match_operand:SF 1 "register_operand" "r")))] |
| 2640 |
"reload_completed && TARGET_USE_FPU" |
| 2641 |
"cmpf.s le, %z0, %z1" |
| 2642 |
[(set_attr "length" "4") |
| 2643 |
(set_attr "type" "fpu")]) |
| 2644 |
|
| 2645 |
(define_insn "cmpsf_lt_insn" |
| 2646 |
[(set (reg:CC_FPU_LT FCC_REGNUM) |
| 2647 |
(compare:CC_FPU_LT (match_operand:SF 0 "register_operand" "r") |
| 2648 |
(match_operand:SF 1 "register_operand" "r")))] |
| 2649 |
"reload_completed && TARGET_USE_FPU" |
| 2650 |
"cmpf.s lt, %z0, %z1" |
| 2651 |
[(set_attr "length" "4") |
| 2652 |
(set_attr "type" "fpu")]) |
| 2653 |
|
| 2654 |
(define_insn "cmpsf_ge_insn" |
| 2655 |
[(set (reg:CC_FPU_GE FCC_REGNUM) |
| 2656 |
(compare:CC_FPU_GE (match_operand:SF 0 "register_operand" "r") |
| 2657 |
(match_operand:SF 1 "register_operand" "r")))] |
| 2658 |
"reload_completed && TARGET_USE_FPU" |
| 2659 |
"cmpf.s le, %z1, %z0" |
| 2660 |
[(set_attr "length" "4") |
| 2661 |
(set_attr "type" "fpu")]) |
| 2662 |
|
| 2663 |
(define_insn "cmpsf_gt_insn" |
| 2664 |
[(set (reg:CC_FPU_GT FCC_REGNUM) |
| 2665 |
(compare:CC_FPU_GT (match_operand:SF 0 "register_operand" "r") |
| 2666 |
(match_operand:SF 1 "register_operand" "r")))] |
| 2667 |
"reload_completed && TARGET_USE_FPU" |
| 2668 |
"cmpf.s lt, %z1, %z0" |
| 2669 |
[(set_attr "length" "4") |
| 2670 |
(set_attr "type" "fpu")]) |
| 2671 |
|
| 2672 |
(define_insn "cmpsf_eq_insn" |
| 2673 |
[(set (reg:CC_FPU_EQ FCC_REGNUM) |
| 2674 |
(compare:CC_FPU_EQ (match_operand:SF 0 "register_operand" "r") |
| 2675 |
(match_operand:SF 1 "register_operand" "r")))] |
| 2676 |
"reload_completed && TARGET_USE_FPU" |
| 2677 |
"cmpf.s eq, %z0, %z1" |
| 2678 |
[(set_attr "length" "4") |
| 2679 |
(set_attr "type" "fpu")]) |
| 2680 |
|
| 2681 |
; DF |
| 2682 |
|
| 2683 |
(define_insn "cmpdf_le_insn" |
| 2684 |
[(set (reg:CC_FPU_LE FCC_REGNUM) |
| 2685 |
(compare:CC_FPU_LE (match_operand:DF 0 "even_reg_operand" "r") |
| 2686 |
(match_operand:DF 1 "even_reg_operand" "r")))] |
| 2687 |
"reload_completed && TARGET_USE_FPU" |
| 2688 |
"cmpf.d le, %z0, %z1" |
| 2689 |
[(set_attr "length" "4") |
| 2690 |
(set_attr "type" "fpu")]) |
| 2691 |
|
| 2692 |
(define_insn "cmpdf_lt_insn" |
| 2693 |
[(set (reg:CC_FPU_LT FCC_REGNUM) |
| 2694 |
(compare:CC_FPU_LT (match_operand:DF 0 "even_reg_operand" "r") |
| 2695 |
(match_operand:DF 1 "even_reg_operand" "r")))] |
| 2696 |
"reload_completed && TARGET_USE_FPU" |
| 2697 |
"cmpf.d lt, %z0, %z1" |
| 2698 |
[(set_attr "length" "4") |
| 2699 |
(set_attr "type" "fpu")]) |
| 2700 |
|
| 2701 |
(define_insn "cmpdf_ge_insn" |
| 2702 |
[(set (reg:CC_FPU_GE FCC_REGNUM) |
| 2703 |
(compare:CC_FPU_GE (match_operand:DF 0 "even_reg_operand" "r") |
| 2704 |
(match_operand:DF 1 "even_reg_operand" "r")))] |
| 2705 |
"reload_completed && TARGET_USE_FPU" |
| 2706 |
"cmpf.d le, %z1, %z0" |
| 2707 |
[(set_attr "length" "4") |
| 2708 |
(set_attr "type" "fpu")]) |
| 2709 |
|
| 2710 |
(define_insn "cmpdf_gt_insn" |
| 2711 |
[(set (reg:CC_FPU_GT FCC_REGNUM) |
| 2712 |
(compare:CC_FPU_GT (match_operand:DF 0 "even_reg_operand" "r") |
| 2713 |
(match_operand:DF 1 "even_reg_operand" "r")))] |
| 2714 |
"reload_completed && TARGET_USE_FPU" |
| 2715 |
"cmpf.d lt, %z1, %z0" |
| 2716 |
[(set_attr "length" "4") |
| 2717 |
(set_attr "type" "fpu")]) |
| 2718 |
|
| 2719 |
(define_insn "cmpdf_eq_insn" |
| 2720 |
[(set (reg:CC_FPU_EQ FCC_REGNUM) |
| 2721 |
(compare:CC_FPU_EQ (match_operand:DF 0 "even_reg_operand" "r") |
| 2722 |
(match_operand:DF 1 "even_reg_operand" "r")))] |
| 2723 |
"reload_completed && TARGET_USE_FPU" |
| 2724 |
"cmpf.d eq, %z0, %z1" |
| 2725 |
[(set_attr "length" "4") |
| 2726 |
(set_attr "type" "fpu")]) |
| 2727 |
|
| 2728 |
;; |
| 2729 |
;; Transfer a v850e2v3 fcc to the Z bit of CC0 (this is necessary to do a |
| 2730 |
;; conditional branch based on a floating-point compare) |
| 2731 |
;; |
| 2732 |
|
| 2733 |
(define_insn "trfsr" |
| 2734 |
[(set (match_operand 0 "" "") (match_operand 1 "" ""))] |
| 2735 |
"reload_completed |
| 2736 |
&& TARGET_USE_FPU |
| 2737 |
&& GET_MODE(operands[0]) == GET_MODE(operands[1]) |
| 2738 |
&& GET_CODE(operands[0]) == REG && REGNO (operands[0]) == CC_REGNUM |
| 2739 |
&& GET_CODE(operands[1]) == REG && REGNO (operands[1]) == FCC_REGNUM |
| 2740 |
&& (GET_MODE(operands[0]) == CC_FPU_LEmode |
| 2741 |
|| GET_MODE(operands[0]) == CC_FPU_GEmode |
| 2742 |
|| GET_MODE(operands[0]) == CC_FPU_LTmode |
| 2743 |
|| GET_MODE(operands[0]) == CC_FPU_GTmode |
| 2744 |
|| GET_MODE(operands[0]) == CC_FPU_EQmode |
| 2745 |
|| GET_MODE(operands[0]) == CC_FPU_NEmode)" |
| 2746 |
"trfsr" |
| 2747 |
[(set_attr "length" "4") |
| 2748 |
(set_attr "type" "fpu")]) |
| 2749 |
|
| 2750 |
;; |
| 2751 |
;; Floating-point conditional moves for the v850e2v3. |
| 2752 |
;; |
| 2753 |
|
| 2754 |
;; The actual v850e2v3 conditional move instructions |
| 2755 |
;; |
| 2756 |
(define_insn "movsfcc_z_insn" |
| 2757 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2758 |
(if_then_else:SF |
| 2759 |
(match_operand 3 "v850_float_z_comparison_operator" "") |
| 2760 |
(match_operand:SF 1 "reg_or_0_operand" "rIG") |
| 2761 |
(match_operand:SF 2 "reg_or_0_operand" "rIG")))] |
| 2762 |
"TARGET_USE_FPU" |
| 2763 |
"cmovf.s 0,%z1,%z2,%0") |
| 2764 |
|
| 2765 |
(define_insn "movsfcc_nz_insn" |
| 2766 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2767 |
(if_then_else:SF |
| 2768 |
(match_operand 3 "v850_float_nz_comparison_operator" "") |
| 2769 |
(match_operand:SF 1 "reg_or_0_operand" "rIG") |
| 2770 |
(match_operand:SF 2 "reg_or_0_operand" "rIG")))] |
| 2771 |
"TARGET_USE_FPU" |
| 2772 |
"cmovf.s 0,%z2,%z1,%0") |
| 2773 |
|
| 2774 |
(define_insn "movdfcc_z_insn" |
| 2775 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2776 |
(if_then_else:DF |
| 2777 |
(match_operand 3 "v850_float_z_comparison_operator" "") |
| 2778 |
(match_operand:DF 1 "even_reg_operand" "r") |
| 2779 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2780 |
"TARGET_USE_FPU" |
| 2781 |
"cmovf.d 0,%z1,%z2,%0") |
| 2782 |
|
| 2783 |
(define_insn "movdfcc_nz_insn" |
| 2784 |
[(set (match_operand:DF 0 "even_reg_operand" "=r") |
| 2785 |
(if_then_else:DF |
| 2786 |
(match_operand 3 "v850_float_nz_comparison_operator" "") |
| 2787 |
(match_operand:DF 1 "even_reg_operand" "r") |
| 2788 |
(match_operand:DF 2 "even_reg_operand" "r")))] |
| 2789 |
"TARGET_USE_FPU" |
| 2790 |
"cmovf.d 0,%z2,%z1,%0") |
| 2791 |
|
| 2792 |
(define_insn "movedfcc_z_zero" |
| 2793 |
[(set (match_operand:DF 0 "register_operand" "=r") |
| 2794 |
(if_then_else:DF |
| 2795 |
(match_operand 3 "v850_float_z_comparison_operator" "") |
| 2796 |
(match_operand:DF 1 "reg_or_0_operand" "rIG") |
| 2797 |
(match_operand:DF 2 "reg_or_0_operand" "rIG")))] |
| 2798 |
"TARGET_USE_FPU" |
| 2799 |
"cmovf.s 0,%z1,%z2,%0 ; cmovf.s 0,%Z1,%Z2,%R0" |
| 2800 |
[(set_attr "length" "8")]) |
| 2801 |
|
| 2802 |
(define_insn "movedfcc_nz_zero" |
| 2803 |
[(set (match_operand:DF 0 "register_operand" "=r") |
| 2804 |
(if_then_else:DF |
| 2805 |
(match_operand 3 "v850_float_nz_comparison_operator" "") |
| 2806 |
(match_operand:DF 1 "reg_or_0_operand" "rIG") |
| 2807 |
(match_operand:DF 2 "reg_or_0_operand" "rIG")))] |
| 2808 |
"TARGET_USE_FPU" |
| 2809 |
"cmovf.s 0,%z2,%z1,%0 ; cmovf.s 0,%Z2,%Z1,%R0" |
| 2810 |
[(set_attr "length" "8")]) |
| 2811 |
|
| 2812 |
|
| 2813 |
;; ---------------------------------------------------------------------- |
| 2814 |
;; HELPER INSTRUCTIONS for saving the prologue and epilogue registers |
| 2815 |
;; ---------------------------------------------------------------------- |
| 2816 |
|
| 2817 |
;; This pattern will match a stack adjust RTX followed by any number of push |
| 2818 |
;; RTXs. These RTXs will then be turned into a suitable call to a worker |
| 2819 |
;; function. |
| 2820 |
|
| 2821 |
;; |
| 2822 |
;; Actually, convert the RTXs into a PREPARE instruction. |
| 2823 |
;; |
| 2824 |
|
| 2825 |
(define_insn "" |
| 2826 |
[(match_parallel 0 "pattern_is_ok_for_prepare" |
| 2827 |
[(set (reg:SI 3) |
| 2828 |
(plus:SI (reg:SI 3) (match_operand:SI 1 "immediate_operand" "i"))) |
| 2829 |
(set (mem:SI (plus:SI (reg:SI 3) |
| 2830 |
(match_operand:SI 2 "immediate_operand" "i"))) |
| 2831 |
(match_operand:SI 3 "register_is_ok_for_epilogue" "r"))])] |
| 2832 |
"TARGET_PROLOG_FUNCTION && (TARGET_V850E_UP)" |
| 2833 |
{ |
| 2834 |
return construct_prepare_instruction (operands[0]); |
| 2835 |
} |
| 2836 |
[(set_attr "length" "4")]) |
| 2837 |
|
| 2838 |
(define_insn "" |
| 2839 |
[(match_parallel 0 "pattern_is_ok_for_prologue" |
| 2840 |
[(set (reg:SI 3) |
| 2841 |
(plus:SI (reg:SI 3) (match_operand:SI 1 "immediate_operand" "i"))) |
| 2842 |
(set (mem:SI (plus:SI (reg:SI 3) |
| 2843 |
(match_operand:SI 2 "immediate_operand" "i"))) |
| 2844 |
(match_operand:SI 3 "register_is_ok_for_epilogue" "r"))])] |
| 2845 |
"TARGET_PROLOG_FUNCTION" |
| 2846 |
{ |
| 2847 |
return construct_save_jarl (operands[0]); |
| 2848 |
} |
| 2849 |
[(set (attr "length") (if_then_else (eq_attr "long_calls" "yes") |
| 2850 |
(const_string "16") |
| 2851 |
(const_string "4")))]) |
| 2852 |
|
| 2853 |
;; |
| 2854 |
;; Actually, turn the RTXs into a DISPOSE instruction. |
| 2855 |
;; |
| 2856 |
(define_insn "" |
| 2857 |
[(match_parallel 0 "pattern_is_ok_for_dispose" |
| 2858 |
[(return) |
| 2859 |
(set (reg:SI 3) |
| 2860 |
(plus:SI (reg:SI 3) (match_operand:SI 1 "immediate_operand" "i"))) |
| 2861 |
(set (match_operand:SI 2 "register_is_ok_for_epilogue" "=r") |
| 2862 |
(mem:SI (plus:SI (reg:SI 3) |
| 2863 |
(match_operand:SI 3 "immediate_operand" "i"))))])] |
| 2864 |
"TARGET_PROLOG_FUNCTION && (TARGET_V850E_UP)" |
| 2865 |
{ |
| 2866 |
return construct_dispose_instruction (operands[0]); |
| 2867 |
} |
| 2868 |
[(set_attr "length" "4")]) |
| 2869 |
|
| 2870 |
;; This pattern will match a return RTX followed by any number of pop RTXs |
| 2871 |
;; and possible a stack adjustment as well. These RTXs will be turned into |
| 2872 |
;; a suitable call to a worker function. |
| 2873 |
|
| 2874 |
(define_insn "" |
| 2875 |
[(match_parallel 0 "pattern_is_ok_for_epilogue" |
| 2876 |
[(return) |
| 2877 |
(set (reg:SI 3) |
| 2878 |
(plus:SI (reg:SI 3) (match_operand:SI 1 "immediate_operand" "i"))) |
| 2879 |
(set (match_operand:SI 2 "register_is_ok_for_epilogue" "=r") |
| 2880 |
(mem:SI (plus:SI (reg:SI 3) |
| 2881 |
(match_operand:SI 3 "immediate_operand" "i"))))])] |
| 2882 |
"TARGET_PROLOG_FUNCTION" |
| 2883 |
{ |
| 2884 |
return construct_restore_jr (operands[0]); |
| 2885 |
} |
| 2886 |
[(set (attr "length") (if_then_else (eq_attr "long_calls" "yes") |
| 2887 |
(const_string "12") |
| 2888 |
(const_string "4")))]) |
| 2889 |
|
| 2890 |
;; Initialize an interrupt function. Do not depend on TARGET_PROLOG_FUNCTION. |
| 2891 |
(define_insn "callt_save_interrupt" |
| 2892 |
[(unspec_volatile [(const_int 0)] 2) |
| 2893 |
(clobber (reg:CC CC_REGNUM))] |
| 2894 |
"(TARGET_V850E_UP) && !TARGET_DISABLE_CALLT" |
| 2895 |
;; The CALLT instruction stores the next address of CALLT to CTPC register |
| 2896 |
;; without saving its previous value. So if the interrupt handler |
| 2897 |
;; or its caller could possibly execute the CALLT insn, save_interrupt |
| 2898 |
;; MUST NOT be called via CALLT. |
| 2899 |
{ |
| 2900 |
output_asm_insn ("addi -28, sp, sp", operands); |
| 2901 |
output_asm_insn ("st.w r1, 24[sp]", operands); |
| 2902 |
output_asm_insn ("st.w r10, 12[sp]", operands); |
| 2903 |
output_asm_insn ("st.w r11, 16[sp]", operands); |
| 2904 |
output_asm_insn ("stsr ctpc, r10", operands); |
| 2905 |
output_asm_insn ("st.w r10, 20[sp]", operands); |
| 2906 |
output_asm_insn ("stsr ctpsw, r10", operands); |
| 2907 |
output_asm_insn ("st.w r10, 24[sp]", operands); |
| 2908 |
output_asm_insn ("callt ctoff(__callt_save_interrupt)", operands); |
| 2909 |
return ""; |
| 2910 |
} |
| 2911 |
[(set_attr "length" "26")]) |
| 2912 |
|
| 2913 |
(define_insn "callt_return_interrupt" |
| 2914 |
[(unspec_volatile [(const_int 0)] 3) |
| 2915 |
(clobber (reg:CC CC_REGNUM))] |
| 2916 |
"(TARGET_V850E_UP) && !TARGET_DISABLE_CALLT" |
| 2917 |
"callt ctoff(__callt_return_interrupt)" |
| 2918 |
[(set_attr "length" "2")]) |
| 2919 |
|
| 2920 |
(define_insn "save_interrupt" |
| 2921 |
[(set (reg:SI 3) (plus:SI (reg:SI 3) (const_int -20))) |
| 2922 |
(set (mem:SI (plus:SI (reg:SI 3) (const_int -20))) (reg:SI 30)) |
| 2923 |
(set (mem:SI (plus:SI (reg:SI 3) (const_int -16))) (reg:SI 4)) |
| 2924 |
(set (mem:SI (plus:SI (reg:SI 3) (const_int -12))) (reg:SI 1)) |
| 2925 |
(set (mem:SI (plus:SI (reg:SI 3) (const_int -8))) (reg:SI 10)) |
| 2926 |
(set (mem:SI (plus:SI (reg:SI 3) (const_int -4))) (reg:SI 11)) |
| 2927 |
(clobber (reg:CC CC_REGNUM))] |
| 2928 |
"" |
| 2929 |
{ |
| 2930 |
if (TARGET_PROLOG_FUNCTION && !TARGET_LONG_CALLS) |
| 2931 |
return "addi -20,sp,sp \; st.w r11,16[sp] \; st.w r10,12[sp] \; jarl __save_interrupt,r10"; |
| 2932 |
else |
| 2933 |
{ |
| 2934 |
output_asm_insn ("addi -20, sp, sp", operands); |
| 2935 |
output_asm_insn ("st.w r11, 16[sp]", operands); |
| 2936 |
output_asm_insn ("st.w r10, 12[sp]", operands); |
| 2937 |
output_asm_insn ("st.w ep, 0[sp]", operands); |
| 2938 |
output_asm_insn ("st.w gp, 4[sp]", operands); |
| 2939 |
output_asm_insn ("st.w r1, 8[sp]", operands); |
| 2940 |
output_asm_insn ("movhi hi(__ep), r0, ep", operands); |
| 2941 |
output_asm_insn ("movea lo(__ep), ep, ep", operands); |
| 2942 |
output_asm_insn ("movhi hi(__gp), r0, gp", operands); |
| 2943 |
output_asm_insn ("movea lo(__gp), gp, gp", operands); |
| 2944 |
return ""; |
| 2945 |
} |
| 2946 |
} |
| 2947 |
[(set (attr "length") |
| 2948 |
(if_then_else (match_test "TARGET_LONG_CALLS") |
| 2949 |
(const_int 10) |
| 2950 |
(const_int 34)))]) |
| 2951 |
|
| 2952 |
;; Restore r1, r4, r10, and return from the interrupt |
| 2953 |
(define_insn "return_interrupt" |
| 2954 |
[(return) |
| 2955 |
(set (reg:SI 3) (plus:SI (reg:SI 3) (const_int 20))) |
| 2956 |
(set (reg:SI 11) (mem:SI (plus:SI (reg:SI 3) (const_int 16)))) |
| 2957 |
(set (reg:SI 10) (mem:SI (plus:SI (reg:SI 3) (const_int 12)))) |
| 2958 |
(set (reg:SI 1) (mem:SI (plus:SI (reg:SI 3) (const_int 8)))) |
| 2959 |
(set (reg:SI 4) (mem:SI (plus:SI (reg:SI 3) (const_int 4)))) |
| 2960 |
(set (reg:SI 30) (mem:SI (reg:SI 3))) |
| 2961 |
(clobber (reg:CC CC_REGNUM))] |
| 2962 |
"" |
| 2963 |
{ |
| 2964 |
if (TARGET_PROLOG_FUNCTION && !TARGET_LONG_CALLS) |
| 2965 |
return "jr __return_interrupt"; |
| 2966 |
else |
| 2967 |
{ |
| 2968 |
output_asm_insn ("ld.w 0[sp], ep", operands); |
| 2969 |
output_asm_insn ("ld.w 4[sp], gp", operands); |
| 2970 |
output_asm_insn ("ld.w 8[sp], r1", operands); |
| 2971 |
output_asm_insn ("ld.w 12[sp], r10", operands); |
| 2972 |
output_asm_insn ("ld.w 16[sp], r11", operands); |
| 2973 |
output_asm_insn ("addi 20, sp, sp", operands); |
| 2974 |
output_asm_insn ("reti", operands); |
| 2975 |
return ""; |
| 2976 |
} |
| 2977 |
} |
| 2978 |
[(set (attr "length") |
| 2979 |
(if_then_else (match_test "TARGET_LONG_CALLS") |
| 2980 |
(const_int 4) |
| 2981 |
(const_int 24)))]) |
| 2982 |
|
| 2983 |
;; Save all registers except for the registers saved in save_interrupt when |
| 2984 |
;; an interrupt function makes a call. |
| 2985 |
;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and |
| 2986 |
;; all of memory. This blocks insns from being moved across this point. |
| 2987 |
;; This is needed because the rest of the compiler is not ready to handle |
| 2988 |
;; insns this complicated. |
| 2989 |
|
| 2990 |
(define_insn "callt_save_all_interrupt" |
| 2991 |
[(unspec_volatile [(const_int 0)] 0) |
| 2992 |
(clobber (reg:CC CC_REGNUM))] |
| 2993 |
"(TARGET_V850E_UP) && !TARGET_DISABLE_CALLT" |
| 2994 |
"callt ctoff(__callt_save_all_interrupt)" |
| 2995 |
[(set_attr "length" "2")]) |
| 2996 |
|
| 2997 |
(define_insn "save_all_interrupt" |
| 2998 |
[(unspec_volatile [(const_int 0)] 0) |
| 2999 |
(clobber (reg:CC CC_REGNUM))] |
| 3000 |
"" |
| 3001 |
{ |
| 3002 |
if (TARGET_PROLOG_FUNCTION && !TARGET_LONG_CALLS) |
| 3003 |
return "jarl __save_all_interrupt,r10"; |
| 3004 |
|
| 3005 |
output_asm_insn ("addi -120, sp, sp", operands); |
| 3006 |
|
| 3007 |
if (TARGET_EP) |
| 3008 |
{ |
| 3009 |
output_asm_insn ("mov ep, r1", operands); |
| 3010 |
output_asm_insn ("mov sp, ep", operands); |
| 3011 |
output_asm_insn ("sst.w r31, 116[ep]", operands); |
| 3012 |
output_asm_insn ("sst.w r2, 112[ep]", operands); |
| 3013 |
output_asm_insn ("sst.w gp, 108[ep]", operands); |
| 3014 |
output_asm_insn ("sst.w r6, 104[ep]", operands); |
| 3015 |
output_asm_insn ("sst.w r7, 100[ep]", operands); |
| 3016 |
output_asm_insn ("sst.w r8, 96[ep]", operands); |
| 3017 |
output_asm_insn ("sst.w r9, 92[ep]", operands); |
| 3018 |
output_asm_insn ("sst.w r11, 88[ep]", operands); |
| 3019 |
output_asm_insn ("sst.w r12, 84[ep]", operands); |
| 3020 |
output_asm_insn ("sst.w r13, 80[ep]", operands); |
| 3021 |
output_asm_insn ("sst.w r14, 76[ep]", operands); |
| 3022 |
output_asm_insn ("sst.w r15, 72[ep]", operands); |
| 3023 |
output_asm_insn ("sst.w r16, 68[ep]", operands); |
| 3024 |
output_asm_insn ("sst.w r17, 64[ep]", operands); |
| 3025 |
output_asm_insn ("sst.w r18, 60[ep]", operands); |
| 3026 |
output_asm_insn ("sst.w r19, 56[ep]", operands); |
| 3027 |
output_asm_insn ("sst.w r20, 52[ep]", operands); |
| 3028 |
output_asm_insn ("sst.w r21, 48[ep]", operands); |
| 3029 |
output_asm_insn ("sst.w r22, 44[ep]", operands); |
| 3030 |
output_asm_insn ("sst.w r23, 40[ep]", operands); |
| 3031 |
output_asm_insn ("sst.w r24, 36[ep]", operands); |
| 3032 |
output_asm_insn ("sst.w r25, 32[ep]", operands); |
| 3033 |
output_asm_insn ("sst.w r26, 28[ep]", operands); |
| 3034 |
output_asm_insn ("sst.w r27, 24[ep]", operands); |
| 3035 |
output_asm_insn ("sst.w r28, 20[ep]", operands); |
| 3036 |
output_asm_insn ("sst.w r29, 16[ep]", operands); |
| 3037 |
output_asm_insn ("mov r1, ep", operands); |
| 3038 |
} |
| 3039 |
else |
| 3040 |
{ |
| 3041 |
output_asm_insn ("st.w r31, 116[sp]", operands); |
| 3042 |
output_asm_insn ("st.w r2, 112[sp]", operands); |
| 3043 |
output_asm_insn ("st.w gp, 108[sp]", operands); |
| 3044 |
output_asm_insn ("st.w r6, 104[sp]", operands); |
| 3045 |
output_asm_insn ("st.w r7, 100[sp]", operands); |
| 3046 |
output_asm_insn ("st.w r8, 96[sp]", operands); |
| 3047 |
output_asm_insn ("st.w r9, 92[sp]", operands); |
| 3048 |
output_asm_insn ("st.w r11, 88[sp]", operands); |
| 3049 |
output_asm_insn ("st.w r12, 84[sp]", operands); |
| 3050 |
output_asm_insn ("st.w r13, 80[sp]", operands); |
| 3051 |
output_asm_insn ("st.w r14, 76[sp]", operands); |
| 3052 |
output_asm_insn ("st.w r15, 72[sp]", operands); |
| 3053 |
output_asm_insn ("st.w r16, 68[sp]", operands); |
| 3054 |
output_asm_insn ("st.w r17, 64[sp]", operands); |
| 3055 |
output_asm_insn ("st.w r18, 60[sp]", operands); |
| 3056 |
output_asm_insn ("st.w r19, 56[sp]", operands); |
| 3057 |
output_asm_insn ("st.w r20, 52[sp]", operands); |
| 3058 |
output_asm_insn ("st.w r21, 48[sp]", operands); |
| 3059 |
output_asm_insn ("st.w r22, 44[sp]", operands); |
| 3060 |
output_asm_insn ("st.w r23, 40[sp]", operands); |
| 3061 |
output_asm_insn ("st.w r24, 36[sp]", operands); |
| 3062 |
output_asm_insn ("st.w r25, 32[sp]", operands); |
| 3063 |
output_asm_insn ("st.w r26, 28[sp]", operands); |
| 3064 |
output_asm_insn ("st.w r27, 24[sp]", operands); |
| 3065 |
output_asm_insn ("st.w r28, 20[sp]", operands); |
| 3066 |
output_asm_insn ("st.w r29, 16[sp]", operands); |
| 3067 |
} |
| 3068 |
|
| 3069 |
return ""; |
| 3070 |
} |
| 3071 |
[(set (attr "length") |
| 3072 |
(if_then_else (match_test "TARGET_LONG_CALLS") |
| 3073 |
(const_int 4) |
| 3074 |
(const_int 62) |
| 3075 |
))]) |
| 3076 |
|
| 3077 |
(define_insn "_save_all_interrupt" |
| 3078 |
[(unspec_volatile [(const_int 0)] 0) |
| 3079 |
(clobber (reg:CC CC_REGNUM))] |
| 3080 |
"TARGET_V850 && ! TARGET_LONG_CALLS" |
| 3081 |
"jarl __save_all_interrupt,r10" |
| 3082 |
[(set_attr "length" "4")]) |
| 3083 |
|
| 3084 |
;; Restore all registers saved when an interrupt function makes a call. |
| 3085 |
;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and |
| 3086 |
;; all of memory. This blocks insns from being moved across this point. |
| 3087 |
;; This is needed because the rest of the compiler is not ready to handle |
| 3088 |
;; insns this complicated. |
| 3089 |
|
| 3090 |
(define_insn "callt_restore_all_interrupt" |
| 3091 |
[(unspec_volatile [(const_int 0)] 1) |
| 3092 |
(clobber (reg:CC CC_REGNUM))] |
| 3093 |
"(TARGET_V850E_UP) && !TARGET_DISABLE_CALLT" |
| 3094 |
"callt ctoff(__callt_restore_all_interrupt)" |
| 3095 |
[(set_attr "length" "2")]) |
| 3096 |
|
| 3097 |
(define_insn "restore_all_interrupt" |
| 3098 |
[(unspec_volatile [(const_int 0)] 1) |
| 3099 |
(clobber (reg:CC CC_REGNUM))] |
| 3100 |
"" |
| 3101 |
{ |
| 3102 |
if (TARGET_PROLOG_FUNCTION && !TARGET_LONG_CALLS) |
| 3103 |
return "jarl __restore_all_interrupt,r10"; |
| 3104 |
|
| 3105 |
if (TARGET_EP) |
| 3106 |
{ |
| 3107 |
output_asm_insn ("mov ep, r1", operands); |
| 3108 |
output_asm_insn ("mov sp, ep", operands); |
| 3109 |
output_asm_insn ("sld.w 116[ep], r31", operands); |
| 3110 |
output_asm_insn ("sld.w 112[ep], r2", operands); |
| 3111 |
output_asm_insn ("sld.w 108[ep], gp", operands); |
| 3112 |
output_asm_insn ("sld.w 104[ep], r6", operands); |
| 3113 |
output_asm_insn ("sld.w 100[ep], r7", operands); |
| 3114 |
output_asm_insn ("sld.w 96[ep], r8", operands); |
| 3115 |
output_asm_insn ("sld.w 92[ep], r9", operands); |
| 3116 |
output_asm_insn ("sld.w 88[ep], r11", operands); |
| 3117 |
output_asm_insn ("sld.w 84[ep], r12", operands); |
| 3118 |
output_asm_insn ("sld.w 80[ep], r13", operands); |
| 3119 |
output_asm_insn ("sld.w 76[ep], r14", operands); |
| 3120 |
output_asm_insn ("sld.w 72[ep], r15", operands); |
| 3121 |
output_asm_insn ("sld.w 68[ep], r16", operands); |
| 3122 |
output_asm_insn ("sld.w 64[ep], r17", operands); |
| 3123 |
output_asm_insn ("sld.w 60[ep], r18", operands); |
| 3124 |
output_asm_insn ("sld.w 56[ep], r19", operands); |
| 3125 |
output_asm_insn ("sld.w 52[ep], r20", operands); |
| 3126 |
output_asm_insn ("sld.w 48[ep], r21", operands); |
| 3127 |
output_asm_insn ("sld.w 44[ep], r22", operands); |
| 3128 |
output_asm_insn ("sld.w 40[ep], r23", operands); |
| 3129 |
output_asm_insn ("sld.w 36[ep], r24", operands); |
| 3130 |
output_asm_insn ("sld.w 32[ep], r25", operands); |
| 3131 |
output_asm_insn ("sld.w 28[ep], r26", operands); |
| 3132 |
output_asm_insn ("sld.w 24[ep], r27", operands); |
| 3133 |
output_asm_insn ("sld.w 20[ep], r28", operands); |
| 3134 |
output_asm_insn ("sld.w 16[ep], r29", operands); |
| 3135 |
output_asm_insn ("mov r1, ep", operands); |
| 3136 |
} |
| 3137 |
else |
| 3138 |
{ |
| 3139 |
output_asm_insn ("ld.w 116[sp], r31", operands); |
| 3140 |
output_asm_insn ("ld.w 112[sp], r2", operands); |
| 3141 |
output_asm_insn ("ld.w 108[sp], gp", operands); |
| 3142 |
output_asm_insn ("ld.w 104[sp], r6", operands); |
| 3143 |
output_asm_insn ("ld.w 100[sp], r7", operands); |
| 3144 |
output_asm_insn ("ld.w 96[sp], r8", operands); |
| 3145 |
output_asm_insn ("ld.w 92[sp], r9", operands); |
| 3146 |
output_asm_insn ("ld.w 88[sp], r11", operands); |
| 3147 |
output_asm_insn ("ld.w 84[sp], r12", operands); |
| 3148 |
output_asm_insn ("ld.w 80[sp], r13", operands); |
| 3149 |
output_asm_insn ("ld.w 76[sp], r14", operands); |
| 3150 |
output_asm_insn ("ld.w 72[sp], r15", operands); |
| 3151 |
output_asm_insn ("ld.w 68[sp], r16", operands); |
| 3152 |
output_asm_insn ("ld.w 64[sp], r17", operands); |
| 3153 |
output_asm_insn ("ld.w 60[sp], r18", operands); |
| 3154 |
output_asm_insn ("ld.w 56[sp], r19", operands); |
| 3155 |
output_asm_insn ("ld.w 52[sp], r20", operands); |
| 3156 |
output_asm_insn ("ld.w 48[sp], r21", operands); |
| 3157 |
output_asm_insn ("ld.w 44[sp], r22", operands); |
| 3158 |
output_asm_insn ("ld.w 40[sp], r23", operands); |
| 3159 |
output_asm_insn ("ld.w 36[sp], r24", operands); |
| 3160 |
output_asm_insn ("ld.w 32[sp], r25", operands); |
| 3161 |
output_asm_insn ("ld.w 28[sp], r26", operands); |
| 3162 |
output_asm_insn ("ld.w 24[sp], r27", operands); |
| 3163 |
output_asm_insn ("ld.w 20[sp], r28", operands); |
| 3164 |
output_asm_insn ("ld.w 16[sp], r29", operands); |
| 3165 |
} |
| 3166 |
output_asm_insn ("addi 120, sp, sp", operands); |
| 3167 |
return ""; |
| 3168 |
} |
| 3169 |
[(set (attr "length") |
| 3170 |
(if_then_else (match_test "TARGET_LONG_CALLS") |
| 3171 |
(const_int 4) |
| 3172 |
(const_int 62) |
| 3173 |
))]) |
| 3174 |
|
| 3175 |
(define_insn "_restore_all_interrupt" |
| 3176 |
[(unspec_volatile [(const_int 0)] 1) |
| 3177 |
(clobber (reg:CC CC_REGNUM))] |
| 3178 |
"TARGET_V850 && ! TARGET_LONG_CALLS" |
| 3179 |
"jarl __restore_all_interrupt,r10" |
| 3180 |
[(set_attr "length" "4")]) |