1 ;; Frv Machine Description 2 ;; Copyright (C) 1999-2024 Free Software Foundation, Inc. 3 ;; Contributed by Red Hat, Inc. 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 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. 22 23 25 ;; :::::::::::::::::::: 26 ;; :: 27 ;; :: Unspec's used 28 ;; :: 29 ;; :::::::::::::::::::: 30 31 ;; GOT constants must go 12/HI/LO for the splitter to work 32 33 (define_constants 34 [(UNSPEC_BLOCKAGE 0) 35 (UNSPEC_CC_TO_GPR 1) 36 (UNSPEC_GPR_TO_CC 2) 37 (UNSPEC_PIC_PROLOGUE 3) 38 (UNSPEC_CR_LOGIC 4) 39 (UNSPEC_STACK_ADJUST 5) 40 (UNSPEC_EH_RETURN_EPILOGUE 6) 41 (UNSPEC_GOT 7) 42 (UNSPEC_LDD 8) 43 (UNSPEC_OPTIONAL_MEMBAR 9) 44 45 (UNSPEC_GETTLSOFF 200) 46 (UNSPEC_TLS_LOAD_GOTTLSOFF12 201) 47 (UNSPEC_TLS_INDIRECT_CALL 202) 48 (UNSPEC_TLS_TLSDESC_LDD 203) 49 (UNSPEC_TLS_TLSDESC_LDD_AUX 204) 50 (UNSPEC_TLS_TLSOFF_LD 205) 51 (UNSPEC_TLS_LDDI 206) 52 (UNSPEC_TLSOFF_HILO 207) 53 54 (R_FRV_GOT12 11) 55 (R_FRV_GOTHI 12) 56 (R_FRV_GOTLO 13) 57 (R_FRV_FUNCDESC 14) 58 (R_FRV_FUNCDESC_GOT12 15) 59 (R_FRV_FUNCDESC_GOTHI 16) 60 (R_FRV_FUNCDESC_GOTLO 17) 61 (R_FRV_FUNCDESC_VALUE 18) 62 (R_FRV_FUNCDESC_GOTOFF12 19) 63 (R_FRV_FUNCDESC_GOTOFFHI 20) 64 (R_FRV_FUNCDESC_GOTOFFLO 21) 65 (R_FRV_GOTOFF12 22) 66 (R_FRV_GOTOFFHI 23) 67 (R_FRV_GOTOFFLO 24) 68 (R_FRV_GPREL12 25) 69 (R_FRV_GPRELHI 26) 70 (R_FRV_GPRELLO 27) 71 (R_FRV_GOTTLSOFF_HI 28) 72 (R_FRV_GOTTLSOFF_LO 29) 73 (R_FRV_TLSMOFFHI 30) 74 (R_FRV_TLSMOFFLO 31) 75 (R_FRV_TLSMOFF12 32) 76 (R_FRV_TLSDESCHI 33) 77 (R_FRV_TLSDESCLO 34) 78 (R_FRV_GOTTLSDESCHI 35) 79 (R_FRV_GOTTLSDESCLO 36) 80 81 (GR8_REG 8) 82 (GR9_REG 9) 83 (GR14_REG 14) 84 ;; LR_REG conflicts with definition in frv.h 85 (LRREG 169) 86 (FDPIC_REG 15) 87 ]) 88 89 (define_mode_iterator IMODE [QI HI SI DI]) 90 (define_mode_attr IMODEsuffix [(QI "b") (HI "h") (SI "") (DI "d")]) 91 (define_mode_attr BREADsuffix [(QI "ub") (HI "uh") (SI "") (DI "d")]) 92 94 (define_attr "length" "" (const_int 4)) 95 96 ;; Processor type -- this attribute must exactly match the processor_type 97 ;; enumeration in frv-protos.h. 98 99 (define_attr "cpu" "generic,fr550,fr500,fr450,fr405,fr400,fr300,simple,tomcat" 100 (const (symbol_ref "(enum attr_cpu) frv_cpu_type"))) 101 102 ;; Attribute is "yes" for branches and jumps that span too great a distance 103 ;; to be implemented in the most natural way. Such instructions will use 104 ;; a call instruction in some way. 105 106 (define_attr "far_jump" "yes,no" (const_string "no")) 107 108 ;; Instruction type 109 ;; "unknown" must come last. 110 (define_attr "type" 111 "int,sethi,setlo,mul,div,gload,gstore,fload,fstore,movfg,movgf,macc,scan,cut,branch,jump,jumpl,call,spr,trap,fnop,fsconv,fsadd,fscmp,fsmul,fsmadd,fsdiv,sqrt_single,fdconv,fdadd,fdcmp,fdmul,fdmadd,fddiv,sqrt_double,mnop,mlogic,maveh,msath,maddh,mqaddh,mpackh,munpackh,mdpackh,mbhconv,mrot,mshift,mexpdhw,mexpdhd,mwcut,mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach,mcpx,mqcpx,mcut,mclracc,mclracca,mdunpackh,mbhconve,mrdacc,mwtacc,maddacc,mdaddacc,mabsh,mdrot,mcpl,mdcut,mqsath,mqlimh,mqshift,mset,ccr,multi,load_or_call,unknown" 112 (const_string "unknown")) 113 114 (define_attr "acc_group" "none,even,odd" 115 (symbol_ref "(enum attr_acc_group) frv_acc_group (insn)")) 116 118 ;; Scheduling and Packing Overview 119 ;; ------------------------------- 120 ;; 121 ;; FR-V instructions are divided into five groups: integer, floating-point, 122 ;; media, branch and control. Each group is associated with a separate set 123 ;; of processing units, the number and behavior of which depend on the target 124 ;; target processor. Integer units have names like I0 and I1, floating-point 125 ;; units have names like F0 and F1, and so on. 126 ;; 127 ;; Each member of the FR-V family has its own restrictions on which 128 ;; instructions can issue to which units. For example, some processors 129 ;; allow loads to issue to I0 or I1 while others only allow them to issue 130 ;; to I0. As well as these processor-specific restrictions, there is a 131 ;; general rule that an instruction can only issue to unit X + 1 if an 132 ;; instruction in the same packet issued to unit X. 133 ;; 134 ;; Sometimes the only way to honor these restrictions is by adding nops 135 ;; to a packet. For example, on the fr550, media instructions that access 136 ;; ACC4-7 can only issue to M1 or M3. It is therefore only possible to 137 ;; execute these instructions by packing them with something that issues 138 ;; to M0. When no useful M0 instruction exists, an "mnop" can be used 139 ;; instead. 140 ;; 141 ;; Having decided which instructions should issue to which units, the packet 142 ;; should be ordered according to the following template: 143 ;; 144 ;; I0 F0/M0 I1 F1/M1 .... B0 B1 ... 145 ;; 146 ;; Note that VLIW packets execute strictly in parallel. Every instruction 147 ;; in the packet will stall until all input operands are ready. These 148 ;; operands are then read simultaneously before any registers are modified. 149 ;; This means that it's OK to have write-after-read hazards between 150 ;; instructions in the same packet, even if the write is listed earlier 151 ;; than the read. 152 ;; 153 ;; Three gcc passes are involved in generating VLIW packets: 154 ;; 155 ;; (1) The scheduler. This pass uses the standard scheduling code and 156 ;; behaves in much the same way as it would for a superscalar RISC 157 ;; architecture. 158 ;; 159 ;; (2) frv_reorg. This pass inserts nops into packets in order to meet 160 ;; the processor's issue requirements. It also has code to optimize 161 ;; the type of padding used to align labels. 162 ;; 163 ;; (3) frv_pack_insns. The final packing phase, which puts the 164 ;; instructions into assembly language order according to the 165 ;; "I0 F0/M0 ..." template above. 166 ;; 167 ;; In the ideal case, these three passes will agree on which instructions 168 ;; should be packed together, but this won't always happen. In particular: 169 ;; 170 ;; (a) (2) might not pack predicated instructions in the same way as (1). 171 ;; The scheduler tries to schedule predicated instructions for the 172 ;; worst case, assuming the predicate is true. However, if we have 173 ;; something like a predicated load, it isn't always possible to 174 ;; fill the load delay with useful instructions. (2) should then 175 ;; pack the user of the loaded value as aggressively as possible, 176 ;; in order to optimize the case when the predicate is false. 177 ;; See frv_pack_insn_p for more details. 178 ;; 179 ;; (b) The final shorten_branches pass runs between (2) and (3). 180 ;; Since (2) inserts nops, it is possible that some branches 181 ;; that were thought to be in range during (2) turned out to 182 ;; out-of-range in (3). 183 ;; 184 ;; All three passes use DFAs to model issue restrictions. The main 185 ;; question that the DFAs are supposed to answer is simply: can these 186 ;; instructions be packed together? The DFAs are not responsible for 187 ;; assigning instructions to execution units; that's the job of 188 ;; frv_sort_insn_group, see below for details. 189 ;; 190 ;; To get the best results, the DFAs should try to allow packets to 191 ;; be built in every possible order. This gives the scheduler more 192 ;; flexibility, removing the need for things like multipass lookahead. 193 ;; It also means we can take more advantage of inter-packet dependencies. 194 ;; 195 ;; For example, suppose we're compiling for the fr400 and we have: 196 ;; 197 ;; addi gr4,#1,gr5 198 ;; ldi @(gr6,gr0),gr4 199 ;; 200 ;; We can pack these instructions together by assigning the load to I0 and 201 ;; the addition to I1. However, because of the anti dependence between the 202 ;; two instructions, the scheduler must schedule the addition first. 203 ;; We should generally get better schedules if the DFA allows both 204 ;; (ldi, addi) and (addi, ldi), leaving the final packing pass to 205 ;; reorder the packet where appropriate. 206 ;; 207 ;; Almost all integer instructions can issue to any unit in the range I0 208 ;; to Ix, where the value of "x" depends on the type of instruction and 209 ;; on the target processor. The rules for other instruction groups are 210 ;; usually similar. 211 ;; 212 ;; When the restrictions are as regular as this, we can get the desired 213 ;; behavior by claiming the DFA unit associated with the highest unused 214 ;; execution unit. For example, if an instruction can issue to I0 or I1, 215 ;; the DFA first tries to take the DFA unit associated with I1, and will 216 ;; only take I0's unit if I1 isn't free. (Note that, as mentioned above, 217 ;; the DFA does not assign instructions to units. An instruction that 218 ;; claims DFA unit I1 will not necessarily issue to I1 in the final packet.) 219 ;; 220 ;; There are some cases, such as the fr550 media restriction mentioned 221 ;; above, where the rule is not as simple as "any unit between 0 and X". 222 ;; Even so, allocating higher units first brings us close to the ideal. 223 ;; 224 ;; Having divided instructions into packets, passes (2) and (3) must 225 ;; assign instructions to specific execution units. They do this using 226 ;; the following algorithm: 227 ;; 228 ;; 1. Partition the instructions into groups (integer, float/media, etc.) 229 ;; 230 ;; 2. For each group of instructions: 231 ;; 232 ;; (a) Issue each instruction in the reset DFA state and use the 233 ;; DFA cpu_unit_query interface to find out which unit it picks 234 ;; first. 235 ;; 236 ;; (b) Sort the instructions into ascending order of picked units. 237 ;; Instructions that pick I1 first come after those that pick 238 ;; I0 first, and so on. Let S be the sorted sequence and S[i] 239 ;; be the ith element of it (counting from zero). 240 ;; 241 ;; (c) If this is the control or branch group, goto (i) 242 ;; 243 ;; (d) Find the largest L such that S[0]...S[L-1] can be issued 244 ;; consecutively from the reset state and such that the DFA 245 ;; claims unit X when S[X] is added. Let D be the DFA state 246 ;; after instructions S[0]...S[L-1] have been issued. 247 ;; 248 ;; (e) If L is the length of S, goto (i) 249 ;; 250 ;; (f) Let U be the number of units belonging to this group and #S be 251 ;; the length of S. Create a new sequence S' by concatenating 252 ;; S[L]...S[#S-1] and (U - #S) nops. 253 ;; 254 ;; (g) For each permutation S'' of S', try issuing S'' from last to 255 ;; first, starting with state D. See if the DFA claims unit 256 ;; X + L when each S''[X] is added. If so, set S to the 257 ;; concatenation of S[0]...S[L-1] and S'', then goto (i). 258 ;; 259 ;; (h) If (g) found no permutation, abort. 260 ;; 261 ;; (i) S is now the sorted sequence for this group, meaning that S[X] 262 ;; issues to unit X. Trim any unwanted nops from the end of S. 263 ;; 264 ;; The sequence calculated by (b) is trivially correct for control 265 ;; instructions since they can't be packed. It is also correct for branch 266 ;; instructions due to their simple issue requirements. For integer and 267 ;; floating-point/media instructions, the sequence calculated by (b) is 268 ;; often the correct answer; the rest of the algorithm is optimized for 269 ;; the case in which it is correct. 270 ;; 271 ;; If there were no irregularities in the issue restrictions then step 272 ;; (d) would not be needed. It is mainly there to cope with the fr550 273 ;; integer restrictions, where a store can issue to I1, but only if a store 274 ;; also issues to I0. (Note that if a packet has two stores, they will be 275 ;; at the beginning of the sequence calculated by (b).) It also copes 276 ;; with fr400 M-2 instructions, which must issue to M0, and which cannot 277 ;; be issued together with an mnop in M1. 278 ;; 279 ;; Step (g) is the main one for integer and float/media instructions. 280 ;; The first permutation it tries is S' itself (because, as noted above, 281 ;; the sequence calculated by (b) is often correct). If S' doesn't work, 282 ;; the implementation tries varying the beginning of the sequence first. 283 ;; Thus the nops towards the end of the sequence will only move to lower 284 ;; positions if absolutely necessary. 285 ;; 286 ;; The algorithm is theoretically exponential in the number of instructions 287 ;; in a group, although it's only O(n log(n)) if the sequence calculated by 288 ;; (b) is acceptable. In practice, the algorithm completes quickly even 289 ;; in the rare cases where (g) needs to try other permutations. 290 (define_automaton "integer, float_media, branch, control, idiv, div") 291 292 ;; The main issue units. Note that not all units are available on 293 ;; all processors. 294 (define_query_cpu_unit "i0,i1,i2,i3" "integer") 295 (define_query_cpu_unit "f0,f1,f2,f3" "float_media") 296 (define_query_cpu_unit "b0,b1" "branch") 297 (define_query_cpu_unit "c" "control") 298 299 ;; Division units. 300 (define_cpu_unit "idiv1,idiv2" "idiv") 301 (define_cpu_unit "div1,div2,root" "div") 302 303 ;; Control instructions cannot be packed with others. 304 (define_reservation "control" "i0+i1+i2+i3+f0+f1+f2+f3+b0+b1") 305 306 ;; Generic reservation for control insns 307 (define_insn_reservation "control" 1 308 (eq_attr "type" "trap,spr,unknown,multi") 309 "c + control") 310 311 ;; Reservation for relaxable calls to gettlsoff. 312 (define_insn_reservation "load_or_call" 3 313 (eq_attr "type" "load_or_call") 314 "c + control") 315 316 ;; :::::::::::::::::::: 317 ;; :: 318 ;; :: Generic/FR500 scheduler description 319 ;; :: 320 ;; :::::::::::::::::::: 321 322 ;; Integer insns 323 ;; Synthetic units used to describe issue restrictions. 324 (define_automaton "fr500_integer") 325 (define_cpu_unit "fr500_load0,fr500_load1,fr500_store0" "fr500_integer") 326 (exclusion_set "fr500_load0,fr500_load1" "fr500_store0") 327 328 (define_bypass 0 "fr500_i1_sethi" "fr500_i1_setlo") 329 (define_insn_reservation "fr500_i1_sethi" 1 330 (and (eq_attr "cpu" "generic,fr500,tomcat") 331 (eq_attr "type" "sethi")) 332 "i1|i0") 333 334 (define_insn_reservation "fr500_i1_setlo" 1 335 (and (eq_attr "cpu" "generic,fr500,tomcat") 336 (eq_attr "type" "setlo")) 337 "i1|i0") 338 339 (define_insn_reservation "fr500_i1_int" 1 340 (and (eq_attr "cpu" "generic,fr500,tomcat") 341 (eq_attr "type" "int")) 342 "i1|i0") 343 344 (define_insn_reservation "fr500_i1_mul" 3 345 (and (eq_attr "cpu" "generic,fr500,tomcat") 346 (eq_attr "type" "mul")) 347 "i1|i0") 348 349 (define_insn_reservation "fr500_i1_div" 19 350 (and (eq_attr "cpu" "generic,fr500,tomcat") 351 (eq_attr "type" "div")) 352 "(i1|i0),(idiv1*18|idiv2*18)") 353 354 (define_insn_reservation "fr500_i2" 4 355 (and (eq_attr "cpu" "generic,fr500,tomcat") 356 (eq_attr "type" "gload,fload")) 357 "(i1|i0) + (fr500_load0|fr500_load1)") 358 359 (define_insn_reservation "fr500_i3" 0 360 (and (eq_attr "cpu" "generic,fr500,tomcat") 361 (eq_attr "type" "gstore,fstore")) 362 "i0 + fr500_store0") 363 364 (define_insn_reservation "fr500_i4" 3 365 (and (eq_attr "cpu" "generic,fr500,tomcat") 366 (eq_attr "type" "movgf,movfg")) 367 "i0") 368 369 (define_insn_reservation "fr500_i5" 0 370 (and (eq_attr "cpu" "generic,fr500,tomcat") 371 (eq_attr "type" "jumpl")) 372 "i0") 373 374 ;; 375 ;; Branch-instructions 376 ;; 377 (define_insn_reservation "fr500_branch" 0 378 (and (eq_attr "cpu" "generic,fr500,tomcat") 379 (eq_attr "type" "jump,branch,ccr")) 380 "b1|b0") 381 382 (define_insn_reservation "fr500_call" 0 383 (and (eq_attr "cpu" "generic,fr500,tomcat") 384 (eq_attr "type" "call")) 385 "b0") 386 387 ;; Floating point insns. The default latencies are for non-media 388 ;; instructions; media instructions incur an extra cycle. 389 390 (define_bypass 4 "fr500_farith" "fr500_m1,fr500_m2,fr500_m3, 391 fr500_m4,fr500_m5,fr500_m6") 392 (define_insn_reservation "fr500_farith" 3 393 (and (eq_attr "cpu" "generic,fr500,tomcat") 394 (eq_attr "type" "fnop,fsconv,fsadd,fsmul,fsmadd,fdconv,fdadd,fdmul,fdmadd")) 395 "(f1|f0)") 396 397 (define_insn_reservation "fr500_fcmp" 4 398 (and (eq_attr "cpu" "generic,fr500,tomcat") 399 (eq_attr "type" "fscmp,fdcmp")) 400 "(f1|f0)") 401 402 (define_bypass 11 "fr500_fdiv" "fr500_m1,fr500_m2,fr500_m3, 403 fr500_m4,fr500_m5,fr500_m6") 404 (define_insn_reservation "fr500_fdiv" 10 405 (and (eq_attr "cpu" "generic,fr500,tomcat") 406 (eq_attr "type" "fsdiv,fddiv")) 407 "(f1|f0),(div1*9 | div2*9)") 408 409 (define_bypass 16 "fr500_froot" "fr500_m1,fr500_m2,fr500_m3, 410 fr500_m4,fr500_m5,fr500_m6") 411 (define_insn_reservation "fr500_froot" 15 412 (and (eq_attr "cpu" "generic,fr500,tomcat") 413 (eq_attr "type" "sqrt_single,sqrt_double")) 414 "(f1|f0) + root*15") 415 416 ;; Media insns. Conflict table is as follows: 417 ;; 418 ;; M1 M2 M3 M4 M5 M6 419 ;; M1 - - - - - - 420 ;; M2 - - - - X X 421 ;; M3 - - - - X X 422 ;; M4 - - - - - X 423 ;; M5 - X X - X X 424 ;; M6 - X X X X X 425 ;; 426 ;; where X indicates an invalid combination. 427 ;; 428 ;; Target registers are as follows: 429 ;; 430 ;; M1 : FPRs 431 ;; M2 : FPRs 432 ;; M3 : ACCs 433 ;; M4 : ACCs 434 ;; M5 : FPRs 435 ;; M6 : ACCs 436 ;; 437 ;; The default FPR latencies are for integer instructions. 438 ;; Floating-point instructions need one cycle more and media 439 ;; instructions need one cycle less. 440 (define_automaton "fr500_media") 441 (define_cpu_unit "fr500_m2_0,fr500_m2_1" "fr500_media") 442 (define_cpu_unit "fr500_m3_0,fr500_m3_1" "fr500_media") 443 (define_cpu_unit "fr500_m4_0,fr500_m4_1" "fr500_media") 444 (define_cpu_unit "fr500_m5" "fr500_media") 445 (define_cpu_unit "fr500_m6" "fr500_media") 446 447 (exclusion_set "fr500_m5,fr500_m6" "fr500_m2_0,fr500_m2_1, 448 fr500_m3_0,fr500_m3_1") 449 (exclusion_set "fr500_m6" "fr500_m4_0,fr500_m4_1,fr500_m5") 450 451 (define_bypass 2 "fr500_m1" "fr500_m1,fr500_m2,fr500_m3, 452 fr500_m4,fr500_m5,fr500_m6") 453 (define_bypass 4 "fr500_m1" "fr500_farith,fr500_fcmp,fr500_fdiv,fr500_froot") 454 (define_insn_reservation "fr500_m1" 3 455 (and (eq_attr "cpu" "generic,fr500,tomcat") 456 (eq_attr "type" "mnop,mlogic,maveh,msath,maddh,mqaddh")) 457 "(f1|f0)") 458 459 (define_bypass 2 "fr500_m2" "fr500_m1,fr500_m2,fr500_m3, 460 fr500_m4,fr500_m5,fr500_m6") 461 (define_bypass 4 "fr500_m2" "fr500_farith,fr500_fcmp,fr500_fdiv,fr500_froot") 462 (define_insn_reservation "fr500_m2" 3 463 (and (eq_attr "cpu" "generic,fr500,tomcat") 464 (eq_attr "type" "mrdacc,mpackh,munpackh,mbhconv,mrot,mshift,mexpdhw,mexpdhd,mwcut,mcut,mdunpackh,mbhconve")) 465 "(f1|f0) + (fr500_m2_0|fr500_m2_1)") 466 467 (define_bypass 1 "fr500_m3" "fr500_m4") 468 (define_insn_reservation "fr500_m3" 2 469 (and (eq_attr "cpu" "generic,fr500,tomcat") 470 (eq_attr "type" "mclracc,mwtacc")) 471 "(f1|f0) + (fr500_m3_0|fr500_m3_1)") 472 473 (define_bypass 1 "fr500_m4" "fr500_m4") 474 (define_insn_reservation "fr500_m4" 2 475 (and (eq_attr "cpu" "generic,fr500,tomcat") 476 (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach,mcpx,mqcpx")) 477 "(f1|f0) + (fr500_m4_0|fr500_m4_1)") 478 479 (define_bypass 2 "fr500_m5" "fr500_m1,fr500_m2,fr500_m3, 480 fr500_m4,fr500_m5,fr500_m6") 481 (define_bypass 4 "fr500_m5" "fr500_farith,fr500_fcmp,fr500_fdiv,fr500_froot") 482 (define_insn_reservation "fr500_m5" 3 483 (and (eq_attr "cpu" "generic,fr500,tomcat") 484 (eq_attr "type" "mdpackh")) 485 "(f1|f0) + fr500_m5") 486 487 (define_bypass 1 "fr500_m6" "fr500_m4") 488 (define_insn_reservation "fr500_m6" 2 489 (and (eq_attr "cpu" "generic,fr500,tomcat") 490 (eq_attr "type" "mclracca")) 491 "(f1|f0) + fr500_m6") 492 493 ;; :::::::::::::::::::: 494 ;; :: 495 ;; :: FR400 scheduler description 496 ;; :: 497 ;; :::::::::::::::::::: 498 499 ;; Category 2 media instructions use both media units, but can be packed 500 ;; with non-media instructions. Use fr400_m1unit to claim the M1 unit 501 ;; without claiming a slot. 502 503 ;; Name Class Units Latency 504 ;; ==== ===== ===== ======= 505 ;; int I1 I0/I1 1 506 ;; sethi I1 I0/I1 0 -- does not interfere with setlo 507 ;; setlo I1 I0/I1 1 508 ;; mul I1 I0 3 (*) 509 ;; div I1 I0 20 (*) 510 ;; gload I2 I0 4 (*) 511 ;; fload I2 I0 4 -- only 3 if read by a media insn 512 ;; gstore I3 I0 0 -- provides no result 513 ;; fstore I3 I0 0 -- provides no result 514 ;; movfg I4 I0 3 (*) 515 ;; movgf I4 I0 3 (*) 516 ;; jumpl I5 I0 0 -- provides no result 517 ;; 518 ;; (*) The results of these instructions can be read one cycle earlier 519 ;; than indicated. The penalty given is for instructions with write-after- 520 ;; write dependencies. 521 522 ;; The FR400 can only do loads and stores in I0, so we there's no danger 523 ;; of memory unit collision in the same packet. There's only one divide 524 ;; unit too. 525 526 (define_automaton "fr400_integer") 527 (define_cpu_unit "fr400_mul" "fr400_integer") 528 529 (define_insn_reservation "fr400_i1_int" 1 530 (and (eq_attr "cpu" "fr400,fr405,fr450") 531 (eq_attr "type" "int")) 532 "i1|i0") 533 534 (define_bypass 0 "fr400_i1_sethi" "fr400_i1_setlo") 535 (define_insn_reservation "fr400_i1_sethi" 1 536 (and (eq_attr "cpu" "fr400,fr405,fr450") 537 (eq_attr "type" "sethi")) 538 "i1|i0") 539 540 (define_insn_reservation "fr400_i1_setlo" 1 541 (and (eq_attr "cpu" "fr400,fr405,fr450") 542 (eq_attr "type" "setlo")) 543 "i1|i0") 544 545 ;; 3 is the worst case (write-after-write hazard). 546 (define_insn_reservation "fr400_i1_mul" 3 547 (and (eq_attr "cpu" "fr400,fr405") 548 (eq_attr "type" "mul")) 549 "i0 + fr400_mul") 550 551 (define_insn_reservation "fr450_i1_mul" 2 552 (and (eq_attr "cpu" "fr450") 553 (eq_attr "type" "mul")) 554 "i0 + fr400_mul") 555 556 (define_bypass 1 "fr400_i1_macc" "fr400_i1_macc") 557 (define_insn_reservation "fr400_i1_macc" 2 558 (and (eq_attr "cpu" "fr405,fr450") 559 (eq_attr "type" "macc")) 560 "(i0|i1) + fr400_mul") 561 562 (define_insn_reservation "fr400_i1_scan" 1 563 (and (eq_attr "cpu" "fr400,fr405,fr450") 564 (eq_attr "type" "scan")) 565 "i0") 566 567 (define_insn_reservation "fr400_i1_cut" 2 568 (and (eq_attr "cpu" "fr405,fr450") 569 (eq_attr "type" "cut")) 570 "i0 + fr400_mul") 571 572 ;; 20 is for a write-after-write hazard. 573 (define_insn_reservation "fr400_i1_div" 20 574 (and (eq_attr "cpu" "fr400,fr405") 575 (eq_attr "type" "div")) 576 "i0 + idiv1*19") 577 578 (define_insn_reservation "fr450_i1_div" 19 579 (and (eq_attr "cpu" "fr450") 580 (eq_attr "type" "div")) 581 "i0 + idiv1*19") 582 583 ;; 4 is for a write-after-write hazard. 584 (define_insn_reservation "fr400_i2" 4 585 (and (eq_attr "cpu" "fr400,fr405") 586 (eq_attr "type" "gload,fload")) 587 "i0") 588 589 (define_insn_reservation "fr450_i2_gload" 3 590 (and (eq_attr "cpu" "fr450") 591 (eq_attr "type" "gload")) 592 "i0") 593 594 ;; 4 is for a write-after-write hazard. 595 (define_insn_reservation "fr450_i2_fload" 4 596 (and (eq_attr "cpu" "fr450") 597 (eq_attr "type" "fload")) 598 "i0") 599 600 (define_insn_reservation "fr400_i3" 0 601 (and (eq_attr "cpu" "fr400,fr405,fr450") 602 (eq_attr "type" "gstore,fstore")) 603 "i0") 604 605 ;; 3 is for a write-after-write hazard. 606 (define_insn_reservation "fr400_i4" 3 607 (and (eq_attr "cpu" "fr400,fr405") 608 (eq_attr "type" "movfg,movgf")) 609 "i0") 610 611 (define_insn_reservation "fr450_i4_movfg" 2 612 (and (eq_attr "cpu" "fr450") 613 (eq_attr "type" "movfg")) 614 "i0") 615 616 ;; 3 is for a write-after-write hazard. 617 (define_insn_reservation "fr450_i4_movgf" 3 618 (and (eq_attr "cpu" "fr450") 619 (eq_attr "type" "movgf")) 620 "i0") 621 622 (define_insn_reservation "fr400_i5" 0 623 (and (eq_attr "cpu" "fr400,fr405,fr450") 624 (eq_attr "type" "jumpl")) 625 "i0") 626 627 ;; The bypass between FPR loads and media instructions, described above. 628 629 (define_bypass 3 630 "fr400_i2" 631 "fr400_m1_1,fr400_m1_2,\ 632 fr400_m2_1,fr400_m2_2,\ 633 fr400_m3_1,fr400_m3_2,\ 634 fr400_m4_1,fr400_m4_2,\ 635 fr400_m5") 636 637 ;; The branch instructions all use the B unit and produce no result. 638 639 (define_insn_reservation "fr400_b" 0 640 (and (eq_attr "cpu" "fr400,fr405,fr450") 641 (eq_attr "type" "jump,branch,ccr,call")) 642 "b0") 643 644 ;; FP->FP moves are marked as "fsconv" instructions in the define_insns 645 ;; below, but are implemented on the FR400 using "mlogic" instructions. 646 ;; It's easier to class "fsconv" as a "m1:1" instruction than provide 647 ;; separate define_insns for the FR400. 648 649 ;; M1 instructions store their results in FPRs. Any instruction can read 650 ;; the result in the following cycle, so no penalty occurs. 651 652 (define_automaton "fr400_media") 653 (define_cpu_unit "fr400_m1a,fr400_m1b,fr400_m2a" "fr400_media") 654 (exclusion_set "fr400_m1a,fr400_m1b" "fr400_m2a") 655 656 (define_reservation "fr400_m1" "(f1|f0) + (fr400_m1a|fr400_m1b)") 657 (define_reservation "fr400_m2" "f0 + fr400_m2a") 658 659 (define_insn_reservation "fr400_m1_1" 1 660 (and (eq_attr "cpu" "fr400,fr405") 661 (eq_attr "type" "fsconv,mnop,mlogic,maveh,msath,maddh,mabsh,mset")) 662 "fr400_m1") 663 664 (define_insn_reservation "fr400_m1_2" 1 665 (and (eq_attr "cpu" "fr400,fr405") 666 (eq_attr "type" "mqaddh,mqsath,mqlimh,mqshift")) 667 "fr400_m2") 668 669 ;; M2 instructions store their results in accumulators, which are read 670 ;; by M2 or M4 media commands. M2 instructions can read the results in 671 ;; the following cycle, but M4 instructions must wait a cycle more. 672 673 (define_bypass 1 674 "fr400_m2_1,fr400_m2_2" 675 "fr400_m2_1,fr400_m2_2") 676 677 (define_insn_reservation "fr400_m2_1" 2 678 (and (eq_attr "cpu" "fr400,fr405") 679 (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mcpx,maddacc")) 680 "fr400_m1") 681 682 (define_insn_reservation "fr400_m2_2" 2 683 (and (eq_attr "cpu" "fr400,fr405") 684 (eq_attr "type" "mqmulh,mqmulxh,mqmach,mqcpx,mdaddacc")) 685 "fr400_m2") 686 687 ;; For our purposes, there seems to be little real difference between 688 ;; M1 and M3 instructions. Keep them separate anyway in case the distinction 689 ;; is needed later. 690 691 (define_insn_reservation "fr400_m3_1" 1 692 (and (eq_attr "cpu" "fr400,fr405") 693 (eq_attr "type" "mpackh,mrot,mshift,mexpdhw")) 694 "fr400_m1") 695 696 (define_insn_reservation "fr400_m3_2" 1 697 (and (eq_attr "cpu" "fr400,fr405") 698 (eq_attr "type" "munpackh,mdpackh,mbhconv,mexpdhd,mwcut,mdrot,mcpl")) 699 "fr400_m2") 700 701 ;; M4 instructions write to accumulators or FPRs. MOVFG and STF 702 ;; instructions can read an FPR result in the following cycle, but 703 ;; M-unit instructions must wait a cycle more for either kind of result. 704 705 (define_bypass 1 "fr400_m4_1,fr400_m4_2" "fr400_i3,fr400_i4") 706 707 (define_insn_reservation "fr400_m4_1" 2 708 (and (eq_attr "cpu" "fr400,fr405") 709 (eq_attr "type" "mrdacc,mcut,mclracc")) 710 "fr400_m1") 711 712 (define_insn_reservation "fr400_m4_2" 2 713 (and (eq_attr "cpu" "fr400,fr405") 714 (eq_attr "type" "mclracca,mdcut")) 715 "fr400_m2") 716 717 ;; M5 instructions always incur a 1-cycle penalty. 718 719 (define_insn_reservation "fr400_m5" 2 720 (and (eq_attr "cpu" "fr400,fr405") 721 (eq_attr "type" "mwtacc")) 722 "fr400_m2") 723 724 ;; :::::::::::::::::::: 725 ;; :: 726 ;; :: FR450 media scheduler description 727 ;; :: 728 ;; :::::::::::::::::::: 729 730 ;; The FR451 media restrictions are similar to the FR400's, but not as 731 ;; strict and not as regular. There are 6 categories with the following 732 ;; restrictions: 733 ;; 734 ;; M1 735 ;; M-1 M-2 M-3 M-4 M-5 M-6 736 ;; M-1: x x x 737 ;; M-2: x x x x x x 738 ;; M0 M-3: x x x 739 ;; M-4: x x x x 740 ;; M-5: x x x 741 ;; M-6: x x x x x x 742 ;; 743 ;; where "x" indicates a conflict. 744 ;; 745 ;; There is no difference between M-1 and M-3 as far as issue 746 ;; restrictions are concerned, so they are combined as "m13". 747 748 ;; Units for odd-numbered categories. There can be two of these 749 ;; in a packet. 750 (define_cpu_unit "fr450_m13a,fr450_m13b" "float_media") 751 (define_cpu_unit "fr450_m5a,fr450_m5b" "float_media") 752 753 ;; Units for even-numbered categories. There can only be one per packet. 754 (define_cpu_unit "fr450_m2a,fr450_m4a,fr450_m6a" "float_media") 755 756 ;; Enforce the restriction matrix above. 757 (exclusion_set "fr450_m2a,fr450_m4a,fr450_m6a" "fr450_m13a,fr450_m13b") 758 (exclusion_set "fr450_m2a,fr450_m6a" "fr450_m5a,fr450_m5b") 759 (exclusion_set "fr450_m4a,fr450_m6a" "fr450_m2a") 760 761 (define_reservation "fr450_m13" "(f1|f0) + (fr450_m13a|fr450_m13b)") 762 (define_reservation "fr450_m2" "f0 + fr450_m2a") 763 (define_reservation "fr450_m4" "f0 + fr450_m4a") 764 (define_reservation "fr450_m5" "(f1|f0) + (fr450_m5a|fr450_m5b)") 765 (define_reservation "fr450_m6" "(f0|f1) + fr450_m6a") 766 767 ;; MD-1, MD-3 and MD-8 instructions, which are the same as far 768 ;; as scheduling is concerned. The inputs and outputs are FPRs. 769 ;; Instructions that have 32-bit inputs and outputs belong to M-1 while 770 ;; the rest belong to M-2. 771 ;; 772 ;; ??? Arithmetic shifts (MD-6) have an extra cycle latency, but we don't 773 ;; make the distinction between them and logical shifts. 774 (define_insn_reservation "fr450_md138_1" 1 775 (and (eq_attr "cpu" "fr450") 776 (eq_attr "type" "fsconv,mnop,mlogic,maveh,msath,maddh,mabsh,mset, 777 mrot,mshift,mexpdhw,mpackh")) 778 "fr450_m13") 779 780 (define_insn_reservation "fr450_md138_2" 1 781 (and (eq_attr "cpu" "fr450") 782 (eq_attr "type" "mqaddh,mqsath,mqlimh, 783 mdrot,mwcut,mqshift,mexpdhd, 784 munpackh,mdpackh,mbhconv,mcpl")) 785 "fr450_m2") 786 787 ;; MD-2 instructions. These take FPR or ACC inputs and produce an ACC output. 788 ;; Instructions that write to double ACCs belong to M-3 while those that write 789 ;; to quad ACCs belong to M-4. 790 (define_insn_reservation "fr450_md2_3" 2 791 (and (eq_attr "cpu" "fr450") 792 (eq_attr "type" "mmulh,mmach,mcpx,mmulxh,mmrdh,maddacc")) 793 "fr450_m13") 794 795 (define_insn_reservation "fr450_md2_4" 2 796 (and (eq_attr "cpu" "fr450") 797 (eq_attr "type" "mqmulh,mqmach,mqcpx,mqmulxh,mdaddacc")) 798 "fr450_m4") 799 800 ;; Another MD-2 instruction can use the result on the following cycle. 801 (define_bypass 1 "fr450_md2_3,fr450_md2_4" "fr450_md2_3,fr450_md2_4") 802 803 ;; MD-4 instructions that write to ACCs. 804 (define_insn_reservation "fr450_md4_3" 2 805 (and (eq_attr "cpu" "fr450") 806 (eq_attr "type" "mclracc")) 807 "fr450_m13") 808 809 (define_insn_reservation "fr450_md4_4" 3 810 (and (eq_attr "cpu" "fr450") 811 (eq_attr "type" "mclracca")) 812 "fr450_m4") 813 814 ;; MD-4 instructions that write to FPRs. 815 (define_insn_reservation "fr450_md4_1" 2 816 (and (eq_attr "cpu" "fr450") 817 (eq_attr "type" "mcut")) 818 "fr450_m13") 819 820 (define_insn_reservation "fr450_md4_5" 2 821 (and (eq_attr "cpu" "fr450") 822 (eq_attr "type" "mrdacc")) 823 "fr450_m5") 824 825 (define_insn_reservation "fr450_md4_6" 2 826 (and (eq_attr "cpu" "fr450") 827 (eq_attr "type" "mdcut")) 828 "fr450_m6") 829 830 ;; Integer instructions can read the FPR result of an MD-4 instruction on 831 ;; the following cycle. 832 (define_bypass 1 "fr450_md4_1,fr450_md4_5,fr450_md4_6" 833 "fr400_i3,fr450_i4_movfg") 834 835 ;; MD-5 instructions, which belong to M-3. They take FPR inputs and 836 ;; write to ACCs. 837 (define_insn_reservation "fr450_md5_3" 2 838 (and (eq_attr "cpu" "fr450") 839 (eq_attr "type" "mwtacc")) 840 "fr450_m13") 841 842 ;; :::::::::::::::::::: 843 ;; :: 844 ;; :: FR550 scheduler description 845 ;; :: 846 ;; :::::::::::::::::::: 847 848 ;; Prevent loads and stores from being issued in the same packet. 849 ;; These units must go into the generic "integer" reservation because 850 ;; of the constraints on fr550_store0 and fr550_store1. 851 (define_cpu_unit "fr550_load0,fr550_load1" "integer") 852 (define_cpu_unit "fr550_store0,fr550_store1" "integer") 853 (exclusion_set "fr550_load0,fr550_load1" "fr550_store0,fr550_store1") 854 855 ;; A store can only issue to I1 if one has also been issued to I0. 856 (presence_set "fr550_store1" "fr550_store0") 857 858 (define_bypass 0 "fr550_sethi" "fr550_setlo") 859 (define_insn_reservation "fr550_sethi" 1 860 (and (eq_attr "cpu" "fr550") 861 (eq_attr "type" "sethi")) 862 "i3|i2|i1|i0") 863 864 (define_insn_reservation "fr550_setlo" 1 865 (and (eq_attr "cpu" "fr550") 866 (eq_attr "type" "setlo")) 867 "i3|i2|i1|i0") 868 869 (define_insn_reservation "fr550_int" 1 870 (and (eq_attr "cpu" "fr550") 871 (eq_attr "type" "int")) 872 "i3|i2|i1|i0") 873 874 (define_insn_reservation "fr550_mul" 2 875 (and (eq_attr "cpu" "fr550") 876 (eq_attr "type" "mul")) 877 "i1|i0") 878 879 (define_insn_reservation "fr550_div" 19 880 (and (eq_attr "cpu" "fr550") 881 (eq_attr "type" "div")) 882 "(i1|i0),(idiv1*18 | idiv2*18)") 883 884 (define_insn_reservation "fr550_load" 3 885 (and (eq_attr "cpu" "fr550") 886 (eq_attr "type" "gload,fload")) 887 "(i1|i0)+(fr550_load0|fr550_load1)") 888 889 ;; We can only issue a store to I1 if one was also issued to I0. 890 ;; This means that, as far as frv_reorder_packet is concerned, 891 ;; the instruction has the same priority as an I0-only instruction. 892 (define_insn_reservation "fr550_store" 1 893 (and (eq_attr "cpu" "fr550") 894 (eq_attr "type" "gstore,fstore")) 895 "(i0+fr550_store0)|(i1+fr550_store1)") 896 897 (define_insn_reservation "fr550_transfer" 2 898 (and (eq_attr "cpu" "fr550") 899 (eq_attr "type" "movgf,movfg")) 900 "i0") 901 902 (define_insn_reservation "fr550_jumpl" 0 903 (and (eq_attr "cpu" "fr550") 904 (eq_attr "type" "jumpl")) 905 "i0") 906 907 (define_cpu_unit "fr550_ccr0,fr550_ccr1" "float_media") 908 909 (define_insn_reservation "fr550_branch" 0 910 (and (eq_attr "cpu" "fr550") 911 (eq_attr "type" "jump,branch")) 912 "b1|b0") 913 914 (define_insn_reservation "fr550_ccr" 0 915 (and (eq_attr "cpu" "fr550") 916 (eq_attr "type" "ccr")) 917 "(b1|b0) + (fr550_ccr1|fr550_ccr0)") 918 919 (define_insn_reservation "fr550_call" 0 920 (and (eq_attr "cpu" "fr550") 921 (eq_attr "type" "call")) 922 "b0") 923 924 (define_automaton "fr550_float_media") 925 (define_cpu_unit "fr550_add0,fr550_add1" "fr550_float_media") 926 927 ;; There are three possible combinations of floating-point/media instructions: 928 ;; 929 ;; - one media and one float 930 ;; - up to four float, no media 931 ;; - up to four media, no float 932 (define_cpu_unit "fr550_f0,fr550_f1,fr550_f2,fr550_f3" "fr550_float_media") 933 (define_cpu_unit "fr550_m0,fr550_m1,fr550_m2,fr550_m3" "fr550_float_media") 934 (exclusion_set "fr550_f1,fr550_f2,fr550_f3" "fr550_m1,fr550_m2,fr550_m3") 935 (exclusion_set "fr550_m0" "fr550_f1,fr550_f2,fr550_f3") 936 ;; FIXME: This next exclusion set should be defined as well, so that we do 937 ;; not get a packet containing multiple media instructions plus a single 938 ;; floating point instruction. At the moment we can get away with not 939 ;; defining it because gcc does not seem to generate such packets. 940 ;; 941 ;; If we do enable the exclusion however the insertion of fnop insns into 942 ;; a packet containing media instructions will stop working, because the 943 ;; fnop insn counts as a floating point instruction. The correct solution 944 ;; is to fix the reservation for the fnop insn so that it does not have the 945 ;; same restrictions as ordinary floating point insns. 946 ;;(exclusion_set "fr550_f0" "fr550_m1,fr550_m2,fr550_m3") 947 948 (define_reservation "fr550_float" "fr550_f0|fr550_f1|fr550_f2|fr550_f3") 949 (define_reservation "fr550_media" "fr550_m0|fr550_m1|fr550_m2|fr550_m3") 950 951 (define_insn_reservation "fr550_f1" 0 952 (and (eq_attr "cpu" "fr550") 953 (eq_attr "type" "fnop")) 954 "(f3|f2|f1|f0) + fr550_float") 955 956 (define_insn_reservation "fr550_f2" 3 957 (and (eq_attr "cpu" "fr550") 958 (eq_attr "type" "fsconv,fsadd,fscmp")) 959 "(f3|f2|f1|f0) + (fr550_add0|fr550_add1) + fr550_float") 960 961 (define_insn_reservation "fr550_f3_mul" 3 962 (and (eq_attr "cpu" "fr550") 963 (eq_attr "type" "fsmul")) 964 "(f1|f0) + fr550_float") 965 966 (define_insn_reservation "fr550_f3_div" 10 967 (and (eq_attr "cpu" "fr550") 968 (eq_attr "type" "fsdiv")) 969 "(f1|f0) + fr550_float") 970 971 (define_insn_reservation "fr550_f3_sqrt" 15 972 (and (eq_attr "cpu" "fr550") 973 (eq_attr "type" "sqrt_single")) 974 "(f1|f0) + fr550_float") 975 976 ;; Synthetic units for enforcing media issue restrictions. Certain types 977 ;; of insn in M2 conflict with certain types in M0: 978 ;; 979 ;; M2 980 ;; MNOP MALU MSFT MMAC MSET 981 ;; MNOP - - x - - 982 ;; MALU - x x - - 983 ;; M0 MSFT - - x - x 984 ;; MMAC - - x x - 985 ;; MSET - - x - - 986 ;; 987 ;; where "x" indicates a conflict. The same restrictions apply to 988 ;; M3 and M1. 989 ;; 990 ;; In addition -- and this is the awkward bit! -- instructions that 991 ;; access ACC0-3 can only issue to M0 or M2. Those that access ACC4-7 992 ;; can only issue to M1 or M3. We refer to such instructions as "even" 993 ;; and "odd" respectively. 994 (define_cpu_unit "fr550_malu0,fr550_malu1" "float_media") 995 (define_cpu_unit "fr550_malu2,fr550_malu3" "float_media") 996 (define_cpu_unit "fr550_msft0,fr550_msft1" "float_media") 997 (define_cpu_unit "fr550_mmac0,fr550_mmac1" "float_media") 998 (define_cpu_unit "fr550_mmac2,fr550_mmac3" "float_media") 999 (define_cpu_unit "fr550_mset0,fr550_mset1" "float_media") 1000 (define_cpu_unit "fr550_mset2,fr550_mset3" "float_media") 1001 1002 (exclusion_set "fr550_malu0" "fr550_malu2") 1003 (exclusion_set "fr550_malu1" "fr550_malu3") 1004 1005 (exclusion_set "fr550_msft0" "fr550_mset2") 1006 (exclusion_set "fr550_msft1" "fr550_mset3") 1007 1008 (exclusion_set "fr550_mmac0" "fr550_mmac2") 1009 (exclusion_set "fr550_mmac1" "fr550_mmac3") 1010 1011 ;; If an MSFT or MMAC instruction issues to a unit other than M0, we may 1012 ;; need to insert some nops. In the worst case, the packet will end up 1013 ;; having 4 integer instructions and 4 media instructions, leaving no 1014 ;; room for any branch instructions that the DFA might have accepted. 1015 ;; 1016 ;; This doesn't matter for JUMP_INSNs and CALL_INSNs because they are 1017 ;; always the last instructions to be passed to the DFA, and could be 1018 ;; pushed out to a separate packet once the nops have been added. 1019 ;; However, it does cause problems for ccr instructions since they 1020 ;; can occur anywhere in the unordered packet. 1021 (exclusion_set "fr550_msft1,fr550_mmac1,fr550_mmac2,fr550_mmac3" 1022 "fr550_ccr0,fr550_ccr1") 1023 1024 (define_reservation "fr550_malu" 1025 "(f3 + fr550_malu3) | (f2 + fr550_malu2) 1026 | (f1 + fr550_malu1) | (f0 + fr550_malu0)") 1027 1028 (define_reservation "fr550_msft_even" 1029 "f0 + fr550_msft0") 1030 1031 (define_reservation "fr550_msft_odd" 1032 "f1 + fr550_msft1") 1033 1034 (define_reservation "fr550_msft_either" 1035 "(f1 + fr550_msft1) | (f0 + fr550_msft0)") 1036 1037 (define_reservation "fr550_mmac_even" 1038 "(f2 + fr550_mmac2) | (f0 + fr550_mmac0)") 1039 1040 (define_reservation "fr550_mmac_odd" 1041 "(f3 + fr550_mmac3) | (f1 + fr550_mmac1)") 1042 1043 (define_reservation "fr550_mset" 1044 "(f3 + fr550_mset3) | (f2 + fr550_mset2) 1045 | (f1 + fr550_mset1) | (f0 + fr550_mset0)") 1046 1047 (define_insn_reservation "fr550_mnop" 0 1048 (and (eq_attr "cpu" "fr550") 1049 (eq_attr "type" "mnop")) 1050 "fr550_media + (f3|f2|f1|f0)") 1051 1052 (define_insn_reservation "fr550_malu" 2 1053 (and (eq_attr "cpu" "fr550") 1054 (eq_attr "type" "mlogic,maveh,msath,mabsh,maddh,mqaddh,mqsath")) 1055 "fr550_media + fr550_malu") 1056 1057 ;; These insns only operate on FPRs and so don't need to be classified 1058 ;; as even/odd. 1059 (define_insn_reservation "fr550_msft_1_either" 2 1060 (and (eq_attr "cpu" "fr550") 1061 (eq_attr "type" "mrot,mwcut,mshift,mexpdhw,mexpdhd,mpackh, 1062 munpackh,mdpackh,mbhconv,mdrot,mcpl")) 1063 "fr550_media + fr550_msft_either") 1064 1065 ;; These insns read from ACC0-3. 1066 (define_insn_reservation "fr550_msft_1_even" 2 1067 (and (eq_attr "cpu" "fr550") 1068 (and (eq_attr "type" "mcut,mrdacc,mdcut") 1069 (eq_attr "acc_group" "even"))) 1070 "fr550_media + fr550_msft_even") 1071 1072 ;; These insns read from ACC4-7. 1073 (define_insn_reservation "fr550_msft_1_odd" 2 1074 (and (eq_attr "cpu" "fr550") 1075 (and (eq_attr "type" "mcut,mrdacc,mdcut") 1076 (eq_attr "acc_group" "odd"))) 1077 "fr550_media + fr550_msft_odd") 1078 1079 ;; MCLRACC with A=1 can issue to either M0 or M1. 1080 (define_insn_reservation "fr550_msft_2_either" 2 1081 (and (eq_attr "cpu" "fr550") 1082 (eq_attr "type" "mclracca")) 1083 "fr550_media + fr550_msft_either") 1084 1085 ;; These insns write to ACC0-3. 1086 (define_insn_reservation "fr550_msft_2_even" 2 1087 (and (eq_attr "cpu" "fr550") 1088 (and (eq_attr "type" "mclracc,mwtacc") 1089 (eq_attr "acc_group" "even"))) 1090 "fr550_media + fr550_msft_even") 1091 1092 ;; These insns write to ACC4-7. 1093 (define_insn_reservation "fr550_msft_2_odd" 2 1094 (and (eq_attr "cpu" "fr550") 1095 (and (eq_attr "type" "mclracc,mwtacc") 1096 (eq_attr "acc_group" "odd"))) 1097 "fr550_media + fr550_msft_odd") 1098 1099 ;; These insns read from and write to ACC0-3. 1100 (define_insn_reservation "fr550_mmac_even" 2 1101 (and (eq_attr "cpu" "fr550") 1102 (and (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach, 1103 maddacc,mdaddacc,mcpx,mqcpx") 1104 (eq_attr "acc_group" "even"))) 1105 "fr550_media + fr550_mmac_even") 1106 1107 ;; These insns read from and write to ACC4-7. 1108 (define_insn_reservation "fr550_mmac_odd" 2 1109 (and (eq_attr "cpu" "fr550") 1110 (and (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach, 1111 maddacc,mdaddacc,mcpx,mqcpx") 1112 (eq_attr "acc_group" "odd"))) 1113 "fr550_media + fr550_mmac_odd") 1114 1115 (define_insn_reservation "fr550_mset" 1 1116 (and (eq_attr "cpu" "fr550") 1117 (eq_attr "type" "mset")) 1118 "fr550_media + fr550_mset") 1119 1120 ;; :::::::::::::::::::: 1121 ;; :: 1122 ;; :: Simple/FR300 scheduler description 1123 ;; :: 1124 ;; :::::::::::::::::::: 1125 1126 ;; Fr300 or simple processor. To describe it as 1 insn issue 1127 ;; processor, we use control unit. 1128 1129 (define_insn_reservation "fr300_lat1" 1 1130 (and (eq_attr "cpu" "fr300,simple") 1131 (eq_attr "type" "!gload,fload,movfg,movgf")) 1132 "c + control") 1133 1134 (define_insn_reservation "fr300_lat2" 2 1135 (and (eq_attr "cpu" "fr300,simple") 1136 (eq_attr "type" "gload,fload,movfg,movgf")) 1137 "c + control") 1138 1139 1141 ;; :::::::::::::::::::: 1142 ;; :: 1143 ;; :: Delay Slots 1144 ;; :: 1145 ;; :::::::::::::::::::: 1146 1147 ;; The insn attribute mechanism can be used to specify the requirements for 1148 ;; delay slots, if any, on a target machine. An instruction is said to require 1149 ;; a "delay slot" if some instructions that are physically after the 1150 ;; instruction are executed as if they were located before it. Classic 1151 ;; examples are branch and call instructions, which often execute the following 1152 ;; instruction before the branch or call is performed. 1153 1154 ;; On some machines, conditional branch instructions can optionally "annul" 1155 ;; instructions in the delay slot. This means that the instruction will not be 1156 ;; executed for certain branch outcomes. Both instructions that annul if the 1157 ;; branch is true and instructions that annul if the branch is false are 1158 ;; supported. 1159 1160 ;; Delay slot scheduling differs from instruction scheduling in that 1161 ;; determining whether an instruction needs a delay slot is dependent only 1162 ;; on the type of instruction being generated, not on data flow between the 1163 ;; instructions. See the next section for a discussion of data-dependent 1164 ;; instruction scheduling. 1165 1166 ;; The requirement of an insn needing one or more delay slots is indicated via 1167 ;; the `define_delay' expression. It has the following form: 1168 ;; 1169 ;; (define_delay TEST 1170 ;; [DELAY-1 ANNUL-TRUE-1 ANNUL-FALSE-1 1171 ;; DELAY-2 ANNUL-TRUE-2 ANNUL-FALSE-2 1172 ;; ...]) 1173 1174 ;; TEST is an attribute test that indicates whether this `define_delay' applies 1175 ;; to a particular insn. If so, the number of required delay slots is 1176 ;; determined by the length of the vector specified as the second argument. An 1177 ;; insn placed in delay slot N must satisfy attribute test DELAY-N. 1178 ;; ANNUL-TRUE-N is an attribute test that specifies which insns may be annulled 1179 ;; if the branch is true. Similarly, ANNUL-FALSE-N specifies which insns in 1180 ;; the delay slot may be annulled if the branch is false. If annulling is not 1181 ;; supported for that delay slot, `(nil)' should be coded. 1182 1183 ;; For example, in the common case where branch and call insns require a single 1184 ;; delay slot, which may contain any insn other than a branch or call, the 1185 ;; following would be placed in the `md' file: 1186 1187 ;; (define_delay (eq_attr "type" "branch,call") 1188 ;; [(eq_attr "type" "!branch,call") (nil) (nil)]) 1189 1190 ;; Multiple `define_delay' expressions may be specified. In this case, each 1191 ;; such expression specifies different delay slot requirements and there must 1192 ;; be no insn for which tests in two `define_delay' expressions are both true. 1193 1194 ;; For example, if we have a machine that requires one delay slot for branches 1195 ;; but two for calls, no delay slot can contain a branch or call insn, and any 1196 ;; valid insn in the delay slot for the branch can be annulled if the branch is 1197 ;; true, we might represent this as follows: 1198 1199 ;; (define_delay (eq_attr "type" "branch") 1200 ;; [(eq_attr "type" "!branch,call") 1201 ;; (eq_attr "type" "!branch,call") 1202 ;; (nil)]) 1203 ;; 1204 ;; (define_delay (eq_attr "type" "call") 1205 ;; [(eq_attr "type" "!branch,call") (nil) (nil) 1206 ;; (eq_attr "type" "!branch,call") (nil) (nil)]) 1207 1208 ;; Note - it is the backend's responsibility to fill any unfilled delay slots 1209 ;; at assembler generation time. This is usually done by adding a special print 1210 ;; operand to the delayed instruction, and then in the PRINT_OPERAND function 1211 ;; calling dbr_sequence_length() to determine how many delay slots were filled. 1212 ;; For example: 1213 ;; 1214 ;; --------------<machine>.md----------------- 1215 ;; (define_insn "call" 1216 ;; [(call (match_operand 0 "memory_operand" "m") 1217 ;; (match_operand 1 "" ""))] 1218 ;; "" 1219 ;; "call_delayed %0,%1,%2%#" 1220 ;; [(set_attr "length" "4") 1221 ;; (set_attr "type" "call")]) 1222 ;; 1223 ;; -------------<machine>.h------------------- 1224 ;; #define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#') 1225 ;; 1226 ;; ------------<machine>.c------------------ 1227 ;; void 1228 ;; machine_print_operand (file, x, code) 1229 ;; FILE * file; 1230 ;; rtx x; 1231 ;; int code; 1232 ;; { 1233 ;; switch (code) 1234 ;; { 1235 ;; case '#': 1236 ;; if (dbr_sequence_length () == 0) 1237 ;; fputs ("\n\tnop", file); 1238 ;; return; 1239 1241 ;; :::::::::::::::::::: 1242 ;; :: 1243 ;; :: Notes on Patterns 1244 ;; :: 1245 ;; :::::::::::::::::::: 1246 1247 ;; If you need to construct a sequence of assembler instructions in order 1248 ;; to implement a pattern be sure to escape any backslashes and double quotes 1249 ;; that you use, e.g.: 1250 ;; 1251 ;; (define_insn "an example" 1252 ;; [(some rtl)] 1253 ;; "" 1254 ;; "* 1255 ;; { static char buffer [100]; 1256 ;; sprintf (buffer, \"insn \\t %d\", REGNO (operands[1])); 1257 ;; return buffer; 1258 ;; }" 1259 ;; ) 1260 ;; 1261 ;; Also if there is more than one instruction, they can be separated by \\; 1262 ;; which is a space saving synonym for \\n\\t: 1263 ;; 1264 ;; (define_insn "another example" 1265 ;; [(some rtl)] 1266 ;; "" 1267 ;; "* 1268 ;; { static char buffer [100]; 1269 ;; sprintf (buffer, \"insn1 \\t %d\\;insn2 \\t %%1\", 1270 ;; REGNO (operands[1])); 1271 ;; return buffer; 1272 ;; }" 1273 ;; ) 1274 ;; 1275 1276 (include "predicates.md") 1277 (include "constraints.md") 1278 1280 ;; :::::::::::::::::::: 1281 ;; :: 1282 ;; :: Moves 1283 ;; :: 1284 ;; :::::::::::::::::::: 1285 1286 ;; Wrap moves in define_expand to prevent memory->memory moves from being 1287 ;; generated at the RTL level, which generates better code for most machines 1288 ;; which can't do mem->mem moves. 1289 1290 ;; If operand 0 is a `subreg' with mode M of a register whose own mode is wider 1291 ;; than M, the effect of this instruction is to store the specified value in 1292 ;; the part of the register that corresponds to mode M. The effect on the rest 1293 ;; of the register is undefined. 1294 1295 ;; This class of patterns is special in several ways. First of all, each of 1296 ;; these names *must* be defined, because there is no other way to copy a datum 1297 ;; from one place to another. 1298 1299 ;; Second, these patterns are not used solely in the RTL generation pass. Even 1300 ;; the reload pass can generate move insns to copy values from stack slots into 1301 ;; temporary registers. When it does so, one of the operands is a hard 1302 ;; register and the other is an operand that can need to be reloaded into a 1303 ;; register. 1304 1305 ;; Therefore, when given such a pair of operands, the pattern must 1306 ;; generate RTL which needs no reloading and needs no temporary 1307 ;; registers--no registers other than the operands. For example, if 1308 ;; you support the pattern with a `define_expand', then in such a 1309 ;; case the `define_expand' mustn't call `force_reg' or any other such 1310 ;; function which might generate new pseudo registers. 1311 1312 ;; This requirement exists even for subword modes on a RISC machine 1313 ;; where fetching those modes from memory normally requires several 1314 ;; insns and some temporary registers. Look in `spur.md' to see how 1315 ;; the requirement can be satisfied. 1316 1317 ;; During reload a memory reference with an invalid address may be passed as an 1318 ;; operand. Such an address will be replaced with a valid address later in the 1319 ;; reload pass. In this case, nothing may be done with the address except to 1320 ;; use it as it stands. If it is copied, it will not be replaced with a valid 1321 ;; address. No attempt should be made to make such an address into a valid 1322 ;; address and no routine (such as `change_address') that will do so may be 1323 ;; called. Note that `general_operand' will fail when applied to such an 1324 ;; address. 1325 ;; 1326 ;; The global variable `reload_in_progress' (which must be explicitly declared 1327 ;; if required) can be used to determine whether such special handling is 1328 ;; required. 1329 ;; 1330 ;; The variety of operands that have reloads depends on the rest of 1331 ;; the machine description, but typically on a RISC machine these can 1332 ;; only be pseudo registers that did not get hard registers, while on 1333 ;; other machines explicit memory references will get optional 1334 ;; reloads. 1335 ;; 1336 ;; If a scratch register is required to move an object to or from memory, it 1337 ;; can be allocated using `gen_reg_rtx' prior to reload. But this is 1338 ;; impossible during and after reload. If there are cases needing scratch 1339 ;; registers after reload, you must define `SECONDARY_INPUT_RELOAD_CLASS' and 1340 ;; perhaps also `SECONDARY_OUTPUT_RELOAD_CLASS' to detect them, and provide 1341 ;; patterns `reload_inM' or `reload_outM' to handle them. 1342 1343 ;; The constraints on a `moveM' must permit moving any hard register to any 1344 ;; other hard register provided that `TARGET_HARD_REGNO_MODE_OK' permits 1345 ;; mode M in both registers and `REGISTER_MOVE_COST' applied to their 1346 ;; classes returns a value of 2. 1347 1348 ;; It is obligatory to support floating point `moveM' instructions 1349 ;; into and out of any registers that can hold fixed point values, 1350 ;; because unions and structures (which have modes `SImode' or 1351 ;; `DImode') can be in those registers and they may have floating 1352 ;; point members. 1353 1354 ;; There may also be a need to support fixed point `moveM' instructions 1355 ;; in and out of floating point registers. Unfortunately, I have 1356 ;; forgotten why this was so, and I don't know whether it is still true. 1357 ;; If `TARGET_HARD_REGNO_MODE_OK' rejects fixed point values in floating 1358 ;; point registers, then the constraints of the fixed point `moveM' 1359 ;; instructions must be designed to avoid ever trying to reload into a 1360 ;; floating point register. 1361 1362 (define_expand "movqi" 1363 [(set (match_operand:QI 0 "general_operand" "") 1364 (match_operand:QI 1 "general_operand" ""))] 1365 "" 1366 "{ frv_emit_move (QImode, operands[0], operands[1]); DONE; }") 1367 1368 (define_insn "*movqi_load" 1369 [(set (match_operand:QI 0 "register_operand" "=d,f") 1370 (match_operand:QI 1 "frv_load_operand" "m,m"))] 1371 "" 1372 "* return output_move_single (operands, insn);" 1373 [(set_attr "length" "4") 1374 (set_attr "type" "gload,fload")]) 1375 1376 (define_insn "*movqi_internal" 1377 [(set (match_operand:QI 0 "move_destination_operand" "=d,d,m,m,?f,?f,?d,?m,f,d,f") 1378 (match_operand:QI 1 "move_source_operand" "L,d,d,O, d, f, f, f,GO,!m,!m"))] 1379 "register_operand(operands[0], QImode) || reg_or_0_operand (operands[1], QImode)" 1380 "* return output_move_single (operands, insn);" 1381 [(set_attr "length" "4") 1382 (set_attr "type" "int,int,gstore,gstore,movgf,fsconv,movfg,fstore,movgf,gload,fload")]) 1383 1384 (define_expand "movhi" 1385 [(set (match_operand:HI 0 "general_operand" "") 1386 (match_operand:HI 1 "general_operand" ""))] 1387 "" 1388 "{ frv_emit_move (HImode, operands[0], operands[1]); DONE; }") 1389 1390 (define_insn "*movhi_load" 1391 [(set (match_operand:HI 0 "register_operand" "=d,f") 1392 (match_operand:HI 1 "frv_load_operand" "m,m"))] 1393 "" 1394 "* return output_move_single (operands, insn);" 1395 [(set_attr "length" "4") 1396 (set_attr "type" "gload,fload")]) 1397 1398 (define_insn "*movhi_internal" 1399 [(set (match_operand:HI 0 "move_destination_operand" "=d,d,d,m,m,?f,?f,?d,?m,f,d,f") 1400 (match_operand:HI 1 "move_source_operand" "L,n,d,d,O, d, f, f, f,GO,!m,!m"))] 1401 "register_operand(operands[0], HImode) || reg_or_0_operand (operands[1], HImode)" 1402 "* return output_move_single (operands, insn);" 1403 [(set_attr "length" "4,8,4,4,4,4,4,4,4,4,4,4") 1404 (set_attr "type" "int,multi,int,gstore,gstore,movgf,fsconv,movfg,fstore,movgf,gload,fload")]) 1405 1406 ;; Split 2 word load of constants into sethi/setlo instructions 1407 (define_split 1408 [(set (match_operand:HI 0 "integer_register_operand" "") 1409 (match_operand:HI 1 "int_2word_operand" ""))] 1410 "reload_completed" 1411 [(set (match_dup 0) 1412 (high:HI (match_dup 1))) 1413 (set (match_dup 0) 1414 (lo_sum:HI (match_dup 0) 1415 (match_dup 1)))] 1416 "") 1417 1418 (define_insn "movhi_high" 1419 [(set (match_operand:HI 0 "integer_register_operand" "=d") 1420 (high:HI (match_operand:HI 1 "int_2word_operand" "i")))] 1421 "" 1422 "sethi #hi(%1), %0" 1423 [(set_attr "type" "sethi") 1424 (set_attr "length" "4")]) 1425 1426 (define_insn "movhi_lo_sum" 1427 [(set (match_operand:HI 0 "integer_register_operand" "+d") 1428 (lo_sum:HI (match_dup 0) 1429 (match_operand:HI 1 "int_2word_operand" "i")))] 1430 "" 1431 "setlo #lo(%1), %0" 1432 [(set_attr "type" "setlo") 1433 (set_attr "length" "4")]) 1434 1435 (define_expand "movsi" 1436 [(set (match_operand:SI 0 "move_destination_operand" "") 1437 (match_operand:SI 1 "move_source_operand" ""))] 1438 "" 1439 "{ frv_emit_move (SImode, operands[0], operands[1]); DONE; }") 1440 1441 ;; Note - it is best to only have one movsi pattern and to handle 1442 ;; all the various contingencies by the use of alternatives. This 1443 ;; allows reload the greatest amount of flexibility (since reload will 1444 ;; only choose amongst alternatives for a selected insn, it will not 1445 ;; replace the insn with another one). 1446 1447 ;; Unfortunately, we do have to separate out load-type moves from the rest, 1448 ;; and only allow memory source operands in the former. If we do memory and 1449 ;; constant loads in a single pattern, reload will be tempted to force 1450 ;; constants into memory when the destination is a floating-point register. 1451 ;; That may make a function use a PIC pointer when it didn't before, and we 1452 ;; cannot change PIC usage (and hence stack layout) so late in the game. 1453 ;; The resulting sequences for loading constants into FPRs are preferable 1454 ;; even when we're not generating PIC code. 1455 1456 ;; However, if we don't accept input from memory at all in the generic 1457 ;; movsi pattern, reloads for asm instructions that reference pseudos 1458 ;; that end up assigned to memory will fail to match, because we 1459 ;; recognize them right after they're emitted, and we don't 1460 ;; re-recognize them again after the substitution for memory. So keep 1461 ;; a memory constraint available, just make sure reload won't be 1462 ;; tempted to use it. 1463 ;; 1464 1465 1466 (define_insn "*movsi_load" 1467 [(set (match_operand:SI 0 "register_operand" "=d,f") 1468 (match_operand:SI 1 "frv_load_operand" "m,m"))] 1469 "" 1470 "* return output_move_single (operands, insn);" 1471 [(set_attr "length" "4") 1472 (set_attr "type" "gload,fload")]) 1473 1474 (define_insn "*movsi_got" 1475 [(set (match_operand:SI 0 "integer_register_operand" "=d") 1476 (match_operand:SI 1 "got12_operand" ""))] 1477 "" 1478 "addi gr0, %1, %0" 1479 [(set_attr "type" "int") 1480 (set_attr "length" "4")]) 1481 1482 (define_insn "*movsi_high_got" 1483 [(set (match_operand:SI 0 "integer_register_operand" "=d") 1484 (high:SI (match_operand:SI 1 "const_unspec_operand" "")))] 1485 "" 1486 "sethi %1, %0" 1487 [(set_attr "type" "sethi") 1488 (set_attr "length" "4")]) 1489 1490 (define_insn "*movsi_lo_sum_got" 1491 [(set (match_operand:SI 0 "integer_register_operand" "=d") 1492 (lo_sum:SI (match_operand:SI 1 "integer_register_operand" "0") 1493 (match_operand:SI 2 "const_unspec_operand" "")))] 1494 "" 1495 "setlo %2, %0" 1496 [(set_attr "type" "setlo") 1497 (set_attr "length" "4")]) 1498 1499 (define_insn "*movsi_internal" 1500 [(set (match_operand:SI 0 "move_destination_operand" "=d,d,d,m,m,z,d,d,f,f,m,?f,?z,d,f") 1501 (match_operand:SI 1 "move_source_operand" "L,n,d,d,O,d,z,f,d,f,f,GO,GO,!m,!m"))] 1502 "register_operand (operands[0], SImode) || reg_or_0_operand (operands[1], SImode)" 1503 "* return output_move_single (operands, insn);" 1504 [(set_attr "length" "4,8,4,4,4,4,4,4,4,4,4,4,4,4,4") 1505 (set_attr "type" "int,multi,int,gstore,gstore,spr,spr,movfg,movgf,fsconv,fstore,movgf,spr,gload,fload")]) 1506 1507 ;; Split 2 word load of constants into sethi/setlo instructions 1508 (define_insn_and_split "*movsi_2word" 1509 [(set (match_operand:SI 0 "integer_register_operand" "=d") 1510 (match_operand:SI 1 "int_2word_operand" "i"))] 1511 "" 1512 "#" 1513 "reload_completed" 1514 [(set (match_dup 0) 1515 (high:SI (match_dup 1))) 1516 (set (match_dup 0) 1517 (lo_sum:SI (match_dup 0) 1518 (match_dup 1)))] 1519 "" 1520 [(set_attr "length" "8") 1521 (set_attr "type" "multi")]) 1522 1523 (define_insn "movsi_high" 1524 [(set (match_operand:SI 0 "integer_register_operand" "=d") 1525 (high:SI (match_operand:SI 1 "int_2word_operand" "i")))] 1526 "" 1527 "sethi #hi(%1), %0" 1528 [(set_attr "type" "sethi") 1529 (set_attr "length" "4")]) 1530 1531 (define_insn "movsi_lo_sum" 1532 [(set (match_operand:SI 0 "integer_register_operand" "+d") 1533 (lo_sum:SI (match_dup 0) 1534 (match_operand:SI 1 "int_2word_operand" "i")))] 1535 "" 1536 "setlo #lo(%1), %0" 1537 [(set_attr "type" "setlo") 1538 (set_attr "length" "4")]) 1539 1540 (define_expand "movdi" 1541 [(set (match_operand:DI 0 "nonimmediate_operand" "") 1542 (match_operand:DI 1 "general_operand" ""))] 1543 "" 1544 "{ frv_emit_move (DImode, operands[0], operands[1]); DONE; }") 1545 1546 (define_insn "*movdi_double" 1547 [(set (match_operand:DI 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f") 1548 (match_operand:DI 1 "move_source_operand" " e,h,d,f,e,h,d,f,R,R,m,m,h,f,e,d,GO,GO,GO,GO,nF,nF,GO,GO"))] 1549 "TARGET_DOUBLE 1550 && (register_operand (operands[0], DImode) 1551 || reg_or_0_operand (operands[1], DImode))" 1552 "* return output_move_double (operands, insn);" 1553 [(set_attr "length" "8,4,8,8,4,4,8,8,4,4,8,8,4,8,4,8,4,8,8,8,16,16,8,8") 1554 (set_attr "type" "multi,fdconv,multi,multi,gstore,fstore,gstore,fstore,gload,fload,gload,fload,movfg,movfg,movgf,movgf,gstore,gstore,multi,multi,multi,multi,movgf,movgf")]) 1555 1556 (define_insn "*movdi_nodouble" 1557 [(set (match_operand:DI 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f") 1558 (match_operand:DI 1 "move_source_operand" " e,h,d,f,e,h,d,f,R,R,m,m,h,f,e,d,GO,GO,GO,GO,nF,nF,GO,GO"))] 1559 "!TARGET_DOUBLE 1560 && (register_operand (operands[0], DImode) 1561 || reg_or_0_operand (operands[1], DImode))" 1562 "* return output_move_double (operands, insn);" 1563 [(set_attr "length" "8,8,8,8,4,4,8,8,4,4,8,8,8,8,8,8,4,8,8,8,16,16,8,8") 1564 (set_attr "type" "multi,multi,multi,multi,gstore,fstore,gstore,fstore,gload,fload,gload,fload,movfg,movfg,movgf,movgf,gstore,gstore,multi,multi,multi,multi,movgf,movgf")]) 1565 1566 (define_split 1567 [(set (match_operand:DI 0 "register_operand" "") 1568 (match_operand:DI 1 "dbl_memory_two_insn_operand" ""))] 1569 "reload_completed" 1570 [(const_int 0)] 1571 "frv_split_double_load (operands[0], operands[1]);") 1572 1573 (define_split 1574 [(set (match_operand:DI 0 "odd_reg_operand" "") 1575 (match_operand:DI 1 "memory_operand" ""))] 1576 "reload_completed" 1577 [(const_int 0)] 1578 "frv_split_double_load (operands[0], operands[1]);") 1579 1580 (define_split 1581 [(set (match_operand:DI 0 "dbl_memory_two_insn_operand" "") 1582 (match_operand:DI 1 "reg_or_0_operand" ""))] 1583 "reload_completed" 1584 [(const_int 0)] 1585 "frv_split_double_store (operands[0], operands[1]);") 1586 1587 (define_split 1588 [(set (match_operand:DI 0 "memory_operand" "") 1589 (match_operand:DI 1 "odd_reg_operand" ""))] 1590 "reload_completed" 1591 [(const_int 0)] 1592 "frv_split_double_store (operands[0], operands[1]);") 1593 1594 (define_split 1595 [(set (match_operand:DI 0 "register_operand" "") 1596 (match_operand:DI 1 "register_operand" ""))] 1597 "reload_completed 1598 && (odd_reg_operand (operands[0], DImode) 1599 || odd_reg_operand (operands[1], DImode) 1600 || (integer_register_operand (operands[0], DImode) 1601 && integer_register_operand (operands[1], DImode)) 1602 || (!TARGET_DOUBLE 1603 && fpr_operand (operands[0], DImode) 1604 && fpr_operand (operands[1], DImode)))" 1605 [(set (match_dup 2) (match_dup 4)) 1606 (set (match_dup 3) (match_dup 5))] 1607 " 1608 { 1609 rtx op0 = operands[0]; 1610 rtx op0_low = gen_lowpart (SImode, op0); 1611 rtx op0_high = gen_highpart (SImode, op0); 1612 rtx op1 = operands[1]; 1613 rtx op1_low = gen_lowpart (SImode, op1); 1614 rtx op1_high = gen_highpart (SImode, op1); 1615 1616 /* We normally copy the low-numbered register first. However, if the first 1617 register operand 0 is the same as the second register of operand 1, we 1618 must copy in the opposite order. */ 1619 1620 if (REGNO (op0_high) == REGNO (op1_low)) 1621 { 1622 operands[2] = op0_low; 1623 operands[3] = op0_high; 1624 operands[4] = op1_low; 1625 operands[5] = op1_high; 1626 } 1627 else 1628 { 1629 operands[2] = op0_high; 1630 operands[3] = op0_low; 1631 operands[4] = op1_high; 1632 operands[5] = op1_low; 1633 } 1634 }") 1635 1636 (define_split 1637 [(set (match_operand:DI 0 "register_operand" "") 1638 (match_operand:DI 1 "const_int_operand" ""))] 1639 "reload_completed" 1640 [(set (match_dup 2) (match_dup 4)) 1641 (set (match_dup 3) (match_dup 5))] 1642 " 1643 { 1644 rtx op0 = operands[0]; 1645 rtx op1 = operands[1]; 1646 1647 operands[2] = gen_highpart (SImode, op0); 1648 operands[3] = gen_lowpart (SImode, op0); 1649 if (HOST_BITS_PER_WIDE_INT <= 32) 1650 { 1651 operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0); 1652 operands[5] = op1; 1653 } 1654 else 1655 { 1656 operands[4] = gen_int_mode ((INTVAL (op1) >> 16) >> 16, SImode); 1657 operands[5] = gen_int_mode (INTVAL (op1), SImode); 1658 } 1659 }") 1660 1661 (define_split 1662 [(set (match_operand:DI 0 "register_operand" "") 1663 (match_operand:DI 1 "const_double_operand" ""))] 1664 "reload_completed" 1665 [(set (match_dup 2) (match_dup 4)) 1666 (set (match_dup 3) (match_dup 5))] 1667 " 1668 { 1669 rtx op0 = operands[0]; 1670 rtx op1 = operands[1]; 1671 1672 operands[2] = gen_highpart (SImode, op0); 1673 operands[3] = gen_lowpart (SImode, op0); 1674 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (op1)); 1675 operands[5] = GEN_INT (CONST_DOUBLE_LOW (op1)); 1676 }") 1677 1678 ;; Floating Point Moves 1679 ;; 1680 ;; Note - Patterns for SF mode moves are compulsory, but 1681 ;; patterns for DF are optional, as GCC can synthesize them. 1682 1683 (define_expand "movsf" 1684 [(set (match_operand:SF 0 "general_operand" "") 1685 (match_operand:SF 1 "general_operand" ""))] 1686 "" 1687 "{ frv_emit_move (SFmode, operands[0], operands[1]); DONE; }") 1688 1689 (define_split 1690 [(set (match_operand:SF 0 "integer_register_operand" "") 1691 (match_operand:SF 1 "int_2word_operand" ""))] 1692 "reload_completed" 1693 [(set (match_dup 0) 1694 (high:SF (match_dup 1))) 1695 (set (match_dup 0) 1696 (lo_sum:SF (match_dup 0) 1697 (match_dup 1)))] 1698 "") 1699 1700 (define_insn "*movsf_load_has_fprs" 1701 [(set (match_operand:SF 0 "register_operand" "=f,d") 1702 (match_operand:SF 1 "frv_load_operand" "m,m"))] 1703 "TARGET_HAS_FPRS" 1704 "* return output_move_single (operands, insn);" 1705 [(set_attr "length" "4") 1706 (set_attr "type" "fload,gload")]) 1707 1708 (define_insn "*movsf_internal_has_fprs" 1709 [(set (match_operand:SF 0 "move_destination_operand" "=f,f,m,m,?f,?d,?d,m,?d") 1710 (match_operand:SF 1 "move_source_operand" "f,OG,f,OG,d,f,d,d,F"))] 1711 "TARGET_HAS_FPRS 1712 && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))" 1713 "* return output_move_single (operands, insn);" 1714 [(set_attr "length" "4,4,4,4,4,4,4,4,8") 1715 (set_attr "type" "fsconv,movgf,fstore,gstore,movgf,movfg,int,gstore,multi")]) 1716 1717 ;; If we don't support the double instructions, prefer gprs over fprs, since it 1718 ;; will all be emulated 1719 (define_insn "*movsf_internal_no_fprs" 1720 [(set (match_operand:SF 0 "move_destination_operand" "=d,d,m,d,d") 1721 (match_operand:SF 1 "move_source_operand" " d,OG,dOG,m,F"))] 1722 "!TARGET_HAS_FPRS 1723 && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))" 1724 "* return output_move_single (operands, insn);" 1725 [(set_attr "length" "4,4,4,4,8") 1726 (set_attr "type" "int,int,gstore,gload,multi")]) 1727 1728 (define_insn "movsf_high" 1729 [(set (match_operand:SF 0 "integer_register_operand" "=d") 1730 (high:SF (match_operand:SF 1 "int_2word_operand" "i")))] 1731 "" 1732 "sethi #hi(%1), %0" 1733 [(set_attr "type" "sethi") 1734 (set_attr "length" "4")]) 1735 1736 (define_insn "movsf_lo_sum" 1737 [(set (match_operand:SF 0 "integer_register_operand" "+d") 1738 (lo_sum:SF (match_dup 0) 1739 (match_operand:SF 1 "int_2word_operand" "i")))] 1740 "" 1741 "setlo #lo(%1), %0" 1742 [(set_attr "type" "setlo") 1743 (set_attr "length" "4")]) 1744 1745 (define_expand "movdf" 1746 [(set (match_operand:DF 0 "nonimmediate_operand" "") 1747 (match_operand:DF 1 "general_operand" ""))] 1748 "" 1749 "{ frv_emit_move (DFmode, operands[0], operands[1]); DONE; }") 1750 1751 (define_insn "*movdf_double" 1752 [(set (match_operand:DF 0 "move_destination_operand" "=h,?e,??f,??d,R,?R,??m,??m,h,?e,??f,??d,?h,??f,?e,??d,R,m,h,??f,e,??d,e,??d") 1753 (match_operand:DF 1 "move_source_operand" " h,e,f,d,h,e,f,d,R,R,m,m,e,d,h,f,GO,GO,GO,GO,GO,GO,F,F"))] 1754 "TARGET_DOUBLE 1755 && (register_operand (operands[0], DFmode) 1756 || reg_or_0_operand (operands[1], DFmode))" 1757 "* return output_move_double (operands, insn);" 1758 [(set_attr "length" "4,8,8,8,4,4,8,8,4,4,8,8,4,8,4,8,4,8,8,8,8,8,16,16") 1759 (set_attr "type" "fdconv,multi,multi,multi,fstore,gstore,fstore,gstore,fload,gload,fload,gload,movgf,movgf,movfg,movfg,gstore,gstore,movgf,movgf,multi,multi,multi,multi")]) 1760 1761 ;; If we don't support the double instructions, prefer gprs over fprs, since it 1762 ;; will all be emulated 1763 (define_insn "*movdf_nodouble" 1764 [(set (match_operand:DF 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f") 1765 (match_operand:DF 1 "move_source_operand" " e,h,d,f,e,h,d,f,R,R,m,m,h,f,e,d,GO,GO,GO,GO,nF,nF,GO,GO"))] 1766 "!TARGET_DOUBLE 1767 && (register_operand (operands[0], DFmode) 1768 || reg_or_0_operand (operands[1], DFmode))" 1769 "* return output_move_double (operands, insn);" 1770 [(set_attr "length" "8,8,8,8,4,4,8,8,4,4,8,8,8,8,8,8,4,8,8,8,16,16,8,8") 1771 (set_attr "type" "multi,multi,multi,multi,gstore,fstore,gstore,fstore,gload,fload,gload,fload,movfg,movfg,movgf,movgf,gstore,gstore,multi,multi,multi,multi,movgf,movgf")]) 1772 1773 (define_split 1774 [(set (match_operand:DF 0 "register_operand" "") 1775 (match_operand:DF 1 "dbl_memory_two_insn_operand" ""))] 1776 "reload_completed" 1777 [(const_int 0)] 1778 "frv_split_double_load (operands[0], operands[1]);") 1779 1780 (define_split 1781 [(set (match_operand:DF 0 "odd_reg_operand" "") 1782 (match_operand:DF 1 "memory_operand" ""))] 1783 "reload_completed" 1784 [(const_int 0)] 1785 "frv_split_double_load (operands[0], operands[1]);") 1786 1787 (define_split 1788 [(set (match_operand:DF 0 "dbl_memory_two_insn_operand" "") 1789 (match_operand:DF 1 "reg_or_0_operand" ""))] 1790 "reload_completed" 1791 [(const_int 0)] 1792 "frv_split_double_store (operands[0], operands[1]);") 1793 1794 (define_split 1795 [(set (match_operand:DF 0 "memory_operand" "") 1796 (match_operand:DF 1 "odd_reg_operand" ""))] 1797 "reload_completed" 1798 [(const_int 0)] 1799 "frv_split_double_store (operands[0], operands[1]);") 1800 1801 (define_split 1802 [(set (match_operand:DF 0 "register_operand" "") 1803 (match_operand:DF 1 "register_operand" ""))] 1804 "reload_completed 1805 && (odd_reg_operand (operands[0], DFmode) 1806 || odd_reg_operand (operands[1], DFmode) 1807 || (integer_register_operand (operands[0], DFmode) 1808 && integer_register_operand (operands[1], DFmode)) 1809 || (!TARGET_DOUBLE 1810 && fpr_operand (operands[0], DFmode) 1811 && fpr_operand (operands[1], DFmode)))" 1812 [(set (match_dup 2) (match_dup 4)) 1813 (set (match_dup 3) (match_dup 5))] 1814 " 1815 { 1816 rtx op0 = operands[0]; 1817 rtx op0_low = gen_lowpart (SImode, op0); 1818 rtx op0_high = gen_highpart (SImode, op0); 1819 rtx op1 = operands[1]; 1820 rtx op1_low = gen_lowpart (SImode, op1); 1821 rtx op1_high = gen_highpart (SImode, op1); 1822 1823 /* We normally copy the low-numbered register first. However, if the first 1824 register operand 0 is the same as the second register of operand 1, we 1825 must copy in the opposite order. */ 1826 1827 if (REGNO (op0_high) == REGNO (op1_low)) 1828 { 1829 operands[2] = op0_low; 1830 operands[3] = op0_high; 1831 operands[4] = op1_low; 1832 operands[5] = op1_high; 1833 } 1834 else 1835 { 1836 operands[2] = op0_high; 1837 operands[3] = op0_low; 1838 operands[4] = op1_high; 1839 operands[5] = op1_low; 1840 } 1841 }") 1842 1843 (define_split 1844 [(set (match_operand:DF 0 "register_operand" "") 1845 (match_operand:DF 1 "const_int_operand" ""))] 1846 "reload_completed" 1847 [(set (match_dup 2) (match_dup 4)) 1848 (set (match_dup 3) (match_dup 5))] 1849 " 1850 { 1851 rtx op0 = operands[0]; 1852 rtx op1 = operands[1]; 1853 1854 operands[2] = gen_highpart (SImode, op0); 1855 operands[3] = gen_lowpart (SImode, op0); 1856 if (HOST_BITS_PER_WIDE_INT <= 32) 1857 { 1858 operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0); 1859 operands[5] = op1; 1860 } 1861 else 1862 { 1863 operands[4] = GEN_INT (((((unsigned HOST_WIDE_INT)INTVAL (op1) >> 16) 1864 >> 16) ^ ((unsigned HOST_WIDE_INT)1 << 31)) 1865 - ((unsigned HOST_WIDE_INT)1 << 31)); 1866 operands[5] = GEN_INT (trunc_int_for_mode (INTVAL (op1), SImode)); 1867 } 1868 }") 1869 1870 (define_split 1871 [(set (match_operand:DF 0 "register_operand" "") 1872 (match_operand:DF 1 "const_double_operand" ""))] 1873 "reload_completed" 1874 [(set (match_dup 2) (match_dup 4)) 1875 (set (match_dup 3) (match_dup 5))] 1876 " 1877 { 1878 rtx op0 = operands[0]; 1879 rtx op1 = operands[1]; 1880 long l[2]; 1881 1882 REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op1), l); 1883 1884 operands[2] = gen_highpart (SImode, op0); 1885 operands[3] = gen_lowpart (SImode, op0); 1886 operands[4] = GEN_INT (l[0]); 1887 operands[5] = GEN_INT (l[1]); 1888 }") 1889 1890 ;; String/block move insn. 1891 ;; Argument 0 is the destination 1892 ;; Argument 1 is the source 1893 ;; Argument 2 is the length 1894 ;; Argument 3 is the alignment 1895 1896 (define_expand "cpymemsi" 1897 [(parallel [(set (match_operand:BLK 0 "" "") 1898 (match_operand:BLK 1 "" "")) 1899 (use (match_operand:SI 2 "" "")) 1900 (use (match_operand:SI 3 "" ""))])] 1901 "" 1902 " 1903 { 1904 if (frv_expand_block_move (operands)) 1905 DONE; 1906 else 1907 FAIL; 1908 }") 1909 1910 ;; String/block set insn. 1911 ;; Argument 0 is the destination 1912 ;; Argument 1 is the length 1913 ;; Argument 2 is the byte value -- ignore any value but zero 1914 ;; Argument 3 is the alignment 1915 1916 (define_expand "setmemsi" 1917 [(parallel [(set (match_operand:BLK 0 "" "") 1918 (match_operand 2 "" "")) 1919 (use (match_operand:SI 1 "" "")) 1920 (use (match_operand:SI 3 "" ""))])] 1921 "" 1922 " 1923 { 1924 /* If value to set is not zero, use the library routine. */ 1925 if (operands[2] != const0_rtx) 1926 FAIL; 1927 1928 if (frv_expand_block_clear (operands)) 1929 DONE; 1930 else 1931 FAIL; 1932 }") 1933 1935 1936 ;; The "membar" part of a __builtin_read* or __builtin_write* function. 1937 ;; Operand 0 is a volatile reference to the memory that the function reads 1938 ;; or writes. Operand 1 is the address being accessed, or zero if the 1939 ;; address isn't a known constant. Operand 2 describes the __builtin 1940 ;; function (either FRV_IO_READ or FRV_IO_WRITE). 1941 (define_insn "optional_membar_<mode>" 1942 [(set (match_operand:IMODE 0 "memory_operand" "=m") 1943 (unspec:IMODE [(match_operand 1 "const_int_operand" "") 1944 (match_operand 2 "const_int_operand" "")] 1945 UNSPEC_OPTIONAL_MEMBAR))] 1946 "" 1947 "membar" 1948 [(set_attr "length" "4")]) 1949 1951 ;; :::::::::::::::::::: 1952 ;; :: 1953 ;; :: Reload CC registers 1954 ;; :: 1955 ;; :::::::::::::::::::: 1956 1957 ;; Use as a define_expand so that cse/gcse/combine can't accidentally 1958 ;; create movcc insns. 1959 1960 (define_expand "movcc" 1961 [(parallel [(set (match_operand:CC 0 "move_destination_operand" "") 1962 (match_operand:CC 1 "move_source_operand" "")) 1963 (clobber (match_dup 2))])] 1964 "" 1965 " 1966 { 1967 if (! reload_in_progress && ! reload_completed) 1968 FAIL; 1969 1970 operands[2] = gen_rtx_REG (CC_CCRmode, ICR_TEMP); 1971 }") 1972 1973 (define_insn "*internal_movcc" 1974 [(set (match_operand:CC 0 "move_destination_operand" "=t,d,d,m,d") 1975 (match_operand:CC 1 "move_source_operand" "d,d,m,d,t")) 1976 (clobber (match_scratch:CC_CCR 2 "=X,X,X,X,&v"))] 1977 "reload_in_progress || reload_completed" 1978 "@ 1979 cmpi %1, #0, %0 1980 mov %1, %0 1981 ld%I1%U1 %M1, %0 1982 st%I0%U0 %1, %M0 1983 #" 1984 [(set_attr "length" "4,4,4,4,20") 1985 (set_attr "type" "int,int,gload,gstore,multi")]) 1986 1987 ;; To move an ICC value to a GPR for a signed comparison, we create a value 1988 ;; that when compared to 0, sets the N and Z flags appropriately (we don't care 1989 ;; about the V and C flags, since these comparisons are signed). 1990 1991 (define_split 1992 [(set (match_operand:CC 0 "integer_register_operand" "") 1993 (match_operand:CC 1 "icc_operand" "")) 1994 (clobber (match_operand:CC_CCR 2 "icr_operand" ""))] 1995 "reload_in_progress || reload_completed" 1996 [(match_dup 3)] 1997 " 1998 { 1999 rtx dest = simplify_gen_subreg (SImode, operands[0], CCmode, 0); 2000 rtx icc = operands[1]; 2001 rtx icr = operands[2]; 2002 2003 start_sequence (); 2004 2005 emit_insn (gen_rtx_SET (icr, gen_rtx_LT (CC_CCRmode, icc, const0_rtx))); 2006 2007 emit_insn (gen_movsi (dest, const1_rtx)); 2008 2009 emit_insn (gen_rtx_COND_EXEC (VOIDmode, 2010 gen_rtx_NE (CC_CCRmode, icr, const0_rtx), 2011 gen_rtx_SET (dest, 2012 gen_rtx_NEG (SImode, dest)))); 2013 2014 emit_insn (gen_rtx_SET (icr, gen_rtx_EQ (CC_CCRmode, icc, const0_rtx))); 2015 2016 emit_insn (gen_rtx_COND_EXEC (VOIDmode, 2017 gen_rtx_NE (CC_CCRmode, icr, const0_rtx), 2018 gen_rtx_SET (dest, const0_rtx))); 2019 2020 operands[3] = get_insns (); 2021 end_sequence (); 2022 }") 2023 2024 ;; Reload CC_UNSmode for unsigned integer comparisons 2025 ;; Use define_expand so that cse/gcse/combine can't create movcc_uns insns 2026 2027 (define_expand "movcc_uns" 2028 [(parallel [(set (match_operand:CC_UNS 0 "move_destination_operand" "") 2029 (match_operand:CC_UNS 1 "move_source_operand" "")) 2030 (clobber (match_dup 2))])] 2031 "" 2032 " 2033 { 2034 if (! reload_in_progress && ! reload_completed) 2035 FAIL; 2036 operands[2] = gen_rtx_REG (CC_CCRmode, ICR_TEMP); 2037 }") 2038 2039 (define_insn "*internal_movcc_uns" 2040 [(set (match_operand:CC_UNS 0 "move_destination_operand" "=t,d,d,m,d") 2041 (match_operand:CC_UNS 1 "move_source_operand" "d,d,m,d,t")) 2042 (clobber (match_scratch:CC_CCR 2 "=X,X,X,X,&v"))] 2043 "reload_in_progress || reload_completed" 2044 "@ 2045 cmpi %1, #1, %0 2046 mov %1, %0 2047 ld%I1%U1 %M1, %0 2048 st%I0%U0 %1, %M0 2049 #" 2050 [(set_attr "length" "4,4,4,4,20") 2051 (set_attr "type" "int,int,gload,gstore,multi")]) 2052 2053 ;; To move an ICC value to a GPR for an unsigned comparison, we create a value 2054 ;; that when compared to 1, sets the Z, V, and C flags appropriately (we don't 2055 ;; care about the N flag, since these comparisons are unsigned). 2056 2057 (define_split 2058 [(set (match_operand:CC_UNS 0 "integer_register_operand" "") 2059 (match_operand:CC_UNS 1 "icc_operand" "")) 2060 (clobber (match_operand:CC_CCR 2 "icr_operand" ""))] 2061 "reload_in_progress || reload_completed" 2062 [(match_dup 3)] 2063 " 2064 { 2065 rtx dest = simplify_gen_subreg (SImode, operands[0], CC_UNSmode, 0); 2066 rtx icc = operands[1]; 2067 rtx icr = operands[2]; 2068 2069 start_sequence (); 2070 2071 emit_insn (gen_rtx_SET (icr, gen_rtx_GTU (CC_CCRmode, icc, const0_rtx))); 2072 2073 emit_insn (gen_movsi (dest, const1_rtx)); 2074 2075 emit_insn (gen_rtx_COND_EXEC (VOIDmode, 2076 gen_rtx_NE (CC_CCRmode, icr, const0_rtx), 2077 gen_addsi3 (dest, dest, dest))); 2078 2079 emit_insn (gen_rtx_SET (icr, gen_rtx_LTU (CC_CCRmode, icc, const0_rtx))); 2080 2081 emit_insn (gen_rtx_COND_EXEC (VOIDmode, 2082 gen_rtx_NE (CC_CCRmode, icr, const0_rtx), 2083 gen_rtx_SET (dest, const0_rtx))); 2084 2085 operands[3] = get_insns (); 2086 end_sequence (); 2087 }") 2088 2089 ;; Reload CC_NZmode. This is mostly the same as the CCmode and CC_UNSmode 2090 ;; handling, but it uses different sequences for moving between GPRs and ICCs. 2091 2092 (define_expand "movcc_nz" 2093 [(parallel [(set (match_operand:CC_NZ 0 "move_destination_operand" "") 2094 (match_operand:CC_NZ 1 "move_source_operand" "")) 2095 (clobber (match_dup 2))])] 2096 "" 2097 " 2098 { 2099 if (!reload_in_progress && !reload_completed) 2100 FAIL; 2101 operands[2] = gen_rtx_REG (CC_CCRmode, ICR_TEMP); 2102 }") 2103 2104 (define_insn "*internal_movcc_nz" 2105 [(set (match_operand:CC_NZ 0 "move_destination_operand" "=t,d,d,m,d") 2106 (match_operand:CC_NZ 1 "move_source_operand" "d,d,m,d,t")) 2107 (clobber (match_scratch:CC_CCR 2 "=X,X,X,X,&v"))] 2108 "reload_in_progress || reload_completed" 2109 "@ 2110 cmpi %1, #0, %0 2111 mov %1, %0 2112 ld%I1%U1 %M1, %0 2113 st%I0%U0 %1, %M0 2114 #" 2115 [(set_attr "length" "4,4,4,4,20") 2116 (set_attr "type" "int,int,gload,gstore,multi")]) 2117 2118 ;; Set the destination to a value that, when compared with zero, will 2119 ;; restore the value of the Z and N flags. The values of the other 2120 ;; flags don't matter. The sequence is: 2121 ;; 2122 ;; setlos op0,#-1 2123 ;; ckp op1,op2 2124 ;; csub gr0,op0,op0,op2 2125 ;; ckeq op1,op2 2126 ;; cmov gr0,op0,op2 2127 (define_split 2128 [(set (match_operand:CC_NZ 0 "integer_register_operand" "") 2129 (match_operand:CC_NZ 1 "icc_operand" "")) 2130 (clobber (match_operand:CC_CCR 2 "icr_operand" ""))] 2131 "reload_in_progress || reload_completed" 2132 [(set (match_dup 3) 2133 (const_int -1)) 2134 (set (match_dup 2) 2135 (ge:CC_CCR (match_dup 1) 2136 (const_int 0))) 2137 (cond_exec (ne:CC_CCR (match_dup 2) 2138 (const_int 0)) 2139 (set (match_dup 3) 2140 (neg:SI (match_dup 3)))) 2141 (set (match_dup 2) 2142 (eq:CC_CCR (match_dup 1) 2143 (const_int 0))) 2144 (cond_exec (ne:CC_CCR (match_dup 2) 2145 (const_int 0)) 2146 (set (match_dup 3) (const_int 0)))] 2147 "operands[3] = simplify_gen_subreg (SImode, operands[0], CC_NZmode, 0);") 2148 2149 ;; Reload CC_FPmode for floating point comparisons 2150 ;; We use a define_expand here so that cse/gcse/combine can't accidentally 2151 ;; create movcc insns. If this was a named define_insn, we would not be able 2152 ;; to make it conditional on reload. 2153 2154 (define_expand "movcc_fp" 2155 [(set (match_operand:CC_FP 0 "movcc_fp_destination_operand" "") 2156 (match_operand:CC_FP 1 "move_source_operand" ""))] 2157 "TARGET_HAS_FPRS" 2158 " 2159 { 2160 if (! reload_in_progress && ! reload_completed) 2161 FAIL; 2162 }") 2163 2164 (define_insn "*movcc_fp_internal" 2165 [(set (match_operand:CC_FP 0 "movcc_fp_destination_operand" "=d,d,d,m") 2166 (match_operand:CC_FP 1 "move_source_operand" "u,d,m,d"))] 2167 "TARGET_HAS_FPRS && (reload_in_progress || reload_completed)" 2168 "@ 2169 # 2170 mov %1, %0 2171 ld%I1%U1 %M1, %0 2172 st%I0%U0 %1, %M0" 2173 [(set_attr "length" "12,4,4,4") 2174 (set_attr "type" "multi,int,gload,gstore")]) 2175 2176 2177 (define_expand "reload_incc_fp" 2178 [(match_operand:CC_FP 0 "fcc_operand" "=u") 2179 (match_operand:CC_FP 1 "gpr_or_memory_operand_with_scratch" "m") 2180 (match_operand:TI 2 "integer_register_operand" "=&d")] 2181 "TARGET_HAS_FPRS" 2182 " 2183 { 2184 rtx cc_op2 = simplify_gen_subreg (CC_FPmode, operands[2], TImode, 0); 2185 rtx int_op2 = simplify_gen_subreg (SImode, operands[2], TImode, 0); 2186 rtx temp1 = simplify_gen_subreg (SImode, operands[2], TImode, 4); 2187 rtx temp2 = simplify_gen_subreg (SImode, operands[2], TImode, 8); 2188 int shift = CC_SHIFT_RIGHT (REGNO (operands[0])); 2189 HOST_WIDE_INT mask; 2190 2191 if (!gpr_or_memory_operand (operands[1], CC_FPmode)) 2192 { 2193 rtx addr; 2194 rtx temp3 = simplify_gen_subreg (SImode, operands[2], TImode, 12); 2195 2196 gcc_assert (GET_CODE (operands[1]) == MEM); 2197 2198 addr = XEXP (operands[1], 0); 2199 2200 gcc_assert (GET_CODE (addr) == PLUS); 2201 2202 emit_move_insn (temp3, XEXP (addr, 1)); 2203 2204 operands[1] = replace_equiv_address (operands[1], 2205 gen_rtx_PLUS (GET_MODE (addr), 2206 XEXP (addr, 0), 2207 temp3)); 2208 } 2209 2210 emit_insn (gen_movcc_fp (cc_op2, operands[1])); 2211 if (shift) 2212 emit_insn (gen_ashlsi3 (int_op2, int_op2, GEN_INT (shift))); 2213 2214 mask = ~ ((HOST_WIDE_INT)CC_MASK << shift); 2215 emit_insn (gen_movsi (temp1, GEN_INT (mask))); 2216 emit_insn (gen_update_fcc (operands[0], int_op2, temp1, temp2)); 2217 DONE; 2218 }") 2219 2220 (define_expand "reload_outcc_fp" 2221 [(set (match_operand:CC_FP 2 "integer_register_operand" "=&d") 2222 (match_operand:CC_FP 1 "fcc_operand" "u")) 2223 (set (match_operand:CC_FP 0 "memory_operand" "=m") 2224 (match_dup 2))] 2225 "TARGET_HAS_FPRS" 2226 "") 2227 2228 ;; Convert a FCC value to gpr 2229 (define_insn "read_fcc" 2230 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2231 (unspec:SI [(match_operand:CC_FP 1 "fcc_operand" "u")] 2232 UNSPEC_CC_TO_GPR))] 2233 "TARGET_HAS_FPRS" 2234 "movsg ccr, %0" 2235 [(set_attr "type" "spr") 2236 (set_attr "length" "4")]) 2237 2238 (define_split 2239 [(set (match_operand:CC_FP 0 "integer_register_operand" "") 2240 (match_operand:CC_FP 1 "fcc_operand" ""))] 2241 "reload_completed && TARGET_HAS_FPRS" 2242 [(match_dup 2)] 2243 " 2244 { 2245 rtx int_op0 = simplify_gen_subreg (SImode, operands[0], CC_FPmode, 0); 2246 int shift = CC_SHIFT_RIGHT (REGNO (operands[1])); 2247 2248 start_sequence (); 2249 2250 emit_insn (gen_read_fcc (int_op0, operands[1])); 2251 if (shift) 2252 emit_insn (gen_lshrsi3 (int_op0, int_op0, GEN_INT (shift))); 2253 2254 emit_insn (gen_andsi3 (int_op0, int_op0, GEN_INT (CC_MASK))); 2255 2256 operands[2] = get_insns (); 2257 end_sequence (); 2258 }") 2259 2260 ;; Move a gpr value to FCC. 2261 ;; Operand0 = FCC 2262 ;; Operand1 = reloaded value shifted appropriately 2263 ;; Operand2 = mask to eliminate current register 2264 ;; Operand3 = temporary to load/store ccr 2265 (define_insn "update_fcc" 2266 [(set (match_operand:CC_FP 0 "fcc_operand" "=u") 2267 (unspec:CC_FP [(match_operand:SI 1 "integer_register_operand" "d") 2268 (match_operand:SI 2 "integer_register_operand" "d")] 2269 UNSPEC_GPR_TO_CC)) 2270 (clobber (match_operand:SI 3 "integer_register_operand" "=&d"))] 2271 "TARGET_HAS_FPRS" 2272 "movsg ccr, %3\;and %2, %3, %3\;or %1, %3, %3\;movgs %3, ccr" 2273 [(set_attr "type" "multi") 2274 (set_attr "length" "16")]) 2275 2276 ;; Reload CC_CCRmode for conditional execution registers 2277 (define_insn "movcc_ccr" 2278 [(set (match_operand:CC_CCR 0 "move_destination_operand" "=d,d,d,m,v,?w,C,d") 2279 (match_operand:CC_CCR 1 "move_source_operand" "C,d,m,d,n,n,C,L"))] 2280 "" 2281 "@ 2282 # 2283 mov %1, %0 2284 ld%I1%U1 %M1, %0 2285 st%I0%U0 %1, %M0 2286 # 2287 # 2288 orcr %1, %1, %0 2289 setlos #%1, %0" 2290 [(set_attr "length" "8,4,4,4,8,12,4,4") 2291 (set_attr "type" "multi,int,gload,gstore,multi,multi,ccr,int")]) 2292 2293 (define_expand "reload_incc_ccr" 2294 [(match_operand:CC_CCR 0 "cr_operand" "=C") 2295 (match_operand:CC_CCR 1 "memory_operand" "m") 2296 (match_operand:CC_CCR 2 "integer_register_operand" "=&d")] 2297 "" 2298 " 2299 { 2300 rtx icc = gen_rtx_REG (CCmode, ICC_TEMP); 2301 rtx int_op2 = simplify_gen_subreg (SImode, operands[2], CC_CCRmode, 0); 2302 rtx icr = (ICR_P (REGNO (operands[0])) 2303 ? operands[0] : gen_rtx_REG (CC_CCRmode, ICR_TEMP)); 2304 2305 emit_insn (gen_movcc_ccr (operands[2], operands[1])); 2306 emit_insn (gen_cmpsi_cc (icc, int_op2, const0_rtx)); 2307 emit_insn (gen_movcc_ccr (icr, gen_rtx_NE (CC_CCRmode, icc, const0_rtx))); 2308 2309 if (! ICR_P (REGNO (operands[0]))) 2310 emit_insn (gen_movcc_ccr (operands[0], icr)); 2311 2312 DONE; 2313 }") 2314 2315 (define_expand "reload_outcc_ccr" 2316 [(set (match_operand:CC_CCR 2 "integer_register_operand" "=&d") 2317 (match_operand:CC_CCR 1 "cr_operand" "C")) 2318 (set (match_operand:CC_CCR 0 "memory_operand" "=m") 2319 (match_dup 2))] 2320 "" 2321 "") 2322 2323 (define_split 2324 [(set (match_operand:CC_CCR 0 "integer_register_operand" "") 2325 (match_operand:CC_CCR 1 "cr_operand" ""))] 2326 "reload_completed" 2327 [(match_dup 2)] 2328 " 2329 { 2330 rtx int_op0 = simplify_gen_subreg (SImode, operands[0], CC_CCRmode, 0); 2331 2332 start_sequence (); 2333 emit_move_insn (operands[0], const1_rtx); 2334 emit_insn (gen_rtx_COND_EXEC (VOIDmode, 2335 gen_rtx_EQ (CC_CCRmode, 2336 operands[1], 2337 const0_rtx), 2338 gen_rtx_SET (int_op0, const0_rtx))); 2339 2340 operands[2] = get_insns (); 2341 end_sequence (); 2342 }") 2343 2344 (define_split 2345 [(set (match_operand:CC_CCR 0 "cr_operand" "") 2346 (match_operand:CC_CCR 1 "const_int_operand" ""))] 2347 "reload_completed" 2348 [(match_dup 2)] 2349 " 2350 { 2351 rtx icc = gen_rtx_REG (CCmode, ICC_TEMP); 2352 rtx r0 = gen_rtx_REG (SImode, GPR_FIRST); 2353 rtx icr = (ICR_P (REGNO (operands[0])) 2354 ? operands[0] : gen_rtx_REG (CC_CCRmode, ICR_TEMP)); 2355 2356 start_sequence (); 2357 2358 emit_insn (gen_cmpsi_cc (icc, r0, const0_rtx)); 2359 2360 emit_insn (gen_movcc_ccr (icr, 2361 gen_rtx_fmt_ee (((INTVAL (operands[1]) == 0) 2362 ? EQ : NE), CC_CCRmode, 2363 r0, const0_rtx))); 2364 2365 if (! ICR_P (REGNO (operands[0]))) 2366 emit_insn (gen_movcc_ccr (operands[0], icr)); 2367 2368 operands[2] = get_insns (); 2369 end_sequence (); 2370 }") 2371 2372 2374 ;; :::::::::::::::::::: 2375 ;; :: 2376 ;; :: Conversions 2377 ;; :: 2378 ;; :::::::::::::::::::: 2379 2380 ;; Signed conversions from a smaller integer to a larger integer 2381 ;; 2382 ;; These operations are optional. If they are not 2383 ;; present GCC will synthesize them for itself 2384 ;; Even though frv does not provide these instructions, we define them 2385 ;; to allow load + sign extend to be collapsed together 2386 (define_insn "extendqihi2" 2387 [(set (match_operand:HI 0 "integer_register_operand" "=d,d") 2388 (sign_extend:HI (match_operand:QI 1 "gpr_or_memory_operand" "d,m")))] 2389 "" 2390 "@ 2391 # 2392 ldsb%I1%U1 %M1,%0" 2393 [(set_attr "length" "8,4") 2394 (set_attr "type" "multi,gload")]) 2395 2396 (define_split 2397 [(set (match_operand:HI 0 "integer_register_operand" "") 2398 (sign_extend:HI (match_operand:QI 1 "integer_register_operand" "")))] 2399 "reload_completed" 2400 [(match_dup 2) 2401 (match_dup 3)] 2402 " 2403 { 2404 rtx op0 = gen_lowpart (SImode, operands[0]); 2405 rtx op1 = gen_lowpart (SImode, operands[1]); 2406 rtx shift = GEN_INT (24); 2407 2408 operands[2] = gen_ashlsi3 (op0, op1, shift); 2409 operands[3] = gen_ashrsi3 (op0, op0, shift); 2410 }") 2411 2412 (define_insn "extendqisi2" 2413 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 2414 (sign_extend:SI (match_operand:QI 1 "gpr_or_memory_operand" "d,m")))] 2415 "" 2416 "@ 2417 # 2418 ldsb%I1%U1 %M1,%0" 2419 [(set_attr "length" "8,4") 2420 (set_attr "type" "multi,gload")]) 2421 2422 (define_split 2423 [(set (match_operand:SI 0 "integer_register_operand" "") 2424 (sign_extend:SI (match_operand:QI 1 "integer_register_operand" "")))] 2425 "reload_completed" 2426 [(match_dup 2) 2427 (match_dup 3)] 2428 " 2429 { 2430 rtx op0 = gen_lowpart (SImode, operands[0]); 2431 rtx op1 = gen_lowpart (SImode, operands[1]); 2432 rtx shift = GEN_INT (24); 2433 2434 operands[2] = gen_ashlsi3 (op0, op1, shift); 2435 operands[3] = gen_ashrsi3 (op0, op0, shift); 2436 }") 2437 2438 ;;(define_insn "extendqidi2" 2439 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2440 ;; (sign_extend:DI (match_operand:QI 1 "general_operand" "g")))] 2441 ;; "" 2442 ;; "extendqihi2 %0,%1" 2443 ;; [(set_attr "length" "4")]) 2444 2445 (define_insn "extendhisi2" 2446 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 2447 (sign_extend:SI (match_operand:HI 1 "gpr_or_memory_operand" "d,m")))] 2448 "" 2449 "@ 2450 # 2451 ldsh%I1%U1 %M1,%0" 2452 [(set_attr "length" "8,4") 2453 (set_attr "type" "multi,gload")]) 2454 2455 (define_split 2456 [(set (match_operand:SI 0 "integer_register_operand" "") 2457 (sign_extend:SI (match_operand:HI 1 "integer_register_operand" "")))] 2458 "reload_completed" 2459 [(match_dup 2) 2460 (match_dup 3)] 2461 " 2462 { 2463 rtx op0 = gen_lowpart (SImode, operands[0]); 2464 rtx op1 = gen_lowpart (SImode, operands[1]); 2465 rtx shift = GEN_INT (16); 2466 2467 operands[2] = gen_ashlsi3 (op0, op1, shift); 2468 operands[3] = gen_ashrsi3 (op0, op0, shift); 2469 }") 2470 2471 ;;(define_insn "extendhidi2" 2472 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2473 ;; (sign_extend:DI (match_operand:HI 1 "general_operand" "g")))] 2474 ;; "" 2475 ;; "extendhihi2 %0,%1" 2476 ;; [(set_attr "length" "4")]) 2477 ;; 2478 ;;(define_insn "extendsidi2" 2479 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2480 ;; (sign_extend:DI (match_operand:SI 1 "general_operand" "g")))] 2481 ;; "" 2482 ;; "extendsidi2 %0,%1" 2483 ;; [(set_attr "length" "4")]) 2484 2485 ;; Unsigned conversions from a smaller integer to a larger integer 2486 (define_insn "zero_extendqihi2" 2487 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d") 2488 (zero_extend:HI 2489 (match_operand:QI 1 "gpr_or_memory_operand" "d,L,m")))] 2490 "" 2491 "@ 2492 andi %1,#0xff,%0 2493 setlos %1,%0 2494 ldub%I1%U1 %M1,%0" 2495 [(set_attr "length" "4") 2496 (set_attr "type" "int,int,gload")]) 2497 2498 (define_insn "zero_extendqisi2" 2499 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d") 2500 (zero_extend:SI 2501 (match_operand:QI 1 "gpr_or_memory_operand" "d,L,m")))] 2502 "" 2503 "@ 2504 andi %1,#0xff,%0 2505 setlos %1,%0 2506 ldub%I1%U1 %M1,%0" 2507 [(set_attr "length" "4") 2508 (set_attr "type" "int,int,gload")]) 2509 2510 ;;(define_insn "zero_extendqidi2" 2511 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2512 ;; (zero_extend:DI (match_operand:QI 1 "general_operand" "g")))] 2513 ;; "" 2514 ;; "zero_extendqihi2 %0,%1" 2515 ;; [(set_attr "length" "4")]) 2516 2517 ;; Do not set the type for the sethi to "sethi", since the scheduler will think 2518 ;; the sethi takes 0 cycles as part of allowing sethi/setlo to be in the same 2519 ;; VLIW instruction. 2520 (define_insn "zero_extendhisi2" 2521 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 2522 (zero_extend:SI (match_operand:HI 1 "gpr_or_memory_operand" "0,m")))] 2523 "" 2524 "@ 2525 sethi #hi(#0),%0 2526 lduh%I1%U1 %M1,%0" 2527 [(set_attr "length" "4") 2528 (set_attr "type" "int,gload")]) 2529 2530 ;;(define_insn "zero_extendhidi2" 2531 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2532 ;; (zero_extend:DI (match_operand:HI 1 "general_operand" "g")))] 2533 ;; "" 2534 ;; "zero_extendhihi2 %0,%1" 2535 ;; [(set_attr "length" "4")]) 2536 ;; 2537 ;;(define_insn "zero_extendsidi2" 2538 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2539 ;; (zero_extend:DI (match_operand:SI 1 "general_operand" "g")))] 2540 ;; "" 2541 ;; "zero_extendsidi2 %0,%1" 2542 ;; [(set_attr "length" "4")]) 2543 ;; 2544 ;;;; Convert between floating point types of different sizes. 2545 ;; 2546 ;;(define_insn "extendsfdf2" 2547 ;; [(set (match_operand:DF 0 "register_operand" "=r") 2548 ;; (float_extend:DF (match_operand:SF 1 "register_operand" "r")))] 2549 ;; "" 2550 ;; "extendsfdf2 %0,%1" 2551 ;; [(set_attr "length" "4")]) 2552 ;; 2553 ;;(define_insn "truncdfsf2" 2554 ;; [(set (match_operand:SF 0 "register_operand" "=r") 2555 ;; (float_truncate:SF (match_operand:DF 1 "register_operand" "r")))] 2556 ;; "" 2557 ;; "truncdfsf2 %0,%1" 2558 ;; [(set_attr "length" "4")]) 2559 2560 ;;;; Convert between signed integer types and floating point. 2561 (define_insn "floatsisf2" 2562 [(set (match_operand:SF 0 "fpr_operand" "=f") 2563 (float:SF (match_operand:SI 1 "fpr_operand" "f")))] 2564 "TARGET_HARD_FLOAT" 2565 "fitos %1,%0" 2566 [(set_attr "length" "4") 2567 (set_attr "type" "fsconv")]) 2568 2569 (define_insn "floatsidf2" 2570 [(set (match_operand:DF 0 "fpr_operand" "=h") 2571 (float:DF (match_operand:SI 1 "fpr_operand" "f")))] 2572 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 2573 "fitod %1,%0" 2574 [(set_attr "length" "4") 2575 (set_attr "type" "fdconv")]) 2576 2577 ;;(define_insn "floatdisf2" 2578 ;; [(set (match_operand:SF 0 "register_operand" "=r") 2579 ;; (float:SF (match_operand:DI 1 "register_operand" "r")))] 2580 ;; "" 2581 ;; "floatdisf2 %0,%1" 2582 ;; [(set_attr "length" "4")]) 2583 ;; 2584 ;;(define_insn "floatdidf2" 2585 ;; [(set (match_operand:DF 0 "register_operand" "=r") 2586 ;; (float:DF (match_operand:DI 1 "register_operand" "r")))] 2587 ;; "" 2588 ;; "floatdidf2 %0,%1" 2589 ;; [(set_attr "length" "4")]) 2590 2591 (define_insn "fix_truncsfsi2" 2592 [(set (match_operand:SI 0 "fpr_operand" "=f") 2593 (fix:SI (match_operand:SF 1 "fpr_operand" "f")))] 2594 "TARGET_HARD_FLOAT" 2595 "fstoi %1,%0" 2596 [(set_attr "length" "4") 2597 (set_attr "type" "fsconv")]) 2598 2599 (define_insn "fix_truncdfsi2" 2600 [(set (match_operand:SI 0 "fpr_operand" "=f") 2601 (fix:SI (match_operand:DF 1 "fpr_operand" "h")))] 2602 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 2603 "fdtoi %1,%0" 2604 [(set_attr "length" "4") 2605 (set_attr "type" "fdconv")]) 2606 2607 ;;(define_insn "fix_truncsfdi2" 2608 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2609 ;; (fix:DI (match_operand:SF 1 "register_operand" "r")))] 2610 ;; "" 2611 ;; "fix_truncsfdi2 %0,%1" 2612 ;; [(set_attr "length" "4")]) 2613 ;; 2614 ;;(define_insn "fix_truncdfdi2" 2615 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2616 ;; (fix:DI (match_operand:DF 1 "register_operand" "r")))] 2617 ;; "" 2618 ;; "fix_truncdfdi2 %0,%1" 2619 ;; [(set_attr "length" "4")]) 2620 ;; 2621 ;;;; Convert between unsigned integer types and floating point. 2622 ;; 2623 ;;(define_insn "floatunssisf2" 2624 ;; [(set (match_operand:SF 0 "register_operand" "=r") 2625 ;; (unsigned_float:SF (match_operand:SI 1 "register_operand" "r")))] 2626 ;; "" 2627 ;; "floatunssisf2 %0,%1" 2628 ;; [(set_attr "length" "4")]) 2629 ;; 2630 ;;(define_insn "floatunssidf2" 2631 ;; [(set (match_operand:DF 0 "register_operand" "=r") 2632 ;; (unsigned_float:DF (match_operand:SI 1 "register_operand" "r")))] 2633 ;; "" 2634 ;; "floatunssidf2 %0,%1" 2635 ;; [(set_attr "length" "4")]) 2636 ;; 2637 ;;(define_insn "floatunsdisf2" 2638 ;; [(set (match_operand:SF 0 "register_operand" "=r") 2639 ;; (unsigned_float:SF (match_operand:DI 1 "register_operand" "r")))] 2640 ;; "" 2641 ;; "floatunsdisf2 %0,%1" 2642 ;; [(set_attr "length" "4")]) 2643 ;; 2644 ;;(define_insn "floatunsdidf2" 2645 ;; [(set (match_operand:DF 0 "register_operand" "=r") 2646 ;; (unsigned_float:DF (match_operand:DI 1 "register_operand" "r")))] 2647 ;; "" 2648 ;; "floatunsdidf2 %0,%1" 2649 ;; [(set_attr "length" "4")]) 2650 ;; 2651 ;;(define_insn "fixuns_truncsfsi2" 2652 ;; [(set (match_operand:SI 0 "register_operand" "=r") 2653 ;; (unsigned_fix:SI (match_operand:SF 1 "register_operand" "r")))] 2654 ;; "" 2655 ;; "fixuns_truncsfsi2 %0,%1" 2656 ;; [(set_attr "length" "4")]) 2657 ;; 2658 ;;(define_insn "fixuns_truncdfsi2" 2659 ;; [(set (match_operand:SI 0 "register_operand" "=r") 2660 ;; (unsigned_fix:SI (match_operand:DF 1 "register_operand" "r")))] 2661 ;; "" 2662 ;; "fixuns_truncdfsi2 %0,%1" 2663 ;; [(set_attr "length" "4")]) 2664 ;; 2665 ;;(define_insn "fixuns_truncsfdi2" 2666 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2667 ;; (unsigned_fix:DI (match_operand:SF 1 "register_operand" "r")))] 2668 ;; "" 2669 ;; "fixuns_truncsfdi2 %0,%1" 2670 ;; [(set_attr "length" "4")]) 2671 ;; 2672 ;;(define_insn "fixuns_truncdfdi2" 2673 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2674 ;; (unsigned_fix:DI (match_operand:DF 1 "register_operand" "r")))] 2675 ;; "" 2676 ;; "fixuns_truncdfdi2 %0,%1" 2677 ;; [(set_attr "length" "4")]) 2678 2679 2681 ;; :::::::::::::::::::: 2682 ;; :: 2683 ;; :: 32-bit Integer arithmetic 2684 ;; :: 2685 ;; :::::::::::::::::::: 2686 2687 ;; Addition 2688 (define_insn "addsi3" 2689 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2690 (plus:SI (match_operand:SI 1 "integer_register_operand" "%d") 2691 (match_operand:SI 2 "gpr_or_int12_operand" "dNOPQ")))] 2692 "" 2693 "add%I2 %1,%2,%0" 2694 [(set_attr "length" "4") 2695 (set_attr "type" "int")]) 2696 2697 ;; Subtraction. No need to worry about constants, since the compiler 2698 ;; canonicalizes them into addsi3's. We prevent SUBREG's here to work around a 2699 ;; combine bug, that combines the 32x32->upper 32 bit multiply that uses a 2700 ;; SUBREG with a minus that shows up in modulus by constants. 2701 (define_insn "subsi3" 2702 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2703 (minus:SI (match_operand:SI 1 "gpr_no_subreg_operand" "d") 2704 (match_operand:SI 2 "gpr_no_subreg_operand" "d")))] 2705 "" 2706 "sub %1,%2,%0" 2707 [(set_attr "length" "4") 2708 (set_attr "type" "int")]) 2709 2710 ;; Signed multiplication producing 64-bit results from 32-bit inputs 2711 ;; Note, frv doesn't have a 32x32->32 bit multiply, but the compiler 2712 ;; will do the 32x32->64 bit multiply and use the bottom word. 2713 (define_expand "mulsidi3" 2714 [(set (match_operand:DI 0 "integer_register_operand" "") 2715 (mult:DI (sign_extend:DI (match_operand:SI 1 "integer_register_operand" "")) 2716 (sign_extend:DI (match_operand:SI 2 "gpr_or_int12_operand" ""))))] 2717 "" 2718 " 2719 { 2720 if (GET_CODE (operands[2]) == CONST_INT) 2721 { 2722 emit_insn (gen_mulsidi3_const (operands[0], operands[1], operands[2])); 2723 DONE; 2724 } 2725 }") 2726 2727 (define_insn "*mulsidi3_reg" 2728 [(set (match_operand:DI 0 "even_gpr_operand" "=e") 2729 (mult:DI (sign_extend:DI (match_operand:SI 1 "integer_register_operand" "%d")) 2730 (sign_extend:DI (match_operand:SI 2 "integer_register_operand" "d"))))] 2731 "" 2732 "smul %1,%2,%0" 2733 [(set_attr "length" "4") 2734 (set_attr "type" "mul")]) 2735 2736 (define_insn "mulsidi3_const" 2737 [(set (match_operand:DI 0 "even_gpr_operand" "=e") 2738 (mult:DI (sign_extend:DI (match_operand:SI 1 "integer_register_operand" "d")) 2739 (match_operand:SI 2 "int12_operand" "NOP")))] 2740 "" 2741 "smuli %1,%2,%0" 2742 [(set_attr "length" "4") 2743 (set_attr "type" "mul")]) 2744 2745 ;; Unsigned multiplication producing 64-bit results from 32-bit inputs 2746 (define_expand "umulsidi3" 2747 [(set (match_operand:DI 0 "even_gpr_operand" "") 2748 (mult:DI (zero_extend:DI (match_operand:SI 1 "integer_register_operand" "")) 2749 (zero_extend:DI (match_operand:SI 2 "gpr_or_int12_operand" ""))))] 2750 "" 2751 " 2752 { 2753 if (GET_CODE (operands[2]) == CONST_INT) 2754 { 2755 emit_insn (gen_umulsidi3_const (operands[0], operands[1], operands[2])); 2756 DONE; 2757 } 2758 }") 2759 2760 (define_insn "*mulsidi3_reg" 2761 [(set (match_operand:DI 0 "even_gpr_operand" "=e") 2762 (mult:DI (zero_extend:DI (match_operand:SI 1 "integer_register_operand" "%d")) 2763 (zero_extend:DI (match_operand:SI 2 "integer_register_operand" "d"))))] 2764 "" 2765 "umul %1,%2,%0" 2766 [(set_attr "length" "4") 2767 (set_attr "type" "mul")]) 2768 2769 (define_insn "umulsidi3_const" 2770 [(set (match_operand:DI 0 "even_gpr_operand" "=e") 2771 (mult:DI (zero_extend:DI (match_operand:SI 1 "integer_register_operand" "d")) 2772 (match_operand:SI 2 "int12_operand" "NOP")))] 2773 "" 2774 "umuli %1,%2,%0" 2775 [(set_attr "length" "4") 2776 (set_attr "type" "mul")]) 2777 2778 ;; Signed Division 2779 (define_insn "divsi3" 2780 [(set (match_operand:SI 0 "register_operand" "=d,d") 2781 (div:SI (match_operand:SI 1 "register_operand" "d,d") 2782 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))] 2783 "" 2784 "sdiv%I2 %1,%2,%0" 2785 [(set_attr "length" "4") 2786 (set_attr "type" "div")]) 2787 2788 ;; Unsigned Division 2789 (define_insn "udivsi3" 2790 [(set (match_operand:SI 0 "register_operand" "=d,d") 2791 (udiv:SI (match_operand:SI 1 "register_operand" "d,d") 2792 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))] 2793 "" 2794 "udiv%I2 %1,%2,%0" 2795 [(set_attr "length" "4") 2796 (set_attr "type" "div")]) 2797 2798 ;; Negation 2799 (define_insn "negsi2" 2800 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2801 (neg:SI (match_operand:SI 1 "integer_register_operand" "d")))] 2802 "" 2803 "sub %.,%1,%0" 2804 [(set_attr "length" "4") 2805 (set_attr "type" "int")]) 2806 2807 ;; Find first one bit 2808 ;; (define_insn "ffssi2" 2809 ;; [(set (match_operand:SI 0 "register_operand" "=r") 2810 ;; (ffs:SI (match_operand:SI 1 "register_operand" "r")))] 2811 ;; "" 2812 ;; "ffssi2 %0,%1" 2813 ;; [(set_attr "length" "4")]) 2814 2815 2817 ;; :::::::::::::::::::: 2818 ;; :: 2819 ;; :: 64-bit Integer arithmetic 2820 ;; :: 2821 ;; :::::::::::::::::::: 2822 2823 ;; Addition 2824 (define_insn_and_split "adddi3" 2825 [(set (match_operand:DI 0 "integer_register_operand" "=&e,e") 2826 (plus:DI (match_operand:DI 1 "integer_register_operand" "%e,0") 2827 (match_operand:DI 2 "gpr_or_int10_operand" "eJ,eJ"))) 2828 (clobber (match_scratch:CC 3 "=t,t"))] 2829 "" 2830 "#" 2831 "reload_completed" 2832 [(match_dup 4) 2833 (match_dup 5)] 2834 " 2835 { 2836 rtx parts[3][2]; 2837 int op, part; 2838 2839 for (op = 0; op < 3; op++) 2840 for (part = 0; part < 2; part++) 2841 parts[op][part] = simplify_gen_subreg (SImode, operands[op], 2842 DImode, part * UNITS_PER_WORD); 2843 2844 operands[4] = gen_adddi3_lower (parts[0][1], parts[1][1], parts[2][1], 2845 operands[3]); 2846 operands[5] = gen_adddi3_upper (parts[0][0], parts[1][0], parts[2][0], 2847 copy_rtx (operands[3])); 2848 }" 2849 [(set_attr "length" "8") 2850 (set_attr "type" "multi")]) 2851 2852 ;; Subtraction No need to worry about constants, since the compiler 2853 ;; canonicalizes them into adddi3's. 2854 (define_insn_and_split "subdi3" 2855 [(set (match_operand:DI 0 "integer_register_operand" "=&e,e,e") 2856 (minus:DI (match_operand:DI 1 "integer_register_operand" "e,0,e") 2857 (match_operand:DI 2 "integer_register_operand" "e,e,0"))) 2858 (clobber (match_scratch:CC 3 "=t,t,t"))] 2859 "" 2860 "#" 2861 "reload_completed" 2862 [(match_dup 4) 2863 (match_dup 5)] 2864 " 2865 { 2866 rtx op0_high = gen_highpart (SImode, operands[0]); 2867 rtx op1_high = gen_highpart (SImode, operands[1]); 2868 rtx op2_high = gen_highpart (SImode, operands[2]); 2869 rtx op0_low = gen_lowpart (SImode, operands[0]); 2870 rtx op1_low = gen_lowpart (SImode, operands[1]); 2871 rtx op2_low = gen_lowpart (SImode, operands[2]); 2872 rtx op3 = operands[3]; 2873 2874 operands[4] = gen_subdi3_lower (op0_low, op1_low, op2_low, op3); 2875 operands[5] = gen_subdi3_upper (op0_high, op1_high, op2_high, op3); 2876 }" 2877 [(set_attr "length" "8") 2878 (set_attr "type" "multi")]) 2879 2880 ;; Patterns for addsi3/subdi3 after splitting 2881 (define_insn "adddi3_lower" 2882 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2883 (plus:SI (match_operand:SI 1 "integer_register_operand" "d") 2884 (match_operand:SI 2 "gpr_or_int10_operand" "dJ"))) 2885 (set (match_operand:CC 3 "icc_operand" "=t") 2886 (compare:CC (plus:SI (match_dup 1) 2887 (match_dup 2)) 2888 (const_int 0)))] 2889 "" 2890 "add%I2cc %1,%2,%0,%3" 2891 [(set_attr "length" "4") 2892 (set_attr "type" "int")]) 2893 2894 (define_insn "adddi3_upper" 2895 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2896 (plus:SI (match_operand:SI 1 "integer_register_operand" "d") 2897 (plus:SI (match_operand:SI 2 "gpr_or_int10_operand" "dJ") 2898 (match_operand:CC 3 "icc_operand" "t"))))] 2899 "" 2900 "addx%I2 %1,%2,%0,%3" 2901 [(set_attr "length" "4") 2902 (set_attr "type" "int")]) 2903 2904 (define_insn "subdi3_lower" 2905 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2906 (minus:SI (match_operand:SI 1 "integer_register_operand" "d") 2907 (match_operand:SI 2 "integer_register_operand" "d"))) 2908 (set (match_operand:CC 3 "icc_operand" "=t") 2909 (compare:CC (plus:SI (match_dup 1) 2910 (match_dup 2)) 2911 (const_int 0)))] 2912 "" 2913 "subcc %1,%2,%0,%3" 2914 [(set_attr "length" "4") 2915 (set_attr "type" "int")]) 2916 2917 (define_insn "subdi3_upper" 2918 [(set (match_operand:SI 0 "integer_register_operand" "=d") 2919 (minus:SI (match_operand:SI 1 "integer_register_operand" "d") 2920 (minus:SI (match_operand:SI 2 "integer_register_operand" "d") 2921 (match_operand:CC 3 "icc_operand" "t"))))] 2922 "" 2923 "subx %1,%2,%0,%3" 2924 [(set_attr "length" "4") 2925 (set_attr "type" "int")]) 2926 2927 (define_insn_and_split "negdi2" 2928 [(set (match_operand:DI 0 "integer_register_operand" "=&e,e") 2929 (neg:DI (match_operand:DI 1 "integer_register_operand" "e,0"))) 2930 (clobber (match_scratch:CC 2 "=t,t"))] 2931 "" 2932 "#" 2933 "reload_completed" 2934 [(match_dup 3) 2935 (match_dup 4)] 2936 " 2937 { 2938 rtx op0_high = gen_highpart (SImode, operands[0]); 2939 rtx op1_high = gen_rtx_REG (SImode, GPR_FIRST); 2940 rtx op2_high = gen_highpart (SImode, operands[1]); 2941 rtx op0_low = gen_lowpart (SImode, operands[0]); 2942 rtx op1_low = op1_high; 2943 rtx op2_low = gen_lowpart (SImode, operands[1]); 2944 rtx op3 = operands[2]; 2945 2946 operands[3] = gen_subdi3_lower (op0_low, op1_low, op2_low, op3); 2947 operands[4] = gen_subdi3_upper (op0_high, op1_high, op2_high, op3); 2948 }" 2949 [(set_attr "length" "8") 2950 (set_attr "type" "multi")]) 2951 2952 ;; Multiplication (same size) 2953 ;; (define_insn "muldi3" 2954 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2955 ;; (mult:DI (match_operand:DI 1 "register_operand" "%r") 2956 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))] 2957 ;; "" 2958 ;; "muldi3 %0,%1,%2" 2959 ;; [(set_attr "length" "4")]) 2960 2961 ;; Signed Division 2962 ;; (define_insn "divdi3" 2963 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2964 ;; (div:DI (match_operand:DI 1 "register_operand" "r") 2965 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))] 2966 ;; "" 2967 ;; "divdi3 %0,%1,%2" 2968 ;; [(set_attr "length" "4")]) 2969 2970 ;; Undsgned Division 2971 ;; (define_insn "udivdi3" 2972 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2973 ;; (udiv:DI (match_operand:DI 1 "register_operand" "r") 2974 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))] 2975 ;; "" 2976 ;; "udivdi3 %0,%1,%2" 2977 ;; [(set_attr "length" "4")]) 2978 2979 ;; Negation 2980 ;; (define_insn "negdi2" 2981 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2982 ;; (neg:DI (match_operand:DI 1 "register_operand" "r")))] 2983 ;; "" 2984 ;; "negdi2 %0,%1" 2985 ;; [(set_attr "length" "4")]) 2986 2987 ;; Find first one bit 2988 ;; (define_insn "ffsdi2" 2989 ;; [(set (match_operand:DI 0 "register_operand" "=r") 2990 ;; (ffs:DI (match_operand:DI 1 "register_operand" "r")))] 2991 ;; "" 2992 ;; "ffsdi2 %0,%1" 2993 ;; [(set_attr "length" "4")]) 2994 2995 2997 ;; :::::::::::::::::::: 2998 ;; :: 2999 ;; :: 32-bit floating point arithmetic 3000 ;; :: 3001 ;; :::::::::::::::::::: 3002 3003 ;; Addition 3004 (define_insn "addsf3" 3005 [(set (match_operand:SF 0 "fpr_operand" "=f") 3006 (plus:SF (match_operand:SF 1 "fpr_operand" "%f") 3007 (match_operand:SF 2 "fpr_operand" "f")))] 3008 "TARGET_HARD_FLOAT" 3009 "fadds %1,%2,%0" 3010 [(set_attr "length" "4") 3011 (set_attr "type" "fsadd")]) 3012 3013 ;; Subtraction 3014 (define_insn "subsf3" 3015 [(set (match_operand:SF 0 "fpr_operand" "=f") 3016 (minus:SF (match_operand:SF 1 "fpr_operand" "f") 3017 (match_operand:SF 2 "fpr_operand" "f")))] 3018 "TARGET_HARD_FLOAT" 3019 "fsubs %1,%2,%0" 3020 [(set_attr "length" "4") 3021 (set_attr "type" "fsadd")]) 3022 3023 ;; Multiplication 3024 (define_insn "mulsf3" 3025 [(set (match_operand:SF 0 "fpr_operand" "=f") 3026 (mult:SF (match_operand:SF 1 "fpr_operand" "%f") 3027 (match_operand:SF 2 "fpr_operand" "f")))] 3028 "TARGET_HARD_FLOAT" 3029 "fmuls %1,%2,%0" 3030 [(set_attr "length" "4") 3031 (set_attr "type" "fsmul")]) 3032 3033 ;; Multiplication with addition/subtraction 3034 (define_insn "fmasf4" 3035 [(set (match_operand:SF 0 "fpr_operand" "=f") 3036 (fma:SF (match_operand:SF 1 "fpr_operand" "f") 3037 (match_operand:SF 2 "fpr_operand" "f") 3038 (match_operand:SF 3 "fpr_operand" "0")))] 3039 "TARGET_HARD_FLOAT && TARGET_MULADD" 3040 "fmadds %1,%2,%0" 3041 [(set_attr "length" "4") 3042 (set_attr "type" "fsmadd")]) 3043 3044 (define_insn "fmssf4" 3045 [(set (match_operand:SF 0 "fpr_operand" "=f") 3046 (fma:SF (match_operand:SF 1 "fpr_operand" "f") 3047 (match_operand:SF 2 "fpr_operand" "f") 3048 (neg:SF (match_operand:SF 3 "fpr_operand" "0"))))] 3049 "TARGET_HARD_FLOAT && TARGET_MULADD" 3050 "fmsubs %1,%2,%0" 3051 [(set_attr "length" "4") 3052 (set_attr "type" "fsmadd")]) 3053 3054 ;; Division 3055 (define_insn "divsf3" 3056 [(set (match_operand:SF 0 "fpr_operand" "=f") 3057 (div:SF (match_operand:SF 1 "fpr_operand" "f") 3058 (match_operand:SF 2 "fpr_operand" "f")))] 3059 "TARGET_HARD_FLOAT" 3060 "fdivs %1,%2,%0" 3061 [(set_attr "length" "4") 3062 (set_attr "type" "fsdiv")]) 3063 3064 ;; Negation 3065 (define_insn "negsf2" 3066 [(set (match_operand:SF 0 "fpr_operand" "=f") 3067 (neg:SF (match_operand:SF 1 "fpr_operand" "f")))] 3068 "TARGET_HARD_FLOAT" 3069 "fnegs %1,%0" 3070 [(set_attr "length" "4") 3071 (set_attr "type" "fsconv")]) 3072 3073 ;; Absolute value 3074 (define_insn "abssf2" 3075 [(set (match_operand:SF 0 "fpr_operand" "=f") 3076 (abs:SF (match_operand:SF 1 "fpr_operand" "f")))] 3077 "TARGET_HARD_FLOAT" 3078 "fabss %1,%0" 3079 [(set_attr "length" "4") 3080 (set_attr "type" "fsconv")]) 3081 3082 ;; Square root 3083 (define_insn "sqrtsf2" 3084 [(set (match_operand:SF 0 "fpr_operand" "=f") 3085 (sqrt:SF (match_operand:SF 1 "fpr_operand" "f")))] 3086 "TARGET_HARD_FLOAT" 3087 "fsqrts %1,%0" 3088 [(set_attr "length" "4") 3089 (set_attr "type" "sqrt_single")]) 3090 3091 3093 ;; :::::::::::::::::::: 3094 ;; :: 3095 ;; :: 64-bit floating point arithmetic 3096 ;; :: 3097 ;; :::::::::::::::::::: 3098 3099 ;; Addition 3100 (define_insn "adddf3" 3101 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3102 (plus:DF (match_operand:DF 1 "fpr_operand" "%h") 3103 (match_operand:DF 2 "fpr_operand" "h")))] 3104 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3105 "faddd %1,%2,%0" 3106 [(set_attr "length" "4") 3107 (set_attr "type" "fdadd")]) 3108 3109 ;; Subtraction 3110 (define_insn "subdf3" 3111 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3112 (minus:DF (match_operand:DF 1 "fpr_operand" "h") 3113 (match_operand:DF 2 "fpr_operand" "h")))] 3114 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3115 "fsubd %1,%2,%0" 3116 [(set_attr "length" "4") 3117 (set_attr "type" "fdadd")]) 3118 3119 ;; Multiplication 3120 (define_insn "muldf3" 3121 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3122 (mult:DF (match_operand:DF 1 "fpr_operand" "%h") 3123 (match_operand:DF 2 "fpr_operand" "h")))] 3124 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3125 "fmuld %1,%2,%0" 3126 [(set_attr "length" "4") 3127 (set_attr "type" "fdmul")]) 3128 3129 ;; Multiplication with addition/subtraction 3130 (define_insn "*muladddf4" 3131 [(set (match_operand:DF 0 "fpr_operand" "=f") 3132 (plus:DF (mult:DF (match_operand:DF 1 "fpr_operand" "%f") 3133 (match_operand:DF 2 "fpr_operand" "f")) 3134 (match_operand:DF 3 "fpr_operand" "0")))] 3135 "TARGET_HARD_FLOAT && TARGET_DOUBLE && TARGET_MULADD" 3136 "fmaddd %1,%2,%0" 3137 [(set_attr "length" "4") 3138 (set_attr "type" "fdmadd")]) 3139 3140 (define_insn "*mulsubdf4" 3141 [(set (match_operand:DF 0 "fpr_operand" "=f") 3142 (minus:DF (mult:DF (match_operand:DF 1 "fpr_operand" "%f") 3143 (match_operand:DF 2 "fpr_operand" "f")) 3144 (match_operand:DF 3 "fpr_operand" "0")))] 3145 "TARGET_HARD_FLOAT && TARGET_DOUBLE && TARGET_MULADD" 3146 "fmsubd %1,%2,%0" 3147 [(set_attr "length" "4") 3148 (set_attr "type" "fdmadd")]) 3149 3150 ;; Division 3151 (define_insn "divdf3" 3152 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3153 (div:DF (match_operand:DF 1 "fpr_operand" "h") 3154 (match_operand:DF 2 "fpr_operand" "h")))] 3155 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3156 "fdivd %1,%2,%0" 3157 [(set_attr "length" "4") 3158 (set_attr "type" "fddiv")]) 3159 3160 ;; Negation 3161 (define_insn "negdf2" 3162 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3163 (neg:DF (match_operand:DF 1 "fpr_operand" "h")))] 3164 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3165 "fnegd %1,%0" 3166 [(set_attr "length" "4") 3167 (set_attr "type" "fdconv")]) 3168 3169 ;; Absolute value 3170 (define_insn "absdf2" 3171 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3172 (abs:DF (match_operand:DF 1 "fpr_operand" "h")))] 3173 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3174 "fabsd %1,%0" 3175 [(set_attr "length" "4") 3176 (set_attr "type" "fdconv")]) 3177 3178 ;; Square root 3179 (define_insn "sqrtdf2" 3180 [(set (match_operand:DF 0 "even_fpr_operand" "=h") 3181 (sqrt:DF (match_operand:DF 1 "fpr_operand" "h")))] 3182 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3183 "fsqrtd %1,%0" 3184 [(set_attr "length" "4") 3185 (set_attr "type" "sqrt_double")]) 3186 3187 3189 ;; :::::::::::::::::::: 3190 ;; :: 3191 ;; :: 32-bit Integer Shifts and Rotates 3192 ;; :: 3193 ;; :::::::::::::::::::: 3194 3195 ;; Arithmetic Shift Left 3196 (define_insn "ashlsi3" 3197 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 3198 (ashift:SI (match_operand:SI 1 "integer_register_operand" "d,d") 3199 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))] 3200 "" 3201 "sll%I2 %1,%2,%0" 3202 [(set_attr "length" "4") 3203 (set_attr "type" "int")]) 3204 3205 ;; Arithmetic Shift Right 3206 (define_insn "ashrsi3" 3207 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 3208 (ashiftrt:SI (match_operand:SI 1 "integer_register_operand" "d,d") 3209 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))] 3210 "" 3211 "sra%I2 %1, %2, %0" 3212 [(set_attr "length" "4") 3213 (set_attr "type" "int")]) 3214 3215 ;; Logical Shift Right 3216 (define_insn "lshrsi3" 3217 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 3218 (lshiftrt:SI (match_operand:SI 1 "integer_register_operand" "d,d") 3219 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))] 3220 "" 3221 "srl%I2 %1, %2, %0" 3222 [(set_attr "length" "4") 3223 (set_attr "type" "int")]) 3224 3225 ;; Rotate Left 3226 ;; (define_insn "rotlsi3" 3227 ;; [(set (match_operand:SI 0 "register_operand" "=r") 3228 ;; (rotate:SI (match_operand:SI 1 "register_operand" "r") 3229 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3230 ;; "" 3231 ;; "rotlsi3 %0,%1,%2" 3232 ;; [(set_attr "length" "4")]) 3233 3234 ;; Rotate Right 3235 ;; (define_insn "rotrsi3" 3236 ;; [(set (match_operand:SI 0 "register_operand" "=r") 3237 ;; (rotatert:SI (match_operand:SI 1 "register_operand" "r") 3238 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3239 ;; "" 3240 ;; "rotrsi3 %0,%1,%2" 3241 ;; [(set_attr "length" "4")]) 3242 3243 3245 ;; :::::::::::::::::::: 3246 ;; :: 3247 ;; :: 64-bit Integer Shifts and Rotates 3248 ;; :: 3249 ;; :::::::::::::::::::: 3250 3251 ;; Arithmetic Shift Left 3252 ;; (define_insn "ashldi3" 3253 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3254 ;; (ashift:DI (match_operand:DI 1 "register_operand" "r") 3255 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3256 ;; "" 3257 ;; "ashldi3 %0,%1,%2" 3258 ;; [(set_attr "length" "4")]) 3259 3260 ;; Arithmetic Shift Right 3261 ;; (define_insn "ashrdi3" 3262 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3263 ;; (ashiftrt:DI (match_operand:DI 1 "register_operand" "r") 3264 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3265 ;; "" 3266 ;; "ashrdi3 %0,%1,%2" 3267 ;; [(set_attr "length" "4")]) 3268 3269 ;; Logical Shift Right 3270 ;; (define_insn "lshrdi3" 3271 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3272 ;; (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") 3273 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3274 ;; "" 3275 ;; "lshrdi3 %0,%1,%2" 3276 ;; [(set_attr "length" "4")]) 3277 3278 ;; Rotate Left 3279 ;; (define_insn "rotldi3" 3280 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3281 ;; (rotate:DI (match_operand:DI 1 "register_operand" "r") 3282 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3283 ;; "" 3284 ;; "rotldi3 %0,%1,%2" 3285 ;; [(set_attr "length" "4")]) 3286 3287 ;; Rotate Right 3288 ;; (define_insn "rotrdi3" 3289 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3290 ;; (rotatert:DI (match_operand:DI 1 "register_operand" "r") 3291 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))] 3292 ;; "" 3293 ;; "rotrdi3 %0,%1,%2" 3294 ;; [(set_attr "length" "4")]) 3295 3296 3298 ;; :::::::::::::::::::: 3299 ;; :: 3300 ;; :: 32-Bit Integer Logical operations 3301 ;; :: 3302 ;; :::::::::::::::::::: 3303 3304 ;; Logical AND, 32-bit integers 3305 (define_insn "andsi3_media" 3306 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f") 3307 (and:SI (match_operand:SI 1 "gpr_or_fpr_operand" "%d,f") 3308 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "dNOP,f")))] 3309 "TARGET_MEDIA" 3310 "@ 3311 and%I2 %1, %2, %0 3312 mand %1, %2, %0" 3313 [(set_attr "length" "4") 3314 (set_attr "type" "int,mlogic")]) 3315 3316 (define_insn "andsi3_nomedia" 3317 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3318 (and:SI (match_operand:SI 1 "integer_register_operand" "%d") 3319 (match_operand:SI 2 "gpr_or_int12_operand" "dNOP")))] 3320 "!TARGET_MEDIA" 3321 "and%I2 %1, %2, %0" 3322 [(set_attr "length" "4") 3323 (set_attr "type" "int")]) 3324 3325 (define_expand "andsi3" 3326 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "") 3327 (and:SI (match_operand:SI 1 "gpr_or_fpr_operand" "") 3328 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "")))] 3329 "" 3330 "") 3331 3332 ;; Inclusive OR, 32-bit integers 3333 (define_insn "iorsi3_media" 3334 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f") 3335 (ior:SI (match_operand:SI 1 "gpr_or_fpr_operand" "%d,f") 3336 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "dNOP,f")))] 3337 "TARGET_MEDIA" 3338 "@ 3339 or%I2 %1, %2, %0 3340 mor %1, %2, %0" 3341 [(set_attr "length" "4") 3342 (set_attr "type" "int,mlogic")]) 3343 3344 (define_insn "iorsi3_nomedia" 3345 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3346 (ior:SI (match_operand:SI 1 "integer_register_operand" "%d") 3347 (match_operand:SI 2 "gpr_or_int12_operand" "dNOP")))] 3348 "!TARGET_MEDIA" 3349 "or%I2 %1, %2, %0" 3350 [(set_attr "length" "4") 3351 (set_attr "type" "int")]) 3352 3353 (define_expand "iorsi3" 3354 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "") 3355 (ior:SI (match_operand:SI 1 "gpr_or_fpr_operand" "") 3356 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "")))] 3357 "" 3358 "") 3359 3360 ;; Exclusive OR, 32-bit integers 3361 (define_insn "xorsi3_media" 3362 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f") 3363 (xor:SI (match_operand:SI 1 "gpr_or_fpr_operand" "%d,f") 3364 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "dNOP,f")))] 3365 "TARGET_MEDIA" 3366 "@ 3367 xor%I2 %1, %2, %0 3368 mxor %1, %2, %0" 3369 [(set_attr "length" "4") 3370 (set_attr "type" "int,mlogic")]) 3371 3372 (define_insn "xorsi3_nomedia" 3373 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3374 (xor:SI (match_operand:SI 1 "integer_register_operand" "%d") 3375 (match_operand:SI 2 "gpr_or_int12_operand" "dNOP")))] 3376 "!TARGET_MEDIA" 3377 "xor%I2 %1, %2, %0" 3378 [(set_attr "length" "4") 3379 (set_attr "type" "int")]) 3380 3381 (define_expand "xorsi3" 3382 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "") 3383 (xor:SI (match_operand:SI 1 "gpr_or_fpr_operand" "") 3384 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "")))] 3385 "" 3386 "") 3387 3388 ;; One's complement, 32-bit integers 3389 (define_insn "one_cmplsi2_media" 3390 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f") 3391 (not:SI (match_operand:SI 1 "gpr_or_fpr_operand" "d,f")))] 3392 "TARGET_MEDIA" 3393 "@ 3394 not %1, %0 3395 mnot %1, %0" 3396 [(set_attr "length" "4") 3397 (set_attr "type" "int,mlogic")]) 3398 3399 (define_insn "one_cmplsi2_nomedia" 3400 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3401 (not:SI (match_operand:SI 1 "integer_register_operand" "d")))] 3402 "!TARGET_MEDIA" 3403 "not %1,%0" 3404 [(set_attr "length" "4") 3405 (set_attr "type" "int")]) 3406 3407 (define_expand "one_cmplsi2" 3408 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "") 3409 (not:SI (match_operand:SI 1 "gpr_or_fpr_operand" "")))] 3410 "" 3411 "") 3412 3413 3415 ;; :::::::::::::::::::: 3416 ;; :: 3417 ;; :: 64-Bit Integer Logical operations 3418 ;; :: 3419 ;; :::::::::::::::::::: 3420 3421 ;; Logical AND, 64-bit integers 3422 ;; (define_insn "anddi3" 3423 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3424 ;; (and:DI (match_operand:DI 1 "register_operand" "%r") 3425 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))] 3426 ;; "" 3427 ;; "anddi3 %0,%1,%2" 3428 ;; [(set_attr "length" "4")]) 3429 3430 ;; Inclusive OR, 64-bit integers 3431 ;; (define_insn "iordi3" 3432 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3433 ;; (ior:DI (match_operand:DI 1 "register_operand" "%r") 3434 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))] 3435 ;; "" 3436 ;; "iordi3 %0,%1,%2" 3437 ;; [(set_attr "length" "4")]) 3438 3439 ;; Exclusive OR, 64-bit integers 3440 ;; (define_insn "xordi3" 3441 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3442 ;; (xor:DI (match_operand:DI 1 "register_operand" "%r") 3443 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))] 3444 ;; "" 3445 ;; "xordi3 %0,%1,%2" 3446 ;; [(set_attr "length" "4")]) 3447 3448 ;; One's complement, 64-bit integers 3449 ;; (define_insn "one_cmpldi2" 3450 ;; [(set (match_operand:DI 0 "register_operand" "=r") 3451 ;; (not:DI (match_operand:DI 1 "register_operand" "r")))] 3452 ;; "" 3453 ;; "notdi3 %0,%1" 3454 ;; [(set_attr "length" "4")]) 3455 3456 3458 ;; :::::::::::::::::::: 3459 ;; :: 3460 ;; :: Combination of integer operation with comparison 3461 ;; :: 3462 ;; :::::::::::::::::::: 3463 3464 (define_insn "*combo_intop_compare1" 3465 [(set (match_operand:CC_NZ 0 "icc_operand" "=t") 3466 (compare:CC_NZ 3467 (match_operator:SI 1 "intop_compare_operator" 3468 [(match_operand:SI 2 "integer_register_operand" "d") 3469 (match_operand:SI 3 "gpr_or_int10_operand" "dJ")]) 3470 (const_int 0)))] 3471 "" 3472 "%O1%I3cc %2, %3, %., %0" 3473 [(set_attr "type" "int") 3474 (set_attr "length" "4")]) 3475 3476 (define_insn "*combo_intop_compare2" 3477 [(set (match_operand:CC_NZ 0 "icc_operand" "=t") 3478 (compare:CC_NZ 3479 (match_operator:SI 1 "intop_compare_operator" 3480 [(match_operand:SI 2 "integer_register_operand" "d") 3481 (match_operand:SI 3 "gpr_or_int10_operand" "dJ")]) 3482 (const_int 0))) 3483 (set (match_operand:SI 4 "integer_register_operand" "=d") 3484 (match_operator:SI 5 "intop_compare_operator" 3485 [(match_dup 2) 3486 (match_dup 3)]))] 3487 "GET_CODE (operands[1]) == GET_CODE (operands[5])" 3488 "%O1%I3cc %2, %3, %4, %0" 3489 [(set_attr "type" "int") 3490 (set_attr "length" "4")]) 3491 3493 ;; :::::::::::::::::::: 3494 ;; :: 3495 ;; :: Comparisons 3496 ;; :: 3497 ;; :::::::::::::::::::: 3498 3499 ;; The comparisons are generated by the branch and/or scc operations 3500 3501 (define_insn "cmpsi_cc" 3502 [(set (match_operand:CC 0 "icc_operand" "=t,t") 3503 (compare:CC (match_operand:SI 1 "integer_register_operand" "d,d") 3504 (match_operand:SI 2 "gpr_or_int10_operand" "d,J")))] 3505 "" 3506 "cmp%I2 %1,%2,%0" 3507 [(set_attr "length" "4") 3508 (set_attr "type" "int")]) 3509 3510 (define_insn "*cmpsi_cc_uns" 3511 [(set (match_operand:CC_UNS 0 "icc_operand" "=t,t") 3512 (compare:CC_UNS (match_operand:SI 1 "integer_register_operand" "d,d") 3513 (match_operand:SI 2 "gpr_or_int10_operand" "d,J")))] 3514 "" 3515 "cmp%I2 %1,%2,%0" 3516 [(set_attr "length" "4") 3517 (set_attr "type" "int")]) 3518 3519 ;; The only requirement for a CC_NZmode GPR or memory value is that 3520 ;; comparing it against zero must set the Z and N flags appropriately. 3521 ;; The source operand is therefore a valid CC_NZmode value. 3522 (define_insn "*cmpsi_cc_nz" 3523 [(set (match_operand:CC_NZ 0 "nonimmediate_operand" "=t,d,m") 3524 (compare:CC_NZ (match_operand:SI 1 "integer_register_operand" "d,d,d") 3525 (const_int 0)))] 3526 "" 3527 "@ 3528 cmpi %1, #0, %0 3529 mov %1, %0 3530 st%I0%U0 %1, %M0" 3531 [(set_attr "length" "4,4,4") 3532 (set_attr "type" "int,int,gstore")]) 3533 3534 (define_insn "*cmpsf_cc_fp" 3535 [(set (match_operand:CC_FP 0 "fcc_operand" "=u") 3536 (compare:CC_FP (match_operand:SF 1 "fpr_operand" "f") 3537 (match_operand:SF 2 "fpr_operand" "f")))] 3538 "TARGET_HARD_FLOAT" 3539 "fcmps %1,%2,%0" 3540 [(set_attr "length" "4") 3541 (set_attr "type" "fscmp")]) 3542 3543 (define_insn "*cmpdf_cc_fp" 3544 [(set (match_operand:CC_FP 0 "fcc_operand" "=u") 3545 (compare:CC_FP (match_operand:DF 1 "even_fpr_operand" "h") 3546 (match_operand:DF 2 "even_fpr_operand" "h")))] 3547 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3548 "fcmpd %1,%2,%0" 3549 [(set_attr "length" "4") 3550 (set_attr "type" "fdcmp")]) 3551 3552 3554 ;; :::::::::::::::::::: 3555 ;; :: 3556 ;; :: Branches 3557 ;; :: 3558 ;; :::::::::::::::::::: 3559 3560 ;; Define_expands called by the machine independent part of the compiler 3561 ;; to allocate a new comparison register. 3562 3563 (define_expand "cbranchdf4" 3564 [(use (match_operator 0 "ordered_comparison_operator" 3565 [(match_operand:DF 1 "fpr_operand" "") 3566 (match_operand:DF 2 "fpr_operand" "")])) 3567 (use (match_operand 3 ""))] 3568 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3569 { if (frv_emit_cond_branch (operands)) DONE; gcc_unreachable (); }) 3570 3571 (define_expand "cbranchsf4" 3572 [(use (match_operator 0 "ordered_comparison_operator" 3573 [(match_operand:SF 1 "fpr_operand" "") 3574 (match_operand:SF 2 "fpr_operand" "")])) 3575 (use (match_operand 3 ""))] 3576 "TARGET_HARD_FLOAT" 3577 { if (frv_emit_cond_branch (operands)) DONE; gcc_unreachable (); }) 3578 3579 (define_expand "cbranchsi4" 3580 [(use (match_operator 0 "ordered_comparison_operator" 3581 [(match_operand:SI 1 "integer_register_operand" "") 3582 (match_operand:SI 2 "gpr_or_int10_operand" "")])) 3583 (use (match_operand 3 ""))] 3584 "" 3585 { if (frv_emit_cond_branch (operands)) DONE; gcc_unreachable (); }) 3586 3587 ;; Actual branches. We must allow for the (label_ref) and the (pc) to be 3588 ;; swapped. If they are swapped, it reverses the sense of the branch. 3589 ;; 3590 ;; Note - unlike the define expands above, these patterns can be amalgamated 3591 ;; into one pattern for branch-if-true and one for branch-if-false. This does 3592 ;; require an operand operator to select the correct branch mnemonic. 3593 ;; 3594 ;; If a fixed condition code register is being used, (as opposed to, say, 3595 ;; using cc0), then the expands could look like this: 3596 ;; 3597 ;; (define_insn "*branch_true" 3598 ;; [(set (pc) 3599 ;; (if_then_else (match_operator:CC 0 "comparison_operator" 3600 ;; [(reg:CC <number_of_CC_register>) 3601 ;; (const_int 0)]) 3602 ;; (label_ref (match_operand 1 "" "")) 3603 ;; (pc)))] 3604 ;; "" 3605 ;; "b%B0 %1" 3606 ;; [(set_attr "length" "4")] 3607 ;; ) 3608 ;; 3609 ;; In the above example the %B is a directive to frv_print_operand() 3610 ;; to decode and print the correct branch mnemonic. 3611 3612 (define_insn "*branch_int_true" 3613 [(set (pc) 3614 (if_then_else (match_operator 0 "integer_relational_operator" 3615 [(match_operand 1 "icc_operand" "t") 3616 (const_int 0)]) 3617 (label_ref (match_operand 2 "" "")) 3618 (pc)))] 3619 "" 3620 "* 3621 { 3622 if (get_attr_length (insn) == 4) 3623 return \"b%c0 %1,%#,%l2\"; 3624 else 3625 return \"b%C0 %1,%#,1f\;call %l2\\n1:\"; 3626 }" 3627 [(set (attr "length") 3628 (if_then_else 3629 (and (ge (minus (match_dup 2) (pc)) (const_int -32768)) 3630 (le (minus (match_dup 2) (pc)) (const_int 32764))) 3631 (const_int 4) 3632 (const_int 8))) 3633 (set (attr "far_jump") 3634 (if_then_else 3635 (eq_attr "length" "4") 3636 (const_string "no") 3637 (const_string "yes"))) 3638 (set (attr "type") 3639 (if_then_else 3640 (eq_attr "length" "4") 3641 (const_string "branch") 3642 (const_string "multi")))]) 3643 3644 (define_insn "*branch_int_false" 3645 [(set (pc) 3646 (if_then_else (match_operator 0 "integer_relational_operator" 3647 [(match_operand 1 "icc_operand" "t") 3648 (const_int 0)]) 3649 (pc) 3650 (label_ref (match_operand 2 "" ""))))] 3651 "" 3652 "* 3653 { 3654 if (get_attr_length (insn) == 4) 3655 return \"b%C0 %1,%#,%l2\"; 3656 else 3657 return \"b%c0 %1,%#,1f\;call %l2\\n1:\"; 3658 }" 3659 [(set (attr "length") 3660 (if_then_else 3661 (and (ge (minus (match_dup 2) (pc)) (const_int -32768)) 3662 (le (minus (match_dup 2) (pc)) (const_int 32764))) 3663 (const_int 4) 3664 (const_int 8))) 3665 (set (attr "far_jump") 3666 (if_then_else 3667 (eq_attr "length" "4") 3668 (const_string "no") 3669 (const_string "yes"))) 3670 (set (attr "type") 3671 (if_then_else 3672 (eq_attr "length" "4") 3673 (const_string "branch") 3674 (const_string "multi")))]) 3675 3676 (define_insn "*branch_fp_true" 3677 [(set (pc) 3678 (if_then_else (match_operator:CC_FP 0 "float_relational_operator" 3679 [(match_operand 1 "fcc_operand" "u") 3680 (const_int 0)]) 3681 (label_ref (match_operand 2 "" "")) 3682 (pc)))] 3683 "" 3684 "* 3685 { 3686 if (get_attr_length (insn) == 4) 3687 return \"fb%f0 %1,%#,%l2\"; 3688 else 3689 return \"fb%F0 %1,%#,1f\;call %l2\\n1:\"; 3690 }" 3691 [(set (attr "length") 3692 (if_then_else 3693 (and (ge (minus (match_dup 2) (pc)) (const_int -32768)) 3694 (le (minus (match_dup 2) (pc)) (const_int 32764))) 3695 (const_int 4) 3696 (const_int 8))) 3697 (set (attr "far_jump") 3698 (if_then_else 3699 (eq_attr "length" "4") 3700 (const_string "no") 3701 (const_string "yes"))) 3702 (set (attr "type") 3703 (if_then_else 3704 (eq_attr "length" "4") 3705 (const_string "branch") 3706 (const_string "multi")))]) 3707 3708 (define_insn "*branch_fp_false" 3709 [(set (pc) 3710 (if_then_else (match_operator:CC_FP 0 "float_relational_operator" 3711 [(match_operand 1 "fcc_operand" "u") 3712 (const_int 0)]) 3713 (pc) 3714 (label_ref (match_operand 2 "" ""))))] 3715 "" 3716 "* 3717 { 3718 if (get_attr_length (insn) == 4) 3719 return \"fb%F0 %1,%#,%l2\"; 3720 else 3721 return \"fb%f0 %1,%#,1f\;call %l2\\n1:\"; 3722 }" 3723 [(set (attr "length") 3724 (if_then_else 3725 (and (ge (minus (match_dup 2) (pc)) (const_int -32768)) 3726 (le (minus (match_dup 2) (pc)) (const_int 32764))) 3727 (const_int 4) 3728 (const_int 8))) 3729 (set (attr "far_jump") 3730 (if_then_else 3731 (eq_attr "length" "4") 3732 (const_string "no") 3733 (const_string "yes"))) 3734 (set (attr "type") 3735 (if_then_else 3736 (eq_attr "length" "4") 3737 (const_string "branch") 3738 (const_string "multi")))]) 3739 3740 3742 ;; :::::::::::::::::::: 3743 ;; :: 3744 ;; :: Set flag operations 3745 ;; :: 3746 ;; :::::::::::::::::::: 3747 3748 ;; Define_expands called by the machine independent part of the compiler 3749 ;; to allocate a new comparison register 3750 3751 (define_expand "cstoredf4" 3752 [(use (match_operator:SI 1 "ordered_comparison_operator" 3753 [(match_operand:DF 2 "fpr_operand") 3754 (match_operand:DF 3 "fpr_operand")])) 3755 (clobber (match_operand:SI 0 "register_operand"))] 3756 "TARGET_HARD_FLOAT && TARGET_DOUBLE" 3757 { if (frv_emit_scc (operands)) DONE; else FAIL; }) 3758 3759 (define_expand "cstoresf4" 3760 [(use (match_operator:SI 1 "ordered_comparison_operator" 3761 [(match_operand:SF 2 "fpr_operand") 3762 (match_operand:SF 3 "fpr_operand")])) 3763 (clobber (match_operand:SI 0 "register_operand"))] 3764 "TARGET_HARD_FLOAT" 3765 { if (frv_emit_scc (operands)) DONE; else FAIL; }) 3766 3767 (define_expand "cstoresi4" 3768 [(use (match_operator:SI 1 "ordered_comparison_operator" 3769 [(match_operand:SI 2 "integer_register_operand") 3770 (match_operand:SI 3 "gpr_or_int10_operand")])) 3771 (clobber (match_operand:SI 0 "register_operand"))] 3772 "" 3773 { if (frv_emit_scc (operands)) DONE; else FAIL; }) 3774 3775 (define_insn "*scc_int" 3776 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3777 (match_operator:SI 1 "integer_relational_operator" 3778 [(match_operand 2 "icc_operand" "t") 3779 (const_int 0)])) 3780 (clobber (match_operand:CC_CCR 3 "icr_operand" "=v"))] 3781 "" 3782 "#" 3783 [(set_attr "length" "12") 3784 (set_attr "type" "multi")]) 3785 3786 (define_insn "*scc_float" 3787 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3788 (match_operator:SI 1 "float_relational_operator" 3789 [(match_operand:CC_FP 2 "fcc_operand" "u") 3790 (const_int 0)])) 3791 (clobber (match_operand:CC_CCR 3 "fcr_operand" "=w"))] 3792 "" 3793 "#" 3794 [(set_attr "length" "12") 3795 (set_attr "type" "multi")]) 3796 3797 ;; XXX -- add reload_completed to the splits, because register allocation 3798 ;; currently isn't ready to see cond_exec packets. 3799 (define_split 3800 [(set (match_operand:SI 0 "integer_register_operand" "") 3801 (match_operator:SI 1 "relational_operator" 3802 [(match_operand 2 "cc_operand" "") 3803 (const_int 0)])) 3804 (clobber (match_operand 3 "cr_operand" ""))] 3805 "reload_completed" 3806 [(match_dup 4)] 3807 "operands[4] = frv_split_scc (operands[0], operands[1], operands[2], 3808 operands[3], (HOST_WIDE_INT) 1);") 3809 3810 (define_insn "*scc_neg1_int" 3811 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3812 (neg:SI (match_operator:SI 1 "integer_relational_operator" 3813 [(match_operand 2 "icc_operand" "t") 3814 (const_int 0)]))) 3815 (clobber (match_operand:CC_CCR 3 "icr_operand" "=v"))] 3816 "" 3817 "#" 3818 [(set_attr "length" "12") 3819 (set_attr "type" "multi")]) 3820 3821 (define_insn "*scc_neg1_float" 3822 [(set (match_operand:SI 0 "integer_register_operand" "=d") 3823 (neg:SI (match_operator:SI 1 "float_relational_operator" 3824 [(match_operand:CC_FP 2 "fcc_operand" "u") 3825 (const_int 0)]))) 3826 (clobber (match_operand:CC_CCR 3 "fcr_operand" "=w"))] 3827 "" 3828 "#" 3829 [(set_attr "length" "12") 3830 (set_attr "type" "multi")]) 3831 3832 (define_split 3833 [(set (match_operand:SI 0 "integer_register_operand" "") 3834 (neg:SI (match_operator:SI 1 "relational_operator" 3835 [(match_operand 2 "cc_operand" "") 3836 (const_int 0)]))) 3837 (clobber (match_operand 3 "cr_operand" ""))] 3838 "reload_completed" 3839 [(match_dup 4)] 3840 "operands[4] = frv_split_scc (operands[0], operands[1], operands[2], 3841 operands[3], (HOST_WIDE_INT) -1);") 3842 3843 3845 ;; :::::::::::::::::::: 3846 ;; :: 3847 ;; :: Conditionally executed instructions 3848 ;; :: 3849 ;; :::::::::::::::::::: 3850 3851 ;; Convert ICC/FCC comparison into CCR bits so we can do conditional execution 3852 (define_insn "*ck_signed" 3853 [(set (match_operand:CC_CCR 0 "icr_operand" "=v") 3854 (match_operator:CC_CCR 1 "integer_relational_operator" 3855 [(match_operand 2 "icc_operand" "t") 3856 (const_int 0)]))] 3857 "" 3858 "ck%c1 %2, %0" 3859 [(set_attr "length" "4") 3860 (set_attr "type" "ccr")]) 3861 3862 (define_insn "*fck_float" 3863 [(set (match_operand:CC_CCR 0 "fcr_operand" "=w") 3864 (match_operator:CC_CCR 1 "float_relational_operator" 3865 [(match_operand:CC_FP 2 "fcc_operand" "u") 3866 (const_int 0)]))] 3867 "TARGET_HAS_FPRS" 3868 "fck%c1 %2, %0" 3869 [(set_attr "length" "4") 3870 (set_attr "type" "ccr")]) 3871 3872 ;; Conditionally convert ICC/FCC comparison into CCR bits to provide && and || 3873 ;; tests in conditional execution 3874 (define_insn "cond_exec_ck" 3875 [(set (match_operand:CC_CCR 0 "cr_operand" "=v,w") 3876 (if_then_else:CC_CCR (match_operator 1 "ccr_eqne_operator" 3877 [(match_operand 2 "cr_operand" "C,C") 3878 (const_int 0)]) 3879 (match_operator 3 "relational_operator" 3880 [(match_operand 4 "cc_operand" "t,u") 3881 (const_int 0)]) 3882 (const_int 0)))] 3883 "" 3884 "@ 3885 cck%c3 %4, %0, %2, %e1 3886 cfck%f3 %4, %0, %2, %e1" 3887 [(set_attr "length" "4") 3888 (set_attr "type" "ccr")]) 3889 3890 ;; Conditionally set a register to either 0 or another register 3891 (define_insn "*cond_exec_movqi" 3892 [(cond_exec 3893 (match_operator 0 "ccr_eqne_operator" 3894 [(match_operand 1 "cr_operand" "C,C,C,C,C,C") 3895 (const_int 0)]) 3896 (set (match_operand:QI 2 "condexec_dest_operand" "=d,d,U,?f,?f,?d") 3897 (match_operand:QI 3 "condexec_source_operand" "dO,U,dO,f,d,f")))] 3898 "register_operand(operands[2], QImode) || reg_or_0_operand (operands[3], QImode)" 3899 "* return output_condmove_single (operands, insn);" 3900 [(set_attr "length" "4") 3901 (set_attr "type" "int,gload,gstore,fsconv,movgf,movfg")]) 3902 3903 (define_insn "*cond_exec_movhi" 3904 [(cond_exec 3905 (match_operator 0 "ccr_eqne_operator" 3906 [(match_operand 1 "cr_operand" "C,C,C,C,C,C") 3907 (const_int 0)]) 3908 (set (match_operand:HI 2 "condexec_dest_operand" "=d,d,U,?f,?f,?d") 3909 (match_operand:HI 3 "condexec_source_operand" "dO,U,dO,f,d,f")))] 3910 "register_operand(operands[2], HImode) || reg_or_0_operand (operands[3], HImode)" 3911 "* return output_condmove_single (operands, insn);" 3912 [(set_attr "length" "4") 3913 (set_attr "type" "int,gload,gstore,fsconv,movgf,movfg")]) 3914 3915 (define_insn "*cond_exec_movsi" 3916 [(cond_exec 3917 (match_operator 0 "ccr_eqne_operator" 3918 [(match_operand 1 "cr_operand" "C,C,C,C,C,C,C,C") 3919 (const_int 0)]) 3920 (set (match_operand:SI 2 "condexec_dest_operand" "=d,d,U,?f,?f,?d,?f,?m") 3921 (match_operand:SI 3 "condexec_source_operand" "dO,U,dO,f,d,f,m,f")))] 3922 "register_operand(operands[2], SImode) || reg_or_0_operand (operands[3], SImode)" 3923 "* return output_condmove_single (operands, insn);" 3924 [(set_attr "length" "4") 3925 (set_attr "type" "int,gload,gstore,fsconv,movgf,movfg,fload,fstore")]) 3926 3927 3928 (define_insn "*cond_exec_movsf_has_fprs" 3929 [(cond_exec 3930 (match_operator 0 "ccr_eqne_operator" 3931 [(match_operand 1 "cr_operand" "C,C,C,C,C,C,C,C,C,C") 3932 (const_int 0)]) 3933 (set (match_operand:SF 2 "condexec_dest_operand" "=f,?d,?d,?f,f,f,?d,U,?U,U") 3934 (match_operand:SF 3 "condexec_source_operand" "f,d,f,d,G,U,U,f,d,G")))] 3935 "TARGET_HAS_FPRS" 3936 "* return output_condmove_single (operands, insn);" 3937 [(set_attr "length" "4") 3938 (set_attr "type" "fsconv,int,movgf,movfg,movgf,fload,gload,fstore,gstore,gstore")]) 3939 3940 (define_insn "*cond_exec_movsf_no_fprs" 3941 [(cond_exec 3942 (match_operator 0 "ccr_eqne_operator" 3943 [(match_operand 1 "cr_operand" "C,C,C") 3944 (const_int 0)]) 3945 (set (match_operand:SF 2 "condexec_dest_operand" "=d,d,U") 3946 (match_operand:SF 3 "condexec_source_operand" "d,U,dG")))] 3947 "! TARGET_HAS_FPRS" 3948 "* return output_condmove_single (operands, insn);" 3949 [(set_attr "length" "4") 3950 (set_attr "type" "int,gload,gstore")]) 3951 3952 (define_insn "*cond_exec_si_binary1" 3953 [(cond_exec 3954 (match_operator 0 "ccr_eqne_operator" 3955 [(match_operand 1 "cr_operand" "C") 3956 (const_int 0)]) 3957 (set (match_operand:SI 2 "integer_register_operand" "=d") 3958 (match_operator:SI 3 "condexec_si_binary_operator" 3959 [(match_operand:SI 4 "integer_register_operand" "d") 3960 (match_operand:SI 5 "integer_register_operand" "d")])))] 3961 "" 3962 "* 3963 { 3964 switch (GET_CODE (operands[3])) 3965 { 3966 case PLUS: return \"cadd %4, %z5, %2, %1, %e0\"; 3967 case MINUS: return \"csub %4, %z5, %2, %1, %e0\"; 3968 case AND: return \"cand %4, %z5, %2, %1, %e0\"; 3969 case IOR: return \"cor %4, %z5, %2, %1, %e0\"; 3970 case XOR: return \"cxor %4, %z5, %2, %1, %e0\"; 3971 case ASHIFT: return \"csll %4, %z5, %2, %1, %e0\"; 3972 case ASHIFTRT: return \"csra %4, %z5, %2, %1, %e0\"; 3973 case LSHIFTRT: return \"csrl %4, %z5, %2, %1, %e0\"; 3974 default: gcc_unreachable (); 3975 } 3976 }" 3977 [(set_attr "length" "4") 3978 (set_attr "type" "int")]) 3979 3980 (define_insn "*cond_exec_si_binary2" 3981 [(cond_exec 3982 (match_operator 0 "ccr_eqne_operator" 3983 [(match_operand 1 "cr_operand" "C") 3984 (const_int 0)]) 3985 (set (match_operand:SI 2 "fpr_operand" "=f") 3986 (match_operator:SI 3 "condexec_si_media_operator" 3987 [(match_operand:SI 4 "fpr_operand" "f") 3988 (match_operand:SI 5 "fpr_operand" "f")])))] 3989 "TARGET_MEDIA" 3990 "* 3991 { 3992 switch (GET_CODE (operands[3])) 3993 { 3994 case AND: return \"cmand %4, %5, %2, %1, %e0\"; 3995 case IOR: return \"cmor %4, %5, %2, %1, %e0\"; 3996 case XOR: return \"cmxor %4, %5, %2, %1, %e0\"; 3997 default: gcc_unreachable (); 3998 } 3999 }" 4000 [(set_attr "length" "4") 4001 (set_attr "type" "mlogic")]) 4002 4003 ;; Note, flow does not (currently) know how to handle an operation that uses 4004 ;; only part of the hard registers allocated for a multiregister value, such as 4005 ;; DImode in this case if the user is only interested in the lower 32-bits. So 4006 ;; we emit a USE of the entire register after the csmul instruction so it won't 4007 ;; get confused. See frv_ifcvt_modify_insn for more details. 4008 4009 (define_insn "*cond_exec_si_smul" 4010 [(cond_exec 4011 (match_operator 0 "ccr_eqne_operator" 4012 [(match_operand 1 "cr_operand" "C") 4013 (const_int 0)]) 4014 (set (match_operand:DI 2 "even_gpr_operand" "=e") 4015 (mult:DI (sign_extend:DI (match_operand:SI 3 "integer_register_operand" "%d")) 4016 (sign_extend:DI (match_operand:SI 4 "integer_register_operand" "d")))))] 4017 "" 4018 "csmul %3, %4, %2, %1, %e0" 4019 [(set_attr "length" "4") 4020 (set_attr "type" "mul")]) 4021 4022 (define_insn "*cond_exec_si_divide" 4023 [(cond_exec 4024 (match_operator 0 "ccr_eqne_operator" 4025 [(match_operand 1 "cr_operand" "C") 4026 (const_int 0)]) 4027 (set (match_operand:SI 2 "integer_register_operand" "=d") 4028 (match_operator:SI 3 "condexec_si_divide_operator" 4029 [(match_operand:SI 4 "integer_register_operand" "d") 4030 (match_operand:SI 5 "integer_register_operand" "d")])))] 4031 "" 4032 "* 4033 { 4034 switch (GET_CODE (operands[3])) 4035 { 4036 case DIV: return \"csdiv %4, %z5, %2, %1, %e0\"; 4037 case UDIV: return \"cudiv %4, %z5, %2, %1, %e0\"; 4038 default: gcc_unreachable (); 4039 } 4040 }" 4041 [(set_attr "length" "4") 4042 (set_attr "type" "div")]) 4043 4044 (define_insn "*cond_exec_si_unary1" 4045 [(cond_exec 4046 (match_operator 0 "ccr_eqne_operator" 4047 [(match_operand 1 "cr_operand" "C") 4048 (const_int 0)]) 4049 (set (match_operand:SI 2 "integer_register_operand" "=d") 4050 (match_operator:SI 3 "condexec_si_unary_operator" 4051 [(match_operand:SI 4 "integer_register_operand" "d")])))] 4052 "" 4053 "* 4054 { 4055 switch (GET_CODE (operands[3])) 4056 { 4057 case NOT: return \"cnot %4, %2, %1, %e0\"; 4058 case NEG: return \"csub %., %4, %2, %1, %e0\"; 4059 default: gcc_unreachable (); 4060 } 4061 }" 4062 [(set_attr "length" "4") 4063 (set_attr "type" "int")]) 4064 4065 (define_insn "*cond_exec_si_unary2" 4066 [(cond_exec 4067 (match_operator 0 "ccr_eqne_operator" 4068 [(match_operand 1 "cr_operand" "C") 4069 (const_int 0)]) 4070 (set (match_operand:SI 2 "fpr_operand" "=f") 4071 (not:SI (match_operand:SI 3 "fpr_operand" "f"))))] 4072 "TARGET_MEDIA" 4073 "cmnot %3, %2, %1, %e0" 4074 [(set_attr "length" "4") 4075 (set_attr "type" "mlogic")]) 4076 4077 (define_insn "*cond_exec_cmpsi_cc" 4078 [(cond_exec 4079 (match_operator 0 "ccr_eqne_operator" 4080 [(match_operand 1 "cr_operand" "C") 4081 (const_int 0)]) 4082 (set (match_operand:CC 2 "icc_operand" "=t") 4083 (compare:CC (match_operand:SI 3 "integer_register_operand" "d") 4084 (match_operand:SI 4 "reg_or_0_operand" "dO"))))] 4085 "reload_completed 4086 && REGNO (operands[1]) == REGNO (operands[2]) - ICC_FIRST + ICR_FIRST" 4087 "ccmp %3, %z4, %1, %e0" 4088 [(set_attr "length" "4") 4089 (set_attr "type" "int")]) 4090 4091 (define_insn "*cond_exec_cmpsi_cc_uns" 4092 [(cond_exec 4093 (match_operator 0 "ccr_eqne_operator" 4094 [(match_operand 1 "cr_operand" "C") 4095 (const_int 0)]) 4096 (set (match_operand:CC_UNS 2 "icc_operand" "=t") 4097 (compare:CC_UNS (match_operand:SI 3 "integer_register_operand" "d") 4098 (match_operand:SI 4 "reg_or_0_operand" "dO"))))] 4099 "reload_completed 4100 && REGNO (operands[1]) == REGNO (operands[2]) - ICC_FIRST + ICR_FIRST" 4101 "ccmp %3, %z4, %1, %e0" 4102 [(set_attr "length" "4") 4103 (set_attr "type" "int")]) 4104 4105 (define_insn "*cond_exec_cmpsi_cc_nz" 4106 [(cond_exec 4107 (match_operator 0 "ccr_eqne_operator" 4108 [(match_operand 1 "cr_operand" "C") 4109 (const_int 0)]) 4110 (set (match_operand:CC_NZ 2 "icc_operand" "=t") 4111 (compare:CC_NZ (match_operand:SI 3 "integer_register_operand" "d") 4112 (const_int 0))))] 4113 "reload_completed 4114 && REGNO (operands[1]) == REGNO (operands[2]) - ICC_FIRST + ICR_FIRST" 4115 "ccmp %3, %., %1, %e0" 4116 [(set_attr "length" "4") 4117 (set_attr "type" "int")]) 4118 4119 (define_insn "*cond_exec_sf_conv" 4120 [(cond_exec 4121 (match_operator 0 "ccr_eqne_operator" 4122 [(match_operand 1 "cr_operand" "C") 4123 (const_int 0)]) 4124 (set (match_operand:SF 2 "fpr_operand" "=f") 4125 (match_operator:SF 3 "condexec_sf_conv_operator" 4126 [(match_operand:SF 4 "fpr_operand" "f")])))] 4127 "TARGET_HARD_FLOAT" 4128 "* 4129 { 4130 switch (GET_CODE (operands[3])) 4131 { 4132 case ABS: return \"cfabss %4, %2, %1, %e0\"; 4133 case NEG: return \"cfnegs %4, %2, %1, %e0\"; 4134 default: gcc_unreachable (); 4135 } 4136 }" 4137 [(set_attr "length" "4") 4138 (set_attr "type" "fsconv")]) 4139 4140 (define_insn "*cond_exec_sf_add" 4141 [(cond_exec 4142 (match_operator 0 "ccr_eqne_operator" 4143 [(match_operand 1 "cr_operand" "C") 4144 (const_int 0)]) 4145 (set (match_operand:SF 2 "fpr_operand" "=f") 4146 (match_operator:SF 3 "condexec_sf_add_operator" 4147 [(match_operand:SF 4 "fpr_operand" "f") 4148 (match_operand:SF 5 "fpr_operand" "f")])))] 4149 "TARGET_HARD_FLOAT" 4150 "* 4151 { 4152 switch (GET_CODE (operands[3])) 4153 { 4154 case PLUS: return \"cfadds %4, %5, %2, %1, %e0\"; 4155 case MINUS: return \"cfsubs %4, %5, %2, %1, %e0\"; 4156 default: gcc_unreachable (); 4157 } 4158 }" 4159 [(set_attr "length" "4") 4160 (set_attr "type" "fsadd")]) 4161 4162 (define_insn "*cond_exec_sf_mul" 4163 [(cond_exec 4164 (match_operator 0 "ccr_eqne_operator" 4165 [(match_operand 1 "cr_operand" "C") 4166 (const_int 0)]) 4167 (set (match_operand:SF 2 "fpr_operand" "=f") 4168 (mult:SF (match_operand:SF 3 "fpr_operand" "f") 4169 (match_operand:SF 4 "fpr_operand" "f"))))] 4170 "TARGET_HARD_FLOAT" 4171 "cfmuls %3, %4, %2, %1, %e0" 4172 [(set_attr "length" "4") 4173 (set_attr "type" "fsmul")]) 4174 4175 (define_insn "*cond_exec_sf_div" 4176 [(cond_exec 4177 (match_operator 0 "ccr_eqne_operator" 4178 [(match_operand 1 "cr_operand" "C") 4179 (const_int 0)]) 4180 (set (match_operand:SF 2 "fpr_operand" "=f") 4181 (div:SF (match_operand:SF 3 "fpr_operand" "f") 4182 (match_operand:SF 4 "fpr_operand" "f"))))] 4183 "TARGET_HARD_FLOAT" 4184 "cfdivs %3, %4, %2, %1, %e0" 4185 [(set_attr "length" "4") 4186 (set_attr "type" "fsdiv")]) 4187 4188 (define_insn "*cond_exec_sf_sqrt" 4189 [(cond_exec 4190 (match_operator 0 "ccr_eqne_operator" 4191 [(match_operand 1 "cr_operand" "C") 4192 (const_int 0)]) 4193 (set (match_operand:SF 2 "fpr_operand" "=f") 4194 (sqrt:SF (match_operand:SF 3 "fpr_operand" "f"))))] 4195 "TARGET_HARD_FLOAT" 4196 "cfsqrts %3, %2, %1, %e0" 4197 [(set_attr "length" "4") 4198 (set_attr "type" "fsdiv")]) 4199 4200 (define_insn "*cond_exec_cmpsi_cc_fp" 4201 [(cond_exec 4202 (match_operator 0 "ccr_eqne_operator" 4203 [(match_operand 1 "cr_operand" "C") 4204 (const_int 0)]) 4205 (set (match_operand:CC_FP 2 "fcc_operand" "=u") 4206 (compare:CC_FP (match_operand:SF 3 "fpr_operand" "f") 4207 (match_operand:SF 4 "fpr_operand" "f"))))] 4208 "reload_completed && TARGET_HARD_FLOAT 4209 && REGNO (operands[1]) == REGNO (operands[2]) - FCC_FIRST + FCR_FIRST" 4210 "cfcmps %3, %4, %2, %1, %e0" 4211 [(set_attr "length" "4") 4212 (set_attr "type" "fsconv")]) 4213 4214 4216 ;; :::::::::::::::::::: 4217 ;; :: 4218 ;; :: Logical operations on CR registers 4219 ;; :: 4220 ;; :::::::::::::::::::: 4221 4222 ;; We use UNSPEC to encode andcr/iorcr/etc. rather than the normal RTL 4223 ;; operations, since the RTL operations only have an idea of TRUE and FALSE, 4224 ;; while the CRs have TRUE, FALSE, and UNDEFINED. 4225 4226 (define_expand "andcr" 4227 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4228 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4229 (match_operand:CC_CCR 2 "cr_operand" "") 4230 (const_int 0)] UNSPEC_CR_LOGIC))] 4231 "" 4232 "") 4233 4234 (define_expand "orcr" 4235 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4236 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4237 (match_operand:CC_CCR 2 "cr_operand" "") 4238 (const_int 1)] UNSPEC_CR_LOGIC))] 4239 "" 4240 "") 4241 4242 (define_expand "xorcr" 4243 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4244 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4245 (match_operand:CC_CCR 2 "cr_operand" "") 4246 (const_int 2)] UNSPEC_CR_LOGIC))] 4247 "" 4248 "") 4249 4250 (define_expand "nandcr" 4251 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4252 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4253 (match_operand:CC_CCR 2 "cr_operand" "") 4254 (const_int 3)] UNSPEC_CR_LOGIC))] 4255 "" 4256 "") 4257 4258 (define_expand "norcr" 4259 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4260 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4261 (match_operand:CC_CCR 2 "cr_operand" "") 4262 (const_int 4)] UNSPEC_CR_LOGIC))] 4263 "" 4264 "") 4265 4266 (define_expand "andncr" 4267 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4268 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4269 (match_operand:CC_CCR 2 "cr_operand" "") 4270 (const_int 5)] UNSPEC_CR_LOGIC))] 4271 "" 4272 "") 4273 4274 (define_expand "orncr" 4275 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4276 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4277 (match_operand:CC_CCR 2 "cr_operand" "") 4278 (const_int 6)] UNSPEC_CR_LOGIC))] 4279 "" 4280 "") 4281 4282 (define_expand "nandncr" 4283 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4284 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4285 (match_operand:CC_CCR 2 "cr_operand" "") 4286 (const_int 7)] UNSPEC_CR_LOGIC))] 4287 "" 4288 "") 4289 4290 (define_expand "norncr" 4291 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4292 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4293 (match_operand:CC_CCR 2 "cr_operand" "") 4294 (const_int 8)] UNSPEC_CR_LOGIC))] 4295 "" 4296 "") 4297 4298 (define_expand "notcr" 4299 [(set (match_operand:CC_CCR 0 "cr_operand" "") 4300 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "") 4301 (match_dup 1) 4302 (const_int 9)] UNSPEC_CR_LOGIC))] 4303 "" 4304 "") 4305 4306 (define_insn "*logical_cr" 4307 [(set (match_operand:CC_CCR 0 "cr_operand" "=C") 4308 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "C") 4309 (match_operand:CC_CCR 2 "cr_operand" "C") 4310 (match_operand:SI 3 "const_int_operand" "n")] 4311 UNSPEC_CR_LOGIC))] 4312 "" 4313 "* 4314 { 4315 switch (INTVAL (operands[3])) 4316 { 4317 default: break; 4318 case 0: return \"andcr %1, %2, %0\"; 4319 case 1: return \"orcr %1, %2, %0\"; 4320 case 2: return \"xorcr %1, %2, %0\"; 4321 case 3: return \"nandcr %1, %2, %0\"; 4322 case 4: return \"norcr %1, %2, %0\"; 4323 case 5: return \"andncr %1, %2, %0\"; 4324 case 6: return \"orncr %1, %2, %0\"; 4325 case 7: return \"nandncr %1, %2, %0\"; 4326 case 8: return \"norncr %1, %2, %0\"; 4327 case 9: return \"notcr %1, %0\"; 4328 } 4329 4330 fatal_insn (\"logical_cr\", insn); 4331 }" 4332 [(set_attr "length" "4") 4333 (set_attr "type" "ccr")]) 4334 4335 4337 ;; :::::::::::::::::::: 4338 ;; :: 4339 ;; :: Conditional move instructions 4340 ;; :: 4341 ;; :::::::::::::::::::: 4342 4343 4344 ;; - conditional moves based on floating-point comparisons require 4345 ;; TARGET_HARD_FLOAT, because an FPU is required to do the comparison. 4346 4347 ;; - conditional moves between FPRs based on integer comparisons 4348 ;; require TARGET_HAS_FPRS. 4349 4350 (define_expand "movqicc" 4351 [(set (match_operand:QI 0 "integer_register_operand" "") 4352 (if_then_else:QI (match_operand 1 "" "") 4353 (match_operand:QI 2 "gpr_or_int_operand" "") 4354 (match_operand:QI 3 "gpr_or_int_operand" "")))] 4355 "TARGET_COND_MOVE" 4356 " 4357 { 4358 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3])) 4359 FAIL; 4360 4361 DONE; 4362 }") 4363 4364 (define_insn "*movqicc_internal1_int" 4365 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d") 4366 (if_then_else:QI (match_operator 1 "integer_relational_operator" 4367 [(match_operand 2 "icc_operand" "t,t,t") 4368 (const_int 0)]) 4369 (match_operand:QI 3 "reg_or_0_operand" "0,dO,dO") 4370 (match_operand:QI 4 "reg_or_0_operand" "dO,0,dO"))) 4371 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))] 4372 "" 4373 "#" 4374 [(set_attr "length" "8,8,12") 4375 (set_attr "type" "multi")]) 4376 4377 (define_insn "*movqicc_internal1_float" 4378 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d") 4379 (if_then_else:QI (match_operator:CC_FP 1 "float_relational_operator" 4380 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u") 4381 (const_int 0)]) 4382 (match_operand:QI 3 "reg_or_0_operand" "0,dO,dO") 4383 (match_operand:QI 4 "reg_or_0_operand" "dO,0,dO"))) 4384 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))] 4385 "TARGET_HARD_FLOAT" 4386 "#" 4387 [(set_attr "length" "8,8,12") 4388 (set_attr "type" "multi")]) 4389 4390 (define_insn "*movqicc_internal2_int" 4391 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d,d,d") 4392 (if_then_else:QI (match_operator 1 "integer_relational_operator" 4393 [(match_operand 2 "icc_operand" "t,t,t,t,t") 4394 (const_int 0)]) 4395 (match_operand:QI 3 "const_int_operand" "O,O,L,n,n") 4396 (match_operand:QI 4 "const_int_operand" "L,n,O,O,n"))) 4397 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v"))] 4398 "(INTVAL (operands[3]) == 0 4399 || INTVAL (operands[4]) == 0 4400 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047) 4401 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))" 4402 "#" 4403 [(set_attr "length" "8,12,8,12,12") 4404 (set_attr "type" "multi")]) 4405 4406 (define_insn "*movqicc_internal2_float" 4407 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d,d,d") 4408 (if_then_else:QI (match_operator:CC_FP 1 "float_relational_operator" 4409 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u") 4410 (const_int 0)]) 4411 (match_operand:QI 3 "const_int_operand" "O,O,L,n,n") 4412 (match_operand:QI 4 "const_int_operand" "L,n,O,O,n"))) 4413 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w"))] 4414 "TARGET_HARD_FLOAT 4415 && (INTVAL (operands[3]) == 0 4416 || INTVAL (operands[4]) == 0 4417 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047) 4418 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))" 4419 "#" 4420 [(set_attr "length" "8,12,8,12,12") 4421 (set_attr "type" "multi")]) 4422 4423 (define_split 4424 [(set (match_operand:QI 0 "integer_register_operand" "") 4425 (if_then_else:QI (match_operator 1 "relational_operator" 4426 [(match_operand 2 "cc_operand" "") 4427 (const_int 0)]) 4428 (match_operand:QI 3 "gpr_or_int_operand" "") 4429 (match_operand:QI 4 "gpr_or_int_operand" ""))) 4430 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))] 4431 "reload_completed" 4432 [(match_dup 6)] 4433 "operands[6] = frv_split_cond_move (operands);") 4434 4435 (define_expand "movhicc" 4436 [(set (match_operand:HI 0 "integer_register_operand" "") 4437 (if_then_else:HI (match_operand 1 "" "") 4438 (match_operand:HI 2 "gpr_or_int_operand" "") 4439 (match_operand:HI 3 "gpr_or_int_operand" "")))] 4440 "TARGET_COND_MOVE" 4441 " 4442 { 4443 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3])) 4444 FAIL; 4445 4446 DONE; 4447 }") 4448 4449 (define_insn "*movhicc_internal1_int" 4450 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d") 4451 (if_then_else:HI (match_operator 1 "integer_relational_operator" 4452 [(match_operand 2 "icc_operand" "t,t,t") 4453 (const_int 0)]) 4454 (match_operand:HI 3 "reg_or_0_operand" "0,dO,dO") 4455 (match_operand:HI 4 "reg_or_0_operand" "dO,0,dO"))) 4456 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))] 4457 "" 4458 "#" 4459 [(set_attr "length" "8,8,12") 4460 (set_attr "type" "multi")]) 4461 4462 (define_insn "*movhicc_internal1_float" 4463 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d") 4464 (if_then_else:HI (match_operator:CC_FP 1 "float_relational_operator" 4465 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u") 4466 (const_int 0)]) 4467 (match_operand:HI 3 "reg_or_0_operand" "0,dO,dO") 4468 (match_operand:HI 4 "reg_or_0_operand" "dO,0,dO"))) 4469 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))] 4470 "TARGET_HARD_FLOAT" 4471 "#" 4472 [(set_attr "length" "8,8,12") 4473 (set_attr "type" "multi")]) 4474 4475 (define_insn "*movhicc_internal2_int" 4476 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d,d,d") 4477 (if_then_else:HI (match_operator 1 "integer_relational_operator" 4478 [(match_operand 2 "icc_operand" "t,t,t,t,t") 4479 (const_int 0)]) 4480 (match_operand:HI 3 "const_int_operand" "O,O,L,n,n") 4481 (match_operand:HI 4 "const_int_operand" "L,n,O,O,n"))) 4482 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v"))] 4483 "(INTVAL (operands[3]) == 0 4484 || INTVAL (operands[4]) == 0 4485 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047) 4486 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))" 4487 "#" 4488 [(set_attr "length" "8,12,8,12,12") 4489 (set_attr "type" "multi")]) 4490 4491 (define_insn "*movhicc_internal2_float" 4492 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d,d,d") 4493 (if_then_else:HI (match_operator:CC_FP 1 "float_relational_operator" 4494 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u") 4495 (const_int 0)]) 4496 (match_operand:HI 3 "const_int_operand" "O,O,L,n,n") 4497 (match_operand:HI 4 "const_int_operand" "L,n,O,O,n"))) 4498 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w"))] 4499 "TARGET_HARD_FLOAT 4500 && (INTVAL (operands[3]) == 0 4501 || INTVAL (operands[4]) == 0 4502 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047) 4503 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))" 4504 "#" 4505 [(set_attr "length" "8,12,8,12,12") 4506 (set_attr "type" "multi")]) 4507 4508 (define_split 4509 [(set (match_operand:HI 0 "integer_register_operand" "") 4510 (if_then_else:HI (match_operator 1 "relational_operator" 4511 [(match_operand 2 "cc_operand" "") 4512 (const_int 0)]) 4513 (match_operand:HI 3 "gpr_or_int_operand" "") 4514 (match_operand:HI 4 "gpr_or_int_operand" ""))) 4515 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))] 4516 "reload_completed" 4517 [(match_dup 6)] 4518 "operands[6] = frv_split_cond_move (operands);") 4519 4520 (define_expand "movsicc" 4521 [(set (match_operand:SI 0 "integer_register_operand" "") 4522 (if_then_else:SI (match_operand 1 "" "") 4523 (match_operand:SI 2 "gpr_or_int_operand" "") 4524 (match_operand:SI 3 "gpr_or_int_operand" "")))] 4525 "TARGET_COND_MOVE" 4526 " 4527 { 4528 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3])) 4529 FAIL; 4530 4531 DONE; 4532 }") 4533 4534 (define_insn "*movsicc_internal1_int" 4535 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d") 4536 (if_then_else:SI (match_operator 1 "integer_relational_operator" 4537 [(match_operand 2 "icc_operand" "t,t,t") 4538 (const_int 0)]) 4539 (match_operand:SI 3 "reg_or_0_operand" "0,dO,dO") 4540 (match_operand:SI 4 "reg_or_0_operand" "dO,0,dO"))) 4541 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))] 4542 "" 4543 "#" 4544 [(set_attr "length" "8,8,12") 4545 (set_attr "type" "multi")]) 4546 4547 (define_insn "*movsicc_internal1_float" 4548 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d") 4549 (if_then_else:SI (match_operator:CC_FP 1 "float_relational_operator" 4550 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u") 4551 (const_int 0)]) 4552 (match_operand:SI 3 "reg_or_0_operand" "0,dO,dO") 4553 (match_operand:SI 4 "reg_or_0_operand" "dO,0,dO"))) 4554 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))] 4555 "TARGET_HARD_FLOAT" 4556 "#" 4557 [(set_attr "length" "8,8,12") 4558 (set_attr "type" "multi")]) 4559 4560 (define_insn "*movsicc_internal2_int" 4561 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d,d,d") 4562 (if_then_else:SI (match_operator 1 "integer_relational_operator" 4563 [(match_operand 2 "icc_operand" "t,t,t,t,t") 4564 (const_int 0)]) 4565 (match_operand:SI 3 "const_int_operand" "O,O,L,n,n") 4566 (match_operand:SI 4 "const_int_operand" "L,n,O,O,n"))) 4567 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v"))] 4568 "(INTVAL (operands[3]) == 0 4569 || INTVAL (operands[4]) == 0 4570 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047) 4571 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))" 4572 "#" 4573 [(set_attr "length" "8,12,8,12,12") 4574 (set_attr "type" "multi")]) 4575 4576 (define_insn "*movsicc_internal2_float" 4577 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d,d,d") 4578 (if_then_else:SI (match_operator:CC_FP 1 "float_relational_operator" 4579 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u") 4580 (const_int 0)]) 4581 (match_operand:SI 3 "const_int_operand" "O,O,L,n,n") 4582 (match_operand:SI 4 "const_int_operand" "L,n,O,O,n"))) 4583 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w"))] 4584 "TARGET_HARD_FLOAT 4585 && (INTVAL (operands[3]) == 0 4586 || INTVAL (operands[4]) == 0 4587 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047) 4588 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))" 4589 "#" 4590 [(set_attr "length" "8,12,8,12,12") 4591 (set_attr "type" "multi")]) 4592 4593 (define_split 4594 [(set (match_operand:SI 0 "integer_register_operand" "") 4595 (if_then_else:SI (match_operator 1 "relational_operator" 4596 [(match_operand 2 "cc_operand" "") 4597 (const_int 0)]) 4598 (match_operand:SI 3 "gpr_or_int_operand" "") 4599 (match_operand:SI 4 "gpr_or_int_operand" ""))) 4600 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))] 4601 "reload_completed" 4602 [(match_dup 6)] 4603 "operands[6] = frv_split_cond_move (operands);") 4604 4605 (define_expand "movsfcc" 4606 [(set (match_operand:SF 0 "register_operand" "") 4607 (if_then_else:SF (match_operand 1 "" "") 4608 (match_operand:SF 2 "register_operand" "") 4609 (match_operand:SF 3 "register_operand" "")))] 4610 "TARGET_COND_MOVE" 4611 " 4612 { 4613 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3])) 4614 FAIL; 4615 4616 DONE; 4617 }") 4618 4619 (define_insn "*movsfcc_has_fprs_int" 4620 [(set (match_operand:SF 0 "register_operand" "=f,f,f,?f,?f,?d") 4621 (if_then_else:SF (match_operator 1 "integer_relational_operator" 4622 [(match_operand 2 "icc_operand" "t,t,t,t,t,t") 4623 (const_int 0)]) 4624 (match_operand:SF 3 "register_operand" "0,f,f,f,d,fd") 4625 (match_operand:SF 4 "register_operand" "f,0,f,d,fd,fd"))) 4626 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v,v"))] 4627 "TARGET_HAS_FPRS" 4628 "#" 4629 [(set_attr "length" "8,8,12,12,12,12") 4630 (set_attr "type" "multi")]) 4631 4632 (define_insn "*movsfcc_hardfloat_float" 4633 [(set (match_operand:SF 0 "register_operand" "=f,f,f,?f,?f,?d") 4634 (if_then_else:SF (match_operator:CC_FP 1 "float_relational_operator" 4635 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u,u") 4636 (const_int 0)]) 4637 (match_operand:SF 3 "register_operand" "0,f,f,f,d,fd") 4638 (match_operand:SF 4 "register_operand" "f,0,f,d,fd,fd"))) 4639 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w,w"))] 4640 "TARGET_HARD_FLOAT" 4641 "#" 4642 [(set_attr "length" "8,8,12,12,12,12") 4643 (set_attr "type" "multi")]) 4644 4645 (define_insn "*movsfcc_no_fprs_int" 4646 [(set (match_operand:SF 0 "integer_register_operand" "=d,d,d") 4647 (if_then_else:SF (match_operator 1 "integer_relational_operator" 4648 [(match_operand 2 "icc_operand" "t,t,t") 4649 (const_int 0)]) 4650 (match_operand:SF 3 "integer_register_operand" "0,d,d") 4651 (match_operand:SF 4 "integer_register_operand" "d,0,d"))) 4652 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))] 4653 "! TARGET_HAS_FPRS" 4654 "#" 4655 [(set_attr "length" "8,8,12") 4656 (set_attr "type" "multi")]) 4657 4658 (define_split 4659 [(set (match_operand:SF 0 "register_operand" "") 4660 (if_then_else:SF (match_operator 1 "relational_operator" 4661 [(match_operand 2 "cc_operand" "") 4662 (const_int 0)]) 4663 (match_operand:SF 3 "register_operand" "") 4664 (match_operand:SF 4 "register_operand" ""))) 4665 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))] 4666 "reload_completed" 4667 [(match_dup 6)] 4668 "operands[6] = frv_split_cond_move (operands);") 4669 4670 4672 ;; :::::::::::::::::::: 4673 ;; :: 4674 ;; :: Minimum, maximum, and integer absolute value 4675 ;; :: 4676 ;; :::::::::::::::::::: 4677 4678 ;; These 'instructions' are provided to give the compiler a slightly better 4679 ;; nudge at register allocation, then it would if it constructed the 4680 ;; instructions from basic building blocks (since it indicates it prefers one 4681 ;; of the operands to be the same as the destination. It also helps the 4682 ;; earlier passes of the compiler, by not breaking things into small basic 4683 ;; blocks. 4684 4685 (define_expand "abssi2" 4686 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "") 4687 (abs:SI (match_operand:SI 1 "integer_register_operand" ""))) 4688 (clobber (match_dup 2)) 4689 (clobber (match_dup 3))])] 4690 "TARGET_COND_MOVE" 4691 " 4692 { 4693 operands[2] = gen_reg_rtx (CCmode); 4694 operands[3] = gen_reg_rtx (CC_CCRmode); 4695 }") 4696 4697 (define_insn_and_split "*abssi2_internal" 4698 [(set (match_operand:SI 0 "integer_register_operand" "=d,d") 4699 (abs:SI (match_operand:SI 1 "integer_register_operand" "0,d"))) 4700 (clobber (match_operand:CC 2 "icc_operand" "=t,t")) 4701 (clobber (match_operand:CC_CCR 3 "icr_operand" "=v,v"))] 4702 "TARGET_COND_MOVE" 4703 "#" 4704 "reload_completed" 4705 [(match_dup 4)] 4706 "operands[4] = frv_split_abs (operands);" 4707 [(set_attr "length" "12,16") 4708 (set_attr "type" "multi")]) 4709 4710 (define_expand "sminsi3" 4711 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "") 4712 (smin:SI (match_operand:SI 1 "integer_register_operand" "") 4713 (match_operand:SI 2 "gpr_or_int10_operand" ""))) 4714 (clobber (match_dup 3)) 4715 (clobber (match_dup 4))])] 4716 "TARGET_COND_MOVE" 4717 " 4718 { 4719 operands[3] = gen_reg_rtx (CCmode); 4720 operands[4] = gen_reg_rtx (CC_CCRmode); 4721 }") 4722 4723 (define_expand "smaxsi3" 4724 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "") 4725 (smax:SI (match_operand:SI 1 "integer_register_operand" "") 4726 (match_operand:SI 2 "gpr_or_int10_operand" ""))) 4727 (clobber (match_dup 3)) 4728 (clobber (match_dup 4))])] 4729 "TARGET_COND_MOVE" 4730 " 4731 { 4732 operands[3] = gen_reg_rtx (CCmode); 4733 operands[4] = gen_reg_rtx (CC_CCRmode); 4734 }") 4735 4736 (define_insn_and_split "*minmax_si_signed" 4737 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,&d") 4738 (match_operator:SI 1 "minmax_operator" 4739 [(match_operand:SI 2 "integer_register_operand" "%0,dO,d") 4740 (match_operand:SI 3 "gpr_or_int10_operand" "dO,0,dJ")])) 4741 (clobber (match_operand:CC 4 "icc_operand" "=t,t,t")) 4742 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))] 4743 "TARGET_COND_MOVE" 4744 "#" 4745 "reload_completed" 4746 [(match_dup 6)] 4747 "operands[6] = frv_split_minmax (operands);" 4748 [(set_attr "length" "12,12,16") 4749 (set_attr "type" "multi")]) 4750 4751 (define_expand "uminsi3" 4752 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "") 4753 (umin:SI (match_operand:SI 1 "integer_register_operand" "") 4754 (match_operand:SI 2 "gpr_or_int10_operand" ""))) 4755 (clobber (match_dup 3)) 4756 (clobber (match_dup 4))])] 4757 "TARGET_COND_MOVE" 4758 " 4759 { 4760 operands[3] = gen_reg_rtx (CC_UNSmode); 4761 operands[4] = gen_reg_rtx (CC_CCRmode); 4762 }") 4763 4764 (define_expand "umaxsi3" 4765 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "") 4766 (umax:SI (match_operand:SI 1 "integer_register_operand" "") 4767 (match_operand:SI 2 "gpr_or_int10_operand" ""))) 4768 (clobber (match_dup 3)) 4769 (clobber (match_dup 4))])] 4770 "TARGET_COND_MOVE" 4771 " 4772 { 4773 operands[3] = gen_reg_rtx (CC_UNSmode); 4774 operands[4] = gen_reg_rtx (CC_CCRmode); 4775 }") 4776 4777 (define_insn_and_split "*minmax_si_unsigned" 4778 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,&d") 4779 (match_operator:SI 1 "minmax_operator" 4780 [(match_operand:SI 2 "integer_register_operand" "%0,dO,d") 4781 (match_operand:SI 3 "gpr_or_int10_operand" "dO,0,dJ")])) 4782 (clobber (match_operand:CC_UNS 4 "icc_operand" "=t,t,t")) 4783 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))] 4784 "TARGET_COND_MOVE" 4785 "#" 4786 "reload_completed" 4787 [(match_dup 6)] 4788 "operands[6] = frv_split_minmax (operands);" 4789 [(set_attr "length" "12,12,16") 4790 (set_attr "type" "multi")]) 4791 4792 (define_expand "sminsf3" 4793 [(parallel [(set (match_operand:SF 0 "fpr_operand" "") 4794 (smin:SF (match_operand:SF 1 "fpr_operand" "") 4795 (match_operand:SF 2 "fpr_operand" ""))) 4796 (clobber (match_dup 3)) 4797 (clobber (match_dup 4))])] 4798 "TARGET_COND_MOVE && TARGET_HARD_FLOAT" 4799 " 4800 { 4801 operands[3] = gen_reg_rtx (CC_FPmode); 4802 operands[4] = gen_reg_rtx (CC_CCRmode); 4803 }") 4804 4805 (define_expand "smaxsf3" 4806 [(parallel [(set (match_operand:SF 0 "fpr_operand" "") 4807 (smax:SF (match_operand:SF 1 "fpr_operand" "") 4808 (match_operand:SF 2 "fpr_operand" ""))) 4809 (clobber (match_dup 3)) 4810 (clobber (match_dup 4))])] 4811 "TARGET_COND_MOVE && TARGET_HARD_FLOAT" 4812 " 4813 { 4814 operands[3] = gen_reg_rtx (CC_FPmode); 4815 operands[4] = gen_reg_rtx (CC_CCRmode); 4816 }") 4817 4818 (define_insn_and_split "*minmax_sf" 4819 [(set (match_operand:SF 0 "fpr_operand" "=f,f,f") 4820 (match_operator:SF 1 "minmax_operator" 4821 [(match_operand:SF 2 "fpr_operand" "%0,f,f") 4822 (match_operand:SF 3 "fpr_operand" "f,0,f")])) 4823 (clobber (match_operand:CC_FP 4 "fcc_operand" "=u,u,u")) 4824 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))] 4825 "TARGET_COND_MOVE && TARGET_HARD_FLOAT" 4826 "#" 4827 "reload_completed" 4828 [(match_dup 6)] 4829 "operands[6] = frv_split_minmax (operands);" 4830 [(set_attr "length" "12,12,16") 4831 (set_attr "type" "multi")]) 4832 4833 (define_expand "smindf3" 4834 [(parallel [(set (match_operand:DF 0 "fpr_operand" "") 4835 (smin:DF (match_operand:DF 1 "fpr_operand" "") 4836 (match_operand:DF 2 "fpr_operand" ""))) 4837 (clobber (match_dup 3)) 4838 (clobber (match_dup 4))])] 4839 "TARGET_COND_MOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE" 4840 " 4841 { 4842 operands[3] = gen_reg_rtx (CC_FPmode); 4843 operands[4] = gen_reg_rtx (CC_CCRmode); 4844 }") 4845 4846 (define_expand "smaxdf3" 4847 [(parallel [(set (match_operand:DF 0 "fpr_operand" "") 4848 (smax:DF (match_operand:DF 1 "fpr_operand" "") 4849 (match_operand:DF 2 "fpr_operand" ""))) 4850 (clobber (match_dup 3)) 4851 (clobber (match_dup 4))])] 4852 "TARGET_COND_MOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE" 4853 " 4854 { 4855 operands[3] = gen_reg_rtx (CC_FPmode); 4856 operands[4] = gen_reg_rtx (CC_CCRmode); 4857 }") 4858 4859 (define_insn_and_split "*minmax_df" 4860 [(set (match_operand:DF 0 "fpr_operand" "=f,f,f") 4861 (match_operator:DF 1 "minmax_operator" 4862 [(match_operand:DF 2 "fpr_operand" "%0,f,f") 4863 (match_operand:DF 3 "fpr_operand" "f,0,f")])) 4864 (clobber (match_operand:CC_FP 4 "fcc_operand" "=u,u,u")) 4865 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))] 4866 "TARGET_COND_MOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE" 4867 "#" 4868 "reload_completed" 4869 [(match_dup 6)] 4870 "operands[6] = frv_split_minmax (operands);" 4871 [(set_attr "length" "12,12,16") 4872 (set_attr "type" "multi")]) 4873 4874 4876 ;; :::::::::::::::::::: 4877 ;; :: 4878 ;; :: Call and branch instructions 4879 ;; :: 4880 ;; :::::::::::::::::::: 4881 4882 ;; Subroutine call instruction returning no value. Operand 0 is the function 4883 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode 4884 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of 4885 ;; registers used as operands. 4886 4887 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It 4888 ;; is supplied for the sake of some RISC machines which need to put this 4889 ;; information into the assembler code; they can put it in the RTL instead of 4890 ;; operand 1. 4891 4892 (define_expand "call" 4893 [(use (match_operand:QI 0 "" "")) 4894 (use (match_operand 1 "" "")) 4895 (use (match_operand 2 "" "")) 4896 (use (match_operand 3 "" ""))] 4897 "" 4898 " 4899 { 4900 rtx lr = gen_rtx_REG (Pmode, LR_REGNO); 4901 rtx addr; 4902 4903 gcc_assert (GET_CODE (operands[0]) == MEM); 4904 4905 addr = XEXP (operands[0], 0); 4906 if (! call_operand (addr, Pmode)) 4907 addr = force_reg (Pmode, addr); 4908 4909 if (! operands[2]) 4910 operands[2] = const0_rtx; 4911 4912 if (TARGET_FDPIC) 4913 frv_expand_fdpic_call (operands, false, false); 4914 else 4915 emit_call_insn (gen_call_internal (addr, operands[1], operands[2], lr)); 4916 4917 DONE; 4918 }") 4919 4920 (define_insn "call_internal" 4921 [(call (mem:QI (match_operand:SI 0 "call_operand" "S,dNOP")) 4922 (match_operand 1 "" "")) 4923 (use (match_operand 2 "" "")) 4924 (clobber (match_operand:SI 3 "lr_operand" "=l,l"))] 4925 "! TARGET_FDPIC" 4926 "@ 4927 call %0 4928 call%i0l %M0" 4929 [(set_attr "length" "4") 4930 (set_attr "type" "call,jumpl")]) 4931 4932 ;; The odd use of GR0 within the UNSPEC below prevents cseing or 4933 ;; hoisting function descriptor loads out of loops. This is almost 4934 ;; never desirable, since if we preserve the function descriptor in a 4935 ;; pair of registers, it takes two insns to move it to gr14/gr15, and 4936 ;; if it's in the stack, we just waste space with the store, since 4937 ;; we'll have to load back from memory anyway. And, in the worst 4938 ;; case, we may end up reusing a function descriptor still pointing at 4939 ;; a PLT entry, instead of to the resolved function, which means going 4940 ;; through the resolver for every call that uses the outdated value. 4941 ;; Bad! 4942 4943 ;; The explicit MEM inside the SPEC prevents the compiler from moving 4944 ;; the load before a branch after a NULL test, or before a store that 4945 ;; initializes a function descriptor. 4946 4947 (define_insn "movdi_ldd" 4948 [(set (match_operand:DI 0 "fdpic_fptr_operand" "=e") 4949 (unspec:DI [(mem:DI (match_operand:SI 1 "ldd_address_operand" "p")) 4950 (reg:SI 0)] UNSPEC_LDD))] 4951 "" 4952 "ldd%I1 %M1, %0" 4953 [(set_attr "length" "4") 4954 (set_attr "type" "gload")]) 4955 4956 (define_insn "call_fdpicdi" 4957 [(call (mem:QI (match_operand:DI 0 "fdpic_fptr_operand" "W")) 4958 (match_operand 1 "" "")) 4959 (clobber (match_operand:SI 2 "lr_operand" "=l"))] 4960 "TARGET_FDPIC" 4961 "call%i0l %M0" 4962 [(set_attr "length" "4") 4963 (set_attr "type" "jumpl")]) 4964 4965 (define_insn "call_fdpicsi" 4966 [(call (mem:QI (match_operand:SI 0 "call_operand" "S,dNOP")) 4967 (match_operand 1 "" "")) 4968 (use (match_operand 2 "" "")) 4969 (use (match_operand:SI 3 "fdpic_operand" "Z,Z")) 4970 (clobber (match_operand:SI 4 "lr_operand" "=l,l"))] 4971 "TARGET_FDPIC" 4972 "@ 4973 call %0 4974 call%i0l %M0" 4975 [(set_attr "length" "4") 4976 (set_attr "type" "call,jumpl")]) 4977 4978 (define_expand "sibcall" 4979 [(use (match_operand:QI 0 "" "")) 4980 (use (match_operand 1 "" "")) 4981 (use (match_operand 2 "" "")) 4982 (use (match_operand 3 "" ""))] 4983 "" 4984 " 4985 { 4986 rtx addr; 4987 4988 gcc_assert (GET_CODE (operands[0]) == MEM); 4989 4990 addr = XEXP (operands[0], 0); 4991 if (! sibcall_operand (addr, Pmode)) 4992 addr = force_reg (Pmode, addr); 4993 4994 if (! operands[2]) 4995 operands[2] = const0_rtx; 4996 4997 if (TARGET_FDPIC) 4998 frv_expand_fdpic_call (operands, false, true); 4999 else 5000 emit_call_insn (gen_sibcall_internal (addr, operands[1], operands[2])); 5001 5002 DONE; 5003 }") 5004 5005 ;; It might seem that these sibcall patterns are missing references to 5006 ;; LR, but they're not necessary because sibcall_epilogue will make 5007 ;; sure LR is restored, and having LR here will set 5008 ;; regs_ever_used[REG_LR], forcing it to be saved on the stack, and 5009 ;; then restored in sibcalls and regular return code paths, even if 5010 ;; the function becomes a leaf function after tail-call elimination. 5011 5012 ;; We must not use a call-saved register here. `W' limits ourselves 5013 ;; to gr14 or gr15, but since we're almost running out of constraint 5014 ;; letters, and most other call-clobbered registers are often used for 5015 ;; argument-passing, this will do. 5016 (define_insn "sibcall_internal" 5017 [(call (mem:QI (match_operand:SI 0 "sibcall_operand" "WNOP")) 5018 (match_operand 1 "" "")) 5019 (use (match_operand 2 "" "")) 5020 (return)] 5021 "! TARGET_FDPIC" 5022 "jmp%i0l %M0" 5023 [(set_attr "length" "4") 5024 (set_attr "type" "jumpl")]) 5025 5026 (define_insn "sibcall_fdpicdi" 5027 [(call (mem:QI (match_operand:DI 0 "fdpic_fptr_operand" "W")) 5028 (match_operand 1 "" "")) 5029 (return)] 5030 "TARGET_FDPIC" 5031 "jmp%i0l %M0" 5032 [(set_attr "length" "4") 5033 (set_attr "type" "jumpl")]) 5034 5035 5036 ;; Subroutine call instruction returning a value. Operand 0 is the hard 5037 ;; register in which the value is returned. There are three more operands, the 5038 ;; same as the three operands of the `call' instruction (but with numbers 5039 ;; increased by one). 5040 5041 ;; Subroutines that return `BLKmode' objects use the `call' insn. 5042 5043 (define_expand "call_value" 5044 [(use (match_operand 0 "" "")) 5045 (use (match_operand:QI 1 "" "")) 5046 (use (match_operand 2 "" "")) 5047 (use (match_operand 3 "" "")) 5048 (use (match_operand 4 "" ""))] 5049 "" 5050 " 5051 { 5052 rtx lr = gen_rtx_REG (Pmode, LR_REGNO); 5053 rtx addr; 5054 5055 gcc_assert (GET_CODE (operands[1]) == MEM); 5056 5057 addr = XEXP (operands[1], 0); 5058 if (! call_operand (addr, Pmode)) 5059 addr = force_reg (Pmode, addr); 5060 5061 if (! operands[3]) 5062 operands[3] = const0_rtx; 5063 5064 if (TARGET_FDPIC) 5065 frv_expand_fdpic_call (operands, true, false); 5066 else 5067 emit_call_insn (gen_call_value_internal (operands[0], addr, operands[2], 5068 operands[3], lr)); 5069 5070 DONE; 5071 }") 5072 5073 (define_insn "call_value_internal" 5074 [(set (match_operand 0 "register_operand" "=d,d") 5075 (call (mem:QI (match_operand:SI 1 "call_operand" "S,dNOP")) 5076 (match_operand 2 "" ""))) 5077 (use (match_operand 3 "" "")) 5078 (clobber (match_operand:SI 4 "lr_operand" "=l,l"))] 5079 "! TARGET_FDPIC" 5080 "@ 5081 call %1 5082 call%i1l %M1" 5083 [(set_attr "length" "4") 5084 (set_attr "type" "call,jumpl")]) 5085 5086 (define_insn "call_value_fdpicdi" 5087 [(set (match_operand 0 "register_operand" "=d") 5088 (call (mem:QI (match_operand:DI 1 "fdpic_fptr_operand" "W")) 5089 (match_operand 2 "" ""))) 5090 (clobber (match_operand:SI 3 "lr_operand" "=l"))] 5091 "TARGET_FDPIC" 5092 "call%i1l %M1" 5093 [(set_attr "length" "4") 5094 (set_attr "type" "jumpl")]) 5095 5096 (define_insn "call_value_fdpicsi" 5097 [(set (match_operand 0 "register_operand" "=d,d") 5098 (call (mem:QI (match_operand:SI 1 "call_operand" "S,dNOP")) 5099 (match_operand 2 "" ""))) 5100 (use (match_operand 3 "" "")) 5101 (use (match_operand:SI 4 "fdpic_operand" "Z,Z")) 5102 (clobber (match_operand:SI 5 "lr_operand" "=l,l"))] 5103 "TARGET_FDPIC" 5104 "@ 5105 call %1 5106 call%i1l %M1" 5107 [(set_attr "length" "4") 5108 (set_attr "type" "call,jumpl")]) 5109 5110 (define_expand "sibcall_value" 5111 [(use (match_operand 0 "" "")) 5112 (use (match_operand:QI 1 "" "")) 5113 (use (match_operand 2 "" "")) 5114 (use (match_operand 3 "" "")) 5115 (use (match_operand 4 "" ""))] 5116 "" 5117 " 5118 { 5119 rtx addr; 5120 5121 gcc_assert (GET_CODE (operands[1]) == MEM); 5122 5123 addr = XEXP (operands[1], 0); 5124 if (! sibcall_operand (addr, Pmode)) 5125 addr = force_reg (Pmode, addr); 5126 5127 if (! operands[3]) 5128 operands[3] = const0_rtx; 5129 5130 if (TARGET_FDPIC) 5131 frv_expand_fdpic_call (operands, true, true); 5132 else 5133 emit_call_insn (gen_sibcall_value_internal (operands[0], addr, operands[2], 5134 operands[3])); 5135 DONE; 5136 }") 5137 5138 (define_insn "sibcall_value_internal" 5139 [(set (match_operand 0 "register_operand" "=d") 5140 (call (mem:QI (match_operand:SI 1 "sibcall_operand" "WNOP")) 5141 (match_operand 2 "" ""))) 5142 (use (match_operand 3 "" "")) 5143 (return)] 5144 "! TARGET_FDPIC" 5145 "jmp%i1l %M1" 5146 [(set_attr "length" "4") 5147 (set_attr "type" "jumpl")]) 5148 5149 (define_insn "sibcall_value_fdpicdi" 5150 [(set (match_operand 0 "register_operand" "=d") 5151 (call (mem:QI (match_operand:DI 1 "fdpic_fptr_operand" "W")) 5152 (match_operand 2 "" ""))) 5153 (return)] 5154 "TARGET_FDPIC" 5155 "jmp%i1l %M1" 5156 [(set_attr "length" "4") 5157 (set_attr "type" "jumpl")]) 5158 5159 ;; return instruction generated instead of jmp to epilog 5160 (define_expand "return" 5161 [(parallel [(return) 5162 (use (match_dup 0)) 5163 (use (const_int 1))])] 5164 "direct_return_p ()" 5165 " 5166 { 5167 operands[0] = gen_rtx_REG (Pmode, LR_REGNO); 5168 }") 5169 5170 ;; return instruction generated by the epilogue 5171 (define_expand "epilogue_return" 5172 [(parallel [(return) 5173 (use (match_operand:SI 0 "register_operand" "")) 5174 (use (const_int 0))])] 5175 "" 5176 "") 5177 5178 (define_insn "*return_internal" 5179 [(return) 5180 (use (match_operand:SI 0 "register_operand" "l,d")) 5181 (use (match_operand:SI 1 "immediate_operand" "n,n"))] 5182 "" 5183 "@ 5184 ret 5185 jmpl @(%0,%.)" 5186 [(set_attr "length" "4") 5187 (set_attr "type" "jump,jumpl")]) 5188 5189 (define_insn "*return_true" 5190 [(set (pc) 5191 (if_then_else (match_operator 0 "integer_relational_operator" 5192 [(match_operand 1 "icc_operand" "t") 5193 (const_int 0)]) 5194 (return) 5195 (pc)))] 5196 "direct_return_p ()" 5197 "b%c0lr %1,%#" 5198 [(set_attr "length" "4") 5199 (set_attr "type" "jump")]) 5200 5201 (define_insn "*return_false" 5202 [(set (pc) 5203 (if_then_else (match_operator 0 "integer_relational_operator" 5204 [(match_operand 1 "icc_operand" "t") 5205 (const_int 0)]) 5206 (pc) 5207 (return)))] 5208 "direct_return_p ()" 5209 "b%C0lr %1,%#" 5210 [(set_attr "length" "4") 5211 (set_attr "type" "jump")]) 5212 5213 ;; A version of addsi3 for deallocating stack space at the end of the 5214 ;; epilogue. The addition is done in parallel with an (unspec_volatile), 5215 ;; which represents the clobbering of the deallocated space. 5216 (define_insn "stack_adjust" 5217 [(set (match_operand:SI 0 "register_operand" "=d") 5218 (plus:SI (match_operand:SI 1 "register_operand" "d") 5219 (match_operand:SI 2 "general_operand" "dNOP"))) 5220 (unspec_volatile [(const_int 0)] UNSPEC_STACK_ADJUST)] 5221 "" 5222 "add%I2 %1,%2,%0" 5223 [(set_attr "length" "4") 5224 (set_attr "type" "int")]) 5225 5226 ;; Normal unconditional jump 5227 5228 ;; Use the "call" instruction for long branches, but prefer to use "bra" for 5229 ;; short ones since it does not force us to save the link register. 5230 5231 ;; This define_insn uses the branch-shortening code to decide which 5232 ;; instruction it emits. Since the main branch-shortening interface is 5233 ;; through get_attr_length(), the two alternatives must be given different 5234 ;; lengths. Here we pretend that the far jump is 8 rather than 4 bytes 5235 ;; long, though both alternatives are really the same size. 5236 (define_insn "jump" 5237 [(set (pc) (label_ref (match_operand 0 "" "")))] 5238 "" 5239 "* 5240 { 5241 if (get_attr_length (insn) == 4) 5242 return \"bra %l0\"; 5243 else 5244 return \"call %l0\"; 5245 }" 5246 [(set (attr "length") 5247 (if_then_else 5248 (and (ge (minus (match_dup 0) (pc)) (const_int -32768)) 5249 (le (minus (match_dup 0) (pc)) (const_int 32764))) 5250 (const_int 4) 5251 (const_int 8))) 5252 (set (attr "far_jump") 5253 (if_then_else 5254 (eq_attr "length" "4") 5255 (const_string "no") 5256 (const_string "yes"))) 5257 (set (attr "type") 5258 (if_then_else 5259 (eq_attr "length" "4") 5260 (const_string "jump") 5261 (const_string "call")))]) 5262 5263 ;; Indirect jump through a register 5264 (define_insn "indirect_jump" 5265 [(set (pc) (match_operand:SI 0 "register_operand" "d,l"))] 5266 "" 5267 "@ 5268 jmpl @(%0,%.) 5269 bralr" 5270 [(set_attr "length" "4") 5271 (set_attr "type" "jumpl,branch")]) 5272 5273 ;; Instruction to jump to a variable address. This is a low-level capability 5274 ;; which can be used to implement a dispatch table when there is no `casesi' 5275 ;; pattern. Either the 'casesi' pattern or the 'tablejump' pattern, or both, 5276 ;; MUST be present in this file. 5277 5278 ;; This pattern requires two operands: the address or offset, and a label which 5279 ;; should immediately precede the jump table. If the macro 5280 ;; `CASE_VECTOR_PC_RELATIVE' is defined then the first operand is an offset 5281 ;; which counts from the address of the table; otherwise, it is an absolute 5282 ;; address to jump to. In either case, the first operand has mode `Pmode'. 5283 5284 ;; The `tablejump' insn is always the last insn before the jump table it uses. 5285 ;; Its assembler code normally has no need to use the second operand, but you 5286 ;; should incorporate it in the RTL pattern so that the jump optimizer will not 5287 ;; delete the table as unreachable code. 5288 5289 (define_expand "tablejump" 5290 [(parallel [(set (pc) (match_operand:SI 0 "address_operand" "p")) 5291 (use (label_ref (match_operand 1 "" "")))])] 5292 "!flag_pic" 5293 "") 5294 5295 (define_insn "tablejump_insn" 5296 [(set (pc) (match_operand:SI 0 "address_operand" "p")) 5297 (use (label_ref (match_operand 1 "" "")))] 5298 "" 5299 "jmp%I0l %M0" 5300 [(set_attr "length" "4") 5301 (set_attr "type" "jumpl")]) 5302 5303 ;; Implement switch statements when generating PIC code. Switches are 5304 ;; implemented by `tablejump' when not using -fpic. 5305 5306 ;; Emit code here to do the range checking and make the index zero based. 5307 ;; operand 0 is the index 5308 ;; operand 1 is the lower bound 5309 ;; operand 2 is the range of indices (highest - lowest + 1) 5310 ;; operand 3 is the label that precedes the table itself 5311 ;; operand 4 is the fall through label 5312 5313 (define_expand "casesi" 5314 [(use (match_operand:SI 0 "integer_register_operand" "")) 5315 (use (match_operand:SI 1 "const_int_operand" "")) 5316 (use (match_operand:SI 2 "const_int_operand" "")) 5317 (use (match_operand 3 "" "")) 5318 (use (match_operand 4 "" ""))] 5319 "flag_pic" 5320 " 5321 { 5322 rtx indx; 5323 rtx scale; 5324 rtx low = operands[1]; 5325 rtx range = operands[2]; 5326 rtx table = operands[3]; 5327 rtx treg; 5328 rtx fail = operands[4]; 5329 rtx mem; 5330 rtx reg2; 5331 rtx reg3; 5332 5333 gcc_assert (GET_CODE (operands[1]) == CONST_INT); 5334 5335 gcc_assert (GET_CODE (operands[2]) == CONST_INT); 5336 5337 /* If we can't generate an immediate instruction, promote to register. */ 5338 if (! IN_RANGE (INTVAL (range), -2048, 2047)) 5339 range = force_reg (SImode, range); 5340 5341 /* If low bound is 0, we don't have to subtract it. */ 5342 if (INTVAL (operands[1]) == 0) 5343 indx = operands[0]; 5344 else 5345 { 5346 indx = gen_reg_rtx (SImode); 5347 if (IN_RANGE (INTVAL (low), -2047, 2048)) 5348 emit_insn (gen_addsi3 (indx, operands[0], GEN_INT (- INTVAL (low)))); 5349 else 5350 emit_insn (gen_subsi3 (indx, operands[0], force_reg (SImode, low))); 5351 } 5352 5353 /* Do an unsigned comparison (in the proper mode) between the index 5354 expression and the value which represents the length of the range. 5355 Since we just finished subtracting the lower bound of the range 5356 from the index expression, this comparison allows us to simultaneously 5357 check that the original index expression value is both greater than 5358 or equal to the minimum value of the range and less than or equal to 5359 the maximum value of the range. */ 5360 5361 emit_cmp_and_jump_insns (indx, range, GTU, NULL_RTX, SImode, 1, fail); 5362 5363 /* Move the table address to a register. */ 5364 treg = gen_reg_rtx (Pmode); 5365 emit_insn (gen_movsi (treg, gen_rtx_LABEL_REF (VOIDmode, table))); 5366 5367 /* Scale index-low by wordsize. */ 5368 scale = gen_reg_rtx (SImode); 5369 emit_insn (gen_ashlsi3 (scale, indx, const2_rtx)); 5370 5371 /* Load the address, add the start of the table back in, 5372 and jump to it. */ 5373 mem = gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, scale, treg)); 5374 reg2 = gen_reg_rtx (SImode); 5375 reg3 = gen_reg_rtx (SImode); 5376 emit_insn (gen_movsi (reg2, mem)); 5377 emit_insn (gen_addsi3 (reg3, reg2, treg)); 5378 emit_jump_insn (gen_tablejump_insn (reg3, table)); 5379 DONE; 5380 }") 5381 5382 5384 ;; :::::::::::::::::::: 5385 ;; :: 5386 ;; :: Prologue and Epilogue instructions 5387 ;; :: 5388 ;; :::::::::::::::::::: 5389 5390 ;; Called after register allocation to add any instructions needed for the 5391 ;; prologue. Using a prologue insn is favored compared to putting all of the 5392 ;; instructions in the FUNCTION_PROLOGUE macro, since it allows the scheduler 5393 ;; to intermix instructions with the saves of the caller saved registers. In 5394 ;; some cases, it might be necessary to emit a barrier instruction as the last 5395 ;; insn to prevent such scheduling. 5396 (define_expand "prologue" 5397 [(const_int 1)] 5398 "" 5399 " 5400 { 5401 frv_expand_prologue (); 5402 DONE; 5403 }") 5404 5405 ;; Called after register allocation to add any instructions needed for the 5406 ;; epilogue. Using an epilogue insn is favored compared to putting all of the 5407 ;; instructions in the FUNCTION_EPILOGUE macro, since it allows the scheduler 5408 ;; to intermix instructions with the restores of the caller saved registers. 5409 ;; In some cases, it might be necessary to emit a barrier instruction as the 5410 ;; first insn to prevent such scheduling. 5411 (define_expand "epilogue" 5412 [(const_int 2)] 5413 "" 5414 " 5415 { 5416 frv_expand_epilogue (true); 5417 DONE; 5418 }") 5419 5420 ;; This pattern, if defined, emits RTL for exit from a function without the final 5421 ;; branch back to the calling function. This pattern will be emitted before any 5422 ;; sibling call (aka tail call) sites. 5423 ;; 5424 ;; The sibcall_epilogue pattern must not clobber any arguments used for 5425 ;; parameter passing or any stack slots for arguments passed to the current 5426 ;; function. 5427 (define_expand "sibcall_epilogue" 5428 [(const_int 3)] 5429 "" 5430 " 5431 { 5432 frv_expand_epilogue (false); 5433 DONE; 5434 }") 5435 5436 ;; Set up the pic register to hold the address of the pic table 5437 (define_insn "pic_prologue" 5438 [(set (match_operand:SI 0 "integer_register_operand" "=d") 5439 (unspec_volatile:SI [(const_int 0)] UNSPEC_PIC_PROLOGUE)) 5440 (clobber (match_operand:SI 1 "lr_operand" "=l")) 5441 (clobber (match_operand:SI 2 "integer_register_operand" "=d"))] 5442 "" 5443 "* 5444 { 5445 static int frv_pic_labelno = 0; 5446 5447 operands[3] = GEN_INT (frv_pic_labelno++); 5448 return \"call %P3\\n%P3:\;movsg %1, %0\;sethi #gprelhi(%P3), %2\;setlo #gprello(%P3), %2\;sub %0,%2,%0\"; 5449 }" 5450 [(set_attr "length" "16") 5451 (set_attr "type" "multi")]) 5452 5454 ;; :::::::::::::::::::: 5455 ;; :: 5456 ;; :: Miscellaneous instructions 5457 ;; :: 5458 ;; :::::::::::::::::::: 5459 5460 ;; No operation, needed in case the user uses -g but not -O. 5461 (define_insn "nop" 5462 [(const_int 0)] 5463 "" 5464 "nop" 5465 [(set_attr "length" "4") 5466 (set_attr "type" "int")]) 5467 5468 (define_insn "fnop" 5469 [(const_int 1)] 5470 "" 5471 "fnop" 5472 [(set_attr "length" "4") 5473 (set_attr "type" "fnop")]) 5474 5475 (define_insn "mnop" 5476 [(const_int 2)] 5477 "" 5478 "mnop" 5479 [(set_attr "length" "4") 5480 (set_attr "type" "mnop")]) 5481 5482 ;; Pseudo instruction that prevents the scheduler from moving code above this 5483 ;; point. Note, type unknown is used to make sure the VLIW instructions are 5484 ;; not continued past this point. 5485 (define_insn "blockage" 5486 [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)] 5487 "" 5488 "# blockage" 5489 [(set_attr "length" "0") 5490 (set_attr "type" "unknown")]) 5491 5493 ;; :::::::::::::::::::: 5494 ;; :: 5495 ;; :: Media instructions 5496 ;; :: 5497 ;; :::::::::::::::::::: 5498 5499 ;; Unimplemented instructions: 5500 ;; - MCMPSH, MCMPUH 5501 5502 (define_constants 5503 [(UNSPEC_MLOGIC 100) 5504 (UNSPEC_MNOT 101) 5505 (UNSPEC_MAVEH 102) 5506 (UNSPEC_MSATH 103) 5507 (UNSPEC_MADDH 104) 5508 (UNSPEC_MQADDH 105) 5509 (UNSPEC_MPACKH 106) 5510 (UNSPEC_MUNPACKH 107) 5511 (UNSPEC_MDPACKH 108) 5512 (UNSPEC_MBTOH 109) 5513 (UNSPEC_MHTOB 110) 5514 (UNSPEC_MROT 111) 5515 (UNSPEC_MSHIFT 112) 5516 (UNSPEC_MEXPDHW 113) 5517 (UNSPEC_MEXPDHD 114) 5518 (UNSPEC_MWCUT 115) 5519 (UNSPEC_MMULH 116) 5520 (UNSPEC_MMULXH 117) 5521 (UNSPEC_MMACH 118) 5522 (UNSPEC_MMRDH 119) 5523 (UNSPEC_MQMULH 120) 5524 (UNSPEC_MQMULXH 121) 5525 (UNSPEC_MQMACH 122) 5526 (UNSPEC_MCPX 123) 5527 (UNSPEC_MQCPX 124) 5528 (UNSPEC_MCUT 125) 5529 (UNSPEC_MRDACC 126) 5530 (UNSPEC_MRDACCG 127) 5531 (UNSPEC_MWTACC 128) 5532 (UNSPEC_MWTACCG 129) 5533 (UNSPEC_MTRAP 130) 5534 (UNSPEC_MCLRACC 131) 5535 (UNSPEC_MCLRACCA 132) 5536 (UNSPEC_MCOP1 133) 5537 (UNSPEC_MCOP2 134) 5538 (UNSPEC_MDUNPACKH 135) 5539 (UNSPEC_MDUNPACKH_INTERNAL 136) 5540 (UNSPEC_MBTOHE 137) 5541 (UNSPEC_MBTOHE_INTERNAL 138) 5542 (UNSPEC_MBTOHE 137) 5543 (UNSPEC_MBTOHE_INTERNAL 138) 5544 (UNSPEC_MQMACH2 139) 5545 (UNSPEC_MADDACC 140) 5546 (UNSPEC_MDADDACC 141) 5547 (UNSPEC_MABSHS 142) 5548 (UNSPEC_MDROTLI 143) 5549 (UNSPEC_MCPLHI 144) 5550 (UNSPEC_MCPLI 145) 5551 (UNSPEC_MDCUTSSI 146) 5552 (UNSPEC_MQSATHS 147) 5553 (UNSPEC_MHSETLOS 148) 5554 (UNSPEC_MHSETLOH 149) 5555 (UNSPEC_MHSETHIS 150) 5556 (UNSPEC_MHSETHIH 151) 5557 (UNSPEC_MHDSETS 152) 5558 (UNSPEC_MHDSETH 153) 5559 (UNSPEC_MQLCLRHS 154) 5560 (UNSPEC_MQLMTHS 155) 5561 (UNSPEC_MQSLLHI 156) 5562 (UNSPEC_MQSRAHI 157) 5563 (UNSPEC_MASACCS 158) 5564 (UNSPEC_MDASACCS 159) 5565 ]) 5566 5567 ;; Logic operations: type "mlogic" 5568 5569 (define_expand "mand" 5570 [(set (match_operand:SI 0 "fpr_operand" "") 5571 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 5572 (match_operand:SI 2 "fpr_operand" "") 5573 (match_dup 3)] 5574 UNSPEC_MLOGIC))] 5575 "TARGET_MEDIA" 5576 "operands[3] = GEN_INT (FRV_BUILTIN_MAND);") 5577 5578 (define_expand "mor" 5579 [(set (match_operand:SI 0 "fpr_operand" "") 5580 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 5581 (match_operand:SI 2 "fpr_operand" "") 5582 (match_dup 3)] 5583 UNSPEC_MLOGIC))] 5584 "TARGET_MEDIA" 5585 "operands[3] = GEN_INT (FRV_BUILTIN_MOR);") 5586 5587 (define_expand "mxor" 5588 [(set (match_operand:SI 0 "fpr_operand" "") 5589 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 5590 (match_operand:SI 2 "fpr_operand" "") 5591 (match_dup 3)] 5592 UNSPEC_MLOGIC))] 5593 "TARGET_MEDIA" 5594 "operands[3] = GEN_INT (FRV_BUILTIN_MXOR);") 5595 5596 (define_insn "*mlogic" 5597 [(set (match_operand:SI 0 "fpr_operand" "=f") 5598 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5599 (match_operand:SI 2 "fpr_operand" "f") 5600 (match_operand:SI 3 "const_int_operand" "n")] 5601 UNSPEC_MLOGIC))] 5602 "TARGET_MEDIA" 5603 "* 5604 { 5605 switch (INTVAL (operands[3])) 5606 { 5607 default: break; 5608 case FRV_BUILTIN_MAND: return \"mand %1, %2, %0\"; 5609 case FRV_BUILTIN_MOR: return \"mor %1, %2, %0\"; 5610 case FRV_BUILTIN_MXOR: return \"mxor %1, %2, %0\"; 5611 } 5612 5613 fatal_insn (\"Bad media insn, mlogic\", insn); 5614 }" 5615 [(set_attr "length" "4") 5616 (set_attr "type" "mlogic")]) 5617 5618 (define_insn "*cond_exec_mlogic" 5619 [(cond_exec 5620 (match_operator 0 "ccr_eqne_operator" 5621 [(match_operand 1 "cr_operand" "C") 5622 (const_int 0)]) 5623 (set (match_operand:SI 2 "fpr_operand" "=f") 5624 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f") 5625 (match_operand:SI 4 "fpr_operand" "f") 5626 (match_operand:SI 5 "const_int_operand" "n")] 5627 UNSPEC_MLOGIC)))] 5628 "TARGET_MEDIA" 5629 "* 5630 { 5631 switch (INTVAL (operands[5])) 5632 { 5633 default: break; 5634 case FRV_BUILTIN_MAND: return \"cmand %3, %4, %2, %1, %e0\"; 5635 case FRV_BUILTIN_MOR: return \"cmor %3, %4, %2, %1, %e0\"; 5636 case FRV_BUILTIN_MXOR: return \"cmxor %3, %4, %2, %1, %e0\"; 5637 } 5638 5639 fatal_insn (\"Bad media insn, cond_exec_mlogic\", insn); 5640 }" 5641 [(set_attr "length" "4") 5642 (set_attr "type" "mlogic")]) 5643 5644 ;; Logical not: type "mlogic" 5645 5646 (define_insn "mnot" 5647 [(set (match_operand:SI 0 "fpr_operand" "=f") 5648 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MNOT))] 5649 "TARGET_MEDIA" 5650 "mnot %1, %0" 5651 [(set_attr "length" "4") 5652 (set_attr "type" "mlogic")]) 5653 5654 (define_insn "*cond_exec_mnot" 5655 [(cond_exec 5656 (match_operator 0 "ccr_eqne_operator" 5657 [(match_operand 1 "cr_operand" "C") 5658 (const_int 0)]) 5659 (set (match_operand:SI 2 "fpr_operand" "=f") 5660 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f")] UNSPEC_MNOT)))] 5661 "TARGET_MEDIA" 5662 "cmnot %3, %2, %1, %e0" 5663 [(set_attr "length" "4") 5664 (set_attr "type" "mlogic")]) 5665 5666 ;; Dual average (halfword): type "maveh" 5667 5668 (define_insn "maveh" 5669 [(set (match_operand:SI 0 "fpr_operand" "=f") 5670 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5671 (match_operand:SI 2 "fpr_operand" "f")] 5672 UNSPEC_MAVEH))] 5673 "TARGET_MEDIA" 5674 "maveh %1, %2, %0" 5675 [(set_attr "length" "4") 5676 (set_attr "type" "maveh")]) 5677 5678 ;; Dual saturation (halfword): type "msath" 5679 5680 (define_expand "msaths" 5681 [(set (match_operand:SI 0 "fpr_operand" "=f") 5682 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5683 (match_operand:SI 2 "fpr_operand" "f") 5684 (match_dup 3)] 5685 UNSPEC_MSATH))] 5686 "TARGET_MEDIA" 5687 "operands[3] = GEN_INT (FRV_BUILTIN_MSATHS);") 5688 5689 (define_expand "msathu" 5690 [(set (match_operand:SI 0 "fpr_operand" "=f") 5691 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5692 (match_operand:SI 2 "fpr_operand" "f") 5693 (match_dup 3)] 5694 UNSPEC_MSATH))] 5695 "TARGET_MEDIA" 5696 "operands[3] = GEN_INT (FRV_BUILTIN_MSATHU);") 5697 5698 (define_insn "*msath" 5699 [(set (match_operand:SI 0 "fpr_operand" "=f") 5700 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5701 (match_operand:SI 2 "fpr_operand" "f") 5702 (match_operand:SI 3 "const_int_operand" "n")] 5703 UNSPEC_MSATH))] 5704 "TARGET_MEDIA" 5705 "* 5706 { 5707 switch (INTVAL (operands[3])) 5708 { 5709 default: break; 5710 case FRV_BUILTIN_MSATHS: return \"msaths %1, %2, %0\"; 5711 case FRV_BUILTIN_MSATHU: return \"msathu %1, %2, %0\"; 5712 } 5713 5714 fatal_insn (\"Bad media insn, msath\", insn); 5715 }" 5716 [(set_attr "length" "4") 5717 (set_attr "type" "msath")]) 5718 5719 ;; Dual addition/subtraction with saturation (halfword): type "maddh" 5720 5721 (define_expand "maddhss" 5722 [(set (match_operand:SI 0 "fpr_operand" "=f") 5723 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5724 (match_operand:SI 2 "fpr_operand" "f") 5725 (match_dup 3)] 5726 UNSPEC_MADDH))] 5727 "TARGET_MEDIA" 5728 "operands[3] = GEN_INT (FRV_BUILTIN_MADDHSS);") 5729 5730 (define_expand "maddhus" 5731 [(set (match_operand:SI 0 "fpr_operand" "=f") 5732 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5733 (match_operand:SI 2 "fpr_operand" "f") 5734 (match_dup 3)] 5735 UNSPEC_MADDH))] 5736 "TARGET_MEDIA" 5737 "operands[3] = GEN_INT (FRV_BUILTIN_MADDHUS);") 5738 5739 (define_expand "msubhss" 5740 [(set (match_operand:SI 0 "fpr_operand" "=f") 5741 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5742 (match_operand:SI 2 "fpr_operand" "f") 5743 (match_dup 3)] 5744 UNSPEC_MADDH))] 5745 "TARGET_MEDIA" 5746 "operands[3] = GEN_INT (FRV_BUILTIN_MSUBHSS);") 5747 5748 (define_expand "msubhus" 5749 [(set (match_operand:SI 0 "fpr_operand" "=f") 5750 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5751 (match_operand:SI 2 "fpr_operand" "f") 5752 (match_dup 3)] 5753 UNSPEC_MADDH))] 5754 "TARGET_MEDIA" 5755 "operands[3] = GEN_INT (FRV_BUILTIN_MSUBHUS);") 5756 5757 (define_insn "*maddh" 5758 [(set (match_operand:SI 0 "fpr_operand" "=f") 5759 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5760 (match_operand:SI 2 "fpr_operand" "f") 5761 (match_operand:SI 3 "const_int_operand" "n")] 5762 UNSPEC_MADDH))] 5763 "TARGET_MEDIA" 5764 "* 5765 { 5766 switch (INTVAL (operands[3])) 5767 { 5768 default: break; 5769 case FRV_BUILTIN_MADDHSS: return \"maddhss %1, %2, %0\"; 5770 case FRV_BUILTIN_MADDHUS: return \"maddhus %1, %2, %0\"; 5771 case FRV_BUILTIN_MSUBHSS: return \"msubhss %1, %2, %0\"; 5772 case FRV_BUILTIN_MSUBHUS: return \"msubhus %1, %2, %0\"; 5773 } 5774 5775 fatal_insn (\"Bad media insn, maddh\", insn); 5776 }" 5777 [(set_attr "length" "4") 5778 (set_attr "type" "maddh")]) 5779 5780 (define_insn "*cond_exec_maddh" 5781 [(cond_exec 5782 (match_operator 0 "ccr_eqne_operator" 5783 [(match_operand 1 "cr_operand" "C") 5784 (const_int 0)]) 5785 (set (match_operand:SI 2 "fpr_operand" "=f") 5786 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f") 5787 (match_operand:SI 4 "fpr_operand" "f") 5788 (match_operand:SI 5 "const_int_operand" "n")] 5789 UNSPEC_MADDH)))] 5790 "TARGET_MEDIA" 5791 "* 5792 { 5793 switch (INTVAL (operands[5])) 5794 { 5795 default: break; 5796 case FRV_BUILTIN_MADDHSS: return \"cmaddhss %3, %4, %2, %1, %e0\"; 5797 case FRV_BUILTIN_MADDHUS: return \"cmaddhus %3, %4, %2, %1, %e0\"; 5798 case FRV_BUILTIN_MSUBHSS: return \"cmsubhss %3, %4, %2, %1, %e0\"; 5799 case FRV_BUILTIN_MSUBHUS: return \"cmsubhus %3, %4, %2, %1, %e0\"; 5800 } 5801 5802 fatal_insn (\"Bad media insn, cond_exec_maddh\", insn); 5803 }" 5804 [(set_attr "length" "4") 5805 (set_attr "type" "maddh")]) 5806 5807 ;; Quad addition/subtraction with saturation (halfword): type "mqaddh" 5808 5809 (define_expand "mqaddhss" 5810 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5811 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 5812 (match_operand:DI 2 "even_fpr_operand" "h") 5813 (match_dup 3)] 5814 UNSPEC_MQADDH))] 5815 "TARGET_MEDIA" 5816 "operands[3] = GEN_INT (FRV_BUILTIN_MQADDHSS);") 5817 5818 (define_expand "mqaddhus" 5819 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5820 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 5821 (match_operand:DI 2 "even_fpr_operand" "h") 5822 (match_dup 3)] 5823 UNSPEC_MQADDH))] 5824 "TARGET_MEDIA" 5825 "operands[3] = GEN_INT (FRV_BUILTIN_MQADDHUS);") 5826 5827 (define_expand "mqsubhss" 5828 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5829 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 5830 (match_operand:DI 2 "even_fpr_operand" "h") 5831 (match_dup 3)] 5832 UNSPEC_MQADDH))] 5833 "TARGET_MEDIA" 5834 "operands[3] = GEN_INT (FRV_BUILTIN_MQSUBHSS);") 5835 5836 (define_expand "mqsubhus" 5837 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5838 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 5839 (match_operand:DI 2 "even_fpr_operand" "h") 5840 (match_dup 3)] 5841 UNSPEC_MQADDH))] 5842 "TARGET_MEDIA" 5843 "operands[3] = GEN_INT (FRV_BUILTIN_MQSUBHUS);") 5844 5845 (define_insn "*mqaddh" 5846 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5847 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 5848 (match_operand:DI 2 "even_fpr_operand" "h") 5849 (match_operand:SI 3 "const_int_operand" "n")] 5850 UNSPEC_MQADDH))] 5851 "TARGET_MEDIA" 5852 "* 5853 { 5854 switch (INTVAL (operands[3])) 5855 { 5856 default: break; 5857 case FRV_BUILTIN_MQADDHSS: return \"mqaddhss %1, %2, %0\"; 5858 case FRV_BUILTIN_MQADDHUS: return \"mqaddhus %1, %2, %0\"; 5859 case FRV_BUILTIN_MQSUBHSS: return \"mqsubhss %1, %2, %0\"; 5860 case FRV_BUILTIN_MQSUBHUS: return \"mqsubhus %1, %2, %0\"; 5861 } 5862 5863 fatal_insn (\"Bad media insn, mqaddh\", insn); 5864 }" 5865 [(set_attr "length" "4") 5866 (set_attr "type" "mqaddh")]) 5867 5868 (define_insn "*cond_exec_mqaddh" 5869 [(cond_exec 5870 (match_operator 0 "ccr_eqne_operator" 5871 [(match_operand 1 "cr_operand" "C") 5872 (const_int 0)]) 5873 (set (match_operand:DI 2 "even_fpr_operand" "=h") 5874 (unspec:DI [(match_operand:DI 3 "even_fpr_operand" "h") 5875 (match_operand:DI 4 "even_fpr_operand" "h") 5876 (match_operand:SI 5 "const_int_operand" "n")] 5877 UNSPEC_MQADDH)))] 5878 "TARGET_MEDIA" 5879 "* 5880 { 5881 switch (INTVAL (operands[5])) 5882 { 5883 default: break; 5884 case FRV_BUILTIN_MQADDHSS: return \"cmqaddhss %3, %4, %2, %1, %e0\"; 5885 case FRV_BUILTIN_MQADDHUS: return \"cmqaddhus %3, %4, %2, %1, %e0\"; 5886 case FRV_BUILTIN_MQSUBHSS: return \"cmqsubhss %3, %4, %2, %1, %e0\"; 5887 case FRV_BUILTIN_MQSUBHUS: return \"cmqsubhus %3, %4, %2, %1, %e0\"; 5888 } 5889 5890 fatal_insn (\"Bad media insn, cond_exec_mqaddh\", insn); 5891 }" 5892 [(set_attr "length" "4") 5893 (set_attr "type" "mqaddh")]) 5894 5895 ;; Pack halfword: type "mpackh" 5896 5897 (define_insn "mpackh" 5898 [(set (match_operand:SI 0 "fpr_operand" "=f") 5899 (unspec:SI [(match_operand:HI 1 "fpr_operand" "f") 5900 (match_operand:HI 2 "fpr_operand" "f")] 5901 UNSPEC_MPACKH))] 5902 "TARGET_MEDIA" 5903 "mpackh %1, %2, %0" 5904 [(set_attr "length" "4") 5905 (set_attr "type" "mpackh")]) 5906 5907 ;; Unpack halfword: type "mpackh" 5908 5909 (define_insn "munpackh" 5910 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5911 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")] 5912 UNSPEC_MUNPACKH))] 5913 "TARGET_MEDIA" 5914 "munpackh %1, %0" 5915 [(set_attr "length" "4") 5916 (set_attr "type" "munpackh")]) 5917 5918 ;; Dual pack halfword: type "mdpackh" 5919 5920 (define_insn "mdpackh" 5921 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5922 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 5923 (match_operand:DI 2 "even_fpr_operand" "h")] 5924 UNSPEC_MDPACKH))] 5925 "TARGET_MEDIA" 5926 "mdpackh %1, %2, %0" 5927 [(set_attr "length" "4") 5928 (set_attr "type" "mdpackh")]) 5929 5930 ;; Byte-halfword conversion: type "mbhconv" 5931 5932 (define_insn "mbtoh" 5933 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 5934 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")] 5935 UNSPEC_MBTOH))] 5936 "TARGET_MEDIA" 5937 "mbtoh %1, %0" 5938 [(set_attr "length" "4") 5939 (set_attr "type" "mbhconv")]) 5940 5941 (define_insn "*cond_exec_mbtoh" 5942 [(cond_exec 5943 (match_operator 0 "ccr_eqne_operator" 5944 [(match_operand 1 "cr_operand" "C") 5945 (const_int 0)]) 5946 (set (match_operand:DI 2 "even_fpr_operand" "=h") 5947 (unspec:DI [(match_operand:SI 3 "fpr_operand" "f")] 5948 UNSPEC_MBTOH)))] 5949 "TARGET_MEDIA" 5950 "cmbtoh %3, %2, %1, %e0" 5951 [(set_attr "length" "4") 5952 (set_attr "type" "mbhconv")]) 5953 5954 (define_insn "mhtob" 5955 [(set (match_operand:SI 0 "fpr_operand" "=f") 5956 (unspec:SI [(match_operand:DI 1 "even_fpr_operand" "h")] 5957 UNSPEC_MHTOB))] 5958 "TARGET_MEDIA" 5959 "mhtob %1, %0" 5960 [(set_attr "length" "4") 5961 (set_attr "type" "mbhconv")]) 5962 5963 (define_insn "*cond_exec_mhtob" 5964 [(cond_exec 5965 (match_operator 0 "ccr_eqne_operator" 5966 [(match_operand 1 "cr_operand" "C") 5967 (const_int 0)]) 5968 (set (match_operand:SI 2 "fpr_operand" "=f") 5969 (unspec:SI [(match_operand:DI 3 "even_fpr_operand" "h")] 5970 UNSPEC_MHTOB)))] 5971 "TARGET_MEDIA" 5972 "cmhtob %3, %2, %1, %e0" 5973 [(set_attr "length" "4") 5974 (set_attr "type" "mbhconv")]) 5975 5976 ;; Rotate: type "mrot" 5977 5978 (define_expand "mrotli" 5979 [(set (match_operand:SI 0 "fpr_operand" "") 5980 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 5981 (match_operand:SI 2 "uint5_operand" "") 5982 (match_dup 3)] 5983 UNSPEC_MROT))] 5984 "TARGET_MEDIA" 5985 "operands[3] = GEN_INT (FRV_BUILTIN_MROTLI);") 5986 5987 (define_expand "mrotri" 5988 [(set (match_operand:SI 0 "fpr_operand" "") 5989 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 5990 (match_operand:SI 2 "uint5_operand" "") 5991 (match_dup 3)] 5992 UNSPEC_MROT))] 5993 "TARGET_MEDIA" 5994 "operands[3] = GEN_INT (FRV_BUILTIN_MROTRI);") 5995 5996 (define_insn "*mrot" 5997 [(set (match_operand:SI 0 "fpr_operand" "=f") 5998 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 5999 (match_operand:SI 2 "uint5_operand" "I") 6000 (match_operand:SI 3 "const_int_operand" "n")] 6001 UNSPEC_MROT))] 6002 "TARGET_MEDIA" 6003 "* 6004 { 6005 switch (INTVAL (operands[3])) 6006 { 6007 default: break; 6008 case FRV_BUILTIN_MROTLI: return \"mrotli %1, %2, %0\"; 6009 case FRV_BUILTIN_MROTRI: return \"mrotri %1, %2, %0\"; 6010 } 6011 6012 fatal_insn (\"Bad media insn, mrot\", insn); 6013 }" 6014 [(set_attr "length" "4") 6015 (set_attr "type" "mrot")]) 6016 6017 ;; Dual shift halfword: type "msh" 6018 6019 (define_expand "msllhi" 6020 [(set (match_operand:SI 0 "fpr_operand" "") 6021 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 6022 (match_operand:SI 2 "uint4_operand" "") 6023 (match_dup 3)] 6024 UNSPEC_MSHIFT))] 6025 "TARGET_MEDIA" 6026 "operands[3] = GEN_INT (FRV_BUILTIN_MSLLHI);") 6027 6028 (define_expand "msrlhi" 6029 [(set (match_operand:SI 0 "fpr_operand" "") 6030 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 6031 (match_operand:SI 2 "uint4_operand" "") 6032 (match_dup 3)] 6033 UNSPEC_MSHIFT))] 6034 "TARGET_MEDIA" 6035 "operands[3] = GEN_INT (FRV_BUILTIN_MSRLHI);") 6036 6037 (define_expand "msrahi" 6038 [(set (match_operand:SI 0 "fpr_operand" "") 6039 (unspec:SI [(match_operand:SI 1 "fpr_operand" "") 6040 (match_operand:SI 2 "uint4_operand" "") 6041 (match_dup 3)] 6042 UNSPEC_MSHIFT))] 6043 "TARGET_MEDIA" 6044 "operands[3] = GEN_INT (FRV_BUILTIN_MSRAHI);") 6045 6046 (define_insn "*mshift" 6047 [(set (match_operand:SI 0 "fpr_operand" "=f") 6048 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6049 (match_operand:SI 2 "uint4_operand" "I") 6050 (match_operand:SI 3 "const_int_operand" "n")] 6051 UNSPEC_MSHIFT))] 6052 "TARGET_MEDIA" 6053 "* 6054 { 6055 switch (INTVAL (operands[3])) 6056 { 6057 default: break; 6058 case FRV_BUILTIN_MSLLHI: return \"msllhi %1, %2, %0\"; 6059 case FRV_BUILTIN_MSRLHI: return \"msrlhi %1, %2, %0\"; 6060 case FRV_BUILTIN_MSRAHI: return \"msrahi %1, %2, %0\"; 6061 } 6062 6063 fatal_insn (\"Bad media insn, mshift\", insn); 6064 }" 6065 [(set_attr "length" "4") 6066 (set_attr "type" "mshift")]) 6067 6068 ;; Expand halfword to word: type "mexpdhw" 6069 6070 (define_insn "mexpdhw" 6071 [(set (match_operand:SI 0 "fpr_operand" "=f") 6072 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6073 (match_operand:SI 2 "uint1_operand" "I")] 6074 UNSPEC_MEXPDHW))] 6075 "TARGET_MEDIA" 6076 "mexpdhw %1, %2, %0" 6077 [(set_attr "length" "4") 6078 (set_attr "type" "mexpdhw")]) 6079 6080 (define_insn "*cond_exec_mexpdhw" 6081 [(cond_exec 6082 (match_operator 0 "ccr_eqne_operator" 6083 [(match_operand 1 "cr_operand" "C") 6084 (const_int 0)]) 6085 (set (match_operand:SI 2 "fpr_operand" "=f") 6086 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f") 6087 (match_operand:SI 4 "uint1_operand" "I")] 6088 UNSPEC_MEXPDHW)))] 6089 "TARGET_MEDIA" 6090 "cmexpdhw %3, %4, %2, %1, %e0" 6091 [(set_attr "length" "4") 6092 (set_attr "type" "mexpdhw")]) 6093 6094 ;; Expand halfword to double: type "mexpdhd" 6095 6096 (define_insn "mexpdhd" 6097 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 6098 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6099 (match_operand:SI 2 "uint1_operand" "I")] 6100 UNSPEC_MEXPDHD))] 6101 "TARGET_MEDIA" 6102 "mexpdhd %1, %2, %0" 6103 [(set_attr "length" "4") 6104 (set_attr "type" "mexpdhd")]) 6105 6106 (define_insn "*cond_exec_mexpdhd" 6107 [(cond_exec 6108 (match_operator 0 "ccr_eqne_operator" 6109 [(match_operand 1 "cr_operand" "C") 6110 (const_int 0)]) 6111 (set (match_operand:DI 2 "even_fpr_operand" "=h") 6112 (unspec:DI [(match_operand:SI 3 "fpr_operand" "f") 6113 (match_operand:SI 4 "uint1_operand" "I")] 6114 UNSPEC_MEXPDHD)))] 6115 "TARGET_MEDIA" 6116 "cmexpdhd %3, %4, %2, %1, %e0" 6117 [(set_attr "length" "4") 6118 (set_attr "type" "mexpdhd")]) 6119 6120 ;; FR cut: type "mwcut" 6121 6122 (define_insn "mwcut" 6123 [(set (match_operand:SI 0 "fpr_operand" "=f") 6124 (unspec:SI [(match_operand:DI 1 "fpr_operand" "f") 6125 (match_operand:SI 2 "fpr_or_int6_operand" "fI")] 6126 UNSPEC_MWCUT))] 6127 "TARGET_MEDIA" 6128 "mwcut%i2 %1, %2, %0" 6129 [(set_attr "length" "4") 6130 (set_attr "type" "mwcut")]) 6131 6132 ;; Dual multiplication (halfword): type "mmulh" 6133 6134 (define_expand "mmulhs" 6135 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6136 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6137 (match_operand:SI 2 "fpr_operand" "f") 6138 (match_dup 4)] 6139 UNSPEC_MMULH)) 6140 (set (match_operand:HI 3 "accg_operand" "=B") 6141 (unspec:HI [(const_int 0)] UNSPEC_MMULH))])] 6142 "TARGET_MEDIA" 6143 "operands[4] = GEN_INT (FRV_BUILTIN_MMULHS);") 6144 6145 (define_expand "mmulhu" 6146 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6147 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6148 (match_operand:SI 2 "fpr_operand" "f") 6149 (match_dup 4)] 6150 UNSPEC_MMULH)) 6151 (set (match_operand:HI 3 "accg_operand" "=B") 6152 (unspec:HI [(const_int 0)] UNSPEC_MMULH))])] 6153 "TARGET_MEDIA" 6154 "operands[4] = GEN_INT (FRV_BUILTIN_MMULHU);") 6155 6156 (define_insn "*mmulh" 6157 [(set (match_operand:DI 0 "even_acc_operand" "=b") 6158 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6159 (match_operand:SI 2 "fpr_operand" "f") 6160 (match_operand:SI 3 "const_int_operand" "n")] 6161 UNSPEC_MMULH)) 6162 (set (match_operand:HI 4 "accg_operand" "=B") 6163 (unspec:HI [(const_int 0)] UNSPEC_MMULH))] 6164 "TARGET_MEDIA" 6165 "* 6166 { 6167 switch (INTVAL (operands[3])) 6168 { 6169 default: break; 6170 case FRV_BUILTIN_MMULHS: return \"mmulhs %1, %2, %0\"; 6171 case FRV_BUILTIN_MMULHU: return \"mmulhu %1, %2, %0\"; 6172 } 6173 6174 fatal_insn (\"Bad media insn, mmulh\", insn); 6175 }" 6176 [(set_attr "length" "4") 6177 (set_attr "type" "mmulh")]) 6178 6179 (define_insn "*cond_exec_mmulh" 6180 [(cond_exec 6181 (match_operator 0 "ccr_eqne_operator" 6182 [(match_operand 1 "cr_operand" "C") 6183 (const_int 0)]) 6184 (parallel [(set (match_operand:DI 2 "even_acc_operand" "=b") 6185 (unspec:DI [(match_operand:SI 3 "fpr_operand" "f") 6186 (match_operand:SI 4 "fpr_operand" "f") 6187 (match_operand:SI 5 "const_int_operand" "n")] 6188 UNSPEC_MMULH)) 6189 (set (match_operand:HI 6 "accg_operand" "=B") 6190 (unspec:HI [(const_int 0)] UNSPEC_MMULH))]))] 6191 "TARGET_MEDIA" 6192 "* 6193 { 6194 switch (INTVAL (operands[5])) 6195 { 6196 default: break; 6197 case FRV_BUILTIN_MMULHS: return \"cmmulhs %3, %4, %2, %1, %e0\"; 6198 case FRV_BUILTIN_MMULHU: return \"cmmulhu %3, %4, %2, %1, %e0\"; 6199 } 6200 6201 fatal_insn (\"Bad media insn, cond_exec_mmulh\", insn); 6202 }" 6203 [(set_attr "length" "4") 6204 (set_attr "type" "mmulh")]) 6205 6206 ;; Dual cross multiplication (halfword): type "mmulxh" 6207 6208 (define_expand "mmulxhs" 6209 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6210 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6211 (match_operand:SI 2 "fpr_operand" "f") 6212 (match_dup 4)] 6213 UNSPEC_MMULXH)) 6214 (set (match_operand:HI 3 "accg_operand" "=B") 6215 (unspec:HI [(const_int 0)] UNSPEC_MMULXH))])] 6216 "TARGET_MEDIA" 6217 "operands[4] = GEN_INT (FRV_BUILTIN_MMULXHS);") 6218 6219 (define_expand "mmulxhu" 6220 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6221 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6222 (match_operand:SI 2 "fpr_operand" "f") 6223 (match_dup 4)] 6224 UNSPEC_MMULXH)) 6225 (set (match_operand:HI 3 "accg_operand" "=B") 6226 (unspec:HI [(const_int 0)] UNSPEC_MMULXH))])] 6227 "TARGET_MEDIA" 6228 "operands[4] = GEN_INT (FRV_BUILTIN_MMULXHU);") 6229 6230 (define_insn "*mmulxh" 6231 [(set (match_operand:DI 0 "even_acc_operand" "=b") 6232 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f") 6233 (match_operand:SI 2 "fpr_operand" "f") 6234 (match_operand:SI 3 "const_int_operand" "n")] 6235 UNSPEC_MMULXH)) 6236 (set (match_operand:HI 4 "accg_operand" "=B") 6237 (unspec:HI [(const_int 0)] UNSPEC_MMULXH))] 6238 "TARGET_MEDIA" 6239 "* 6240 { 6241 switch (INTVAL (operands[3])) 6242 { 6243 default: break; 6244 case FRV_BUILTIN_MMULXHS: return \"mmulxhs %1, %2, %0\"; 6245 case FRV_BUILTIN_MMULXHU: return \"mmulxhu %1, %2, %0\"; 6246 } 6247 6248 fatal_insn (\"Bad media insn, mmulxh\", insn); 6249 }" 6250 [(set_attr "length" "4") 6251 (set_attr "type" "mmulxh")]) 6252 6253 ;; Dual product-sum (halfword): type "mmach" 6254 6255 (define_expand "mmachs" 6256 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b") 6257 (unspec:DI [(match_dup 0) 6258 (match_operand:SI 1 "fpr_operand" "f") 6259 (match_operand:SI 2 "fpr_operand" "f") 6260 (match_operand:HI 3 "accg_operand" "+B") 6261 (match_dup 4)] 6262 UNSPEC_MMACH)) 6263 (set (match_dup 3) 6264 (unspec:HI [(const_int 0)] UNSPEC_MMACH))])] 6265 "TARGET_MEDIA" 6266 "operands[4] = GEN_INT (FRV_BUILTIN_MMACHS);") 6267 6268 (define_expand "mmachu" 6269 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b") 6270 (unspec:DI [(match_dup 0) 6271 (match_operand:SI 1 "fpr_operand" "f") 6272 (match_operand:SI 2 "fpr_operand" "f") 6273 (match_operand:HI 3 "accg_operand" "+B") 6274 (match_dup 4)] 6275 UNSPEC_MMACH)) 6276 (set (match_dup 3) 6277 (unspec:HI [(const_int 0)] UNSPEC_MMACH))])] 6278 "TARGET_MEDIA" 6279 "operands[4] = GEN_INT (FRV_BUILTIN_MMACHU);") 6280 6281 (define_insn "*mmach" 6282 [(set (match_operand:DI 0 "even_acc_operand" "+b") 6283 (unspec:DI [(match_dup 0) 6284 (match_operand:SI 1 "fpr_operand" "f") 6285 (match_operand:SI 2 "fpr_operand" "f") 6286 (match_operand:HI 3 "accg_operand" "+B") 6287 (match_operand:SI 4 "const_int_operand" "n")] 6288 UNSPEC_MMACH)) 6289 (set (match_dup 3) (unspec:HI [(const_int 0)] UNSPEC_MMACH))] 6290 "TARGET_MEDIA" 6291 "* 6292 { 6293 switch (INTVAL (operands[4])) 6294 { 6295 default: break; 6296 case FRV_BUILTIN_MMACHS: return \"mmachs %1, %2, %0\"; 6297 case FRV_BUILTIN_MMACHU: return \"mmachu %1, %2, %0\"; 6298 } 6299 6300 fatal_insn (\"Bad media insn, mmach\", insn); 6301 }" 6302 [(set_attr "length" "4") 6303 (set_attr "type" "mmach")]) 6304 6305 (define_insn "*cond_exec_mmach" 6306 [(cond_exec 6307 (match_operator 0 "ccr_eqne_operator" 6308 [(match_operand 1 "cr_operand" "C") 6309 (const_int 0)]) 6310 (parallel [(set (match_operand:DI 2 "even_acc_operand" "+b") 6311 (unspec:DI [(match_dup 2) 6312 (match_operand:SI 3 "fpr_operand" "f") 6313 (match_operand:SI 4 "fpr_operand" "f") 6314 (match_operand:HI 5 "accg_operand" "+B") 6315 (match_operand:SI 6 "const_int_operand" "n")] 6316 UNSPEC_MMACH)) 6317 (set (match_dup 5) 6318 (unspec:HI [(const_int 0)] UNSPEC_MMACH))]))] 6319 "TARGET_MEDIA" 6320 "* 6321 { 6322 switch (INTVAL (operands[6])) 6323 { 6324 default: break; 6325 case FRV_BUILTIN_MMACHS: return \"cmmachs %3, %4, %2, %1, %e0\"; 6326 case FRV_BUILTIN_MMACHU: return \"cmmachu %3, %4, %2, %1, %e0\"; 6327 } 6328 6329 fatal_insn (\"Bad media insn, cond_exec_mmach\", insn); 6330 }" 6331 [(set_attr "length" "4") 6332 (set_attr "type" "mmach")]) 6333 6334 ;; Dual product-difference: type "mmrdh" 6335 6336 (define_expand "mmrdhs" 6337 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b") 6338 (unspec:DI [(match_dup 0) 6339 (match_operand:SI 1 "fpr_operand" "f") 6340 (match_operand:SI 2 "fpr_operand" "f") 6341 (match_operand:HI 3 "accg_operand" "+B") 6342 (match_dup 4)] 6343 UNSPEC_MMRDH)) 6344 (set (match_dup 3) 6345 (unspec:HI [(const_int 0)] UNSPEC_MMRDH))])] 6346 "TARGET_MEDIA" 6347 "operands[4] = GEN_INT (FRV_BUILTIN_MMRDHS);") 6348 6349 (define_expand "mmrdhu" 6350 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b") 6351 (unspec:DI [(match_dup 0) 6352 (match_operand:SI 1 "fpr_operand" "f") 6353 (match_operand:SI 2 "fpr_operand" "f") 6354 (match_operand:HI 3 "accg_operand" "+B") 6355 (match_dup 4)] 6356 UNSPEC_MMRDH)) 6357 (set (match_dup 3) 6358 (unspec:HI [(const_int 0)] UNSPEC_MMRDH))])] 6359 "TARGET_MEDIA" 6360 "operands[4] = GEN_INT (FRV_BUILTIN_MMRDHU);") 6361 6362 (define_insn "*mmrdh" 6363 [(set (match_operand:DI 0 "even_acc_operand" "+b") 6364 (unspec:DI [(match_dup 0) 6365 (match_operand:SI 1 "fpr_operand" "f") 6366 (match_operand:SI 2 "fpr_operand" "f") 6367 (match_operand:HI 3 "accg_operand" "+B") 6368 (match_operand:SI 4 "const_int_operand" "n")] 6369 UNSPEC_MMRDH)) 6370 (set (match_dup 3) 6371 (unspec:HI [(const_int 0)] UNSPEC_MMRDH))] 6372 "TARGET_MEDIA" 6373 "* 6374 { 6375 switch (INTVAL (operands[4])) 6376 { 6377 default: break; 6378 case FRV_BUILTIN_MMRDHS: return \"mmrdhs %1, %2, %0\"; 6379 case FRV_BUILTIN_MMRDHU: return \"mmrdhu %1, %2, %0\"; 6380 } 6381 6382 fatal_insn (\"Bad media insn, mrdh\", insn); 6383 }" 6384 [(set_attr "length" "4") 6385 (set_attr "type" "mmrdh")]) 6386 6387 ;; Quad multiply (halfword): type "mqmulh" 6388 6389 (define_expand "mqmulhs" 6390 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 6391 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h") 6392 (match_operand:DI 2 "even_fpr_operand" "h") 6393 (match_dup 4)] 6394 UNSPEC_MQMULH)) 6395 (set (match_operand:V4QI 3 "accg_operand" "=B") 6396 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))])] 6397 "TARGET_MEDIA" 6398 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULHS);") 6399 6400 (define_expand "mqmulhu" 6401 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 6402 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h") 6403 (match_operand:DI 2 "even_fpr_operand" "h") 6404 (match_dup 4)] 6405 UNSPEC_MQMULH)) 6406 (set (match_operand:V4QI 3 "accg_operand" "=B") 6407 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))])] 6408 "TARGET_MEDIA" 6409 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULHU);") 6410 6411 (define_insn "*mqmulh" 6412 [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 6413 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h") 6414 (match_operand:DI 2 "even_fpr_operand" "h") 6415 (match_operand:SI 3 "const_int_operand" "n")] 6416 UNSPEC_MQMULH)) 6417 (set (match_operand:V4QI 4 "accg_operand" "=B") 6418 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))] 6419 "TARGET_MEDIA" 6420 "* 6421 { 6422 switch (INTVAL (operands[3])) 6423 { 6424 default: break; 6425 case FRV_BUILTIN_MQMULHS: return \"mqmulhs %1, %2, %0\"; 6426 case FRV_BUILTIN_MQMULHU: return \"mqmulhu %1, %2, %0\"; 6427 } 6428 6429 fatal_insn (\"Bad media insn, mqmulh\", insn); 6430 }" 6431 [(set_attr "length" "4") 6432 (set_attr "type" "mqmulh")]) 6433 6434 (define_insn "*cond_exec_mqmulh" 6435 [(cond_exec 6436 (match_operator 0 "ccr_eqne_operator" 6437 [(match_operand 1 "cr_operand" "C") 6438 (const_int 0)]) 6439 (parallel [(set (match_operand:V4SI 2 "quad_acc_operand" "=A") 6440 (unspec:V4SI [(match_operand:DI 3 "even_fpr_operand" "h") 6441 (match_operand:DI 4 "even_fpr_operand" "h") 6442 (match_operand:SI 5 "const_int_operand" "n")] 6443 UNSPEC_MQMULH)) 6444 (set (match_operand:V4QI 6 "accg_operand" "=B") 6445 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))]))] 6446 "TARGET_MEDIA" 6447 "* 6448 { 6449 switch (INTVAL (operands[5])) 6450 { 6451 default: break; 6452 case FRV_BUILTIN_MQMULHS: return \"cmqmulhs %3, %4, %2, %1, %e0\"; 6453 case FRV_BUILTIN_MQMULHU: return \"cmqmulhu %3, %4, %2, %1, %e0\"; 6454 } 6455 6456 fatal_insn (\"Bad media insn, cond_exec_mqmulh\", insn); 6457 }" 6458 [(set_attr "length" "4") 6459 (set_attr "type" "mqmulh")]) 6460 6461 ;; Quad cross multiply (halfword): type "mqmulxh" 6462 6463 (define_expand "mqmulxhs" 6464 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 6465 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h") 6466 (match_operand:DI 2 "even_fpr_operand" "h") 6467 (match_dup 4)] 6468 UNSPEC_MQMULXH)) 6469 (set (match_operand:V4QI 3 "accg_operand" "=B") 6470 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULXH))])] 6471 "TARGET_MEDIA" 6472 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULXHS);") 6473 6474 (define_expand "mqmulxhu" 6475 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 6476 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h") 6477 (match_operand:DI 2 "even_fpr_operand" "h") 6478 (match_dup 4)] 6479 UNSPEC_MQMULXH)) 6480 (set (match_operand:V4QI 3 "accg_operand" "=B") 6481 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULXH))])] 6482 "TARGET_MEDIA" 6483 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULXHU);") 6484 6485 (define_insn "*mqmulxh" 6486 [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 6487 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h") 6488 (match_operand:DI 2 "even_fpr_operand" "h") 6489 (match_operand:SI 3 "const_int_operand" "n")] 6490 UNSPEC_MQMULXH)) 6491 (set (match_operand:V4QI 4 "accg_operand" "=B") 6492 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULXH))] 6493 "TARGET_MEDIA" 6494 "* 6495 { 6496 switch (INTVAL (operands[3])) 6497 { 6498 default: break; 6499 case FRV_BUILTIN_MQMULXHS: return \"mqmulxhs %1, %2, %0\"; 6500 case FRV_BUILTIN_MQMULXHU: return \"mqmulxhu %1, %2, %0\"; 6501 } 6502 6503 fatal_insn (\"Bad media insn, mqmulxh\", insn); 6504 }" 6505 [(set_attr "length" "4") 6506 (set_attr "type" "mqmulxh")]) 6507 6508 ;; Quad product-sum (halfword): type "mqmach" 6509 6510 (define_expand "mqmachs" 6511 [(parallel [(set (match_operand:V4SI 0 "even_acc_operand" "+A") 6512 (unspec:V4SI [(match_dup 0) 6513 (match_operand:DI 1 "even_fpr_operand" "h") 6514 (match_operand:DI 2 "even_fpr_operand" "h") 6515 (match_operand:V4QI 3 "accg_operand" "+B") 6516 (match_dup 4)] 6517 UNSPEC_MQMACH)) 6518 (set (match_dup 3) 6519 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))])] 6520 "TARGET_MEDIA" 6521 "operands[4] = GEN_INT (FRV_BUILTIN_MQMACHS);") 6522 6523 (define_expand "mqmachu" 6524 [(parallel [(set (match_operand:V4SI 0 "even_acc_operand" "+A") 6525 (unspec:V4SI [(match_dup 0) 6526 (match_operand:DI 1 "even_fpr_operand" "h") 6527 (match_operand:DI 2 "even_fpr_operand" "h") 6528 (match_operand:V4QI 3 "accg_operand" "+B") 6529 (match_dup 4)] 6530 UNSPEC_MQMACH)) 6531 (set (match_dup 3) 6532 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))])] 6533 "TARGET_MEDIA" 6534 "operands[4] = GEN_INT (FRV_BUILTIN_MQMACHU);") 6535 6536 (define_insn "*mqmach" 6537 [(set (match_operand:V4SI 0 "even_acc_operand" "+A") 6538 (unspec:V4SI [(match_dup 0) 6539 (match_operand:DI 1 "even_fpr_operand" "h") 6540 (match_operand:DI 2 "even_fpr_operand" "h") 6541 (match_operand:V4QI 3 "accg_operand" "+B") 6542 (match_operand:SI 4 "const_int_operand" "n")] 6543 UNSPEC_MQMACH)) 6544 (set (match_dup 3) 6545 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))] 6546 "TARGET_MEDIA" 6547 "* 6548 { 6549 switch (INTVAL (operands[4])) 6550 { 6551 default: break; 6552 case FRV_BUILTIN_MQMACHS: return \"mqmachs %1, %2, %0\"; 6553 case FRV_BUILTIN_MQMACHU: return \"mqmachu %1, %2, %0\"; 6554 } 6555 6556 fatal_insn (\"Bad media insn, mqmach\", insn); 6557 }" 6558 [(set_attr "length" "4") 6559 (set_attr "type" "mqmach")]) 6560 6561 (define_insn "*cond_exec_mqmach" 6562 [(cond_exec 6563 (match_operator 0 "ccr_eqne_operator" 6564 [(match_operand 1 "cr_operand" "C") 6565 (const_int 0)]) 6566 (parallel [(set (match_operand:V4SI 2 "even_acc_operand" "+A") 6567 (unspec:V4SI [(match_dup 2) 6568 (match_operand:DI 3 "even_fpr_operand" "h") 6569 (match_operand:DI 4 "even_fpr_operand" "h") 6570 (match_operand:V4QI 5 "accg_operand" "+B") 6571 (match_operand:SI 6 "const_int_operand" "n")] 6572 UNSPEC_MQMACH)) 6573 (set (match_dup 5) 6574 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))]))] 6575 "TARGET_MEDIA" 6576 "* 6577 { 6578 switch (INTVAL (operands[6])) 6579 { 6580 default: break; 6581 case FRV_BUILTIN_MQMACHS: return \"cmqmachs %3, %4, %2, %1, %e0\"; 6582 case FRV_BUILTIN_MQMACHU: return \"cmqmachu %3, %4, %2, %1, %e0\"; 6583 } 6584 6585 fatal_insn (\"Bad media insn, cond_exec_mqmach\", insn); 6586 }" 6587 [(set_attr "length" "4") 6588 (set_attr "type" "mqmach")]) 6589 6590 ;; Dual complex number product-sum (halfword) 6591 6592 (define_expand "mcpxrs" 6593 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a") 6594 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6595 (match_operand:SI 2 "fpr_operand" "f") 6596 (match_dup 4)] 6597 UNSPEC_MCPX)) 6598 (set (match_operand:QI 3 "accg_operand" "=B") 6599 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])] 6600 "TARGET_MEDIA" 6601 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXRS);") 6602 6603 (define_expand "mcpxru" 6604 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a") 6605 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6606 (match_operand:SI 2 "fpr_operand" "f") 6607 (match_dup 4)] 6608 UNSPEC_MCPX)) 6609 (set (match_operand:QI 3 "accg_operand" "=B") 6610 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])] 6611 "TARGET_MEDIA" 6612 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXRU);") 6613 6614 (define_expand "mcpxis" 6615 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a") 6616 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6617 (match_operand:SI 2 "fpr_operand" "f") 6618 (match_dup 4)] 6619 UNSPEC_MCPX)) 6620 (set (match_operand:QI 3 "accg_operand" "=B") 6621 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])] 6622 "TARGET_MEDIA" 6623 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXIS);") 6624 6625 (define_expand "mcpxiu" 6626 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a") 6627 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6628 (match_operand:SI 2 "fpr_operand" "f") 6629 (match_dup 4)] 6630 UNSPEC_MCPX)) 6631 (set (match_operand:QI 3 "accg_operand" "=B") 6632 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])] 6633 "TARGET_MEDIA" 6634 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXIU);") 6635 6636 (define_insn "*mcpx" 6637 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a") 6638 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6639 (match_operand:SI 2 "fpr_operand" "f") 6640 (match_operand:SI 3 "const_int_operand" "n")] 6641 UNSPEC_MCPX)) 6642 (set (match_operand:QI 4 "accg_operand" "=B") 6643 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])] 6644 "TARGET_MEDIA" 6645 "* 6646 { 6647 switch (INTVAL (operands[3])) 6648 { 6649 default: break; 6650 case FRV_BUILTIN_MCPXRS: return \"mcpxrs %1, %2, %0\"; 6651 case FRV_BUILTIN_MCPXRU: return \"mcpxru %1, %2, %0\"; 6652 case FRV_BUILTIN_MCPXIS: return \"mcpxis %1, %2, %0\"; 6653 case FRV_BUILTIN_MCPXIU: return \"mcpxiu %1, %2, %0\"; 6654 } 6655 6656 fatal_insn (\"Bad media insn, mcpx\", insn); 6657 }" 6658 [(set_attr "length" "4") 6659 (set_attr "type" "mcpx")]) 6660 6661 (define_insn "*cond_exec_mcpx" 6662 [(cond_exec 6663 (match_operator 0 "ccr_eqne_operator" 6664 [(match_operand 1 "cr_operand" "C") 6665 (const_int 0)]) 6666 (parallel [(set (match_operand:SI 2 "acc_operand" "=a") 6667 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f") 6668 (match_operand:SI 4 "fpr_operand" "f") 6669 (match_operand:SI 5 "const_int_operand" "n")] 6670 UNSPEC_MCPX)) 6671 (set (match_operand:QI 6 "accg_operand" "=B") 6672 (unspec:QI [(const_int 0)] UNSPEC_MCPX))]))] 6673 "TARGET_MEDIA" 6674 "* 6675 { 6676 switch (INTVAL (operands[5])) 6677 { 6678 default: break; 6679 case FRV_BUILTIN_MCPXRS: return \"cmcpxrs %3, %4, %2, %1, %e0\"; 6680 case FRV_BUILTIN_MCPXRU: return \"cmcpxru %3, %4, %2, %1, %e0\"; 6681 case FRV_BUILTIN_MCPXIS: return \"cmcpxis %3, %4, %2, %1, %e0\"; 6682 case FRV_BUILTIN_MCPXIU: return \"cmcpxiu %3, %4, %2, %1, %e0\"; 6683 } 6684 6685 fatal_insn (\"Bad media insn, cond_exec_mcpx\", insn); 6686 }" 6687 [(set_attr "length" "4") 6688 (set_attr "type" "mcpx")]) 6689 6690 ;; Quad complex number product-sum (halfword): type "mqcpx" 6691 6692 (define_expand "mqcpxrs" 6693 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6694 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f") 6695 (match_operand:DI 2 "fpr_operand" "f") 6696 (match_dup 4)] 6697 UNSPEC_MQCPX)) 6698 (set (match_operand:HI 3 "accg_operand" "=B") 6699 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])] 6700 "TARGET_MEDIA" 6701 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXRS);") 6702 6703 (define_expand "mqcpxru" 6704 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6705 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f") 6706 (match_operand:DI 2 "fpr_operand" "f") 6707 (match_dup 4)] 6708 UNSPEC_MQCPX)) 6709 (set (match_operand:HI 3 "accg_operand" "=B") 6710 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])] 6711 "TARGET_MEDIA" 6712 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXRU);") 6713 6714 (define_expand "mqcpxis" 6715 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6716 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f") 6717 (match_operand:DI 2 "fpr_operand" "f") 6718 (match_dup 4)] 6719 UNSPEC_MQCPX)) 6720 (set (match_operand:HI 3 "accg_operand" "=B") 6721 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])] 6722 "TARGET_MEDIA" 6723 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXIS);") 6724 6725 (define_expand "mqcpxiu" 6726 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b") 6727 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f") 6728 (match_operand:DI 2 "fpr_operand" "f") 6729 (match_dup 4)] 6730 UNSPEC_MQCPX)) 6731 (set (match_operand:HI 3 "accg_operand" "=B") 6732 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])] 6733 "TARGET_MEDIA" 6734 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXIU);") 6735 6736 (define_insn "*mqcpx" 6737 [(set (match_operand:DI 0 "even_acc_operand" "=b") 6738 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f") 6739 (match_operand:DI 2 "fpr_operand" "f") 6740 (match_operand:SI 3 "const_int_operand" "n")] 6741 UNSPEC_MQCPX)) 6742 (set (match_operand:HI 4 "accg_operand" "=B") 6743 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))] 6744 "TARGET_MEDIA" 6745 "* 6746 { 6747 switch (INTVAL (operands[3])) 6748 { 6749 default: break; 6750 case FRV_BUILTIN_MQCPXRS: return \"mqcpxrs %1, %2, %0\"; 6751 case FRV_BUILTIN_MQCPXRU: return \"mqcpxru %1, %2, %0\"; 6752 case FRV_BUILTIN_MQCPXIS: return \"mqcpxis %1, %2, %0\"; 6753 case FRV_BUILTIN_MQCPXIU: return \"mqcpxiu %1, %2, %0\"; 6754 } 6755 6756 fatal_insn (\"Bad media insn, mqcpx\", insn); 6757 }" 6758 [(set_attr "length" "4") 6759 (set_attr "type" "mqcpx")]) 6760 6761 ;; Cut: type "mcut" 6762 6763 (define_expand "mcut" 6764 [(set (match_operand:SI 0 "fpr_operand" "=f") 6765 (unspec:SI [(match_operand:SI 1 "acc_operand" "a") 6766 (match_operand:SI 2 "fpr_or_int6_operand" "fI") 6767 (match_operand:QI 3 "accg_operand" "B") 6768 (match_dup 4)] 6769 UNSPEC_MCUT))] 6770 "TARGET_MEDIA" 6771 "operands[4] = GEN_INT (FRV_BUILTIN_MCUT);") 6772 6773 (define_expand "mcutss" 6774 [(set (match_operand:SI 0 "fpr_operand" "=f") 6775 (unspec:SI [(match_operand:SI 1 "acc_operand" "a") 6776 (match_operand:SI 2 "fpr_or_int6_operand" "fI") 6777 (match_operand:QI 3 "accg_operand" "B") 6778 (match_dup 4)] 6779 UNSPEC_MCUT))] 6780 "TARGET_MEDIA" 6781 "operands[4] = GEN_INT (FRV_BUILTIN_MCUTSS);") 6782 6783 (define_insn "*mcut" 6784 [(set (match_operand:SI 0 "fpr_operand" "=f") 6785 (unspec:SI [(match_operand:SI 1 "acc_operand" "a") 6786 (match_operand:SI 2 "fpr_or_int6_operand" "fI") 6787 (match_operand:QI 3 "accg_operand" "B") 6788 (match_operand:SI 4 "const_int_operand" "n")] 6789 UNSPEC_MCUT))] 6790 "TARGET_MEDIA" 6791 "* 6792 { 6793 switch (INTVAL (operands[4])) 6794 { 6795 default: break; 6796 case FRV_BUILTIN_MCUT: return \"mcut%i2 %1, %2, %0\"; 6797 case FRV_BUILTIN_MCUTSS: return \"mcutss%i2 %1, %2, %0\"; 6798 } 6799 6800 fatal_insn (\"Bad media insn, mcut\", insn); 6801 }" 6802 [(set_attr "length" "4") 6803 (set_attr "type" "mcut")]) 6804 6805 ;; Accumulator read: type "mrdacc" 6806 6807 (define_insn "mrdacc" 6808 [(set (match_operand:SI 0 "fpr_operand" "=f") 6809 (unspec:SI [(match_operand:SI 1 "acc_operand" "a")] UNSPEC_MRDACC))] 6810 "TARGET_MEDIA" 6811 "mrdacc %1, %0" 6812 [(set_attr "length" "4") 6813 (set_attr "type" "mrdacc")]) 6814 6815 (define_insn "mrdaccg" 6816 [(set (match_operand:SI 0 "fpr_operand" "=f") 6817 (unspec:SI [(match_operand:QI 1 "accg_operand" "B")] UNSPEC_MRDACCG))] 6818 "TARGET_MEDIA" 6819 "mrdaccg %1, %0" 6820 [(set_attr "length" "4") 6821 (set_attr "type" "mrdacc")]) 6822 6823 ;; Accumulator write: type "mwtacc" 6824 6825 (define_insn "mwtacc" 6826 [(set (match_operand:SI 0 "acc_operand" "=a") 6827 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MWTACC))] 6828 "TARGET_MEDIA" 6829 "mwtacc %1, %0" 6830 [(set_attr "length" "4") 6831 (set_attr "type" "mwtacc")]) 6832 6833 (define_insn "mwtaccg" 6834 [(set (match_operand:QI 0 "accg_operand" "=B") 6835 (unspec:QI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MWTACCG))] 6836 "TARGET_MEDIA" 6837 "mwtaccg %1, %0" 6838 [(set_attr "length" "4") 6839 (set_attr "type" "mwtacc")]) 6840 6841 ;; Trap: This one executes on the control unit, not the media units. 6842 6843 (define_insn "mtrap" 6844 [(unspec_volatile [(const_int 0)] UNSPEC_MTRAP)] 6845 "TARGET_MEDIA" 6846 "mtrap" 6847 [(set_attr "length" "4") 6848 (set_attr "type" "trap")]) 6849 6850 ;; Clear single accumulator: type "mclracc" 6851 6852 (define_insn "mclracc_internal" 6853 [(set (match_operand:SI 0 "acc_operand" "=a") 6854 (unspec:SI [(const_int 0)] UNSPEC_MCLRACC)) 6855 (set (match_operand:QI 1 "accg_operand" "=B") 6856 (unspec:QI [(const_int 0)] UNSPEC_MCLRACC))] 6857 "TARGET_MEDIA" 6858 "mclracc %0,#0" 6859 [(set_attr "length" "4") 6860 (set_attr "type" "mclracc")]) 6861 6862 (define_expand "mclracc" 6863 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a") 6864 (unspec:SI [(const_int 0)] UNSPEC_MCLRACC)) 6865 (set (match_dup 1) 6866 (unspec:QI [(const_int 0)] UNSPEC_MCLRACC))])] 6867 "TARGET_MEDIA" 6868 " 6869 { 6870 if (GET_CODE (operands[0]) != REG || !ACC_P (REGNO (operands[0]))) 6871 FAIL; 6872 6873 operands[1] = frv_matching_accg_for_acc (operands[0]); 6874 }") 6875 6876 ;; Clear all accumulators: type "mclracca" 6877 6878 (define_insn "mclracca8_internal" 6879 [(set (match_operand:V4SI 0 "quad_acc_operand" "=b") 6880 (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA)) 6881 (set (match_operand:V4SI 1 "quad_acc_operand" "=b") 6882 (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA)) 6883 (set (match_operand:V4QI 2 "accg_operand" "=B") 6884 (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA)) 6885 (set (match_operand:V4QI 3 "accg_operand" "=B") 6886 (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))] 6887 "TARGET_MEDIA && TARGET_ACC_8" 6888 "mclracc acc0,#1" 6889 [(set_attr "length" "4") 6890 (set_attr "type" "mclracca")]) 6891 6892 (define_insn "mclracca4_internal" 6893 [(set (match_operand:V4SI 0 "quad_acc_operand" "=b") 6894 (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA)) 6895 (set (match_operand:V4QI 1 "accg_operand" "=B") 6896 (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))] 6897 "TARGET_MEDIA && TARGET_ACC_4" 6898 "mclracc acc0,#1" 6899 [(set_attr "length" "4") 6900 (set_attr "type" "mclracca")]) 6901 6902 (define_expand "mclracca8" 6903 [(parallel [(set (match_dup 0) (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA)) 6904 (set (match_dup 1) (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA)) 6905 (set (match_dup 2) (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA)) 6906 (set (match_dup 3) (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))])] 6907 "TARGET_MEDIA && TARGET_ACC_8" 6908 " 6909 { 6910 operands[0] = gen_rtx_REG (V4SImode, ACC_FIRST); 6911 operands[1] = gen_rtx_REG (V4SImode, ACC_FIRST + (~3 & ACC_MASK)); 6912 operands[2] = gen_rtx_REG (V4QImode, ACCG_FIRST); 6913 operands[3] = gen_rtx_REG (V4QImode, ACCG_FIRST + (~3 & ACC_MASK)); 6914 }") 6915 6916 (define_expand "mclracca4" 6917 [(parallel [(set (match_dup 0) (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA)) 6918 (set (match_dup 1) (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))])] 6919 "TARGET_MEDIA && TARGET_ACC_4" 6920 " 6921 { 6922 operands[0] = gen_rtx_REG (V4SImode, ACC_FIRST); 6923 operands[1] = gen_rtx_REG (V4QImode, ACCG_FIRST); 6924 }") 6925 6926 (define_insn "mcop1" 6927 [(set (match_operand:SI 0 "fpr_operand" "=f") 6928 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6929 (match_operand:SI 2 "fpr_operand" "f")] UNSPEC_MCOP1))] 6930 "TARGET_MEDIA_REV1" 6931 "mcop1 %1, %2, %0" 6932 [(set_attr "length" "4") 6933 ;; What is the class of the insn ??? 6934 (set_attr "type" "multi")]) 6935 6936 (define_insn "mcop2" 6937 [(set (match_operand:SI 0 "fpr_operand" "=f") 6938 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f") 6939 (match_operand:SI 2 "fpr_operand" "f")] UNSPEC_MCOP2))] 6940 "TARGET_MEDIA_REV1" 6941 "mcop2 %1, %2, %0" 6942 [(set_attr "length" "4") 6943 ;; What is the class of the insn ??? 6944 (set_attr "type" "multi")]) 6945 6946 (define_insn "*mdunpackh_internal" 6947 [(set (match_operand:V4SI 0 "quad_fpr_operand" "=x") 6948 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")] 6949 UNSPEC_MDUNPACKH_INTERNAL))] 6950 "TARGET_MEDIA_REV1" 6951 "mdunpackh %1, %0" 6952 [(set_attr "length" "4") 6953 (set_attr "type" "mdunpackh")]) 6954 6955 (define_insn_and_split "mdunpackh" 6956 [(set (match_operand:V4SI 0 "memory_operand" "=o") 6957 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")] 6958 UNSPEC_MDUNPACKH)) 6959 (clobber (match_scratch:V4SI 2 "=x"))] 6960 "TARGET_MEDIA_REV1" 6961 "#" 6962 "reload_completed" 6963 [(set (match_dup 2) 6964 (unspec:V4SI [(match_dup 1)] UNSPEC_MDUNPACKH_INTERNAL)) 6965 (set (match_dup 3) 6966 (match_dup 4)) 6967 (set (match_dup 5) 6968 (match_dup 6))] 6969 " 6970 { 6971 operands[3] = change_address (operands[0], DImode, NULL_RTX); 6972 operands[4] = gen_rtx_REG (DImode, REGNO (operands[2])); 6973 operands[5] = frv_index_memory (operands[0], DImode, 1); 6974 operands[6] = gen_rtx_REG (DImode, REGNO (operands[2])+2); 6975 }" 6976 [(set_attr "length" "20") 6977 (set_attr "type" "multi")]) 6978 6979 (define_insn "*mbtohe_internal" 6980 [(set (match_operand:V4SI 0 "quad_fpr_operand" "=x") 6981 (unspec:V4SI [(match_operand:SI 1 "fpr_operand" "f")] 6982 UNSPEC_MBTOHE_INTERNAL))] 6983 "TARGET_MEDIA_REV1" 6984 "mbtohe %1, %0" 6985 [(set_attr "length" "4") 6986 (set_attr "type" "mbhconve")]) 6987 6988 (define_insn_and_split "mbtohe" 6989 [(set (match_operand:V4SI 0 "memory_operand" "=o") 6990 (unspec:V4SI [(match_operand:SI 1 "fpr_operand" "f")] 6991 UNSPEC_MBTOHE)) 6992 (clobber (match_scratch:V4SI 2 "=x"))] 6993 "TARGET_MEDIA_REV1" 6994 "#" 6995 "reload_completed" 6996 [(set (match_dup 2) 6997 (unspec:V4SI [(match_dup 1)] UNSPEC_MBTOHE_INTERNAL)) 6998 (set (match_dup 3) 6999 (match_dup 4)) 7000 (set (match_dup 5) 7001 (match_dup 6))] 7002 " 7003 { 7004 operands[3] = change_address (operands[0], DImode, NULL_RTX); 7005 operands[4] = gen_rtx_REG (DImode, REGNO (operands[2])); 7006 operands[5] = frv_index_memory (operands[0], DImode, 1); 7007 operands[6] = gen_rtx_REG (DImode, REGNO (operands[2])+2); 7008 }" 7009 [(set_attr "length" "20") 7010 (set_attr "type" "multi")]) 7011 7012 ;; Quad product-sum (halfword) instructions only found on the FR400. 7013 ;; type "mqmach" 7014 7015 (define_expand "mqxmachs" 7016 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "") 7017 (unspec:V4SI [(match_dup 0) 7018 (match_operand:DI 1 "even_fpr_operand" "") 7019 (match_operand:DI 2 "even_fpr_operand" "") 7020 (match_operand:V4QI 3 "accg_operand" "") 7021 (match_dup 4)] 7022 UNSPEC_MQMACH2)) 7023 (set (match_dup 3) 7024 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))])] 7025 "TARGET_MEDIA_REV2" 7026 "operands[4] = GEN_INT (FRV_BUILTIN_MQXMACHS);") 7027 7028 (define_expand "mqxmacxhs" 7029 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "") 7030 (unspec:V4SI [(match_dup 0) 7031 (match_operand:DI 1 "even_fpr_operand" "") 7032 (match_operand:DI 2 "even_fpr_operand" "") 7033 (match_operand:V4QI 3 "accg_operand" "") 7034 (match_dup 4)] 7035 UNSPEC_MQMACH2)) 7036 (set (match_dup 3) 7037 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))])] 7038 "TARGET_MEDIA_REV2" 7039 "operands[4] = GEN_INT (FRV_BUILTIN_MQXMACXHS);") 7040 7041 (define_expand "mqmacxhs" 7042 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "") 7043 (unspec:V4SI [(match_dup 0) 7044 (match_operand:DI 1 "even_fpr_operand" "") 7045 (match_operand:DI 2 "even_fpr_operand" "") 7046 (match_operand:V4QI 3 "accg_operand" "") 7047 (match_dup 4)] 7048 UNSPEC_MQMACH2)) 7049 (set (match_dup 3) 7050 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))])] 7051 "TARGET_MEDIA_REV2" 7052 "operands[4] = GEN_INT (FRV_BUILTIN_MQMACXHS);") 7053 7054 (define_insn "*mqmach2" 7055 [(set (match_operand:V4SI 0 "quad_acc_operand" "+A") 7056 (unspec:V4SI [(match_dup 0) 7057 (match_operand:DI 1 "even_fpr_operand" "h") 7058 (match_operand:DI 2 "even_fpr_operand" "h") 7059 (match_operand:V4QI 3 "accg_operand" "+B") 7060 (match_operand:SI 4 "const_int_operand" "n")] 7061 UNSPEC_MQMACH2)) 7062 (set (match_dup 3) 7063 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))] 7064 "TARGET_MEDIA_REV2" 7065 "* 7066 { 7067 switch (INTVAL (operands[4])) 7068 { 7069 default: break; 7070 case FRV_BUILTIN_MQXMACHS: return \"mqxmachs %1, %2, %0\"; 7071 case FRV_BUILTIN_MQXMACXHS: return \"mqxmacxhs %1, %2, %0\"; 7072 case FRV_BUILTIN_MQMACXHS: return \"mqmacxhs %1, %2, %0\"; 7073 } 7074 7075 fatal_insn (\"Bad media insn, mqmach2\", insn); 7076 }" 7077 [(set_attr "length" "4") 7078 (set_attr "type" "mqmach")]) 7079 7080 ;; Accumulator addition/subtraction: type "maddacc" 7081 7082 (define_expand "maddaccs" 7083 [(parallel [(set (match_operand:SI 0 "acc_operand" "") 7084 (unspec:SI [(match_operand:DI 1 "even_acc_operand" "")] 7085 UNSPEC_MADDACC)) 7086 (set (match_operand:QI 2 "accg_operand" "") 7087 (unspec:QI [(match_operand:HI 3 "accg_operand" "") 7088 (match_dup 4)] 7089 UNSPEC_MADDACC))])] 7090 "TARGET_MEDIA_REV2" 7091 "operands[4] = GEN_INT (FRV_BUILTIN_MADDACCS);") 7092 7093 (define_expand "msubaccs" 7094 [(parallel [(set (match_operand:SI 0 "acc_operand" "") 7095 (unspec:SI [(match_operand:DI 1 "even_acc_operand" "")] 7096 UNSPEC_MADDACC)) 7097 (set (match_operand:QI 2 "accg_operand" "") 7098 (unspec:QI [(match_operand:HI 3 "accg_operand" "") 7099 (match_dup 4)] 7100 UNSPEC_MADDACC))])] 7101 "TARGET_MEDIA_REV2" 7102 "operands[4] = GEN_INT (FRV_BUILTIN_MSUBACCS);") 7103 7104 (define_insn "masaccs" 7105 [(set (match_operand:DI 0 "even_acc_operand" "=b") 7106 (unspec:DI [(match_operand:DI 1 "even_acc_operand" "b")] 7107 UNSPEC_MASACCS)) 7108 (set (match_operand:HI 2 "accg_operand" "=B") 7109 (unspec:HI [(match_operand:HI 3 "accg_operand" "B")] 7110 UNSPEC_MASACCS))] 7111 "TARGET_MEDIA_REV2" 7112 "masaccs %1, %0" 7113 [(set_attr "length" "4") 7114 (set_attr "type" "maddacc")]) 7115 7116 (define_insn "*maddacc" 7117 [(set (match_operand:SI 0 "acc_operand" "=a") 7118 (unspec:SI [(match_operand:DI 1 "even_acc_operand" "b")] 7119 UNSPEC_MADDACC)) 7120 (set (match_operand:QI 2 "accg_operand" "=B") 7121 (unspec:QI [(match_operand:HI 3 "accg_operand" "B") 7122 (match_operand:SI 4 "const_int_operand" "n")] 7123 UNSPEC_MADDACC))] 7124 "TARGET_MEDIA_REV2" 7125 "* 7126 { 7127 switch (INTVAL (operands[4])) 7128 { 7129 default: break; 7130 case FRV_BUILTIN_MADDACCS: return \"maddaccs %1, %0\"; 7131 case FRV_BUILTIN_MSUBACCS: return \"msubaccs %1, %0\"; 7132 } 7133 7134 fatal_insn (\"Bad media insn, maddacc\", insn); 7135 }" 7136 [(set_attr "length" "4") 7137 (set_attr "type" "maddacc")]) 7138 7139 ;; Dual accumulator addition/subtraction: type "mdaddacc" 7140 7141 (define_expand "mdaddaccs" 7142 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "") 7143 (unspec:DI [(match_operand:V4SI 1 "quad_acc_operand" "")] 7144 UNSPEC_MDADDACC)) 7145 (set (match_operand:HI 2 "accg_operand" "") 7146 (unspec:HI [(match_operand:V4QI 3 "accg_operand" "") 7147 (match_dup 4)] 7148 UNSPEC_MDADDACC))])] 7149 "TARGET_MEDIA_REV2" 7150 "operands[4] = GEN_INT (FRV_BUILTIN_MDADDACCS);") 7151 7152 (define_expand "mdsubaccs" 7153 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "") 7154 (unspec:DI [(match_operand:V4SI 1 "quad_acc_operand" "")] 7155 UNSPEC_MDADDACC)) 7156 (set (match_operand:HI 2 "accg_operand" "") 7157 (unspec:HI [(match_operand:V4QI 3 "accg_operand" "") 7158 (match_dup 4)] 7159 UNSPEC_MDADDACC))])] 7160 "TARGET_MEDIA_REV2" 7161 "operands[4] = GEN_INT (FRV_BUILTIN_MDSUBACCS);") 7162 7163 (define_insn "mdasaccs" 7164 [(set (match_operand:V4SI 0 "quad_acc_operand" "=A") 7165 (unspec:V4SI [(match_operand:V4SI 1 "quad_acc_operand" "A")] 7166 UNSPEC_MDASACCS)) 7167 (set (match_operand:V4QI 2 "accg_operand" "=B") 7168 (unspec:V4QI [(match_operand:V4QI 3 "accg_operand" "B")] 7169 UNSPEC_MDASACCS))] 7170 "TARGET_MEDIA_REV2" 7171 "mdasaccs %1, %0" 7172 [(set_attr "length" "4") 7173 (set_attr "type" "mdaddacc")]) 7174 7175 (define_insn "*mdaddacc" 7176 [(set (match_operand:DI 0 "even_acc_operand" "=b") 7177 (unspec:DI [(match_operand:V4SI 1 "quad_acc_operand" "A")] 7178 UNSPEC_MDADDACC)) 7179 (set (match_operand:HI 2 "accg_operand" "=B") 7180 (unspec:HI [(match_operand:V4QI 3 "accg_operand" "B") 7181 (match_operand:SI 4 "const_int_operand" "n")] 7182 UNSPEC_MDADDACC))] 7183 "TARGET_MEDIA_REV2" 7184 "* 7185 { 7186 switch (INTVAL (operands[4])) 7187 { 7188 default: break; 7189 case FRV_BUILTIN_MDADDACCS: return \"mdaddaccs %1, %0\"; 7190 case FRV_BUILTIN_MDSUBACCS: return \"mdsubaccs %1, %0\"; 7191 } 7192 7193 fatal_insn (\"Bad media insn, mdaddacc\", insn); 7194 }" 7195 [(set_attr "length" "4") 7196 (set_attr "type" "mdaddacc")]) 7197 7198 ;; Dual absolute (halfword): type "mabsh" 7199 7200 (define_insn "mabshs" 7201 [(set (match_operand:SI 0 "fpr_operand" "=f") 7202 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MABSHS))] 7203 "TARGET_MEDIA_REV2" 7204 "mabshs %1, %0" 7205 [(set_attr "length" "4") 7206 (set_attr "type" "mabsh")]) 7207 7208 ;; Dual rotate: type "mdrot" 7209 7210 (define_insn "mdrotli" 7211 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7212 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 7213 (match_operand:SI 2 "uint5_operand" "I")] 7214 UNSPEC_MDROTLI))] 7215 "TARGET_MEDIA_REV2" 7216 "mdrotli %1, %2, %0" 7217 [(set_attr "length" "4") 7218 (set_attr "type" "mdrot")]) 7219 7220 ;; Dual coupling (concatenation): type "mcpl" 7221 7222 (define_insn "mcplhi" 7223 [(set (match_operand:SI 0 "fpr_operand" "=f") 7224 (unspec:SI [(match_operand:DI 1 "fpr_operand" "h") 7225 (match_operand:SI 2 "uint4_operand" "I")] 7226 UNSPEC_MCPLHI))] 7227 "TARGET_MEDIA_REV2" 7228 "mcplhi %1, %2, %0" 7229 [(set_attr "length" "4") 7230 (set_attr "type" "mcpl")]) 7231 7232 (define_insn "mcpli" 7233 [(set (match_operand:SI 0 "fpr_operand" "=f") 7234 (unspec:SI [(match_operand:DI 1 "fpr_operand" "h") 7235 (match_operand:SI 2 "uint5_operand" "I")] 7236 UNSPEC_MCPLI))] 7237 "TARGET_MEDIA_REV2" 7238 "mcpli %1, %2, %0" 7239 [(set_attr "length" "4") 7240 (set_attr "type" "mcpl")]) 7241 7242 ;; Dual cut: type "mdcut" 7243 7244 (define_insn "mdcutssi" 7245 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7246 (unspec:DI [(match_operand:DI 1 "even_acc_operand" "b") 7247 (match_operand:SI 2 "int6_operand" "I") 7248 (match_operand:HI 3 "accg_operand" "B")] 7249 UNSPEC_MDCUTSSI))] 7250 "TARGET_MEDIA_REV2" 7251 "mdcutssi %1, %2, %0" 7252 [(set_attr "length" "4") 7253 (set_attr "type" "mdcut")]) 7254 7255 ;; Quad saturate (halfword): type "mqsath" 7256 7257 (define_insn "mqsaths" 7258 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7259 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 7260 (match_operand:DI 2 "even_fpr_operand" "h")] 7261 UNSPEC_MQSATHS))] 7262 "TARGET_MEDIA_REV2" 7263 "mqsaths %1, %2, %0" 7264 [(set_attr "length" "4") 7265 (set_attr "type" "mqsath")]) 7266 7267 ;; Quad limit instructions: type "mqlimh" 7268 7269 (define_insn "mqlclrhs" 7270 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7271 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 7272 (match_operand:DI 2 "even_fpr_operand" "h")] 7273 UNSPEC_MQLCLRHS))] 7274 "TARGET_MEDIA_FR450" 7275 "mqlclrhs %1, %2, %0" 7276 [(set_attr "length" "4") 7277 (set_attr "type" "mqlimh")]) 7278 7279 (define_insn "mqlmths" 7280 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7281 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 7282 (match_operand:DI 2 "even_fpr_operand" "h")] 7283 UNSPEC_MQLMTHS))] 7284 "TARGET_MEDIA_FR450" 7285 "mqlmths %1, %2, %0" 7286 [(set_attr "length" "4") 7287 (set_attr "type" "mqlimh")]) 7288 7289 (define_insn "mqsllhi" 7290 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7291 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 7292 (match_operand:SI 2 "int6_operand" "I")] 7293 UNSPEC_MQSLLHI))] 7294 "TARGET_MEDIA_FR450" 7295 "mqsllhi %1, %2, %0" 7296 [(set_attr "length" "4") 7297 (set_attr "type" "mqshift")]) 7298 7299 (define_insn "mqsrahi" 7300 [(set (match_operand:DI 0 "even_fpr_operand" "=h") 7301 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h") 7302 (match_operand:SI 2 "int6_operand" "I")] 7303 UNSPEC_MQSRAHI))] 7304 "TARGET_MEDIA_FR450" 7305 "mqsrahi %1, %2, %0" 7306 [(set_attr "length" "4") 7307 (set_attr "type" "mqshift")]) 7308 7309 ;; Set hi/lo instructions: type "mset" 7310 7311 (define_insn "mhsetlos" 7312 [(set (match_operand:SI 0 "fpr_operand" "=f") 7313 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0") 7314 (match_operand:SI 2 "int12_operand" "NOP")] 7315 UNSPEC_MHSETLOS))] 7316 "TARGET_MEDIA_REV2" 7317 "mhsetlos %2, %0" 7318 [(set_attr "length" "4") 7319 (set_attr "type" "mset")]) 7320 7321 (define_insn "mhsetloh" 7322 [(set (match_operand:SI 0 "fpr_operand" "=f") 7323 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0") 7324 (match_operand:SI 2 "int5_operand" "I")] 7325 UNSPEC_MHSETLOH))] 7326 "TARGET_MEDIA_REV2" 7327 "mhsetloh %2, %0" 7328 [(set_attr "length" "4") 7329 (set_attr "type" "mset")]) 7330 7331 (define_insn "mhsethis" 7332 [(set (match_operand:SI 0 "fpr_operand" "=f") 7333 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0") 7334 (match_operand:SI 2 "int12_operand" "NOP")] 7335 UNSPEC_MHSETHIS))] 7336 "TARGET_MEDIA_REV2" 7337 "mhsethis %2, %0" 7338 [(set_attr "length" "4") 7339 (set_attr "type" "mset")]) 7340 7341 (define_insn "mhsethih" 7342 [(set (match_operand:SI 0 "fpr_operand" "=f") 7343 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0") 7344 (match_operand:SI 2 "int5_operand" "I")] 7345 UNSPEC_MHSETHIH))] 7346 "TARGET_MEDIA_REV2" 7347 "mhsethih %2, %0" 7348 [(set_attr "length" "4") 7349 (set_attr "type" "mset")]) 7350 7351 (define_insn "mhdsets" 7352 [(set (match_operand:SI 0 "fpr_operand" "=f") 7353 (unspec:SI [(match_operand:SI 1 "int12_operand" "NOP")] 7354 UNSPEC_MHDSETS))] 7355 "TARGET_MEDIA_REV2" 7356 "mhdsets %1, %0" 7357 [(set_attr "length" "4") 7358 (set_attr "type" "mset")]) 7359 7360 (define_insn "mhdseth" 7361 [(set (match_operand:SI 0 "fpr_operand" "=f") 7362 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0") 7363 (match_operand:SI 2 "int5_operand" "I")] 7364 UNSPEC_MHDSETH))] 7365 "TARGET_MEDIA_REV2" 7366 "mhdseth %2, %0" 7367 [(set_attr "length" "4") 7368 (set_attr "type" "mset")]) 7369 7370 ;;----------------------------------------------------------------------------- 7371 7372 (define_expand "symGOT2reg" 7373 [(match_operand:SI 0 "" "") 7374 (match_operand:SI 1 "" "") 7375 (match_operand:SI 2 "" "") 7376 (match_operand:SI 3 "" "")] 7377 "" 7378 " 7379 { 7380 rtx_insn *insn = emit_insn (gen_symGOT2reg_i (operands[0], operands[1], 7381 operands[2], operands[3])); 7382 7383 MEM_READONLY_P (SET_SRC (PATTERN (insn))) = 1; 7384 7385 set_unique_reg_note (insn, REG_EQUAL, operands[1]); 7386 7387 DONE; 7388 }") 7389 7390 (define_expand "symGOT2reg_i" 7391 [(set (match_operand:SI 0 "" "") 7392 (mem:SI (plus:SI (match_operand:SI 2 "" "") 7393 (const:SI (unspec:SI [(match_operand:SI 1 "" "") 7394 (match_operand:SI 3 "" "")] 7395 UNSPEC_GOT)))))] 7396 "" 7397 "") 7398 7399 (define_expand "symGOT2reg_hilo" 7400 [(set (match_dup 6) 7401 (high:SI (const:SI (unspec:SI [(match_operand:SI 1 "" "") 7402 (match_dup 4)] UNSPEC_GOT)))) 7403 (set (match_dup 5) 7404 (lo_sum:SI (match_dup 6) 7405 (const:SI (unspec:SI [(match_dup 1) 7406 (match_operand:SI 3 "" "")] 7407 UNSPEC_GOT)))) 7408 (set (match_operand:SI 0 "" "") 7409 (mem:SI (plus:SI (match_dup 5) 7410 (match_operand:SI 2 "" "")))) 7411 ] 7412 "" 7413 " 7414 { 7415 if (!can_create_pseudo_p ()) 7416 operands[6] = operands[5] = operands[0]; 7417 else 7418 { 7419 operands[6] = gen_reg_rtx (SImode); 7420 operands[5] = gen_reg_rtx (SImode); 7421 } 7422 7423 operands[4] = GEN_INT (INTVAL (operands[3]) + 1); 7424 operands[3] = GEN_INT (INTVAL (operands[3]) + 2); 7425 }") 7426 7427 (define_expand "symGOTOFF2reg_hilo" 7428 [(set (match_dup 6) 7429 (high:SI (const:SI (unspec:SI [(match_operand:SI 1 "" "") 7430 (match_dup 4)] UNSPEC_GOT)))) 7431 (set (match_dup 5) 7432 (lo_sum:SI (match_dup 6) 7433 (const:SI (unspec:SI [(match_dup 1) 7434 (match_operand:SI 3 "" "")] 7435 UNSPEC_GOT)))) 7436 (set (match_operand:SI 0 "" "") 7437 (plus:SI (match_dup 5) 7438 (match_operand:SI 2 "" ""))) 7439 ] 7440 "" 7441 " 7442 { 7443 if (!can_create_pseudo_p ()) 7444 operands[6] = operands[5] = operands[0]; 7445 else 7446 { 7447 operands[6] = gen_reg_rtx (SImode); 7448 operands[5] = gen_reg_rtx (SImode); 7449 } 7450 7451 operands[4] = GEN_INT (INTVAL (operands[3]) + 1); 7452 operands[3] = GEN_INT (INTVAL (operands[3]) + 2); 7453 }") 7454 7455 (define_expand "symGOTOFF2reg" 7456 [(match_operand:SI 0 "" "") 7457 (match_operand:SI 1 "" "") 7458 (match_operand:SI 2 "" "") 7459 (match_operand:SI 3 "" "")] 7460 "" 7461 " 7462 { 7463 rtx_insn *insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1], 7464 operands[2], operands[3])); 7465 7466 set_unique_reg_note (insn, REG_EQUAL, operands[1]); 7467 7468 DONE; 7469 }") 7470 7471 (define_expand "symGOTOFF2reg_i" 7472 [(set (match_operand:SI 0 "" "") 7473 (plus:SI (match_operand:SI 2 "" "") 7474 (const:SI 7475 (unspec:SI [(match_operand:SI 1 "" "") 7476 (match_operand:SI 3 "" "")] 7477 UNSPEC_GOT))))] 7478 "" 7479 "") 7480 7481 (define_expand "symGPREL2reg" 7482 [(match_operand:SI 0 "" "") 7483 (match_operand:SI 1 "" "") 7484 (match_operand:SI 2 "" "") 7485 (match_operand:SI 3 "" "") 7486 (match_dup 4)] 7487 "" 7488 " 7489 { 7490 if (!can_create_pseudo_p ()) 7491 operands[4] = operands[0]; 7492 else 7493 operands[4] = gen_reg_rtx (SImode); 7494 7495 emit_insn (frv_gen_GPsym2reg (operands[4], operands[2])); 7496 7497 rtx_insn *insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1], 7498 operands[4], operands[3])); 7499 7500 set_unique_reg_note (insn, REG_EQUAL, operands[1]); 7501 7502 DONE; 7503 }") 7504 7505 (define_expand "symGPREL2reg_hilo" 7506 [(match_operand:SI 0 "" "") 7507 (match_operand:SI 1 "" "") 7508 (match_operand:SI 2 "" "") 7509 (match_operand:SI 3 "" "") 7510 (match_dup 4)] 7511 "" 7512 " 7513 { 7514 if (!can_create_pseudo_p ()) 7515 { 7516 emit_insn (gen_symGOT2reg (operands[0], operands[1], operands[2], 7517 GEN_INT (R_FRV_GOT12))); 7518 DONE; 7519 } 7520 7521 operands[4] = gen_reg_rtx (SImode); 7522 7523 emit_insn (frv_gen_GPsym2reg (operands[4], operands[2])); 7524 7525 rtx_insn *insn = emit_insn (gen_symGOTOFF2reg_hilo (operands[0], operands[1], 7526 operands[4], operands[3])); 7527 7528 set_unique_reg_note (insn, REG_EQUAL, operands[1]); 7529 7530 DONE; 7531 }") 7532 7534 (define_constants 7535 [ 7536 (UNSPEC_SMUL 154) 7537 (UNSPEC_UMUL 155) 7538 (UNSPEC_SMU 156) 7539 (UNSPEC_ADDSS 157) 7540 (UNSPEC_SUBSS 158) 7541 (UNSPEC_SLASS 159) 7542 (UNSPEC_SCAN 160) 7543 (UNSPEC_INTSS 161) 7544 (UNSPEC_SCUTSS 162) 7545 (UNSPEC_PREFETCH0 163) 7546 (UNSPEC_PREFETCH 164) 7547 (UNSPEC_IACCreadll 165) 7548 (UNSPEC_IACCreadl 166) 7549 (UNSPEC_IACCsetll 167) 7550 (UNSPEC_IACCsetl 168) 7551 (UNSPEC_SMASS 169) 7552 (UNSPEC_SMSSS 170) 7553 (UNSPEC_IMUL 171) 7554 7555 (IACC0_REG 171) 7556 ]) 7557 7558 (define_insn "smul" 7559 [(set (match_operand:DI 0 "integer_register_operand" "=d") 7560 (unspec:DI [(match_operand:SI 1 "integer_register_operand" "d") 7561 (match_operand:SI 2 "integer_register_operand" "d")] 7562 UNSPEC_SMUL))] 7563 "" 7564 "smul %1, %2, %0" 7565 [(set_attr "length" "4") 7566 (set_attr "type" "mul")]) 7567 7568 (define_insn "umul" 7569 [(set (match_operand:DI 0 "integer_register_operand" "=d") 7570 (unspec:DI [(match_operand:SI 1 "integer_register_operand" "d") 7571 (match_operand:SI 2 "integer_register_operand" "d")] 7572 UNSPEC_UMUL))] 7573 "" 7574 "umul %1, %2, %0" 7575 [(set_attr "length" "4") 7576 (set_attr "type" "mul")]) 7577 7578 (define_insn "smass" 7579 [(set (reg:DI IACC0_REG) 7580 (unspec:DI [(match_operand:SI 0 "integer_register_operand" "d") 7581 (match_operand:SI 1 "integer_register_operand" "d") 7582 (reg:DI IACC0_REG)] 7583 UNSPEC_SMASS))] 7584 "TARGET_FR405_BUILTINS" 7585 "smass %1, %0" 7586 [(set_attr "length" "4") 7587 (set_attr "type" "macc")]) 7588 7589 (define_insn "smsss" 7590 [(set (reg:DI IACC0_REG) 7591 (unspec:DI [(match_operand:SI 0 "integer_register_operand" "d") 7592 (match_operand:SI 1 "integer_register_operand" "d") 7593 (reg:DI IACC0_REG)] 7594 UNSPEC_SMSSS))] 7595 "TARGET_FR405_BUILTINS" 7596 "smsss %1, %0" 7597 [(set_attr "length" "4") 7598 (set_attr "type" "macc")]) 7599 7600 (define_insn "smu" 7601 [(set (reg:DI IACC0_REG) 7602 (unspec:DI [(match_operand:SI 0 "integer_register_operand" "d") 7603 (match_operand:SI 1 "integer_register_operand" "d")] 7604 UNSPEC_SMU))] 7605 "TARGET_FR405_BUILTINS" 7606 "smu %1, %0" 7607 [(set_attr "length" "4") 7608 (set_attr "type" "macc")]) 7609 7610 (define_insn "addss" 7611 [(set (match_operand:SI 0 "integer_register_operand" "=d") 7612 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d") 7613 (match_operand:SI 2 "integer_register_operand" "d")] 7614 UNSPEC_ADDSS))] 7615 "TARGET_FR405_BUILTINS" 7616 "addss %1, %2, %0" 7617 [(set_attr "length" "4") 7618 (set_attr "type" "int")]) 7619 7620 (define_insn "subss" 7621 [(set (match_operand:SI 0 "integer_register_operand" "=d") 7622 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d") 7623 (match_operand:SI 2 "integer_register_operand" "d")] 7624 UNSPEC_SUBSS))] 7625 "TARGET_FR405_BUILTINS" 7626 "subss %1, %2, %0" 7627 [(set_attr "length" "4") 7628 (set_attr "type" "int")]) 7629 7630 (define_insn "slass" 7631 [(set (match_operand:SI 0 "integer_register_operand" "=d") 7632 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d") 7633 (match_operand:SI 2 "integer_register_operand" "d")] 7634 UNSPEC_SLASS))] 7635 "TARGET_FR405_BUILTINS" 7636 "slass %1, %2, %0" 7637 [(set_attr "length" "4") 7638 (set_attr "type" "int")]) 7639 7640 (define_insn "scan" 7641 [(set (match_operand:SI 0 "integer_register_operand" "=d") 7642 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d") 7643 (match_operand:SI 2 "integer_register_operand" "d")] 7644 UNSPEC_SCAN))] 7645 "" 7646 "scan %1, %2, %0" 7647 [(set_attr "length" "4") 7648 (set_attr "type" "scan")]) 7649 7650 (define_insn "scutss" 7651 [(set (match_operand:SI 0 "integer_register_operand" "=d") 7652 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d") 7653 (reg:DI IACC0_REG)] 7654 UNSPEC_SCUTSS))] 7655 "TARGET_FR405_BUILTINS" 7656 "scutss %1,%0" 7657 [(set_attr "length" "4") 7658 (set_attr "type" "cut")]) 7659 7660 (define_insn "frv_prefetch0" 7661 [(prefetch (unspec:SI [(match_operand:SI 0 "register_operand" "r")] 7662 UNSPEC_PREFETCH0) 7663 (const_int 0) 7664 (const_int 0))] 7665 "" 7666 "dcpl %0, gr0, #0" 7667 [(set_attr "length" "4")]) 7668 7669 (define_insn "frv_prefetch" 7670 [(prefetch (unspec:SI [(match_operand:SI 0 "register_operand" "r")] 7671 UNSPEC_PREFETCH) 7672 (const_int 0) 7673 (const_int 0))] 7674 "TARGET_FR500_FR550_BUILTINS" 7675 "nop.p\\n\\tnldub @(%0, gr0), gr0" 7676 [(set_attr "length" "8")]) 7677 7678 ;; TLS patterns 7679 7680 (define_insn "call_gettlsoff" 7681 [(set (match_operand:SI 0 "register_operand" "=D09") 7682 (unspec:SI 7683 [(match_operand:SI 1 "symbolic_operand" "")] 7684 UNSPEC_GETTLSOFF)) 7685 (clobber (reg:SI GR8_REG)) 7686 (clobber (reg:SI LRREG)) 7687 (use (match_operand:SI 2 "register_operand" "D15"))] 7688 "HAVE_AS_TLS" 7689 "call #gettlsoff(%a1)" 7690 [(set_attr "length" "4") 7691 (set_attr "type" "load_or_call")]) 7692 7693 ;; We have to expand this like a libcall (it sort of actually is) 7694 ;; because otherwise sched may move, for example, an insn that sets up 7695 ;; GR8 for a subsequence call before the *tls_indirect_call insn, and 7696 ;; then reload won't be able to fix things up. 7697 (define_expand "tls_indirect_call" 7698 [(set (reg:DI GR8_REG) 7699 (match_operand:DI 2 "register_operand" "")) 7700 (parallel 7701 [(set (reg:SI GR9_REG) 7702 (unspec:SI 7703 [(match_operand:SI 1 "symbolic_operand" "") 7704 (reg:DI GR8_REG)] 7705 UNSPEC_TLS_INDIRECT_CALL)) 7706 (clobber (reg:SI GR8_REG)) 7707 (clobber (reg:SI LRREG)) 7708 (use (match_operand:SI 3 "register_operand" ""))]) 7709 (set (match_operand:SI 0 "register_operand" "") 7710 (reg:SI GR9_REG))] 7711 "HAVE_AS_TLS") 7712 7713 (define_insn "*tls_indirect_call" 7714 [(set (reg:SI GR9_REG) 7715 (unspec:SI 7716 [(match_operand:SI 0 "symbolic_operand" "") 7717 (reg:DI GR8_REG)] 7718 UNSPEC_TLS_INDIRECT_CALL)) 7719 (clobber (reg:SI GR8_REG)) 7720 (clobber (reg:SI LRREG)) 7721 ;; If there was a way to represent the fact that we don't need GR9 7722 ;; or GR15 to be set before this instruction (it could be in 7723 ;; parallel), we could use it here. This change wouldn't apply to 7724 ;; call_gettlsoff, thought, since the linker may turn the latter 7725 ;; into ldi @(gr15,offset),gr9. 7726 (use (match_operand:SI 1 "register_operand" "D15"))] 7727 "HAVE_AS_TLS" 7728 "calll #gettlsoff(%a0)@(gr8,gr0)" 7729 [(set_attr "length" "4") 7730 (set_attr "type" "jumpl")]) 7731 7732 (define_insn "tls_load_gottlsoff12" 7733 [(set (match_operand:SI 0 "register_operand" "=r") 7734 (unspec:SI 7735 [(match_operand:SI 1 "symbolic_operand" "") 7736 (match_operand:SI 2 "register_operand" "r")] 7737 UNSPEC_TLS_LOAD_GOTTLSOFF12))] 7738 "HAVE_AS_TLS" 7739 "ldi @(%2, #gottlsoff12(%1)), %0" 7740 [(set_attr "length" "4")]) 7741 7742 (define_expand "tlsoff_hilo" 7743 [(set (match_operand:SI 0 "register_operand" "=r") 7744 (high:SI (const:SI (unspec:SI 7745 [(match_operand:SI 1 "symbolic_operand" "") 7746 (match_operand:SI 2 "immediate_operand" "n")] 7747 UNSPEC_GOT)))) 7748 (set (match_dup 0) 7749 (lo_sum:SI (match_dup 0) 7750 (const:SI (unspec:SI [(match_dup 1) 7751 (match_dup 3)] UNSPEC_GOT))))] 7752 "" 7753 " 7754 { 7755 operands[3] = GEN_INT (INTVAL (operands[2]) + 1); 7756 }") 7757 7758 ;; Just like movdi_ldd, but with relaxation annotations. 7759 (define_insn "tls_tlsdesc_ldd" 7760 [(set (match_operand:DI 0 "register_operand" "=r") 7761 (unspec:DI [(mem:DI (unspec:SI 7762 [(match_operand:SI 1 "register_operand" "r") 7763 (match_operand:SI 2 "register_operand" "r") 7764 (match_operand:SI 3 "symbolic_operand" "")] 7765 UNSPEC_TLS_TLSDESC_LDD_AUX))] 7766 UNSPEC_TLS_TLSDESC_LDD))] 7767 "" 7768 "ldd #tlsdesc(%a3)@(%1,%2), %0" 7769 [(set_attr "length" "4") 7770 (set_attr "type" "gload")]) 7771 7772 (define_insn "tls_tlsoff_ld" 7773 [(set (match_operand:SI 0 "register_operand" "=r") 7774 (mem:SI (unspec:SI 7775 [(match_operand:SI 1 "register_operand" "r") 7776 (match_operand:SI 2 "register_operand" "r") 7777 (match_operand:SI 3 "symbolic_operand" "")] 7778 UNSPEC_TLS_TLSOFF_LD)))] 7779 "" 7780 "ld #tlsoff(%a3)@(%1,%2), %0" 7781 [(set_attr "length" "4") 7782 (set_attr "type" "gload")]) 7783 7784 (define_insn "tls_lddi" 7785 [(set (match_operand:DI 0 "register_operand" "=r") 7786 (unspec:DI [(match_operand:SI 1 "symbolic_operand" "") 7787 (match_operand:SI 2 "register_operand" "d")] 7788 UNSPEC_TLS_LDDI))] 7789 "" 7790 "lddi @(%2, #gottlsdesc12(%a1)), %0" 7791 [(set_attr "length" "4") 7792 (set_attr "type" "gload")]) 7793