| 1 |
;;- Machine description for GNU compiler, Motorola 68000 Version |
| 2 |
;; Copyright (C) 1987-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
;; This file is part of GCC. |
| 5 |
|
| 6 |
;; GCC is free software; you can redistribute it and/or modify |
| 7 |
;; it under the terms of the GNU General Public License as published by |
| 8 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 9 |
;; any later version. |
| 10 |
|
| 11 |
;; GCC is distributed in the hope that it will be useful, |
| 12 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
;; GNU General Public License for more details. |
| 15 |
|
| 16 |
;; You should have received a copy of the GNU General Public License |
| 17 |
;; along with GCC; see the file COPYING3. If not see |
| 18 |
;; <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
;;- Information about MCF5200 port. |
| 21 |
|
| 22 |
;;- The MCF5200 "ColdFire" architecture is a reduced version of the |
| 23 |
;;- 68k ISA. Differences include reduced support for byte and word |
| 24 |
;;- operands and the removal of BCD, bitfield, rotate, and integer |
| 25 |
;;- divide instructions. The TARGET_COLDFIRE flag turns the use of the |
| 26 |
;;- removed opcodes and addressing modes off. |
| 27 |
;;- |
| 28 |
|
| 29 |
|
| 30 |
;;- instruction definitions |
| 31 |
|
| 32 |
;;- @@The original PO technology requires these to be ordered by speed, |
| 33 |
;;- @@ so that assigner will pick the fastest. |
| 34 |
|
| 35 |
;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. |
| 36 |
|
| 37 |
;;- When naming insn's (operand 0 of define_insn) be careful about using |
| 38 |
;;- names from other targets machine descriptions. |
| 39 |
|
| 40 |
;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code |
| 41 |
;;- updates for most instructions. |
| 42 |
|
| 43 |
;;- Operand classes for the register allocator: |
| 44 |
;;- 'a' one of the address registers can be used. |
| 45 |
;;- 'd' one of the data registers can be used. |
| 46 |
;;- 'f' one of the m68881/fpu registers can be used |
| 47 |
;;- 'r' either a data or an address register can be used. |
| 48 |
|
| 49 |
;;- Immediate Floating point operator constraints |
| 50 |
;;- 'G' a floating point constant that is *NOT* one of the standard |
| 51 |
;; 68881 constant values (to force calling output_move_const_double |
| 52 |
;; to get it from rom if it is a 68881 constant). |
| 53 |
;; |
| 54 |
;; See the functions standard_XXX_constant_p in output-m68k.c for more |
| 55 |
;; info. |
| 56 |
|
| 57 |
;;- Immediate integer operand constraints: |
| 58 |
;;- 'I' 1 .. 8 |
| 59 |
;;- 'J' -32768 .. 32767 |
| 60 |
;;- 'K' all integers EXCEPT -128 .. 127 |
| 61 |
;;- 'L' -8 .. -1 |
| 62 |
;;- 'M' all integers EXCEPT -256 .. 255 |
| 63 |
;;- 'N' 24 .. 31 |
| 64 |
;;- 'O' 16 |
| 65 |
;;- 'P' 8 .. 15 |
| 66 |
|
| 67 |
;;- Assembler specs: |
| 68 |
;;- "%." size separator ("." or "") move%.l d0,d1 |
| 69 |
;;- "%-" push operand "sp@-" move%.l d0,%- |
| 70 |
;;- "%+" pop operand "sp@+" move%.l d0,%+ |
| 71 |
;;- "%@" top of stack "sp@" move%.l d0,%@ |
| 72 |
;;- "%!" fpcr register |
| 73 |
;;- "%$" single-precision fp specifier ("s" or "") f%$add.x fp0,fp1 |
| 74 |
;;- "%&" double-precision fp specifier ("d" or "") f%&add.x fp0,fp1 |
| 75 |
|
| 76 |
;;- Information about 68040 port. |
| 77 |
|
| 78 |
;;- The 68040 executes all 68030 and 68881/2 instructions, but some must |
| 79 |
;;- be emulated in software by the OS. It is faster to avoid these |
| 80 |
;;- instructions and issue a library call rather than trapping into |
| 81 |
;;- the kernel. The affected instructions are fintrz and fscale. The |
| 82 |
;;- TUNE_68040 flag turns the use of the opcodes off. |
| 83 |
|
| 84 |
;;- The '040 also implements a set of new floating-point instructions |
| 85 |
;;- which specify the rounding precision in the opcode. This finally |
| 86 |
;;- permit the 68k series to be truly IEEE compliant, and solves all |
| 87 |
;;- issues of excess precision accumulating in the extended registers. |
| 88 |
;;- By default, GCC does not use these instructions, since such code will |
| 89 |
;;- not run on an '030. To use these instructions, use the -m68040-only |
| 90 |
;;- switch. |
| 91 |
|
| 92 |
;;- These new instructions aren't directly in the md. They are brought |
| 93 |
;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather |
| 94 |
;;- than "". |
| 95 |
|
| 96 |
;;- Information about 68060 port. |
| 97 |
|
| 98 |
;;- The 68060 executes all 68030 and 68881/2 instructions, but some must |
| 99 |
;;- be emulated in software by the OS. It is faster to avoid these |
| 100 |
;;- instructions and issue a library call rather than trapping into |
| 101 |
;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq; |
| 102 |
;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq; and |
| 103 |
;;- fscale. The TUNE_68060 flag turns the use of the opcodes off. |
| 104 |
|
| 105 |
;;- Some of these insn's are composites of several m68000 op codes. |
| 106 |
;;- The assembler (or final @@??) insures that the appropriate one is |
| 107 |
;;- selected. |
| 108 |
|
| 109 |
;; UNSPEC usage: |
| 110 |
|
| 111 |
(define_constants |
| 112 |
[(UNSPEC_SIN 1) |
| 113 |
(UNSPEC_COS 2) |
| 114 |
(UNSPEC_GOT 3) |
| 115 |
(UNSPEC_IB 4) |
| 116 |
(UNSPEC_TIE 5) |
| 117 |
(UNSPEC_RELOC16 6) |
| 118 |
(UNSPEC_RELOC32 7) |
| 119 |
]) |
| 120 |
|
| 121 |
;; UNSPEC_VOLATILE usage: |
| 122 |
|
| 123 |
(define_constants |
| 124 |
[(UNSPECV_BLOCKAGE 0) |
| 125 |
(UNSPECV_CAS_1 1) |
| 126 |
(UNSPECV_CAS_2 2) |
| 127 |
(UNSPECV_TAS_1 3) |
| 128 |
(UNSPECV_TAS_2 4) |
| 129 |
]) |
| 130 |
|
| 131 |
;; Registers by name. |
| 132 |
(define_constants |
| 133 |
[(D0_REG 0) |
| 134 |
(A0_REG 8) |
| 135 |
(A1_REG 9) |
| 136 |
(PIC_REG 13) |
| 137 |
(A6_REG 14) |
| 138 |
(SP_REG 15) |
| 139 |
(FP0_REG 16) |
| 140 |
]) |
| 141 |
|
| 142 |
(include "predicates.md") |
| 143 |
(include "constraints.md") |
| 144 |
|
| 145 |
;; :::::::::::::::::::: |
| 146 |
;; :: |
| 147 |
;; :: Attributes |
| 148 |
;; :: |
| 149 |
;; :::::::::::::::::::: |
| 150 |
|
| 151 |
;; Processor type. |
| 152 |
(define_attr "cpu" "cfv1, cfv2, cfv3, cfv4, unknown" |
| 153 |
(const (symbol_ref "m68k_sched_cpu"))) |
| 154 |
|
| 155 |
;; MAC type. |
| 156 |
(define_attr "mac" "no, cf_mac, cf_emac" |
| 157 |
(const (symbol_ref "m68k_sched_mac"))) |
| 158 |
|
| 159 |
;; Instruction type for use in scheduling description. |
| 160 |
;; _l and _w suffixes indicate size of the operands of instruction. |
| 161 |
;; alu - usual arithmetic or logic instruction. |
| 162 |
;; aluq - arithmetic or logic instruction which has a quick immediate (the one |
| 163 |
;; that is encoded in the instruction word) for its Y operand. |
| 164 |
;; alux - Arithmetic instruction that uses carry bit (e.g., addx and subx). |
| 165 |
;; bcc - conditional branch. |
| 166 |
;; bitr - bit operation that only updates flags. |
| 167 |
;; bitrw - bit operation that updates flags and output operand. |
| 168 |
;; bra, bsr, clr, cmp, div, ext - corresponding instruction. |
| 169 |
;; falu, fbcc, fcmp, fdiv, fmove, fmul, fneg, fsqrt, ftst - corresponding |
| 170 |
;; instruction. |
| 171 |
;; ib - fake instruction to subscribe slots in ColdFire V1,V2,V3 instruction |
| 172 |
;; buffer. |
| 173 |
;; ignore - fake instruction. |
| 174 |
;; jmp, jsr, lea, link, mov3q, move, moveq, mul - corresponding instruction. |
| 175 |
;; mvsz - mvs or mvz instruction. |
| 176 |
;; neg, nop, pea, rts, scc - corresponding instruction. |
| 177 |
;; shift - arithmetic or logical shift instruction. |
| 178 |
;; trap, tst, unlk - corresponding instruction. |
| 179 |
(define_attr "type" |
| 180 |
"alu_l,aluq_l,alux_l,bcc,bitr,bitrw,bra,bsr,clr,clr_l,cmp,cmp_l, |
| 181 |
div_w,div_l,ext, |
| 182 |
falu,fbcc,fcmp,fdiv,fmove,fmul,fneg,fsqrt,ftst, |
| 183 |
ib,ignore, |
| 184 |
jmp,jsr,lea,link,mov3q_l,move,move_l,moveq_l,mul_w,mul_l,mvsz,neg_l,nop, |
| 185 |
pea,rts,scc,shift, |
| 186 |
trap,tst,tst_l,unlk, |
| 187 |
unknown" |
| 188 |
(const_string "unknown")) |
| 189 |
|
| 190 |
;; Index of the X or Y operand in recog_data.operand[]. |
| 191 |
;; Should be used only within opx_type and opy_type. |
| 192 |
(define_attr "opx" "" (const_int 0)) |
| 193 |
(define_attr "opy" "" (const_int 1)) |
| 194 |
|
| 195 |
;; Type of the Y operand. |
| 196 |
;; See m68k.cc: enum attr_op_type. |
| 197 |
(define_attr "opy_type" |
| 198 |
"none,Rn,FPn,mem1,mem234,mem5,mem6,mem7,imm_q,imm_w,imm_l" |
| 199 |
(cond [(eq_attr "type" "ext,fbcc,ftst,neg_l,bcc,bra,bsr,clr,clr_l,ib,ignore, |
| 200 |
jmp,jsr,nop,rts,scc,trap,tst,tst_l, |
| 201 |
unlk,unknown") (const_string "none") |
| 202 |
(eq_attr "type" "lea,pea") |
| 203 |
(symbol_ref "m68k_sched_attr_opy_type (insn, 1)")] |
| 204 |
(symbol_ref "m68k_sched_attr_opy_type (insn, 0)"))) |
| 205 |
|
| 206 |
;; Type of the X operand. |
| 207 |
;; See m68k.cc: enum attr_op_type. |
| 208 |
(define_attr "opx_type" |
| 209 |
"none,Rn,FPn,mem1,mem234,mem5,mem6,mem7,imm_q,imm_w,imm_l" |
| 210 |
(cond [(eq_attr "type" "ib,ignore,nop,rts,trap,unlk, |
| 211 |
unknown") (const_string "none") |
| 212 |
(eq_attr "type" "pea") (const_string "mem1") |
| 213 |
(eq_attr "type" "jmp,jsr") |
| 214 |
(symbol_ref "m68k_sched_attr_opx_type (insn, 1)")] |
| 215 |
(symbol_ref "m68k_sched_attr_opx_type (insn, 0)"))) |
| 216 |
|
| 217 |
;; Access to the X operand: none, read, write, read/write, unknown. |
| 218 |
;; Access to the Y operand is either none (if opy_type is none) |
| 219 |
;; or read otherwise. |
| 220 |
(define_attr "opx_access" "none, r, w, rw" |
| 221 |
(cond [(eq_attr "type" "ib,ignore,nop,rts,trap,unlk, |
| 222 |
unknown") (const_string "none") |
| 223 |
(eq_attr "type" "bcc,bra,bsr,bitr,cmp,cmp_l,fbcc,fcmp,ftst, |
| 224 |
jmp,jsr,tst,tst_l") (const_string "r") |
| 225 |
(eq_attr "type" "clr,clr_l,fneg,fmove,lea, |
| 226 |
mov3q_l,move,move_l,moveq_l,mvsz, |
| 227 |
pea,scc") (const_string "w") |
| 228 |
(eq_attr "type" "alu_l,aluq_l,alux_l,bitrw,div_w,div_l,ext, |
| 229 |
falu,fdiv,fmul,fsqrt,link,mul_w,mul_l, |
| 230 |
neg_l,shift") (const_string "rw")] |
| 231 |
;; Should never be used. |
| 232 |
(symbol_ref "(gcc_unreachable (), OPX_ACCESS_NONE)"))) |
| 233 |
|
| 234 |
;; Memory accesses of the insn. |
| 235 |
;; 00 - no memory references |
| 236 |
;; 10 - memory is read |
| 237 |
;; i0 - indexed memory is read |
| 238 |
;; 01 - memory is written |
| 239 |
;; 0i - indexed memory is written |
| 240 |
;; 11 - memory is read, memory is written |
| 241 |
;; i1 - indexed memory is read, memory is written |
| 242 |
;; 1i - memory is read, indexed memory is written |
| 243 |
(define_attr "op_mem" "00, 10, i0, 01, 0i, 11, i1, 1i" |
| 244 |
(symbol_ref "m68k_sched_attr_op_mem (insn)")) |
| 245 |
|
| 246 |
;; Instruction size in words. |
| 247 |
(define_attr "size" "1,2,3" |
| 248 |
(symbol_ref "m68k_sched_attr_size (insn)")) |
| 249 |
|
| 250 |
;; Alternative is OK for ColdFire. |
| 251 |
(define_attr "ok_for_coldfire" "yes,no" (const_string "yes")) |
| 252 |
|
| 253 |
;; Instruction sets flags predictably to allow a following comparison to be |
| 254 |
;; elided. |
| 255 |
;; "no" means we should clear all flag state. "yes" means the destination |
| 256 |
;; register is valid. "noov" is similar but does not allow tests that rely |
| 257 |
;; on the overflow flag. "unchanged" means the instruction does not set the |
| 258 |
;; flags (but we should still verify none of the remembered operands are |
| 259 |
;; clobbered). "move" is a special case for which we remember both the |
| 260 |
;; destination and the source. "set" is another special case where the |
| 261 |
;; instruction pattern already performs the update and no more work is |
| 262 |
;; required in postscan_insn. |
| 263 |
(define_attr "flags_valid" "no,yes,set,noov,move,unchanged" (const_string "no")) |
| 264 |
|
| 265 |
;; Define 'enabled' attribute. |
| 266 |
(define_attr "enabled" "" |
| 267 |
(cond [(and (match_test "TARGET_COLDFIRE") |
| 268 |
(eq_attr "ok_for_coldfire" "no")) |
| 269 |
(const_int 0)] |
| 270 |
(const_int 1))) |
| 271 |
|
| 272 |
;; Mode macros for integer operations. |
| 273 |
(define_mode_iterator I [QI HI SI]) |
| 274 |
(define_mode_attr sz [(QI "%.b") (HI "%.w") (SI "%.l")]) |
| 275 |
|
| 276 |
;; Mode macros for floating point operations. |
| 277 |
;; Valid floating point modes |
| 278 |
(define_mode_iterator FP [SF DF (XF "TARGET_68881")]) |
| 279 |
;; Mnemonic infix to round result |
| 280 |
(define_mode_attr round [(SF "%$") (DF "%&") (XF "")]) |
| 281 |
;; Mnemonic infix to round result for mul or div instruction |
| 282 |
(define_mode_attr round_mul [(SF "sgl") (DF "%&") (XF "")]) |
| 283 |
;; Suffix specifying source operand format |
| 284 |
(define_mode_attr prec [(SF "s") (DF "d") (XF "x")]) |
| 285 |
;; Allowable D registers |
| 286 |
(define_mode_attr dreg [(SF "d") (DF "") (XF "")]) |
| 287 |
;; Allowable 68881 constant constraints |
| 288 |
(define_mode_attr const [(SF "F") (DF "G") (XF "")]) |
| 289 |
|
| 290 |
|
| 291 |
(define_insn_and_split "*movdf_internal" |
| 292 |
[(set (match_operand:DF 0 "push_operand" "=m, m") |
| 293 |
(match_operand:DF 1 "general_operand" "f, ro<>E"))] |
| 294 |
"" |
| 295 |
"@ |
| 296 |
fmove%.d %f1,%0 |
| 297 |
#" |
| 298 |
"&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 1)" |
| 299 |
[(const_int 0)] |
| 300 |
{ |
| 301 |
m68k_emit_move_double (operands); |
| 302 |
DONE; |
| 303 |
} |
| 304 |
[(set_attr "type" "fmove,*")]) |
| 305 |
|
| 306 |
(define_insn_and_split "pushdi" |
| 307 |
[(set (match_operand:DI 0 "push_operand" "=m") |
| 308 |
(match_operand:DI 1 "general_operand" "ro<>Fi"))] |
| 309 |
"" |
| 310 |
"#" |
| 311 |
"&& reload_completed" |
| 312 |
[(const_int 0)] |
| 313 |
{ |
| 314 |
m68k_emit_move_double (operands); |
| 315 |
DONE; |
| 316 |
}) |
| 317 |
|
| 318 |
;; Compare instructions, combined with jumps or scc operations. |
| 319 |
|
| 320 |
(define_insn "beq0_di" |
| 321 |
[(set (pc) |
| 322 |
(if_then_else (eq (match_operand:DI 0 "general_operand" "d*a,o,<>") |
| 323 |
(const_int 0)) |
| 324 |
(label_ref (match_operand 1 "" ",,")) |
| 325 |
(pc))) |
| 326 |
(clobber (match_scratch:SI 2 "=d,&d,d"))] |
| 327 |
"" |
| 328 |
{ |
| 329 |
rtx_code code = m68k_find_flags_value (operands[0], const0_rtx, EQ); |
| 330 |
if (code == EQ) |
| 331 |
return "jeq %l1"; |
| 332 |
if (which_alternative == 2) |
| 333 |
return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1"; |
| 334 |
if (GET_CODE (operands[0]) == REG) |
| 335 |
operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 336 |
else |
| 337 |
operands[3] = adjust_address (operands[0], SImode, 4); |
| 338 |
if (! ADDRESS_REG_P (operands[0])) |
| 339 |
{ |
| 340 |
if (reg_overlap_mentioned_p (operands[2], operands[0])) |
| 341 |
{ |
| 342 |
if (reg_overlap_mentioned_p (operands[2], operands[3])) |
| 343 |
return "or%.l %0,%2\;jeq %l1"; |
| 344 |
else |
| 345 |
return "or%.l %3,%2\;jeq %l1"; |
| 346 |
} |
| 347 |
return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1"; |
| 348 |
} |
| 349 |
operands[4] = gen_label_rtx(); |
| 350 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 351 |
output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands); |
| 352 |
else |
| 353 |
output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands); |
| 354 |
(*targetm.asm_out.internal_label) (asm_out_file, "L", |
| 355 |
CODE_LABEL_NUMBER (operands[4])); |
| 356 |
return ""; |
| 357 |
}) |
| 358 |
|
| 359 |
(define_insn "bne0_di" |
| 360 |
[(set (pc) |
| 361 |
(if_then_else (ne (match_operand:DI 0 "general_operand" "d,o,*a") |
| 362 |
(const_int 0)) |
| 363 |
(label_ref (match_operand 1 "" ",,")) |
| 364 |
(pc))) |
| 365 |
(clobber (match_scratch:SI 2 "=d,&d,X"))] |
| 366 |
"" |
| 367 |
{ |
| 368 |
rtx_code code = m68k_find_flags_value (operands[0], const0_rtx, NE); |
| 369 |
if (code == NE) |
| 370 |
return "jne %l1"; |
| 371 |
if (GET_CODE (operands[0]) == REG) |
| 372 |
operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 373 |
else |
| 374 |
operands[3] = adjust_address (operands[0], SImode, 4); |
| 375 |
if (!ADDRESS_REG_P (operands[0])) |
| 376 |
{ |
| 377 |
if (reg_overlap_mentioned_p (operands[2], operands[0])) |
| 378 |
{ |
| 379 |
if (reg_overlap_mentioned_p (operands[2], operands[3])) |
| 380 |
return "or%.l %0,%2\;jne %l1"; |
| 381 |
else |
| 382 |
return "or%.l %3,%2\;jne %l1"; |
| 383 |
} |
| 384 |
return "move%.l %0,%2\;or%.l %3,%2\;jne %l1"; |
| 385 |
} |
| 386 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 387 |
return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1"; |
| 388 |
else |
| 389 |
return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1"; |
| 390 |
}) |
| 391 |
|
| 392 |
(define_insn "cbranchdi4_insn" |
| 393 |
[(set (pc) |
| 394 |
(if_then_else (match_operator 1 "ordered_comparison_operator" |
| 395 |
[(match_operand:DI 2 "nonimmediate_operand" "0,d,am,d") |
| 396 |
(match_operand:DI 3 "general_operand" "d,0,C0,C0")]) |
| 397 |
(label_ref (match_operand 4 "")) |
| 398 |
(pc))) |
| 399 |
(clobber (match_scratch:DI 0 "=d,d,d,X")) |
| 400 |
(clobber (match_scratch:SI 5 "=X,X,X,d"))] |
| 401 |
"" |
| 402 |
{ |
| 403 |
rtx_code code = GET_CODE (operands[1]); |
| 404 |
code = m68k_output_compare_di (operands[2], operands[3], operands[5], operands[0], insn, code); |
| 405 |
operands[3] = operands[4]; |
| 406 |
return m68k_output_branch_integer (code); |
| 407 |
}) |
| 408 |
|
| 409 |
(define_expand "cbranchdi4" |
| 410 |
[(parallel |
| 411 |
[(set (pc) |
| 412 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 413 |
[(match_operand:DI 1 "nonimmediate_operand") |
| 414 |
(match_operand:DI 2 "general_operand")]) |
| 415 |
(label_ref (match_operand 3 "")) |
| 416 |
(pc))) |
| 417 |
(clobber (match_scratch:DI 4 "")) |
| 418 |
(clobber (match_scratch:SI 5 ""))])] |
| 419 |
"" |
| 420 |
{ |
| 421 |
rtx_code code = GET_CODE (operands[0]); |
| 422 |
if ((code == GE || code == LT) && operands[2] == const0_rtx) |
| 423 |
{ |
| 424 |
rtx xop1 = operand_subword_force (operands[1], 0, DImode); |
| 425 |
rtx xop2 = operand_subword_force (operands[2], 0, DImode); |
| 426 |
/* gen_cbranchsi4 won't use anything from operands[0] other than the |
| 427 |
code. */ |
| 428 |
emit_jump_insn (gen_cbranchsi4 (operands[0], xop1, xop2, operands[3])); |
| 429 |
DONE; |
| 430 |
} |
| 431 |
if (code == EQ && operands[2] == const0_rtx) |
| 432 |
{ |
| 433 |
emit_jump_insn (gen_beq0_di (operands[1], operands[3])); |
| 434 |
DONE; |
| 435 |
} |
| 436 |
if (code == NE && operands[2] == const0_rtx) |
| 437 |
{ |
| 438 |
emit_jump_insn (gen_bne0_di (operands[1], operands[3])); |
| 439 |
DONE; |
| 440 |
} |
| 441 |
}) |
| 442 |
|
| 443 |
(define_expand "cstoredi4" |
| 444 |
[(set (match_operand:QI 0 "register_operand") |
| 445 |
(match_operator:QI 1 "ordered_comparison_operator" |
| 446 |
[(match_operand:DI 2 "nonimmediate_operand") |
| 447 |
(match_operand:DI 3 "general_operand")]))] |
| 448 |
"" |
| 449 |
{ |
| 450 |
rtx_code code = GET_CODE (operands[1]); |
| 451 |
if ((code == GE || code == LT) && operands[3] == const0_rtx) |
| 452 |
{ |
| 453 |
rtx xop2 = operand_subword_force (operands[2], 0, DImode); |
| 454 |
rtx xop3 = operand_subword_force (operands[3], 0, DImode); |
| 455 |
/* gen_cstoresi4 won't use anything from operands[1] other than the |
| 456 |
code. */ |
| 457 |
emit_jump_insn (gen_cstoresi4 (operands[0], operands[1], xop2, xop3)); |
| 458 |
DONE; |
| 459 |
} |
| 460 |
}) |
| 461 |
|
| 462 |
(define_mode_iterator CMPMODE [QI HI SI]) |
| 463 |
|
| 464 |
(define_expand "cbranch<mode>4" |
| 465 |
[(set (pc) |
| 466 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 467 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "") |
| 468 |
(match_operand:CMPMODE 2 "m68k_comparison_operand" "")]) |
| 469 |
(label_ref (match_operand 3 "")) |
| 470 |
(pc)))] |
| 471 |
"" |
| 472 |
"") |
| 473 |
|
| 474 |
(define_expand "cstore<mode>4" |
| 475 |
[(set (match_operand:QI 0 "register_operand") |
| 476 |
(match_operator:QI 1 "ordered_comparison_operator" |
| 477 |
[(match_operand:CMPMODE 2 "nonimmediate_operand" "") |
| 478 |
(match_operand:CMPMODE 3 "m68k_comparison_operand" "")]))] |
| 479 |
"" |
| 480 |
"") |
| 481 |
|
| 482 |
;; In theory we ought to be able to use some 'S' constraints and |
| 483 |
;; operand predicates that allow PC-rel addressing modes in the |
| 484 |
;; comparison patterns and expanders below. But we would have to be |
| 485 |
;; cognizant of the fact that PC-rel addresses are not allowed for |
| 486 |
;; both operands and determining whether or not we emit the operands in |
| 487 |
;; order or reversed is not trivial to do just based on the constraints |
| 488 |
;; and operand predicates. So to be safe, just don't allow the PC-rel |
| 489 |
|
| 490 |
(define_mode_attr scc0_constraints [(QI "=d,d,d") (HI "=d,d,d,d,d") (SI "=d,d,d,d,d,d")]) |
| 491 |
(define_mode_attr cmp1_constraints [(QI "dn,dm,>") (HI "rnm,d,n,m,>") (SI "r,r,r,mr,ma,>")]) |
| 492 |
(define_mode_attr cmp2_constraints [(QI "dm,nd,>") (HI "d,rnm,m,n,>") (SI "mrC0,mr,ma,KTrC0,Ksr,>")]) |
| 493 |
|
| 494 |
;; Note that operand 0 of an SCC insn is supported in the hardware as |
| 495 |
;; memory, but we cannot allow it to be in memory in case the address |
| 496 |
;; needs to be reloaded. |
| 497 |
|
| 498 |
(define_mode_attr scc0_cf_constraints [(QI "=d") (HI "=d") (SI "=d,d,d")]) |
| 499 |
(define_mode_attr cmp1_cf_constraints [(QI "dm") (HI "dm") (SI "mr,r,rm")]) |
| 500 |
(define_mode_attr cmp2_cf_constraints [(QI "C0") (HI "C0") (SI "r,mrKs,C0")]) |
| 501 |
(define_mode_attr cmp2_cf_predicate [(QI "const0_operand") (HI "const0_operand") (SI "general_operand")]) |
| 502 |
|
| 503 |
(define_insn "cbranch<mode>4_insn" |
| 504 |
[(set (pc) |
| 505 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 506 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "<cmp1_constraints>") |
| 507 |
(match_operand:CMPMODE 2 "general_operand" "<cmp2_constraints>")]) |
| 508 |
(label_ref (match_operand 3 "")) |
| 509 |
(pc)))] |
| 510 |
"!TARGET_COLDFIRE" |
| 511 |
{ |
| 512 |
rtx_code code = GET_CODE (operands[0]); |
| 513 |
code = m68k_output_compare_<mode> (operands[1], operands[2], code); |
| 514 |
return m68k_output_branch_integer (code); |
| 515 |
} |
| 516 |
[(set_attr "flags_valid" "set")]) |
| 517 |
|
| 518 |
(define_insn "cbranch<mode>4_insn_rev" |
| 519 |
[(set (pc) |
| 520 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 521 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "<cmp1_constraints>") |
| 522 |
(match_operand:CMPMODE 2 "general_operand" "<cmp2_constraints>")]) |
| 523 |
(pc) |
| 524 |
(label_ref (match_operand 3 ""))))] |
| 525 |
"!TARGET_COLDFIRE" |
| 526 |
{ |
| 527 |
rtx_code code = GET_CODE (operands[0]); |
| 528 |
code = m68k_output_compare_<mode> (operands[1], operands[2], code); |
| 529 |
return m68k_output_branch_integer_rev (code); |
| 530 |
} |
| 531 |
[(set_attr "flags_valid" "set")]) |
| 532 |
|
| 533 |
(define_insn "cbranch<mode>4_insn_cf" |
| 534 |
[(set (pc) |
| 535 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 536 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "<cmp1_cf_constraints>") |
| 537 |
(match_operand:CMPMODE 2 "<cmp2_cf_predicate>" "<cmp2_cf_constraints>")]) |
| 538 |
(label_ref (match_operand 3 "")) |
| 539 |
(pc)))] |
| 540 |
"TARGET_COLDFIRE" |
| 541 |
{ |
| 542 |
rtx_code code = GET_CODE (operands[0]); |
| 543 |
code = m68k_output_compare_<mode> (operands[1], operands[2], code); |
| 544 |
return m68k_output_branch_integer (code); |
| 545 |
} |
| 546 |
[(set_attr "flags_valid" "set")]) |
| 547 |
|
| 548 |
(define_insn "cbranch<mode>4_insn_cf_rev" |
| 549 |
[(set (pc) |
| 550 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 551 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "<cmp1_cf_constraints>") |
| 552 |
(match_operand:CMPMODE 2 "<cmp2_cf_predicate>" "<cmp2_cf_constraints>")]) |
| 553 |
(pc) |
| 554 |
(label_ref (match_operand 3 ""))))] |
| 555 |
"TARGET_COLDFIRE" |
| 556 |
{ |
| 557 |
rtx_code code = GET_CODE (operands[0]); |
| 558 |
code = m68k_output_compare_<mode> (operands[1], operands[2], code); |
| 559 |
return m68k_output_branch_integer_rev (code); |
| 560 |
} |
| 561 |
[(set_attr "flags_valid" "set")]) |
| 562 |
|
| 563 |
(define_insn "cstore<mode>4_insn" |
| 564 |
[(set (match_operand:QI 0 "register_operand" "<scc0_constraints>") |
| 565 |
(match_operator:QI 1 "ordered_comparison_operator" |
| 566 |
[(match_operand:CMPMODE 2 "nonimmediate_operand" "<cmp1_constraints>") |
| 567 |
(match_operand:CMPMODE 3 "general_operand" "<cmp2_constraints>")]))] |
| 568 |
"!TARGET_COLDFIRE" |
| 569 |
{ |
| 570 |
rtx_code code = GET_CODE (operands[1]); |
| 571 |
code = m68k_output_compare_<mode> (operands[2], operands[3], code); |
| 572 |
return m68k_output_scc (code); |
| 573 |
} |
| 574 |
[(set_attr "flags_valid" "set")]) |
| 575 |
|
| 576 |
(define_insn "cstore<mode>4_insn_cf" |
| 577 |
[(set (match_operand:QI 0 "register_operand" "<scc0_cf_constraints>") |
| 578 |
(match_operator:QI 1 "ordered_comparison_operator" |
| 579 |
[(match_operand:CMPMODE 2 "nonimmediate_operand" "<cmp1_cf_constraints>") |
| 580 |
(match_operand:CMPMODE 3 "<cmp2_cf_predicate>" "<cmp2_cf_constraints>")]))] |
| 581 |
"TARGET_COLDFIRE" |
| 582 |
{ |
| 583 |
rtx_code code = GET_CODE (operands[1]); |
| 584 |
code = m68k_output_compare_<mode> (operands[2], operands[3], code); |
| 585 |
return m68k_output_scc (code); |
| 586 |
} |
| 587 |
[(set_attr "flags_valid" "set")]) |
| 588 |
|
| 589 |
;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is |
| 590 |
;; specified as a constant, so we must disable all patterns that may extract |
| 591 |
;; from a MEM at a constant bit position if we can't use this as a constraint. |
| 592 |
|
| 593 |
(define_insn "cbranchsi4_btst_mem_insn" |
| 594 |
[(set (pc) |
| 595 |
(if_then_else (match_operator 0 "equality_comparison_operator" |
| 596 |
[(zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS,o") |
| 597 |
(const_int 1) |
| 598 |
(minus:SI (const_int 7) |
| 599 |
(match_operand:SI 2 "general_operand" "di,d"))) |
| 600 |
(const_int 0)]) |
| 601 |
(label_ref (match_operand 3 "")) |
| 602 |
(pc)))] |
| 603 |
"" |
| 604 |
{ |
| 605 |
rtx_code code = GET_CODE (operands[0]); |
| 606 |
code = m68k_output_btst (operands[2], operands[1], code, 7); |
| 607 |
return m68k_output_branch_integer (code); |
| 608 |
} |
| 609 |
[(set_attr "ok_for_coldfire" "no,yes")]) |
| 610 |
|
| 611 |
(define_insn "cbranchsi4_btst_reg_insn" |
| 612 |
[(set (pc) |
| 613 |
(if_then_else (match_operator 0 "equality_comparison_operator" |
| 614 |
[(zero_extract:SI (match_operand:SI 1 "register_operand" "d") |
| 615 |
(const_int 1) |
| 616 |
(minus:SI (const_int 31) |
| 617 |
(match_operand:SI 2 "general_operand" "di"))) |
| 618 |
(const_int 0)]) |
| 619 |
(label_ref (match_operand 3 "")) |
| 620 |
(pc)))] |
| 621 |
"!(CONST_INT_P (operands[1]) && !IN_RANGE (INTVAL (operands[1]), 0, 31))" |
| 622 |
{ |
| 623 |
rtx_code code = GET_CODE (operands[0]); |
| 624 |
code = m68k_output_btst (operands[2], operands[1], code, 31); |
| 625 |
return m68k_output_branch_integer (code); |
| 626 |
}) |
| 627 |
|
| 628 |
;; Nonoffsettable mem refs are ok in this one pattern |
| 629 |
;; since we don't try to adjust them. |
| 630 |
(define_insn "cbranchsi4_btst_mem_insn_1" |
| 631 |
[(set (pc) |
| 632 |
(if_then_else (match_operator 0 "equality_comparison_operator" |
| 633 |
[(zero_extract:SI (match_operand:QI 1 "memory_operand" "m") |
| 634 |
(const_int 1) |
| 635 |
(match_operand:SI 2 "const_int_operand" "n")) |
| 636 |
(const_int 0)]) |
| 637 |
(label_ref (match_operand 3 "")) |
| 638 |
(pc)))] |
| 639 |
"!TARGET_COLDFIRE && (unsigned) INTVAL (operands[2]) < 8" |
| 640 |
{ |
| 641 |
rtx_code code = GET_CODE (operands[0]); |
| 642 |
operands[2] = GEN_INT (7 - INTVAL (operands[2])); |
| 643 |
code = m68k_output_btst (operands[2], operands[1], code, 7); |
| 644 |
return m68k_output_branch_integer (code); |
| 645 |
}) |
| 646 |
|
| 647 |
(define_insn "cbranchsi4_btst_reg_insn_1" |
| 648 |
[(set (pc) |
| 649 |
(if_then_else (match_operator 0 "equality_comparison_operator" |
| 650 |
[(zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do,dQ") |
| 651 |
(const_int 1) |
| 652 |
(match_operand:SI 2 "const_int_operand" "n,n")) |
| 653 |
(const_int 0)]) |
| 654 |
(label_ref (match_operand 3 "")) |
| 655 |
(pc)))] |
| 656 |
"!(REG_P (operands[1]) && !IN_RANGE (INTVAL (operands[2]), 0, 31))" |
| 657 |
{ |
| 658 |
rtx_code code = GET_CODE (operands[0]); |
| 659 |
if (GET_CODE (operands[1]) == MEM) |
| 660 |
{ |
| 661 |
operands[1] = adjust_address (operands[1], QImode, |
| 662 |
INTVAL (operands[2]) / 8); |
| 663 |
operands[2] = GEN_INT (7 - INTVAL (operands[2]) % 8); |
| 664 |
code = m68k_output_btst (operands[2], operands[1], code, 7); |
| 665 |
} |
| 666 |
else |
| 667 |
{ |
| 668 |
operands[2] = GEN_INT (31 - INTVAL (operands[2])); |
| 669 |
code = m68k_output_btst (operands[2], operands[1], code, 31); |
| 670 |
} |
| 671 |
return m68k_output_branch_integer (code); |
| 672 |
} |
| 673 |
[(set_attr "ok_for_coldfire" "no,yes")]) |
| 674 |
|
| 675 |
(define_mode_iterator BTST [QI SI]) |
| 676 |
(define_mode_attr btst_predicate [(QI "memory_operand") (SI "register_operand")]) |
| 677 |
(define_mode_attr btst_constraint [(QI "o") (SI "d")]) |
| 678 |
(define_mode_attr btst_range [(QI "7") (SI "31")]) |
| 679 |
|
| 680 |
;; Special patterns for optimizing bit-field instructions. |
| 681 |
(define_insn "cbranch_bftst<mode>_insn" |
| 682 |
[(set (pc) |
| 683 |
(if_then_else (match_operator 0 "ordered_comparison_operator" |
| 684 |
[(zero_extract:SI (match_operand:BTST 1 "<btst_predicate>" "<btst_constraint>") |
| 685 |
(match_operand:SI 2 "const_int_operand" "n") |
| 686 |
(match_operand:SI 3 "general_operand" "dn")) |
| 687 |
(const_int 0)]) |
| 688 |
(label_ref (match_operand 4 "")) |
| 689 |
(pc)))] |
| 690 |
"TARGET_68020 && TARGET_BITFIELD |
| 691 |
&& (!REG_P (operands[1]) || !CONST_INT_P (operands[3]) |
| 692 |
|| IN_RANGE (INTVAL (operands[3]), 0, 31))" |
| 693 |
{ |
| 694 |
rtx_code code = GET_CODE (operands[0]); |
| 695 |
code = m68k_output_bftst (operands[1], operands[2], operands[3], code); |
| 696 |
operands[3] = operands[4]; |
| 697 |
return m68k_output_branch_integer (code); |
| 698 |
}) |
| 699 |
|
| 700 |
(define_insn "cstore_bftst<mode>_insn" |
| 701 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 702 |
(match_operator:QI 1 "ordered_comparison_operator" |
| 703 |
[(zero_extract:SI (match_operand:BTST 2 "<btst_predicate>" "<btst_constraint>") |
| 704 |
(match_operand:SI 3 "const_int_operand" "n") |
| 705 |
(match_operand:SI 4 "general_operand" "dn")) |
| 706 |
(const_int 0)]))] |
| 707 |
"TARGET_68020 && TARGET_BITFIELD |
| 708 |
&& (!REG_P (operands[2]) || !CONST_INT_P (operands[4]) |
| 709 |
|| IN_RANGE (INTVAL (operands[4]), 0, 31))" |
| 710 |
{ |
| 711 |
rtx_code code = GET_CODE (operands[1]); |
| 712 |
code = m68k_output_bftst (operands[2], operands[3], operands[4], code); |
| 713 |
return m68k_output_scc (code); |
| 714 |
}) |
| 715 |
|
| 716 |
;; Floating point comparison patterns |
| 717 |
(define_expand "cbranch<mode>4" |
| 718 |
[(set (pc) |
| 719 |
(if_then_else (match_operator 0 "comparison_operator" |
| 720 |
[(match_operand:FP 1 "register_operand" "") |
| 721 |
(match_operand:FP 2 "fp_src_operand" "")]) |
| 722 |
(label_ref (match_operand 3 "")) |
| 723 |
(pc)))] |
| 724 |
"TARGET_HARD_FLOAT" |
| 725 |
"") |
| 726 |
|
| 727 |
;; ??? This presumably tries to allow tests against zero for coldfire, but |
| 728 |
;; it would have to test operands[3] and use CONST0_RTX (mode). |
| 729 |
(define_expand "cstore<mode>4" |
| 730 |
[(set (match_operand:QI 0 "register_operand") |
| 731 |
(match_operator:QI 1 "m68k_cstore_comparison_operator" |
| 732 |
[(match_operand:FP 2 "register_operand" "") |
| 733 |
(match_operand:FP 3 "fp_src_operand" "")]))] |
| 734 |
"TARGET_HARD_FLOAT && !(TUNE_68060 || TARGET_COLDFIRE_FPU)" |
| 735 |
"if (TARGET_COLDFIRE && operands[2] != const0_rtx) |
| 736 |
FAIL;") |
| 737 |
|
| 738 |
(define_insn "cbranch<mode>4_insn_68881" |
| 739 |
[(set (pc) |
| 740 |
(if_then_else (match_operator 0 "comparison_operator" |
| 741 |
[(match_operand:FP 1 "fp_src_operand" "f,f,<FP:dreg>mF,f<FP:dreg>m") |
| 742 |
(match_operand:FP 2 "fp_src_operand" "f,<FP:dreg>mF,f,H")]) |
| 743 |
(label_ref (match_operand 3 "")) |
| 744 |
(pc)))] |
| 745 |
"TARGET_68881 |
| 746 |
&& (register_operand (operands[1], <MODE>mode) |
| 747 |
|| register_operand (operands[2], <MODE>mode) |
| 748 |
|| const0_operand (operands[2], <MODE>mode))" |
| 749 |
{ |
| 750 |
rtx_code code = GET_CODE (operands[0]); |
| 751 |
code = m68k_output_compare_fp (operands[1], operands[2], code); |
| 752 |
return m68k_output_branch_float (code); |
| 753 |
} |
| 754 |
[(set_attr "flags_valid" "set")]) |
| 755 |
|
| 756 |
(define_insn "cbranch<mode>4_insn_cf" |
| 757 |
[(set (pc) |
| 758 |
(if_then_else (match_operator 0 "comparison_operator" |
| 759 |
[(match_operand:FP 1 "fp_src_operand" "f,f,<FP:dreg><Q>U,f<FP:dreg><Q>U") |
| 760 |
(match_operand:FP 2 "fp_src_operand" "f,<FP:dreg><Q>U,f,H")]) |
| 761 |
(label_ref (match_operand 3 "")) |
| 762 |
(pc)))] |
| 763 |
"TARGET_COLDFIRE_FPU |
| 764 |
&& (register_operand (operands[1], <MODE>mode) |
| 765 |
|| register_operand (operands[2], <MODE>mode) |
| 766 |
|| const0_operand (operands[2], <MODE>mode))" |
| 767 |
{ |
| 768 |
rtx_code code = GET_CODE (operands[0]); |
| 769 |
code = m68k_output_compare_fp (operands[1], operands[2], code); |
| 770 |
return m68k_output_branch_float (code); |
| 771 |
} |
| 772 |
[(set_attr "flags_valid" "set")]) |
| 773 |
|
| 774 |
(define_insn "cbranch<mode>4_insn_rev_68881" |
| 775 |
[(set (pc) |
| 776 |
(if_then_else (match_operator 0 "comparison_operator" |
| 777 |
[(match_operand:FP 1 "fp_src_operand" "f,f,<FP:dreg>mF,f<FP:dreg>m") |
| 778 |
(match_operand:FP 2 "fp_src_operand" "f,<FP:dreg>mF,f,H")]) |
| 779 |
(pc) |
| 780 |
(label_ref (match_operand 3 ""))))] |
| 781 |
"TARGET_68881 |
| 782 |
&& (register_operand (operands[1], <MODE>mode) |
| 783 |
|| register_operand (operands[2], <MODE>mode) |
| 784 |
|| const0_operand (operands[2], <MODE>mode))" |
| 785 |
{ |
| 786 |
rtx_code code = GET_CODE (operands[0]); |
| 787 |
code = m68k_output_compare_fp (operands[1], operands[2], code); |
| 788 |
return m68k_output_branch_float_rev (code); |
| 789 |
} |
| 790 |
[(set_attr "flags_valid" "set")]) |
| 791 |
|
| 792 |
(define_insn "cbranch<mode>4_insn_rev_cf" |
| 793 |
[(set (pc) |
| 794 |
(if_then_else (match_operator 0 "comparison_operator" |
| 795 |
[(match_operand:FP 1 "fp_src_operand" "f,f,<FP:dreg><Q>U,f<FP:dreg><Q>U") |
| 796 |
(match_operand:FP 2 "fp_src_operand" "f,<FP:dreg><Q>U,f,H")]) |
| 797 |
(pc) |
| 798 |
(label_ref (match_operand 3 ""))))] |
| 799 |
"TARGET_COLDFIRE_FPU |
| 800 |
&& (register_operand (operands[1], <MODE>mode) |
| 801 |
|| register_operand (operands[2], <MODE>mode) |
| 802 |
|| const0_operand (operands[2], <MODE>mode))" |
| 803 |
{ |
| 804 |
rtx_code code = GET_CODE (operands[0]); |
| 805 |
code = m68k_output_compare_fp (operands[1], operands[2], code); |
| 806 |
return m68k_output_branch_float_rev (code); |
| 807 |
} |
| 808 |
[(set_attr "flags_valid" "set")]) |
| 809 |
|
| 810 |
(define_insn "cstore<mode>4_insn_68881" |
| 811 |
[(set (match_operand:QI 0 "register_operand" "=d,d,d,d") |
| 812 |
(match_operator:QI 1 "m68k_cstore_comparison_operator" |
| 813 |
[(match_operand:FP 2 "fp_src_operand" "f,f,<FP:dreg>mF,f<FP:dreg>m") |
| 814 |
(match_operand:FP 3 "fp_src_operand" "f,<FP:dreg>mF,f,H")]))] |
| 815 |
"TARGET_HARD_FLOAT && !(TUNE_68060 || TARGET_COLDFIRE_FPU) |
| 816 |
&& (register_operand (operands[2], <MODE>mode) |
| 817 |
|| register_operand (operands[3], <MODE>mode) |
| 818 |
|| const0_operand (operands[3], <MODE>mode))" |
| 819 |
{ |
| 820 |
rtx_code code = GET_CODE (operands[1]); |
| 821 |
code = m68k_output_compare_fp (operands[2], operands[3], code); |
| 822 |
return m68k_output_scc_float (code); |
| 823 |
} |
| 824 |
[(set_attr "flags_valid" "set")]) |
| 825 |
|
| 826 |
;; Test against zero only for coldfire floating point cstore. |
| 827 |
(define_insn "cstore<mode>4_insn_cf" |
| 828 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 829 |
(match_operator:QI 1 "m68k_cstore_comparison_operator" |
| 830 |
[(match_operand:FP 2 "fp_src_operand" "f<FP:dreg><Q>U") |
| 831 |
(match_operand:FP 3 "const0_operand" "H")]))] |
| 832 |
"TARGET_HARD_FLOAT && TARGET_COLDFIRE_FPU" |
| 833 |
{ |
| 834 |
rtx_code code = GET_CODE (operands[1]); |
| 835 |
code = m68k_output_compare_fp (operands[2], operands[3], code); |
| 836 |
return m68k_output_scc_float (code); |
| 837 |
} |
| 838 |
[(set_attr "flags_valid" "set")]) |
| 839 |
|
| 840 |
;; move instructions |
| 841 |
|
| 842 |
;; A special case in which it is not desirable |
| 843 |
;; to reload the constant into a data register. |
| 844 |
(define_insn "pushexthisi_const" |
| 845 |
[(set (match_operand:SI 0 "push_operand" "=m,m,m") |
| 846 |
(match_operand:SI 1 "const_int_operand" "C0,R,J"))] |
| 847 |
"INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000" |
| 848 |
"@ |
| 849 |
clr%.l %0 |
| 850 |
mov3q%.l %1,%- |
| 851 |
pea %a1" |
| 852 |
[(set_attr "type" "clr_l,mov3q_l,pea")]) |
| 853 |
|
| 854 |
;This is never used. |
| 855 |
;(define_insn "swapsi" |
| 856 |
; [(set (match_operand:SI 0 "nonimmediate_operand" "+r") |
| 857 |
; (match_operand:SI 1 "general_operand" "+r")) |
| 858 |
; (set (match_dup 1) (match_dup 0))] |
| 859 |
; "" |
| 860 |
; "exg %1,%0") |
| 861 |
|
| 862 |
;; Special case of fullword move when source is zero for 68000_10. |
| 863 |
;; moveq is faster on the 68000. |
| 864 |
(define_insn "*movsi_const0_68000_10" |
| 865 |
[(set (match_operand:SI 0 "movsi_const0_operand" "=d,a,g") |
| 866 |
(const_int 0))] |
| 867 |
"TUNE_68000_10" |
| 868 |
"@ |
| 869 |
moveq #0,%0 |
| 870 |
sub%.l %0,%0 |
| 871 |
clr%.l %0" |
| 872 |
[(set_attr "type" "moveq_l,alu_l,clr_l") |
| 873 |
(set_attr "opy" "*,0,*")]) |
| 874 |
|
| 875 |
;; Special case of fullword move when source is zero for 68040_60. |
| 876 |
;; On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 |
| 877 |
(define_insn "*movsi_const0_68040_60" |
| 878 |
[(set (match_operand:SI 0 "movsi_const0_operand" "=a,g") |
| 879 |
(const_int 0))] |
| 880 |
"TUNE_68040_60" |
| 881 |
{ |
| 882 |
if (which_alternative == 0) |
| 883 |
return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0"; |
| 884 |
else if (which_alternative == 1) |
| 885 |
return "clr%.l %0"; |
| 886 |
else |
| 887 |
{ |
| 888 |
gcc_unreachable (); |
| 889 |
return ""; |
| 890 |
} |
| 891 |
} |
| 892 |
[(set_attr "type" "lea,clr_l")]) |
| 893 |
|
| 894 |
;; Special case of fullword move when source is zero. |
| 895 |
(define_insn "*movsi_const0" |
| 896 |
[(set (match_operand:SI 0 "movsi_const0_operand" "=a,g") |
| 897 |
(const_int 0))] |
| 898 |
"!(TUNE_68000_10 || TUNE_68040_60)" |
| 899 |
"@ |
| 900 |
sub%.l %0,%0 |
| 901 |
clr%.l %0" |
| 902 |
[(set_attr "type" "alu_l,clr_l") |
| 903 |
(set_attr "opy" "0,*")]) |
| 904 |
|
| 905 |
;; General case of fullword move. |
| 906 |
;; |
| 907 |
;; This is the main "hook" for PIC code. When generating |
| 908 |
;; PIC, movsi is responsible for determining when the source address |
| 909 |
;; needs PIC relocation and appropriately calling legitimize_pic_address |
| 910 |
;; to perform the actual relocation. |
| 911 |
;; |
| 912 |
;; In both the PIC and non-PIC cases the patterns generated will |
| 913 |
;; matched by the next define_insn. |
| 914 |
(define_expand "movsi" |
| 915 |
[(set (match_operand:SI 0 "" "") |
| 916 |
(match_operand:SI 1 "" ""))] |
| 917 |
"" |
| 918 |
{ |
| 919 |
rtx tmp, base, offset; |
| 920 |
|
| 921 |
/* Recognize the case where operand[1] is a reference to thread-local |
| 922 |
data and load its address to a register. */ |
| 923 |
if (!TARGET_PCREL && m68k_tls_reference_p (operands[1], false)) |
| 924 |
{ |
| 925 |
rtx tmp = operands[1]; |
| 926 |
rtx addend = NULL; |
| 927 |
|
| 928 |
if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS) |
| 929 |
{ |
| 930 |
addend = XEXP (XEXP (tmp, 0), 1); |
| 931 |
tmp = XEXP (XEXP (tmp, 0), 0); |
| 932 |
} |
| 933 |
|
| 934 |
gcc_assert (GET_CODE (tmp) == SYMBOL_REF); |
| 935 |
gcc_assert (SYMBOL_REF_TLS_MODEL (tmp) != 0); |
| 936 |
|
| 937 |
tmp = m68k_legitimize_tls_address (tmp); |
| 938 |
|
| 939 |
if (addend) |
| 940 |
{ |
| 941 |
if (!REG_P (tmp)) |
| 942 |
{ |
| 943 |
rtx reg; |
| 944 |
|
| 945 |
reg = gen_reg_rtx (Pmode); |
| 946 |
emit_move_insn (reg, tmp); |
| 947 |
tmp = reg; |
| 948 |
} |
| 949 |
|
| 950 |
tmp = gen_rtx_PLUS (SImode, tmp, addend); |
| 951 |
} |
| 952 |
|
| 953 |
operands[1] = tmp; |
| 954 |
} |
| 955 |
else if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode)) |
| 956 |
{ |
| 957 |
/* The source is an address which requires PIC relocation. |
| 958 |
Call legitimize_pic_address with the source, mode, and a relocation |
| 959 |
register (a new pseudo, or the final destination if reload_in_progress |
| 960 |
or lra_in_progress is set). Then fall through normally */ |
| 961 |
rtx temp = ((reload_in_progress || lra_in_progress) |
| 962 |
? operands[0] : gen_reg_rtx (Pmode)); |
| 963 |
operands[1] = legitimize_pic_address (operands[1], SImode, temp); |
| 964 |
} |
| 965 |
else if (flag_pic && TARGET_PCREL && ! (reload_in_progress || lra_in_progress)) |
| 966 |
{ |
| 967 |
/* Don't allow writes to memory except via a register; |
| 968 |
the m68k doesn't consider PC-relative addresses to be writable. */ |
| 969 |
if (symbolic_operand (operands[0], SImode)) |
| 970 |
operands[0] = force_reg (SImode, XEXP (operands[0], 0)); |
| 971 |
else if (GET_CODE (operands[0]) == MEM |
| 972 |
&& symbolic_operand (XEXP (operands[0], 0), SImode)) |
| 973 |
operands[0] = gen_rtx_MEM (SImode, |
| 974 |
force_reg (SImode, XEXP (operands[0], 0))); |
| 975 |
} |
| 976 |
if (M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P) |
| 977 |
{ |
| 978 |
split_const (operands[1], &base, &offset); |
| 979 |
if (GET_CODE (base) == SYMBOL_REF |
| 980 |
&& !offset_within_block_p (base, INTVAL (offset))) |
| 981 |
{ |
| 982 |
tmp = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (SImode); |
| 983 |
emit_move_insn (tmp, base); |
| 984 |
emit_insn (gen_addsi3 (operands[0], tmp, offset)); |
| 985 |
DONE; |
| 986 |
} |
| 987 |
} |
| 988 |
}) |
| 989 |
|
| 990 |
;; General case of fullword move. |
| 991 |
(define_insn "*movsi_m68k" |
| 992 |
;; Notes: make sure no alternative allows g vs g. |
| 993 |
;; We don't allow f-regs since fixed point cannot go in them. |
| 994 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<") |
| 995 |
(match_operand:SI 1 "general_src_operand" "damSnT,n,i"))] |
| 996 |
"!TARGET_COLDFIRE && reload_completed" |
| 997 |
{ |
| 998 |
return output_move_simode (operands); |
| 999 |
} |
| 1000 |
[(set_attr "flags_valid" "set")]) |
| 1001 |
|
| 1002 |
;; Before reload is completed the register constraints |
| 1003 |
;; force integer constants in range for a moveq to be reloaded |
| 1004 |
;; if they are headed for memory. |
| 1005 |
(define_insn "*movsi_m68k2" |
| 1006 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<") |
| 1007 |
(match_operand:SI 1 "general_src_operand" "damSKT,n,i"))] |
| 1008 |
|
| 1009 |
"!TARGET_COLDFIRE" |
| 1010 |
{ |
| 1011 |
return output_move_simode (operands); |
| 1012 |
} |
| 1013 |
[(set_attr "flags_valid" "set")]) |
| 1014 |
|
| 1015 |
;; ColdFire move instructions can have at most one operand of mode >= 6. |
| 1016 |
(define_insn "*movsi_cf" |
| 1017 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=g,d, d, d, d, d, a,Ap, a, r<Q>,g, U") |
| 1018 |
(match_operand:SI 1 "general_operand" " R,CQ,CW,CZ,CS,Ci,J,J Cs,Cs, g, Rr<Q>,U"))] |
| 1019 |
"TARGET_COLDFIRE" |
| 1020 |
{ |
| 1021 |
switch (which_alternative) |
| 1022 |
{ |
| 1023 |
case 0: |
| 1024 |
return "mov3q%.l %1,%0"; |
| 1025 |
|
| 1026 |
case 1: |
| 1027 |
return "moveq %1,%0"; |
| 1028 |
|
| 1029 |
case 2: |
| 1030 |
{ |
| 1031 |
unsigned u = INTVAL (operands[1]); |
| 1032 |
|
| 1033 |
operands[1] = GEN_INT ((u << 16) | (u >> 16)); /*|*/ |
| 1034 |
return "moveq %1,%0\n\tswap %0"; |
| 1035 |
} |
| 1036 |
|
| 1037 |
case 3: |
| 1038 |
return "mvz%.w %1,%0"; |
| 1039 |
|
| 1040 |
case 4: |
| 1041 |
return "mvs%.w %1,%0"; |
| 1042 |
|
| 1043 |
case 5: |
| 1044 |
return "move%.l %1,%0"; |
| 1045 |
|
| 1046 |
case 6: |
| 1047 |
return "move%.w %1,%0"; |
| 1048 |
|
| 1049 |
case 7: |
| 1050 |
return "pea %a1"; |
| 1051 |
|
| 1052 |
case 8: |
| 1053 |
return "lea %a1,%0"; |
| 1054 |
|
| 1055 |
case 9: |
| 1056 |
case 10: |
| 1057 |
case 11: |
| 1058 |
return "move%.l %1,%0"; |
| 1059 |
|
| 1060 |
default: |
| 1061 |
gcc_unreachable (); |
| 1062 |
return ""; |
| 1063 |
} |
| 1064 |
} |
| 1065 |
[(set_attr "type" "mov3q_l,moveq_l,*,mvsz,mvsz,move_l,move,pea,lea,move_l,move_l,move_l")]) |
| 1066 |
|
| 1067 |
;; Special case of fullword move, where we need to get a non-GOT PIC |
| 1068 |
;; reference into an address register. |
| 1069 |
(define_insn "" |
| 1070 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=a<") |
| 1071 |
(match_operand:SI 1 "pcrel_address" ""))] |
| 1072 |
"TARGET_PCREL" |
| 1073 |
{ |
| 1074 |
if (push_operand (operands[0], SImode)) |
| 1075 |
return "pea %a1"; |
| 1076 |
return "lea %a1,%0"; |
| 1077 |
}) |
| 1078 |
|
| 1079 |
(define_expand "movhi" |
| 1080 |
[(set (match_operand:HI 0 "nonimmediate_operand" "") |
| 1081 |
(match_operand:HI 1 "general_operand" ""))] |
| 1082 |
"" |
| 1083 |
"") |
| 1084 |
|
| 1085 |
(define_insn "" |
| 1086 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=g") |
| 1087 |
(match_operand:HI 1 "general_src_operand" "gS"))] |
| 1088 |
"!TARGET_COLDFIRE" |
| 1089 |
"* return output_move_himode (operands);" |
| 1090 |
[(set (attr "flags_valid") |
| 1091 |
(if_then_else (match_operand 0 "address_reg_operand") |
| 1092 |
(const_string "unchanged") |
| 1093 |
(const_string "move")))]) |
| 1094 |
|
| 1095 |
(define_insn "" |
| 1096 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U") |
| 1097 |
(match_operand:HI 1 "general_operand" "g,r<Q>,U"))] |
| 1098 |
"TARGET_COLDFIRE" |
| 1099 |
"* return output_move_himode (operands);" |
| 1100 |
[(set (attr "flags_valid") |
| 1101 |
(if_then_else (match_operand 0 "address_reg_operand") |
| 1102 |
(const_string "unchanged") |
| 1103 |
(const_string "move")))]) |
| 1104 |
|
| 1105 |
(define_expand "movstricthi" |
| 1106 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "")) |
| 1107 |
(match_operand:HI 1 "general_src_operand" ""))] |
| 1108 |
"" |
| 1109 |
"") |
| 1110 |
|
| 1111 |
(define_insn "" |
| 1112 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm")) |
| 1113 |
(match_operand:HI 1 "general_src_operand" "rmSn"))] |
| 1114 |
"!TARGET_COLDFIRE" |
| 1115 |
"* return output_move_stricthi (operands);" |
| 1116 |
[(set_attr "flags_valid" "move")]) |
| 1117 |
|
| 1118 |
(define_insn "" |
| 1119 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m")) |
| 1120 |
(match_operand:HI 1 "general_src_operand" "rmn,r"))] |
| 1121 |
"TARGET_COLDFIRE" |
| 1122 |
"* return output_move_stricthi (operands);" |
| 1123 |
[(set_attr "flags_valid" "move")]) |
| 1124 |
|
| 1125 |
(define_expand "movqi" |
| 1126 |
[(set (match_operand:QI 0 "nonimmediate_operand" "") |
| 1127 |
(match_operand:QI 1 "general_src_operand" ""))] |
| 1128 |
"" |
| 1129 |
"") |
| 1130 |
|
| 1131 |
(define_insn "" |
| 1132 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m") |
| 1133 |
(match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))] |
| 1134 |
"!TARGET_COLDFIRE" |
| 1135 |
"* return output_move_qimode (operands);" |
| 1136 |
[(set_attr "flags_valid" "set")]) |
| 1137 |
|
| 1138 |
(define_insn "" |
| 1139 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a") |
| 1140 |
(match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))] |
| 1141 |
"TARGET_COLDFIRE" |
| 1142 |
"* return output_move_qimode (operands);" |
| 1143 |
[(set_attr "flags_valid" "set")]) |
| 1144 |
|
| 1145 |
(define_expand "movstrictqi" |
| 1146 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "")) |
| 1147 |
(match_operand:QI 1 "general_src_operand" ""))] |
| 1148 |
"" |
| 1149 |
"") |
| 1150 |
|
| 1151 |
(define_insn "" |
| 1152 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm")) |
| 1153 |
(match_operand:QI 1 "general_src_operand" "dmSn"))] |
| 1154 |
"!TARGET_COLDFIRE" |
| 1155 |
"* return output_move_strictqi (operands);" |
| 1156 |
[(set_attr "flags_valid" "move")]) |
| 1157 |
|
| 1158 |
(define_insn "*movstrictqi_cf" |
| 1159 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d, Ac, d,m")) |
| 1160 |
(match_operand:QI 1 "general_src_operand" "C0,C0, dmn,d"))] |
| 1161 |
"TARGET_COLDFIRE" |
| 1162 |
"@ |
| 1163 |
clr%.b %0 |
| 1164 |
clr%.b %0 |
| 1165 |
move%.b %1,%0 |
| 1166 |
move%.b %1,%0" |
| 1167 |
[(set_attr "type" "clr,clr,move,move")]) |
| 1168 |
|
| 1169 |
(define_expand "pushqi1" |
| 1170 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2))) |
| 1171 |
(set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1))) |
| 1172 |
(match_operand:QI 0 "general_operand" ""))] |
| 1173 |
"!TARGET_COLDFIRE" |
| 1174 |
"") |
| 1175 |
|
| 1176 |
(define_expand "reload_insf" |
| 1177 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=f") |
| 1178 |
(match_operand:SF 1 "general_operand" "mf")) |
| 1179 |
(clobber (match_operand:SI 2 "register_operand" "=&a"))] |
| 1180 |
"TARGET_COLDFIRE_FPU" |
| 1181 |
{ |
| 1182 |
if (emit_move_sequence (operands, SFmode, operands[2])) |
| 1183 |
DONE; |
| 1184 |
|
| 1185 |
/* We don't want the clobber emitted, so handle this ourselves. */ |
| 1186 |
emit_insn (gen_rtx_SET (operands[0], operands[1])); |
| 1187 |
DONE; |
| 1188 |
}) |
| 1189 |
|
| 1190 |
(define_expand "reload_outsf" |
| 1191 |
[(set (match_operand:SF 0 "general_operand" "") |
| 1192 |
(match_operand:SF 1 "register_operand" "f")) |
| 1193 |
(clobber (match_operand:SI 2 "register_operand" "=&a"))] |
| 1194 |
"TARGET_COLDFIRE_FPU" |
| 1195 |
{ |
| 1196 |
if (emit_move_sequence (operands, SFmode, operands[2])) |
| 1197 |
DONE; |
| 1198 |
|
| 1199 |
/* We don't want the clobber emitted, so handle this ourselves. */ |
| 1200 |
emit_insn (gen_rtx_SET (operands[0], operands[1])); |
| 1201 |
DONE; |
| 1202 |
}) |
| 1203 |
|
| 1204 |
(define_expand "movsf" |
| 1205 |
[(set (match_operand:SF 0 "nonimmediate_operand" "") |
| 1206 |
(match_operand:SF 1 "general_operand" ""))] |
| 1207 |
"" |
| 1208 |
"") |
| 1209 |
|
| 1210 |
(define_insn "" |
| 1211 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=rmf") |
| 1212 |
(match_operand:SF 1 "general_operand" "rmfF"))] |
| 1213 |
"!TARGET_COLDFIRE" |
| 1214 |
{ |
| 1215 |
if (FP_REG_P (operands[0])) |
| 1216 |
{ |
| 1217 |
if (FP_REG_P (operands[1])) |
| 1218 |
return "f%$move%.x %1,%0"; |
| 1219 |
else if (ADDRESS_REG_P (operands[1])) |
| 1220 |
return "move%.l %1,%-\;f%$move%.s %+,%0"; |
| 1221 |
else if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 1222 |
return output_move_const_single (operands); |
| 1223 |
return "f%$move%.s %f1,%0"; |
| 1224 |
} |
| 1225 |
if (FP_REG_P (operands[1])) |
| 1226 |
{ |
| 1227 |
if (ADDRESS_REG_P (operands[0])) |
| 1228 |
return "fmove%.s %1,%-\;move%.l %+,%0"; |
| 1229 |
return "fmove%.s %f1,%0"; |
| 1230 |
} |
| 1231 |
if (operands[1] == CONST0_RTX (SFmode) |
| 1232 |
/* clr insns on 68000 read before writing. */ |
| 1233 |
&& ((TARGET_68010 || TARGET_COLDFIRE) |
| 1234 |
|| !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))) |
| 1235 |
{ |
| 1236 |
if (ADDRESS_REG_P (operands[0])) |
| 1237 |
{ |
| 1238 |
/* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */ |
| 1239 |
if (TUNE_68040_60) |
| 1240 |
return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0"; |
| 1241 |
else |
| 1242 |
return "sub%.l %0,%0"; |
| 1243 |
} |
| 1244 |
/* moveq is faster on the 68000. */ |
| 1245 |
if (DATA_REG_P (operands[0]) && TUNE_68000_10) |
| 1246 |
return "moveq #0,%0"; |
| 1247 |
return "clr%.l %0"; |
| 1248 |
} |
| 1249 |
return "move%.l %1,%0"; |
| 1250 |
} |
| 1251 |
[(set_attr "flags_valid" "move")]) |
| 1252 |
|
| 1253 |
(define_insn "movsf_cf_soft" |
| 1254 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>,g,U") |
| 1255 |
(match_operand:SF 1 "general_operand" "g,r<Q>,U"))] |
| 1256 |
"TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU" |
| 1257 |
"move%.l %1,%0" |
| 1258 |
[(set_attr "type" "move_l")]) |
| 1259 |
|
| 1260 |
;; SFmode MEMs are restricted to modes 2-4 if TARGET_COLDFIRE_FPU. |
| 1261 |
;; The move instructions can handle all combinations. |
| 1262 |
(define_insn "movsf_cf_hard" |
| 1263 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f |
| 1264 |
,m") |
| 1265 |
(match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m |
| 1266 |
,f"))] |
| 1267 |
"TARGET_COLDFIRE_FPU" |
| 1268 |
{ |
| 1269 |
if (which_alternative == 4 || which_alternative == 5) { |
| 1270 |
rtx xoperands[2]; |
| 1271 |
long l; |
| 1272 |
REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (operands[1]), l); |
| 1273 |
xoperands[0] = operands[0]; |
| 1274 |
xoperands[1] = GEN_INT (l); |
| 1275 |
if (which_alternative == 5) { |
| 1276 |
if (l == 0) { |
| 1277 |
if (ADDRESS_REG_P (xoperands[0])) |
| 1278 |
output_asm_insn ("sub%.l %0,%0", xoperands); |
| 1279 |
else |
| 1280 |
output_asm_insn ("clr%.l %0", xoperands); |
| 1281 |
} else |
| 1282 |
if (GET_CODE (operands[0]) == MEM |
| 1283 |
&& symbolic_operand (XEXP (operands[0], 0), SImode)) |
| 1284 |
output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands); |
| 1285 |
else |
| 1286 |
output_asm_insn ("move%.l %1,%0", xoperands); |
| 1287 |
return ""; |
| 1288 |
} |
| 1289 |
if (l != 0) |
| 1290 |
output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands); |
| 1291 |
else |
| 1292 |
output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands); |
| 1293 |
return ""; |
| 1294 |
} |
| 1295 |
if (FP_REG_P (operands[0])) |
| 1296 |
{ |
| 1297 |
if (ADDRESS_REG_P (operands[1])) |
| 1298 |
return "move%.l %1,%-;fsmove%.s %+,%0"; |
| 1299 |
if (FP_REG_P (operands[1])) |
| 1300 |
return "fsmove%.d %1,%0"; |
| 1301 |
return "fsmove%.s %f1,%0"; |
| 1302 |
} |
| 1303 |
if (FP_REG_P (operands[1])) |
| 1304 |
{ |
| 1305 |
if (ADDRESS_REG_P (operands[0])) |
| 1306 |
return "fmove%.s %1,%-;move%.l %+,%0"; |
| 1307 |
return "fmove%.s %f1,%0"; |
| 1308 |
} |
| 1309 |
if (operands[1] == CONST0_RTX (SFmode)) |
| 1310 |
{ |
| 1311 |
if (ADDRESS_REG_P (operands[0])) |
| 1312 |
return "sub%.l %0,%0"; |
| 1313 |
return "clr%.l %0"; |
| 1314 |
} |
| 1315 |
return "move%.l %1,%0"; |
| 1316 |
}) |
| 1317 |
|
| 1318 |
(define_expand "reload_indf" |
| 1319 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=f") |
| 1320 |
(match_operand:DF 1 "general_operand" "mf")) |
| 1321 |
(clobber (match_operand:SI 2 "register_operand" "=&a"))] |
| 1322 |
"TARGET_COLDFIRE_FPU" |
| 1323 |
{ |
| 1324 |
if (emit_move_sequence (operands, DFmode, operands[2])) |
| 1325 |
DONE; |
| 1326 |
|
| 1327 |
/* We don't want the clobber emitted, so handle this ourselves. */ |
| 1328 |
emit_insn (gen_rtx_SET (operands[0], operands[1])); |
| 1329 |
DONE; |
| 1330 |
}) |
| 1331 |
|
| 1332 |
(define_expand "reload_outdf" |
| 1333 |
[(set (match_operand:DF 0 "general_operand" "") |
| 1334 |
(match_operand:DF 1 "register_operand" "f")) |
| 1335 |
(clobber (match_operand:SI 2 "register_operand" "=&a"))] |
| 1336 |
"TARGET_COLDFIRE_FPU" |
| 1337 |
{ |
| 1338 |
if (emit_move_sequence (operands, DFmode, operands[2])) |
| 1339 |
DONE; |
| 1340 |
|
| 1341 |
/* We don't want the clobber emitted, so handle this ourselves. */ |
| 1342 |
emit_insn (gen_rtx_SET (operands[0], operands[1])); |
| 1343 |
DONE; |
| 1344 |
}) |
| 1345 |
|
| 1346 |
(define_expand "movdf" |
| 1347 |
[(set (match_operand:DF 0 "nonimmediate_operand" "") |
| 1348 |
(match_operand:DF 1 "general_operand" ""))] |
| 1349 |
"" |
| 1350 |
{ |
| 1351 |
if (TARGET_COLDFIRE_FPU) |
| 1352 |
if (emit_move_sequence (operands, DFmode, 0)) |
| 1353 |
DONE; |
| 1354 |
}) |
| 1355 |
|
| 1356 |
(define_insn "" |
| 1357 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>,&rf<>") |
| 1358 |
(match_operand:DF 1 "general_operand" "*rf,m,0,*rfE<>,*rofE<>"))] |
| 1359 |
; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>") |
| 1360 |
; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))] |
| 1361 |
"!TARGET_COLDFIRE" |
| 1362 |
{ |
| 1363 |
if (FP_REG_P (operands[0])) |
| 1364 |
{ |
| 1365 |
if (FP_REG_P (operands[1])) |
| 1366 |
return "f%&move%.x %1,%0"; |
| 1367 |
if (REG_P (operands[1])) |
| 1368 |
{ |
| 1369 |
rtx xoperands[2]; |
| 1370 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 1371 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 1372 |
output_asm_insn ("move%.l %1,%-", operands); |
| 1373 |
return "f%&move%.d %+,%0"; |
| 1374 |
} |
| 1375 |
if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 1376 |
return output_move_const_double (operands); |
| 1377 |
return "f%&move%.d %f1,%0"; |
| 1378 |
} |
| 1379 |
else if (FP_REG_P (operands[1])) |
| 1380 |
{ |
| 1381 |
if (REG_P (operands[0])) |
| 1382 |
{ |
| 1383 |
output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands); |
| 1384 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1385 |
return "move%.l %+,%0"; |
| 1386 |
} |
| 1387 |
else |
| 1388 |
return "fmove%.d %f1,%0"; |
| 1389 |
} |
| 1390 |
return output_move_double (operands); |
| 1391 |
} |
| 1392 |
[(set_attr "flags_valid" "move")]) |
| 1393 |
|
| 1394 |
(define_insn_and_split "movdf_cf_soft" |
| 1395 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=r,g") |
| 1396 |
(match_operand:DF 1 "general_operand" "g,r"))] |
| 1397 |
"TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU" |
| 1398 |
"#" |
| 1399 |
"&& reload_completed" |
| 1400 |
[(const_int 0)] |
| 1401 |
{ |
| 1402 |
m68k_emit_move_double (operands); |
| 1403 |
DONE; |
| 1404 |
}) |
| 1405 |
|
| 1406 |
(define_insn "movdf_cf_hard" |
| 1407 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f") |
| 1408 |
(match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))] |
| 1409 |
"TARGET_COLDFIRE_FPU" |
| 1410 |
{ |
| 1411 |
rtx xoperands[3]; |
| 1412 |
long l[2]; |
| 1413 |
|
| 1414 |
switch (which_alternative) |
| 1415 |
{ |
| 1416 |
default: |
| 1417 |
return "fdmove%.d %1,%0"; |
| 1418 |
case 1: |
| 1419 |
return "fmove%.d %1,%0"; |
| 1420 |
case 2: |
| 1421 |
return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0"; |
| 1422 |
case 3: |
| 1423 |
return "move%.l %R1,%-;move%.l %1,%-;fdmove%.d %+,%0"; |
| 1424 |
case 4: case 5: case 6: |
| 1425 |
return output_move_double (operands); |
| 1426 |
case 7: |
| 1427 |
REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (operands[1]), l); |
| 1428 |
xoperands[0] = operands[0]; |
| 1429 |
xoperands[1] = GEN_INT (l[0]); |
| 1430 |
xoperands[2] = GEN_INT (l[1]); |
| 1431 |
if (operands[1] == CONST0_RTX (DFmode)) |
| 1432 |
output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0", |
| 1433 |
xoperands); |
| 1434 |
else |
| 1435 |
if (l[1] == 0) |
| 1436 |
output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0", |
| 1437 |
xoperands); |
| 1438 |
else |
| 1439 |
output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0", |
| 1440 |
xoperands); |
| 1441 |
return ""; |
| 1442 |
} |
| 1443 |
}) |
| 1444 |
|
| 1445 |
;; ??? The XFmode patterns are schizophrenic about whether constants are |
| 1446 |
;; allowed. Most but not all have predicates and constraint that disallow |
| 1447 |
;; constants. Most but not all have output templates that handle constants. |
| 1448 |
;; See also TARGET_LEGITIMATE_CONSTANT_P. |
| 1449 |
|
| 1450 |
(define_expand "movxf" |
| 1451 |
[(set (match_operand:XF 0 "nonimmediate_operand" "") |
| 1452 |
(match_operand:XF 1 "general_operand" ""))] |
| 1453 |
"" |
| 1454 |
{ |
| 1455 |
/* We can't rewrite operands during reload. */ |
| 1456 |
if (! (reload_in_progress || lra_in_progress)) |
| 1457 |
{ |
| 1458 |
if (CONSTANT_P (operands[1])) |
| 1459 |
{ |
| 1460 |
operands[1] = force_const_mem (XFmode, operands[1]); |
| 1461 |
if (! memory_address_p (XFmode, XEXP (operands[1], 0))) |
| 1462 |
operands[1] = adjust_address (operands[1], XFmode, 0); |
| 1463 |
} |
| 1464 |
if (flag_pic && TARGET_PCREL) |
| 1465 |
{ |
| 1466 |
/* Don't allow writes to memory except via a register; the |
| 1467 |
m68k doesn't consider PC-relative addresses to be writable. */ |
| 1468 |
if (GET_CODE (operands[0]) == MEM |
| 1469 |
&& symbolic_operand (XEXP (operands[0], 0), SImode)) |
| 1470 |
operands[0] = gen_rtx_MEM (XFmode, |
| 1471 |
force_reg (SImode, XEXP (operands[0], 0))); |
| 1472 |
} |
| 1473 |
} |
| 1474 |
}) |
| 1475 |
|
| 1476 |
(define_insn "" |
| 1477 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r") |
| 1478 |
(match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))] |
| 1479 |
"TARGET_68881" |
| 1480 |
{ |
| 1481 |
if (FP_REG_P (operands[0])) |
| 1482 |
{ |
| 1483 |
if (FP_REG_P (operands[1])) |
| 1484 |
return "fmove%.x %1,%0"; |
| 1485 |
if (REG_P (operands[1])) |
| 1486 |
{ |
| 1487 |
rtx xoperands[2]; |
| 1488 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2); |
| 1489 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 1490 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 1491 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 1492 |
output_asm_insn ("move%.l %1,%-", operands); |
| 1493 |
return "fmove%.x %+,%0"; |
| 1494 |
} |
| 1495 |
if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 1496 |
return "fmove%.x %1,%0"; |
| 1497 |
return "fmove%.x %f1,%0"; |
| 1498 |
} |
| 1499 |
if (FP_REG_P (operands[1])) |
| 1500 |
{ |
| 1501 |
if (REG_P (operands[0])) |
| 1502 |
{ |
| 1503 |
output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands); |
| 1504 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1505 |
output_asm_insn ("move%.l %+,%0", operands); |
| 1506 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1507 |
return "move%.l %+,%0"; |
| 1508 |
} |
| 1509 |
/* Must be memory destination. */ |
| 1510 |
return "fmove%.x %f1,%0"; |
| 1511 |
} |
| 1512 |
return output_move_double (operands); |
| 1513 |
} |
| 1514 |
[(set_attr "flags_valid" "move")]) |
| 1515 |
|
| 1516 |
(define_insn "" |
| 1517 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>,&rf<>") |
| 1518 |
(match_operand:XF 1 "nonimmediate_operand" "rf,m,rf<>,rof<>"))] |
| 1519 |
"! TARGET_68881 && ! TARGET_COLDFIRE" |
| 1520 |
{ |
| 1521 |
if (FP_REG_P (operands[0])) |
| 1522 |
{ |
| 1523 |
if (FP_REG_P (operands[1])) |
| 1524 |
return "fmove%.x %1,%0"; |
| 1525 |
if (REG_P (operands[1])) |
| 1526 |
{ |
| 1527 |
rtx xoperands[2]; |
| 1528 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2); |
| 1529 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 1530 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 1531 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 1532 |
output_asm_insn ("move%.l %1,%-", operands); |
| 1533 |
return "fmove%.x %+,%0"; |
| 1534 |
} |
| 1535 |
if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 1536 |
return "fmove%.x %1,%0"; |
| 1537 |
return "fmove%.x %f1,%0"; |
| 1538 |
} |
| 1539 |
if (FP_REG_P (operands[1])) |
| 1540 |
{ |
| 1541 |
if (REG_P (operands[0])) |
| 1542 |
{ |
| 1543 |
output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands); |
| 1544 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1545 |
output_asm_insn ("move%.l %+,%0", operands); |
| 1546 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1547 |
return "move%.l %+,%0"; |
| 1548 |
} |
| 1549 |
else |
| 1550 |
return "fmove%.x %f1,%0"; |
| 1551 |
} |
| 1552 |
return output_move_double (operands); |
| 1553 |
}) |
| 1554 |
|
| 1555 |
(define_insn "" |
| 1556 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=r,g") |
| 1557 |
(match_operand:XF 1 "nonimmediate_operand" "g,r"))] |
| 1558 |
"! TARGET_68881 && TARGET_COLDFIRE" |
| 1559 |
"* return output_move_double (operands);") |
| 1560 |
|
| 1561 |
(define_expand "movdi" |
| 1562 |
;; Let's see if it really still needs to handle fp regs, and, if so, why. |
| 1563 |
[(set (match_operand:DI 0 "nonimmediate_operand" "") |
| 1564 |
(match_operand:DI 1 "general_operand" ""))] |
| 1565 |
"" |
| 1566 |
"") |
| 1567 |
|
| 1568 |
;; movdi can apply to fp regs in some cases |
| 1569 |
(define_insn "" |
| 1570 |
;; Let's see if it really still needs to handle fp regs, and, if so, why. |
| 1571 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>,&r<>") |
| 1572 |
(match_operand:DI 1 "general_operand" "rF,m,ri<>F,roi<>F"))] |
| 1573 |
; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f") |
| 1574 |
; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))] |
| 1575 |
; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f") |
| 1576 |
; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))] |
| 1577 |
"!TARGET_COLDFIRE" |
| 1578 |
{ |
| 1579 |
if (FP_REG_P (operands[0])) |
| 1580 |
{ |
| 1581 |
if (FP_REG_P (operands[1])) |
| 1582 |
return "fmove%.x %1,%0"; |
| 1583 |
if (REG_P (operands[1])) |
| 1584 |
{ |
| 1585 |
rtx xoperands[2]; |
| 1586 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 1587 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 1588 |
output_asm_insn ("move%.l %1,%-", operands); |
| 1589 |
return "fmove%.d %+,%0"; |
| 1590 |
} |
| 1591 |
if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 1592 |
return output_move_const_double (operands); |
| 1593 |
return "fmove%.d %f1,%0"; |
| 1594 |
} |
| 1595 |
else if (FP_REG_P (operands[1])) |
| 1596 |
{ |
| 1597 |
if (REG_P (operands[0])) |
| 1598 |
{ |
| 1599 |
output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands); |
| 1600 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1601 |
return "move%.l %+,%0"; |
| 1602 |
} |
| 1603 |
else |
| 1604 |
return "fmove%.d %f1,%0"; |
| 1605 |
} |
| 1606 |
return output_move_double (operands); |
| 1607 |
}) |
| 1608 |
|
| 1609 |
(define_insn "" |
| 1610 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,g") |
| 1611 |
(match_operand:DI 1 "general_operand" "g,r"))] |
| 1612 |
"TARGET_COLDFIRE" |
| 1613 |
"* return output_move_double (operands);") |
| 1614 |
|
| 1615 |
;; Thus goes after the move instructions |
| 1616 |
;; because the move instructions are better (require no spilling) |
| 1617 |
;; when they can apply. It goes before the add/sub insns |
| 1618 |
;; so we will prefer it to them. |
| 1619 |
|
| 1620 |
(define_insn "pushasi" |
| 1621 |
[(set (match_operand:SI 0 "push_operand" "=m") |
| 1622 |
(match_operand:SI 1 "address_operand" "p"))] |
| 1623 |
"" |
| 1624 |
"pea %a1" |
| 1625 |
[(set_attr "type" "pea")]) |
| 1626 |
|
| 1627 |
;; truncation instructions |
| 1628 |
(define_insn "truncsiqi2" |
| 1629 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d") |
| 1630 |
(truncate:QI |
| 1631 |
(match_operand:SI 1 "general_src_operand" "doJS,i")))] |
| 1632 |
"!TARGET_COLDFIRE" |
| 1633 |
{ |
| 1634 |
if (GET_CODE (operands[0]) == REG) |
| 1635 |
return "move%.l %1,%0"; |
| 1636 |
|
| 1637 |
if (GET_CODE (operands[1]) == MEM) |
| 1638 |
operands[1] = adjust_address (operands[1], QImode, 3); |
| 1639 |
return "move%.b %1,%0"; |
| 1640 |
} |
| 1641 |
[(set (attr "flags_valid") |
| 1642 |
(if_then_else (match_operand 0 "register_operand") |
| 1643 |
(const_string "no") |
| 1644 |
(const_string "yes")))]) |
| 1645 |
|
| 1646 |
(define_insn "trunchiqi2" |
| 1647 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d") |
| 1648 |
(truncate:QI |
| 1649 |
(match_operand:HI 1 "general_src_operand" "doJS,i")))] |
| 1650 |
"!TARGET_COLDFIRE" |
| 1651 |
{ |
| 1652 |
if (GET_CODE (operands[0]) == REG |
| 1653 |
&& (GET_CODE (operands[1]) == MEM |
| 1654 |
|| GET_CODE (operands[1]) == CONST_INT)) |
| 1655 |
return "move%.w %1,%0"; |
| 1656 |
|
| 1657 |
if (GET_CODE (operands[0]) == REG) |
| 1658 |
return "move%.l %1,%0"; |
| 1659 |
|
| 1660 |
if (GET_CODE (operands[1]) == MEM) |
| 1661 |
operands[1] = adjust_address (operands[1], QImode, 1); |
| 1662 |
return "move%.b %1,%0"; |
| 1663 |
} |
| 1664 |
[(set (attr "flags_valid") |
| 1665 |
(if_then_else (match_operand 0 "register_operand") |
| 1666 |
(const_string "no") |
| 1667 |
(const_string "yes")))]) |
| 1668 |
|
| 1669 |
(define_insn "truncsihi2" |
| 1670 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d") |
| 1671 |
(truncate:HI |
| 1672 |
(match_operand:SI 1 "general_src_operand" "roJS,i")))] |
| 1673 |
"!TARGET_COLDFIRE" |
| 1674 |
{ |
| 1675 |
if (GET_CODE (operands[0]) == REG) |
| 1676 |
return "move%.l %1,%0"; |
| 1677 |
|
| 1678 |
if (GET_CODE (operands[1]) == MEM) |
| 1679 |
operands[1] = adjust_address (operands[1], QImode, 2); |
| 1680 |
return "move%.w %1,%0"; |
| 1681 |
} |
| 1682 |
[(set (attr "flags_valid") |
| 1683 |
(if_then_else (match_operand 0 "register_operand") |
| 1684 |
(const_string "no") |
| 1685 |
(const_string "yes")))]) |
| 1686 |
|
| 1687 |
;; zero extension instructions |
| 1688 |
|
| 1689 |
;; two special patterns to match various post_inc/pre_dec patterns |
| 1690 |
(define_insn_and_split "*zero_extend_inc" |
| 1691 |
[(set (match_operand 0 "post_inc_operand" "") |
| 1692 |
(zero_extend (match_operand 1 "register_operand" "")))] |
| 1693 |
"GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT && |
| 1694 |
GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT && |
| 1695 |
GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2" |
| 1696 |
"#" |
| 1697 |
"&& 1" |
| 1698 |
[(set (match_dup 0) |
| 1699 |
(const_int 0)) |
| 1700 |
(set (match_dup 0) |
| 1701 |
(match_dup 1))] |
| 1702 |
{ |
| 1703 |
operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0); |
| 1704 |
}) |
| 1705 |
|
| 1706 |
(define_insn_and_split "*zero_extend_dec" |
| 1707 |
[(set (match_operand 0 "pre_dec_operand" "") |
| 1708 |
(zero_extend (match_operand 1 "register_operand" "")))] |
| 1709 |
"(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) && |
| 1710 |
GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT && |
| 1711 |
GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT && |
| 1712 |
GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2" |
| 1713 |
"#" |
| 1714 |
"&& 1" |
| 1715 |
[(set (match_dup 0) |
| 1716 |
(match_dup 1)) |
| 1717 |
(set (match_dup 0) |
| 1718 |
(const_int 0))] |
| 1719 |
{ |
| 1720 |
operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0); |
| 1721 |
}) |
| 1722 |
|
| 1723 |
(define_insn_and_split "zero_extendqidi2" |
| 1724 |
[(set (match_operand:DI 0 "register_operand" "") |
| 1725 |
(zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))] |
| 1726 |
"" |
| 1727 |
"#" |
| 1728 |
"" |
| 1729 |
[(set (match_dup 2) |
| 1730 |
(zero_extend:SI (match_dup 1))) |
| 1731 |
(set (match_dup 3) |
| 1732 |
(const_int 0))] |
| 1733 |
{ |
| 1734 |
operands[2] = gen_lowpart (SImode, operands[0]); |
| 1735 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 1736 |
}) |
| 1737 |
|
| 1738 |
(define_insn_and_split "zero_extendhidi2" |
| 1739 |
[(set (match_operand:DI 0 "register_operand" "") |
| 1740 |
(zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))] |
| 1741 |
"" |
| 1742 |
"#" |
| 1743 |
"" |
| 1744 |
[(set (match_dup 2) |
| 1745 |
(zero_extend:SI (match_dup 1))) |
| 1746 |
(set (match_dup 3) |
| 1747 |
(const_int 0))] |
| 1748 |
{ |
| 1749 |
operands[2] = gen_lowpart (SImode, operands[0]); |
| 1750 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 1751 |
}) |
| 1752 |
|
| 1753 |
(define_expand "zero_extendsidi2" |
| 1754 |
[(set (match_operand:DI 0 "nonimmediate_operand" "") |
| 1755 |
(zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))] |
| 1756 |
"" |
| 1757 |
{ |
| 1758 |
if (GET_CODE (operands[0]) == MEM |
| 1759 |
&& GET_CODE (operands[1]) == MEM) |
| 1760 |
operands[1] = force_reg (SImode, operands[1]); |
| 1761 |
}) |
| 1762 |
|
| 1763 |
(define_insn_and_split "*zero_extendsidi2" |
| 1764 |
[(set (match_operand:DI 0 "nonimmediate_operand" "") |
| 1765 |
(zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))] |
| 1766 |
"GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM" |
| 1767 |
"#" |
| 1768 |
"&& 1" |
| 1769 |
[(set (match_dup 2) |
| 1770 |
(match_dup 1)) |
| 1771 |
(set (match_dup 3) |
| 1772 |
(const_int 0))] |
| 1773 |
{ |
| 1774 |
operands[2] = gen_lowpart (SImode, operands[0]); |
| 1775 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 1776 |
}) |
| 1777 |
|
| 1778 |
(define_insn "*zero_extendhisi2_cf" |
| 1779 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 1780 |
(zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))] |
| 1781 |
"ISA_HAS_MVS_MVZ" |
| 1782 |
"mvz%.w %1,%0" |
| 1783 |
[(set_attr "type" "mvsz")]) |
| 1784 |
|
| 1785 |
(define_insn "zero_extendhisi2" |
| 1786 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 1787 |
(zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))] |
| 1788 |
"" |
| 1789 |
"#") |
| 1790 |
|
| 1791 |
(define_expand "zero_extendqihi2" |
| 1792 |
[(set (match_operand:HI 0 "register_operand" "") |
| 1793 |
(zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))] |
| 1794 |
"!TARGET_COLDFIRE" |
| 1795 |
"") |
| 1796 |
|
| 1797 |
(define_insn "*zero_extendqihi2" |
| 1798 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 1799 |
(zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))] |
| 1800 |
"!TARGET_COLDFIRE" |
| 1801 |
"#") |
| 1802 |
|
| 1803 |
(define_insn "*zero_extendqisi2_cfv4" |
| 1804 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 1805 |
(zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))] |
| 1806 |
"ISA_HAS_MVS_MVZ" |
| 1807 |
"mvz%.b %1,%0" |
| 1808 |
[(set_attr "type" "mvsz")]) |
| 1809 |
|
| 1810 |
(define_insn "zero_extendqisi2" |
| 1811 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 1812 |
(zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))] |
| 1813 |
"" |
| 1814 |
"#") |
| 1815 |
|
| 1816 |
;; these two pattern split everything else which isn't matched by |
| 1817 |
;; something else above |
| 1818 |
(define_split |
| 1819 |
[(set (match_operand 0 "register_operand" "") |
| 1820 |
(zero_extend (match_operand 1 "nonimmediate_src_operand" "")))] |
| 1821 |
"!ISA_HAS_MVS_MVZ |
| 1822 |
&& reload_completed |
| 1823 |
&& reg_mentioned_p (operands[0], operands[1])" |
| 1824 |
[(set (strict_low_part (match_dup 2)) |
| 1825 |
(match_dup 1)) |
| 1826 |
(set (match_dup 0) |
| 1827 |
(match_op_dup 4 [(match_dup 0) (match_dup 3)]))] |
| 1828 |
{ |
| 1829 |
operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]); |
| 1830 |
operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1]))); |
| 1831 |
operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]); |
| 1832 |
}) |
| 1833 |
|
| 1834 |
(define_split |
| 1835 |
[(set (match_operand 0 "register_operand" "") |
| 1836 |
(zero_extend (match_operand 1 "nonimmediate_src_operand" "")))] |
| 1837 |
"!ISA_HAS_MVS_MVZ && reload_completed" |
| 1838 |
[(set (match_dup 0) |
| 1839 |
(const_int 0)) |
| 1840 |
(set (strict_low_part (match_dup 2)) |
| 1841 |
(match_dup 1))] |
| 1842 |
{ |
| 1843 |
operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]); |
| 1844 |
}) |
| 1845 |
|
| 1846 |
;; sign extension instructions |
| 1847 |
|
| 1848 |
(define_insn "extendqidi2" |
| 1849 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=d") |
| 1850 |
(sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))] |
| 1851 |
"" |
| 1852 |
{ |
| 1853 |
operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1854 |
if (ISA_HAS_MVS_MVZ) |
| 1855 |
return "mvs%.b %1,%2\;smi %0\;extb%.l %0"; |
| 1856 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 1857 |
{ |
| 1858 |
if (ADDRESS_REG_P (operands[1])) |
| 1859 |
return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0"; |
| 1860 |
else |
| 1861 |
return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0"; |
| 1862 |
} |
| 1863 |
else |
| 1864 |
{ |
| 1865 |
if (ADDRESS_REG_P (operands[1])) |
| 1866 |
return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0"; |
| 1867 |
else |
| 1868 |
return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0"; |
| 1869 |
} |
| 1870 |
}) |
| 1871 |
|
| 1872 |
(define_insn "extendhidi2" |
| 1873 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=d") |
| 1874 |
(sign_extend:DI |
| 1875 |
(match_operand:HI 1 "general_src_operand" "rmS")))] |
| 1876 |
"" |
| 1877 |
{ |
| 1878 |
operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1879 |
if (ISA_HAS_MVS_MVZ) |
| 1880 |
return "mvs%.w %1,%2\;smi %0\;extb%.l %0"; |
| 1881 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 1882 |
return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0"; |
| 1883 |
else |
| 1884 |
return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0"; |
| 1885 |
}) |
| 1886 |
|
| 1887 |
(define_insn "extendsidi2" |
| 1888 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=d,o,o,<") |
| 1889 |
(sign_extend:DI |
| 1890 |
(match_operand:SI 1 "nonimmediate_src_operand" "rm,rm,r<Q>,rm"))) |
| 1891 |
(clobber (match_scratch:SI 2 "=X,&d,&d,&d"))] |
| 1892 |
"" |
| 1893 |
{ |
| 1894 |
if (which_alternative == 0) |
| 1895 |
/* Handle alternative 0. */ |
| 1896 |
{ |
| 1897 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 1898 |
return "move%.l %1,%R0\;smi %0\;extb%.l %0"; |
| 1899 |
else |
| 1900 |
return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0"; |
| 1901 |
} |
| 1902 |
|
| 1903 |
/* Handle alternatives 1, 2 and 3. We don't need to adjust address by 4 |
| 1904 |
in alternative 3 because autodecrement will do that for us. */ |
| 1905 |
operands[3] = adjust_address (operands[0], SImode, |
| 1906 |
which_alternative == 3 ? 0 : 4); |
| 1907 |
operands[0] = adjust_address (operands[0], SImode, 0); |
| 1908 |
|
| 1909 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 1910 |
return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0"; |
| 1911 |
else |
| 1912 |
return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0"; |
| 1913 |
} |
| 1914 |
[(set_attr "ok_for_coldfire" "yes,no,yes,yes")]) |
| 1915 |
|
| 1916 |
;; Special case when one can avoid register clobbering, copy and test |
| 1917 |
;; Maybe there is a way to make that the general case, by forcing the |
| 1918 |
;; result of the SI tree to be in the lower register of the DI target |
| 1919 |
|
| 1920 |
;; Don't allow memory for operand 1 as that would require an earlyclobber |
| 1921 |
;; which results in worse code |
| 1922 |
(define_insn "extendplussidi" |
| 1923 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 1924 |
(sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rn") |
| 1925 |
(match_operand:SI 2 "general_operand" "rmn"))))] |
| 1926 |
"" |
| 1927 |
{ |
| 1928 |
operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 1929 |
if (GET_CODE (operands[1]) == CONST_INT |
| 1930 |
&& (unsigned) INTVAL (operands[1]) > 8) |
| 1931 |
{ |
| 1932 |
rtx tmp = operands[1]; |
| 1933 |
|
| 1934 |
operands[1] = operands[2]; |
| 1935 |
operands[2] = tmp; |
| 1936 |
} |
| 1937 |
if (GET_CODE (operands[1]) == REG |
| 1938 |
&& REGNO (operands[1]) == REGNO (operands[3])) |
| 1939 |
output_asm_insn ("add%.l %2,%3", operands); |
| 1940 |
else |
| 1941 |
output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands); |
| 1942 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 1943 |
return "smi %0\;extb%.l %0"; |
| 1944 |
else |
| 1945 |
return "smi %0\;ext%.w %0\;ext%.l %0"; |
| 1946 |
}) |
| 1947 |
|
| 1948 |
(define_expand "extendhisi2" |
| 1949 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 1950 |
(sign_extend:SI |
| 1951 |
(match_operand:HI 1 "nonimmediate_src_operand" "")))] |
| 1952 |
"" |
| 1953 |
"") |
| 1954 |
|
| 1955 |
(define_insn "*cfv4_extendhisi2" |
| 1956 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 1957 |
(sign_extend:SI |
| 1958 |
(match_operand:HI 1 "nonimmediate_src_operand" "rmS")))] |
| 1959 |
"ISA_HAS_MVS_MVZ" |
| 1960 |
"mvs%.w %1,%0" |
| 1961 |
[(set_attr "type" "mvsz")]) |
| 1962 |
|
| 1963 |
(define_insn "*68k_extendhisi2" |
| 1964 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a") |
| 1965 |
(sign_extend:SI |
| 1966 |
(match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))] |
| 1967 |
"!ISA_HAS_MVS_MVZ" |
| 1968 |
"@ |
| 1969 |
ext%.l %0 |
| 1970 |
move%.w %1,%0" |
| 1971 |
[(set_attr "type" "ext,move")]) |
| 1972 |
|
| 1973 |
(define_insn "extendqihi2" |
| 1974 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=d") |
| 1975 |
(sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))] |
| 1976 |
"" |
| 1977 |
"ext%.w %0" |
| 1978 |
[(set_attr "type" "ext")]) |
| 1979 |
|
| 1980 |
(define_expand "extendqisi2" |
| 1981 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 1982 |
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] |
| 1983 |
"TARGET_68020 || TARGET_COLDFIRE" |
| 1984 |
"") |
| 1985 |
|
| 1986 |
(define_insn "*cfv4_extendqisi2" |
| 1987 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 1988 |
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))] |
| 1989 |
"ISA_HAS_MVS_MVZ" |
| 1990 |
"mvs%.b %1,%0" |
| 1991 |
[(set_attr "type" "mvsz")]) |
| 1992 |
|
| 1993 |
(define_insn "*68k_extendqisi2" |
| 1994 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 1995 |
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))] |
| 1996 |
"TARGET_68020 || (TARGET_COLDFIRE && !ISA_HAS_MVS_MVZ)" |
| 1997 |
"extb%.l %0" |
| 1998 |
[(set_attr "type" "ext")]) |
| 1999 |
|
| 2000 |
;; Conversions between float and double. |
| 2001 |
|
| 2002 |
(define_expand "extendsfdf2" |
| 2003 |
[(set (match_operand:DF 0 "nonimmediate_operand" "") |
| 2004 |
(float_extend:DF |
| 2005 |
(match_operand:SF 1 "general_operand" "")))] |
| 2006 |
"TARGET_HARD_FLOAT" |
| 2007 |
"") |
| 2008 |
|
| 2009 |
(define_insn "" |
| 2010 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f") |
| 2011 |
(float_extend:DF |
| 2012 |
(match_operand:SF 1 "general_operand" "f,dmF")))] |
| 2013 |
"TARGET_68881" |
| 2014 |
{ |
| 2015 |
if (FP_REG_P (operands[0]) && FP_REG_P (operands[1])) |
| 2016 |
{ |
| 2017 |
if (REGNO (operands[0]) == REGNO (operands[1])) |
| 2018 |
{ |
| 2019 |
/* Extending float to double in an fp-reg is a no-op. */ |
| 2020 |
return ""; |
| 2021 |
} |
| 2022 |
return "f%&move%.x %1,%0"; |
| 2023 |
} |
| 2024 |
if (FP_REG_P (operands[0])) |
| 2025 |
return "f%&move%.s %f1,%0"; |
| 2026 |
if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1])) |
| 2027 |
{ |
| 2028 |
output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands); |
| 2029 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 2030 |
return "move%.l %+,%0"; |
| 2031 |
} |
| 2032 |
return "fmove%.d %f1,%0"; |
| 2033 |
}) |
| 2034 |
|
| 2035 |
(define_insn "extendsfdf2_cf" |
| 2036 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=f,f") |
| 2037 |
(float_extend:DF |
| 2038 |
(match_operand:SF 1 "general_operand" "f,<Q>U")))] |
| 2039 |
"TARGET_COLDFIRE_FPU" |
| 2040 |
{ |
| 2041 |
if (FP_REG_P (operands[0]) && FP_REG_P (operands[1])) |
| 2042 |
{ |
| 2043 |
if (REGNO (operands[0]) == REGNO (operands[1])) |
| 2044 |
{ |
| 2045 |
/* Extending float to double in an fp-reg is a no-op. */ |
| 2046 |
return ""; |
| 2047 |
} |
| 2048 |
return "fdmove%.d %1,%0"; |
| 2049 |
} |
| 2050 |
return "fdmove%.s %f1,%0"; |
| 2051 |
}) |
| 2052 |
|
| 2053 |
;; This cannot output into an f-reg because there is no way to be |
| 2054 |
;; sure of truncating in that case. |
| 2055 |
(define_expand "truncdfsf2" |
| 2056 |
[(set (match_operand:SF 0 "nonimmediate_operand" "") |
| 2057 |
(float_truncate:SF |
| 2058 |
(match_operand:DF 1 "general_operand" "")))] |
| 2059 |
"TARGET_HARD_FLOAT" |
| 2060 |
"") |
| 2061 |
|
| 2062 |
;; On the '040 we can truncate in a register accurately and easily. |
| 2063 |
(define_insn "" |
| 2064 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=f") |
| 2065 |
(float_truncate:SF |
| 2066 |
(match_operand:DF 1 "general_operand" "fmG")))] |
| 2067 |
"TARGET_68881 && TARGET_68040" |
| 2068 |
{ |
| 2069 |
if (FP_REG_P (operands[1])) |
| 2070 |
return "f%$move%.x %1,%0"; |
| 2071 |
return "f%$move%.d %f1,%0"; |
| 2072 |
}) |
| 2073 |
|
| 2074 |
(define_insn "truncdfsf2_cf" |
| 2075 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U") |
| 2076 |
(float_truncate:SF |
| 2077 |
(match_operand:DF 1 "general_operand" "<Q>U,f")))] |
| 2078 |
"TARGET_COLDFIRE_FPU" |
| 2079 |
"@ |
| 2080 |
fsmove%.d %1,%0 |
| 2081 |
fmove%.s %1,%0" |
| 2082 |
[(set_attr "type" "fmove")]) |
| 2083 |
|
| 2084 |
(define_insn "*truncdfsf2_68881" |
| 2085 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=dm") |
| 2086 |
(float_truncate:SF |
| 2087 |
(match_operand:DF 1 "general_operand" "f")))] |
| 2088 |
"TARGET_68881" |
| 2089 |
"fmove%.s %f1,%0" |
| 2090 |
[(set_attr "type" "fmove")]) |
| 2091 |
|
| 2092 |
;; Conversion between fixed point and floating point. |
| 2093 |
;; Note that among the fix-to-float insns |
| 2094 |
;; the ones that start with SImode come first. |
| 2095 |
;; That is so that an operand that is a CONST_INT |
| 2096 |
;; (and therefore lacks a specific machine mode). |
| 2097 |
;; will be recognized as SImode (which is always valid) |
| 2098 |
;; rather than as QImode or HImode. |
| 2099 |
|
| 2100 |
(define_expand "floatsi<mode>2" |
| 2101 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 2102 |
(float:FP (match_operand:SI 1 "general_operand" "")))] |
| 2103 |
"TARGET_HARD_FLOAT" |
| 2104 |
"") |
| 2105 |
|
| 2106 |
(define_insn "floatsi<mode>2_68881" |
| 2107 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2108 |
(float:FP (match_operand:SI 1 "general_operand" "dmi")))] |
| 2109 |
"TARGET_68881" |
| 2110 |
"f<FP:round>move%.l %1,%0" |
| 2111 |
[(set_attr "type" "fmove")]) |
| 2112 |
|
| 2113 |
(define_insn "floatsi<mode>2_cf" |
| 2114 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2115 |
(float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))] |
| 2116 |
"TARGET_COLDFIRE_FPU" |
| 2117 |
"f<FP:prec>move%.l %1,%0" |
| 2118 |
[(set_attr "type" "fmove")]) |
| 2119 |
|
| 2120 |
|
| 2121 |
(define_expand "floathi<mode>2" |
| 2122 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 2123 |
(float:FP (match_operand:HI 1 "general_operand" "")))] |
| 2124 |
"TARGET_HARD_FLOAT" |
| 2125 |
"") |
| 2126 |
|
| 2127 |
(define_insn "floathi<mode>2_68881" |
| 2128 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2129 |
(float:FP (match_operand:HI 1 "general_operand" "dmn")))] |
| 2130 |
"TARGET_68881" |
| 2131 |
"fmove%.w %1,%0" |
| 2132 |
[(set_attr "type" "fmove")]) |
| 2133 |
|
| 2134 |
(define_insn "floathi<mode>2_cf" |
| 2135 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2136 |
(float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))] |
| 2137 |
"TARGET_COLDFIRE_FPU" |
| 2138 |
"fmove%.w %1,%0" |
| 2139 |
[(set_attr "type" "fmove")]) |
| 2140 |
|
| 2141 |
|
| 2142 |
(define_expand "floatqi<mode>2" |
| 2143 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 2144 |
(float:FP (match_operand:QI 1 "general_operand" "")))] |
| 2145 |
"TARGET_HARD_FLOAT" |
| 2146 |
"") |
| 2147 |
|
| 2148 |
(define_insn "floatqi<mode>2_68881" |
| 2149 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2150 |
(float:FP (match_operand:QI 1 "general_operand" "dmn")))] |
| 2151 |
"TARGET_68881" |
| 2152 |
"fmove%.b %1,%0" |
| 2153 |
[(set_attr "type" "fmove")]) |
| 2154 |
|
| 2155 |
(define_insn "floatqi<mode>2_cf" |
| 2156 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2157 |
(float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))] |
| 2158 |
"TARGET_COLDFIRE_FPU" |
| 2159 |
"fmove%.b %1,%0" |
| 2160 |
[(set_attr "type" "fmove")]) |
| 2161 |
|
| 2162 |
|
| 2163 |
;; New routines to convert floating-point values to integers |
| 2164 |
;; to be used on the '040. These should be faster than trapping |
| 2165 |
;; into the kernel to emulate fintrz. They should also be faster |
| 2166 |
;; than calling the subroutines fixsfsi or fixdfsi. |
| 2167 |
|
| 2168 |
(define_insn "fix_truncdfsi2" |
| 2169 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=dm") |
| 2170 |
(fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f")))) |
| 2171 |
(clobber (match_scratch:SI 2 "=d")) |
| 2172 |
(clobber (match_scratch:SI 3 "=d"))] |
| 2173 |
"TARGET_68881 && TUNE_68040" |
| 2174 |
{ |
| 2175 |
return "fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!"; |
| 2176 |
}) |
| 2177 |
|
| 2178 |
(define_insn "fix_truncdfhi2" |
| 2179 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=dm") |
| 2180 |
(fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f")))) |
| 2181 |
(clobber (match_scratch:SI 2 "=d")) |
| 2182 |
(clobber (match_scratch:SI 3 "=d"))] |
| 2183 |
"TARGET_68881 && TUNE_68040" |
| 2184 |
{ |
| 2185 |
return "fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!"; |
| 2186 |
}) |
| 2187 |
|
| 2188 |
(define_insn "fix_truncdfqi2" |
| 2189 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm") |
| 2190 |
(fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f")))) |
| 2191 |
(clobber (match_scratch:SI 2 "=d")) |
| 2192 |
(clobber (match_scratch:SI 3 "=d"))] |
| 2193 |
"TARGET_68881 && TUNE_68040" |
| 2194 |
{ |
| 2195 |
return "fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!"; |
| 2196 |
}) |
| 2197 |
|
| 2198 |
;; Convert a float to a float whose value is an integer. |
| 2199 |
;; This is the first stage of converting it to an integer type. |
| 2200 |
|
| 2201 |
(define_expand "ftrunc<mode>2" |
| 2202 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 2203 |
(fix:FP (match_operand:FP 1 "general_operand" "")))] |
| 2204 |
"TARGET_HARD_FLOAT && !TUNE_68040" |
| 2205 |
"") |
| 2206 |
|
| 2207 |
(define_insn "ftrunc<mode>2_68881" |
| 2208 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2209 |
(fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))] |
| 2210 |
"TARGET_68881 && !TUNE_68040" |
| 2211 |
{ |
| 2212 |
if (FP_REG_P (operands[1])) |
| 2213 |
return "fintrz%.x %f1,%0"; |
| 2214 |
return "fintrz%.<FP:prec> %f1,%0"; |
| 2215 |
} |
| 2216 |
[(set_attr "type" "falu")]) |
| 2217 |
|
| 2218 |
(define_insn "ftrunc<mode>2_cf" |
| 2219 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2220 |
(fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))] |
| 2221 |
"TARGET_COLDFIRE_FPU" |
| 2222 |
{ |
| 2223 |
if (FP_REG_P (operands[1])) |
| 2224 |
return "fintrz%.d %f1,%0"; |
| 2225 |
return "fintrz%.<FP:prec> %f1,%0"; |
| 2226 |
} |
| 2227 |
[(set_attr "type" "falu")]) |
| 2228 |
|
| 2229 |
;; Convert a float whose value is an integer |
| 2230 |
;; to an actual integer. Second stage of converting float to integer type. |
| 2231 |
(define_expand "fix<mode>qi2" |
| 2232 |
[(set (match_operand:QI 0 "nonimmediate_operand" "") |
| 2233 |
(fix:QI (match_operand:FP 1 "general_operand" "")))] |
| 2234 |
"TARGET_HARD_FLOAT" |
| 2235 |
"") |
| 2236 |
|
| 2237 |
(define_insn "fix<mode>qi2_68881" |
| 2238 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm") |
| 2239 |
(fix:QI (match_operand:FP 1 "general_operand" "f")))] |
| 2240 |
"TARGET_68881" |
| 2241 |
"fmove%.b %1,%0" |
| 2242 |
[(set_attr "type" "fmove")]) |
| 2243 |
|
| 2244 |
(define_insn "fix<mode>qi2_cf" |
| 2245 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U") |
| 2246 |
(fix:QI (match_operand:FP 1 "general_operand" "f")))] |
| 2247 |
"TARGET_COLDFIRE_FPU" |
| 2248 |
"fmove%.b %1,%0" |
| 2249 |
[(set_attr "type" "fmove")]) |
| 2250 |
|
| 2251 |
(define_expand "fix<mode>hi2" |
| 2252 |
[(set (match_operand:HI 0 "nonimmediate_operand" "") |
| 2253 |
(fix:HI (match_operand:FP 1 "general_operand" "")))] |
| 2254 |
"TARGET_HARD_FLOAT" |
| 2255 |
"") |
| 2256 |
|
| 2257 |
(define_insn "fix<mode>hi2_68881" |
| 2258 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=dm") |
| 2259 |
(fix:HI (match_operand:FP 1 "general_operand" "f")))] |
| 2260 |
"TARGET_68881" |
| 2261 |
"fmove%.w %1,%0" |
| 2262 |
[(set_attr "type" "fmove")]) |
| 2263 |
|
| 2264 |
(define_insn "fix<mode>hi2_cf" |
| 2265 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U") |
| 2266 |
(fix:HI (match_operand:FP 1 "general_operand" "f")))] |
| 2267 |
"TARGET_COLDFIRE_FPU" |
| 2268 |
"fmove%.w %1,%0" |
| 2269 |
[(set_attr "type" "fmove")]) |
| 2270 |
|
| 2271 |
(define_expand "fix<mode>si2" |
| 2272 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 2273 |
(fix:SI (match_operand:FP 1 "general_operand" "")))] |
| 2274 |
"TARGET_HARD_FLOAT" |
| 2275 |
"") |
| 2276 |
|
| 2277 |
(define_insn "fix<mode>si2_68881" |
| 2278 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=dm") |
| 2279 |
(fix:SI (match_operand:FP 1 "general_operand" "f")))] |
| 2280 |
"TARGET_68881" |
| 2281 |
"fmove%.l %1,%0" |
| 2282 |
[(set_attr "type" "fmove")]) |
| 2283 |
|
| 2284 |
(define_insn "fix<mode>si2_cf" |
| 2285 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U") |
| 2286 |
(fix:SI (match_operand:FP 1 "general_operand" "f")))] |
| 2287 |
"TARGET_COLDFIRE_FPU" |
| 2288 |
"fmove%.l %1,%0" |
| 2289 |
[(set_attr "type" "fmove")]) |
| 2290 |
|
| 2291 |
|
| 2292 |
;; add instructions |
| 2293 |
|
| 2294 |
(define_insn "adddi_lshrdi_63" |
| 2295 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=d") |
| 2296 |
(plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm") |
| 2297 |
(const_int 63)) |
| 2298 |
(match_dup 1))) |
| 2299 |
(clobber (match_scratch:SI 2 "=d"))] |
| 2300 |
"" |
| 2301 |
{ |
| 2302 |
operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 2303 |
if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0])) |
| 2304 |
return |
| 2305 |
"move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0"; |
| 2306 |
if (GET_CODE (operands[1]) == REG) |
| 2307 |
operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 2308 |
else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC |
| 2309 |
|| GET_CODE (XEXP (operands[1], 0)) == PRE_DEC) |
| 2310 |
operands[4] = operands[1]; |
| 2311 |
else |
| 2312 |
operands[4] = adjust_address (operands[1], SImode, 4); |
| 2313 |
if (GET_CODE (operands[1]) == MEM |
| 2314 |
&& GET_CODE (XEXP (operands[1], 0)) == PRE_DEC) |
| 2315 |
output_asm_insn ("move%.l %4,%3", operands); |
| 2316 |
output_asm_insn ("move%.l %1,%0\;smi %2", operands); |
| 2317 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 2318 |
output_asm_insn ("extb%.l %2", operands); |
| 2319 |
else |
| 2320 |
output_asm_insn ("ext%.w %2\;ext%.l %2", operands); |
| 2321 |
if (GET_CODE (operands[1]) != MEM |
| 2322 |
|| GET_CODE (XEXP (operands[1], 0)) != PRE_DEC) |
| 2323 |
output_asm_insn ("move%.l %4,%3", operands); |
| 2324 |
return "sub%.l %2,%3\;subx%.l %2,%0"; |
| 2325 |
}) |
| 2326 |
|
| 2327 |
(define_insn "adddi_sexthishl32" |
| 2328 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d") |
| 2329 |
(plus:DI (ashift:DI (sign_extend:DI |
| 2330 |
(match_operand:HI 1 "general_operand" "rm,rm,rm,rm")) |
| 2331 |
(const_int 32)) |
| 2332 |
(match_operand:DI 2 "general_operand" "0,0,0,0"))) |
| 2333 |
(clobber (match_scratch:SI 3 "=&d,X,a,?d"))] |
| 2334 |
"!TARGET_COLDFIRE" |
| 2335 |
{ |
| 2336 |
if (ADDRESS_REG_P (operands[0])) |
| 2337 |
return "add%.w %1,%0"; |
| 2338 |
else if (ADDRESS_REG_P (operands[3])) |
| 2339 |
return "move%.w %1,%3\;add%.l %3,%0"; |
| 2340 |
else |
| 2341 |
return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0"; |
| 2342 |
}) |
| 2343 |
|
| 2344 |
(define_insn "*adddi_dilshr32" |
| 2345 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=d,o") |
| 2346 |
(plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d") |
| 2347 |
(const_int 32)) |
| 2348 |
(match_operand:DI 2 "general_operand" "0,0")))] |
| 2349 |
"!TARGET_COLDFIRE" |
| 2350 |
{ |
| 2351 |
if (GET_CODE (operands[0]) == REG) |
| 2352 |
operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 2353 |
else |
| 2354 |
operands[2] = adjust_address (operands[0], SImode, 4); |
| 2355 |
return "add%.l %1,%2\;negx%.l %0\;neg%.l %0"; |
| 2356 |
}) |
| 2357 |
|
| 2358 |
(define_insn "*adddi_dilshr32_cf" |
| 2359 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 2360 |
(plus:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro") |
| 2361 |
(const_int 32)) |
| 2362 |
(match_operand:DI 2 "register_operand" "0")))] |
| 2363 |
"TARGET_COLDFIRE" |
| 2364 |
{ |
| 2365 |
return "add%.l %1,%R0\;negx%.l %0\;neg%.l %0"; |
| 2366 |
}) |
| 2367 |
|
| 2368 |
(define_insn "adddi_dishl32" |
| 2369 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,o") |
| 2370 |
;; (plus:DI (match_operand:DI 2 "general_operand" "%0") |
| 2371 |
;; (ashift:DI (match_operand:DI 1 "general_operand" "ro") |
| 2372 |
;; (const_int 32))))] |
| 2373 |
(plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d") |
| 2374 |
(const_int 32)) |
| 2375 |
(match_operand:DI 2 "general_operand" "0,0")))] |
| 2376 |
"" |
| 2377 |
{ |
| 2378 |
if (GET_CODE (operands[1]) == REG) |
| 2379 |
operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 2380 |
else |
| 2381 |
operands[1] = adjust_address (operands[1], SImode, 4); |
| 2382 |
return "add%.l %1,%0"; |
| 2383 |
} |
| 2384 |
[(set_attr "type" "alu_l")]) |
| 2385 |
|
| 2386 |
(define_insn "adddi3" |
| 2387 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d") |
| 2388 |
(plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0") |
| 2389 |
(match_operand:DI 2 "general_operand" "d,no>,d,a"))) |
| 2390 |
(clobber (match_scratch:SI 3 "=&d,&d,X,&d"))] |
| 2391 |
"" |
| 2392 |
{ |
| 2393 |
if (DATA_REG_P (operands[0])) |
| 2394 |
{ |
| 2395 |
if (DATA_REG_P (operands[2])) |
| 2396 |
return "add%.l %R2,%R0\;addx%.l %2,%0"; |
| 2397 |
else if (GET_CODE (operands[2]) == MEM |
| 2398 |
&& GET_CODE (XEXP (operands[2], 0)) == POST_INC) |
| 2399 |
return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0"; |
| 2400 |
else |
| 2401 |
{ |
| 2402 |
rtx high, low; |
| 2403 |
rtx xoperands[2]; |
| 2404 |
|
| 2405 |
if (GET_CODE (operands[2]) == REG) |
| 2406 |
{ |
| 2407 |
low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1); |
| 2408 |
high = operands[2]; |
| 2409 |
} |
| 2410 |
else if (CONSTANT_P (operands[2])) |
| 2411 |
split_double (operands[2], &high, &low); |
| 2412 |
else |
| 2413 |
{ |
| 2414 |
low = adjust_address (operands[2], SImode, 4); |
| 2415 |
high = operands[2]; |
| 2416 |
} |
| 2417 |
|
| 2418 |
operands[1] = low, operands[2] = high; |
| 2419 |
xoperands[0] = operands[3]; |
| 2420 |
if (GET_CODE (operands[1]) == CONST_INT |
| 2421 |
&& INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0) |
| 2422 |
xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1); |
| 2423 |
else |
| 2424 |
xoperands[1] = operands[2]; |
| 2425 |
|
| 2426 |
output_asm_insn (output_move_simode (xoperands), xoperands); |
| 2427 |
if (GET_CODE (operands[1]) == CONST_INT) |
| 2428 |
{ |
| 2429 |
if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8) |
| 2430 |
return "addq%.l %1,%R0\;addx%.l %3,%0"; |
| 2431 |
else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0) |
| 2432 |
{ |
| 2433 |
operands[1] = GEN_INT (-INTVAL (operands[1])); |
| 2434 |
return "subq%.l %1,%R0\;subx%.l %3,%0"; |
| 2435 |
} |
| 2436 |
} |
| 2437 |
return "add%.l %1,%R0\;addx%.l %3,%0"; |
| 2438 |
} |
| 2439 |
} |
| 2440 |
else |
| 2441 |
{ |
| 2442 |
gcc_assert (GET_CODE (operands[0]) == MEM); |
| 2443 |
if (GET_CODE (XEXP (operands[0], 0)) == POST_INC) |
| 2444 |
{ |
| 2445 |
operands[1] = gen_rtx_MEM (SImode, |
| 2446 |
plus_constant (Pmode, |
| 2447 |
XEXP(operands[0], 0), -8)); |
| 2448 |
return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1"; |
| 2449 |
} |
| 2450 |
else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC) |
| 2451 |
{ |
| 2452 |
operands[1] = XEXP(operands[0], 0); |
| 2453 |
return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1"; |
| 2454 |
} |
| 2455 |
else |
| 2456 |
{ |
| 2457 |
operands[1] = adjust_address (operands[0], SImode, 4); |
| 2458 |
return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0"; |
| 2459 |
} |
| 2460 |
} |
| 2461 |
} |
| 2462 |
[(set (attr "flags_valid") |
| 2463 |
(if_then_else (match_operand 0 "register_operand") |
| 2464 |
(const_string "noov") |
| 2465 |
(const_string "no")))]) |
| 2466 |
|
| 2467 |
(define_insn "addsi_lshrsi_31" |
| 2468 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=dm,dm,d<Q>") |
| 2469 |
(plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm,r<Q>,rm") |
| 2470 |
(const_int 31)) |
| 2471 |
(match_dup 1)))] |
| 2472 |
"" |
| 2473 |
{ |
| 2474 |
operands[2] = operands[0]; |
| 2475 |
operands[3] = gen_label_rtx(); |
| 2476 |
if (GET_CODE (operands[0]) == MEM) |
| 2477 |
{ |
| 2478 |
if (GET_CODE (XEXP (operands[0], 0)) == POST_INC) |
| 2479 |
operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0)); |
| 2480 |
else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC) |
| 2481 |
operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0)); |
| 2482 |
} |
| 2483 |
output_asm_insn ("move%.l %1,%0", operands); |
| 2484 |
output_asm_insn ("jpl %l3", operands); |
| 2485 |
output_asm_insn ("addq%.l #1,%2", operands); |
| 2486 |
(*targetm.asm_out.internal_label) (asm_out_file, "L", |
| 2487 |
CODE_LABEL_NUMBER (operands[3])); |
| 2488 |
return ""; |
| 2489 |
} |
| 2490 |
[(set_attr "ok_for_coldfire" "no,yes,yes")]) |
| 2491 |
|
| 2492 |
(define_expand "addsi3" |
| 2493 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 2494 |
(plus:SI (match_operand:SI 1 "general_operand" "") |
| 2495 |
(match_operand:SI 2 "general_src_operand" "")))] |
| 2496 |
"" |
| 2497 |
"") |
| 2498 |
|
| 2499 |
;; Note that the middle two alternatives are near-duplicates |
| 2500 |
;; in order to handle insns generated by reload. |
| 2501 |
;; This is needed since they are not themselves reloaded, |
| 2502 |
;; so commutativity won't apply to them. |
| 2503 |
(define_insn "*addsi3_internal" |
| 2504 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a") |
| 2505 |
(plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0") |
| 2506 |
(match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))] |
| 2507 |
|
| 2508 |
|
| 2509 |
"! TARGET_COLDFIRE" |
| 2510 |
"* return output_addsi3 (operands);" |
| 2511 |
[(set_attr "flags_valid" "noov,unchanged,unchanged,noov,unchanged")]) |
| 2512 |
|
| 2513 |
(define_insn_and_split "*addsi3_5200" |
| 2514 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=mr,mr,a, m,r, ?a, ?a,?a,?a") |
| 2515 |
(plus:SI (match_operand:SI 1 "general_operand" "%0, 0, 0, 0,0, a, a, r, a") |
| 2516 |
(match_operand:SI 2 "general_src_operand" " I, L, JCu,d,mrKi,Cj, r, a, JCu")))] |
| 2517 |
"TARGET_COLDFIRE" |
| 2518 |
{ |
| 2519 |
switch (which_alternative) |
| 2520 |
{ |
| 2521 |
case 0: |
| 2522 |
return "addq%.l %2,%0"; |
| 2523 |
|
| 2524 |
case 1: |
| 2525 |
operands[2] = GEN_INT (- INTVAL (operands[2])); |
| 2526 |
return "subq%.l %2,%0"; |
| 2527 |
|
| 2528 |
case 3: |
| 2529 |
case 4: |
| 2530 |
return "add%.l %2,%0"; |
| 2531 |
|
| 2532 |
case 5: |
| 2533 |
/* move%.l %2,%0\n\tadd%.l %1,%0 */ |
| 2534 |
return "#"; |
| 2535 |
|
| 2536 |
case 6: |
| 2537 |
return MOTOROLA ? "lea (%1,%2.l),%0" : "lea %1@(0,%2:l),%0"; |
| 2538 |
|
| 2539 |
case 7: |
| 2540 |
return MOTOROLA ? "lea (%2,%1.l),%0" : "lea %2@(0,%1:l),%0"; |
| 2541 |
|
| 2542 |
case 2: |
| 2543 |
case 8: |
| 2544 |
return MOTOROLA ? "lea (%c2,%1),%0" : "lea %1@(%c2),%0"; |
| 2545 |
|
| 2546 |
default: |
| 2547 |
gcc_unreachable (); |
| 2548 |
return ""; |
| 2549 |
} |
| 2550 |
} |
| 2551 |
"&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 5) && !operands_match_p (operands[0], operands[1])" |
| 2552 |
[(set (match_dup 0) |
| 2553 |
(match_dup 2)) |
| 2554 |
(set (match_dup 0) |
| 2555 |
(plus:SI (match_dup 0) |
| 2556 |
(match_dup 1)))] |
| 2557 |
"" |
| 2558 |
[(set_attr "type" "aluq_l,aluq_l,lea, alu_l,alu_l,*,lea, lea, lea") |
| 2559 |
(set_attr "opy" "2, 2, *, 2, 2, *,*, *, *") |
| 2560 |
(set_attr "opy_type" "*, *, mem5,*, *, *,mem6,mem6,mem5")]) |
| 2561 |
|
| 2562 |
(define_insn "" |
| 2563 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=a") |
| 2564 |
(plus:SI (match_operand:SI 1 "general_operand" "0") |
| 2565 |
(sign_extend:SI |
| 2566 |
(match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))] |
| 2567 |
"!TARGET_COLDFIRE" |
| 2568 |
"add%.w %2,%0") |
| 2569 |
|
| 2570 |
(define_insn "addhi3" |
| 2571 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=m,r") |
| 2572 |
(plus:HI (match_operand:HI 1 "general_operand" "%0,0") |
| 2573 |
(match_operand:HI 2 "general_src_operand" "dn,rmSn")))] |
| 2574 |
"!TARGET_COLDFIRE" |
| 2575 |
{ |
| 2576 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 2577 |
{ |
| 2578 |
/* If the constant would be a negative number when interpreted as |
| 2579 |
HImode, make it negative. This is usually, but not always, done |
| 2580 |
elsewhere in the compiler. First check for constants out of range, |
| 2581 |
which could confuse us. */ |
| 2582 |
|
| 2583 |
if (INTVAL (operands[2]) >= 32768) |
| 2584 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 65536); |
| 2585 |
|
| 2586 |
if (INTVAL (operands[2]) > 0 |
| 2587 |
&& INTVAL (operands[2]) <= 8) |
| 2588 |
return "addq%.w %2,%0"; |
| 2589 |
if (INTVAL (operands[2]) < 0 |
| 2590 |
&& INTVAL (operands[2]) >= -8) |
| 2591 |
{ |
| 2592 |
operands[2] = GEN_INT (- INTVAL (operands[2])); |
| 2593 |
return "subq%.w %2,%0"; |
| 2594 |
} |
| 2595 |
/* On the CPU32 it is faster to use two addqw instructions to |
| 2596 |
add a small integer (8 < N <= 16) to a register. |
| 2597 |
Likewise for subqw. */ |
| 2598 |
if (TUNE_CPU32 && REG_P (operands[0])) |
| 2599 |
{ |
| 2600 |
if (INTVAL (operands[2]) > 8 |
| 2601 |
&& INTVAL (operands[2]) <= 16) |
| 2602 |
{ |
| 2603 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 8); |
| 2604 |
return "addq%.w #8,%0\;addq%.w %2,%0"; |
| 2605 |
} |
| 2606 |
if (INTVAL (operands[2]) < -8 |
| 2607 |
&& INTVAL (operands[2]) >= -16) |
| 2608 |
{ |
| 2609 |
operands[2] = GEN_INT (- INTVAL (operands[2]) - 8); |
| 2610 |
return "subq%.w #8,%0\;subq%.w %2,%0"; |
| 2611 |
} |
| 2612 |
} |
| 2613 |
if (ADDRESS_REG_P (operands[0]) && !TUNE_68040) |
| 2614 |
return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0"; |
| 2615 |
} |
| 2616 |
return "add%.w %2,%0"; |
| 2617 |
} |
| 2618 |
[(set (attr "flags_valid") |
| 2619 |
(if_then_else (match_operand 0 "address_reg_operand") |
| 2620 |
(const_string "unchanged") |
| 2621 |
(const_string "noov")))]) |
| 2622 |
|
| 2623 |
;; These insns must use MATCH_DUP instead of the more expected |
| 2624 |
;; use of a matching constraint because the "output" here is also |
| 2625 |
;; an input, so you can't use the matching constraint. That also means |
| 2626 |
;; that you can't use the "%", so you need patterns with the matched |
| 2627 |
;; operand in both positions. |
| 2628 |
|
| 2629 |
(define_insn "" |
| 2630 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 2631 |
(plus:HI (match_dup 0) |
| 2632 |
(match_operand:HI 1 "general_src_operand" "dn,rmSn")))] |
| 2633 |
"!TARGET_COLDFIRE" |
| 2634 |
{ |
| 2635 |
gcc_assert (!ADDRESS_REG_P (operands[0])); |
| 2636 |
if (GET_CODE (operands[1]) == CONST_INT) |
| 2637 |
{ |
| 2638 |
/* If the constant would be a negative number when interpreted as |
| 2639 |
HImode, make it negative. This is usually, but not always, done |
| 2640 |
elsewhere in the compiler. First check for constants out of range, |
| 2641 |
which could confuse us. */ |
| 2642 |
|
| 2643 |
if (INTVAL (operands[1]) >= 32768) |
| 2644 |
operands[1] = GEN_INT (INTVAL (operands[1]) - 65536); |
| 2645 |
|
| 2646 |
if (INTVAL (operands[1]) > 0 |
| 2647 |
&& INTVAL (operands[1]) <= 8) |
| 2648 |
return "addq%.w %1,%0"; |
| 2649 |
if (INTVAL (operands[1]) < 0 |
| 2650 |
&& INTVAL (operands[1]) >= -8) |
| 2651 |
{ |
| 2652 |
operands[1] = GEN_INT (- INTVAL (operands[1])); |
| 2653 |
return "subq%.w %1,%0"; |
| 2654 |
} |
| 2655 |
/* On the CPU32 it is faster to use two addqw instructions to |
| 2656 |
add a small integer (8 < N <= 16) to a register. |
| 2657 |
Likewise for subqw. */ |
| 2658 |
if (TUNE_CPU32 && REG_P (operands[0])) |
| 2659 |
{ |
| 2660 |
if (INTVAL (operands[1]) > 8 |
| 2661 |
&& INTVAL (operands[1]) <= 16) |
| 2662 |
{ |
| 2663 |
operands[1] = GEN_INT (INTVAL (operands[1]) - 8); |
| 2664 |
return "addq%.w #8,%0\;addq%.w %1,%0"; |
| 2665 |
} |
| 2666 |
if (INTVAL (operands[1]) < -8 |
| 2667 |
&& INTVAL (operands[1]) >= -16) |
| 2668 |
{ |
| 2669 |
operands[1] = GEN_INT (- INTVAL (operands[1]) - 8); |
| 2670 |
return "subq%.w #8,%0\;subq%.w %1,%0"; |
| 2671 |
} |
| 2672 |
} |
| 2673 |
} |
| 2674 |
return "add%.w %1,%0"; |
| 2675 |
} |
| 2676 |
[(set_attr "flags_valid" "noov")]) |
| 2677 |
|
| 2678 |
(define_insn "" |
| 2679 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 2680 |
(plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn") |
| 2681 |
(match_dup 0)))] |
| 2682 |
"!TARGET_COLDFIRE" |
| 2683 |
{ |
| 2684 |
gcc_assert (!ADDRESS_REG_P (operands[0])); |
| 2685 |
if (GET_CODE (operands[1]) == CONST_INT) |
| 2686 |
{ |
| 2687 |
/* If the constant would be a negative number when interpreted as |
| 2688 |
HImode, make it negative. This is usually, but not always, done |
| 2689 |
elsewhere in the compiler. First check for constants out of range, |
| 2690 |
which could confuse us. */ |
| 2691 |
|
| 2692 |
if (INTVAL (operands[1]) >= 32768) |
| 2693 |
operands[1] = GEN_INT (INTVAL (operands[1]) - 65536); |
| 2694 |
|
| 2695 |
if (INTVAL (operands[1]) > 0 |
| 2696 |
&& INTVAL (operands[1]) <= 8) |
| 2697 |
return "addq%.w %1,%0"; |
| 2698 |
if (INTVAL (operands[1]) < 0 |
| 2699 |
&& INTVAL (operands[1]) >= -8) |
| 2700 |
{ |
| 2701 |
operands[1] = GEN_INT (- INTVAL (operands[1])); |
| 2702 |
return "subq%.w %1,%0"; |
| 2703 |
} |
| 2704 |
/* On the CPU32 it is faster to use two addqw instructions to |
| 2705 |
add a small integer (8 < N <= 16) to a register. |
| 2706 |
Likewise for subqw. */ |
| 2707 |
if (TUNE_CPU32 && REG_P (operands[0])) |
| 2708 |
{ |
| 2709 |
if (INTVAL (operands[1]) > 8 |
| 2710 |
&& INTVAL (operands[1]) <= 16) |
| 2711 |
{ |
| 2712 |
operands[1] = GEN_INT (INTVAL (operands[1]) - 8); |
| 2713 |
return "addq%.w #8,%0\;addq%.w %1,%0"; |
| 2714 |
} |
| 2715 |
if (INTVAL (operands[1]) < -8 |
| 2716 |
&& INTVAL (operands[1]) >= -16) |
| 2717 |
{ |
| 2718 |
operands[1] = GEN_INT (- INTVAL (operands[1]) - 8); |
| 2719 |
return "subq%.w #8,%0\;subq%.w %1,%0"; |
| 2720 |
} |
| 2721 |
} |
| 2722 |
} |
| 2723 |
return "add%.w %1,%0"; |
| 2724 |
} |
| 2725 |
[(set_attr "flags_valid" "noov")]) |
| 2726 |
|
| 2727 |
(define_insn "addqi3" |
| 2728 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=m,d") |
| 2729 |
(plus:QI (match_operand:QI 1 "general_operand" "%0,0") |
| 2730 |
(match_operand:QI 2 "general_src_operand" "dn,dmSn")))] |
| 2731 |
"!TARGET_COLDFIRE" |
| 2732 |
{ |
| 2733 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 2734 |
{ |
| 2735 |
if (INTVAL (operands[2]) >= 128) |
| 2736 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 256); |
| 2737 |
|
| 2738 |
if (INTVAL (operands[2]) > 0 |
| 2739 |
&& INTVAL (operands[2]) <= 8) |
| 2740 |
return "addq%.b %2,%0"; |
| 2741 |
if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8) |
| 2742 |
{ |
| 2743 |
operands[2] = GEN_INT (- INTVAL (operands[2])); |
| 2744 |
return "subq%.b %2,%0"; |
| 2745 |
} |
| 2746 |
} |
| 2747 |
return "add%.b %2,%0"; |
| 2748 |
} |
| 2749 |
[(set_attr "flags_valid" "noov")]) |
| 2750 |
|
| 2751 |
(define_insn "" |
| 2752 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 2753 |
(plus:QI (match_dup 0) |
| 2754 |
(match_operand:QI 1 "general_src_operand" "dn,dmSn")))] |
| 2755 |
"!TARGET_COLDFIRE" |
| 2756 |
{ |
| 2757 |
if (GET_CODE (operands[1]) == CONST_INT) |
| 2758 |
{ |
| 2759 |
if (INTVAL (operands[1]) >= 128) |
| 2760 |
operands[1] = GEN_INT (INTVAL (operands[1]) - 256); |
| 2761 |
|
| 2762 |
if (INTVAL (operands[1]) > 0 |
| 2763 |
&& INTVAL (operands[1]) <= 8) |
| 2764 |
return "addq%.b %1,%0"; |
| 2765 |
if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8) |
| 2766 |
{ |
| 2767 |
operands[1] = GEN_INT (- INTVAL (operands[1])); |
| 2768 |
return "subq%.b %1,%0"; |
| 2769 |
} |
| 2770 |
} |
| 2771 |
return "add%.b %1,%0"; |
| 2772 |
}) |
| 2773 |
|
| 2774 |
(define_insn "" |
| 2775 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 2776 |
(plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn") |
| 2777 |
(match_dup 0)))] |
| 2778 |
"!TARGET_COLDFIRE" |
| 2779 |
{ |
| 2780 |
if (GET_CODE (operands[1]) == CONST_INT) |
| 2781 |
{ |
| 2782 |
if (INTVAL (operands[1]) >= 128) |
| 2783 |
operands[1] = GEN_INT (INTVAL (operands[1]) - 256); |
| 2784 |
|
| 2785 |
if (INTVAL (operands[1]) > 0 |
| 2786 |
&& INTVAL (operands[1]) <= 8) |
| 2787 |
return "addq%.b %1,%0"; |
| 2788 |
if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8) |
| 2789 |
{ |
| 2790 |
operands[1] = GEN_INT (- INTVAL (operands[1])); |
| 2791 |
return "subq%.b %1,%0"; |
| 2792 |
} |
| 2793 |
} |
| 2794 |
return "add%.b %1,%0"; |
| 2795 |
}) |
| 2796 |
|
| 2797 |
(define_expand "add<mode>3" |
| 2798 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 2799 |
(plus:FP (match_operand:FP 1 "general_operand" "") |
| 2800 |
(match_operand:FP 2 "general_operand" "")))] |
| 2801 |
"TARGET_HARD_FLOAT" |
| 2802 |
"") |
| 2803 |
|
| 2804 |
(define_insn "add<mode>3_floatsi_68881" |
| 2805 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2806 |
(plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi")) |
| 2807 |
(match_operand:FP 1 "general_operand" "0")))] |
| 2808 |
"TARGET_68881" |
| 2809 |
"f<FP:round>add%.l %2,%0" |
| 2810 |
[(set_attr "type" "falu") |
| 2811 |
(set_attr "opy" "2")]) |
| 2812 |
|
| 2813 |
(define_insn "add<mode>3_floathi_68881" |
| 2814 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2815 |
(plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn")) |
| 2816 |
(match_operand:FP 1 "general_operand" "0")))] |
| 2817 |
"TARGET_68881" |
| 2818 |
"f<FP:round>add%.w %2,%0" |
| 2819 |
[(set_attr "type" "falu") |
| 2820 |
(set_attr "opy" "2")]) |
| 2821 |
|
| 2822 |
(define_insn "add<mode>3_floatqi_68881" |
| 2823 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2824 |
(plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn")) |
| 2825 |
(match_operand:FP 1 "general_operand" "0")))] |
| 2826 |
"TARGET_68881" |
| 2827 |
"f<FP:round>add%.b %2,%0" |
| 2828 |
[(set_attr "type" "falu") |
| 2829 |
(set_attr "opy" "2")]) |
| 2830 |
|
| 2831 |
(define_insn "add<mode>3_68881" |
| 2832 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2833 |
(plus:FP (match_operand:FP 1 "general_operand" "%0") |
| 2834 |
(match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))] |
| 2835 |
"TARGET_68881" |
| 2836 |
{ |
| 2837 |
if (FP_REG_P (operands[2])) |
| 2838 |
return "f<FP:round>add%.x %2,%0"; |
| 2839 |
return "f<FP:round>add%.<FP:prec> %f2,%0"; |
| 2840 |
} |
| 2841 |
[(set_attr "type" "falu") |
| 2842 |
(set_attr "opy" "2")]) |
| 2843 |
|
| 2844 |
(define_insn "add<mode>3_cf" |
| 2845 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 2846 |
(plus:FP (match_operand:FP 1 "general_operand" "%0") |
| 2847 |
(match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))] |
| 2848 |
"TARGET_COLDFIRE_FPU" |
| 2849 |
{ |
| 2850 |
if (FP_REG_P (operands[2])) |
| 2851 |
return "f<FP:prec>add%.d %2,%0"; |
| 2852 |
return "f<FP:prec>add%.<FP:prec> %2,%0"; |
| 2853 |
} |
| 2854 |
[(set_attr "type" "falu") |
| 2855 |
(set_attr "opy" "2")]) |
| 2856 |
|
| 2857 |
;; subtract instructions |
| 2858 |
|
| 2859 |
(define_insn "subdi_sexthishl32" |
| 2860 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d") |
| 2861 |
(minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0") |
| 2862 |
(ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm")) |
| 2863 |
(const_int 32)))) |
| 2864 |
(clobber (match_scratch:SI 3 "=&d,X,a,?d"))] |
| 2865 |
"!TARGET_COLDFIRE" |
| 2866 |
{ |
| 2867 |
if (ADDRESS_REG_P (operands[0])) |
| 2868 |
return "sub%.w %2,%0"; |
| 2869 |
else if (ADDRESS_REG_P (operands[3])) |
| 2870 |
return "move%.w %2,%3\;sub%.l %3,%0"; |
| 2871 |
else |
| 2872 |
return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0"; |
| 2873 |
}) |
| 2874 |
|
| 2875 |
(define_insn "subdi_dishl32" |
| 2876 |
[(set (match_operand:DI 0 "nonimmediate_operand" "+ro") |
| 2877 |
(minus:DI (match_dup 0) |
| 2878 |
(ashift:DI (match_operand:DI 1 "general_operand" "ro") |
| 2879 |
(const_int 32))))] |
| 2880 |
"" |
| 2881 |
{ |
| 2882 |
if (GET_CODE (operands[1]) == REG) |
| 2883 |
operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 2884 |
else |
| 2885 |
operands[1] = adjust_address (operands[1], SImode, 4); |
| 2886 |
return "sub%.l %1,%0"; |
| 2887 |
} |
| 2888 |
[(set_attr "type" "alu_l")]) |
| 2889 |
|
| 2890 |
(define_insn "subdi3" |
| 2891 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d") |
| 2892 |
(minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0") |
| 2893 |
(match_operand:DI 2 "general_operand" "d,no>,d,a"))) |
| 2894 |
(clobber (match_scratch:SI 3 "=&d,&d,X,&d"))] |
| 2895 |
"" |
| 2896 |
{ |
| 2897 |
if (DATA_REG_P (operands[0])) |
| 2898 |
{ |
| 2899 |
if (DATA_REG_P (operands[2])) |
| 2900 |
return "sub%.l %R2,%R0\;subx%.l %2,%0"; |
| 2901 |
else if (GET_CODE (operands[2]) == MEM |
| 2902 |
&& GET_CODE (XEXP (operands[2], 0)) == POST_INC) |
| 2903 |
{ |
| 2904 |
return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0"; |
| 2905 |
} |
| 2906 |
else |
| 2907 |
{ |
| 2908 |
rtx high, low; |
| 2909 |
rtx xoperands[2]; |
| 2910 |
|
| 2911 |
if (GET_CODE (operands[2]) == REG) |
| 2912 |
{ |
| 2913 |
low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1); |
| 2914 |
high = operands[2]; |
| 2915 |
} |
| 2916 |
else if (CONSTANT_P (operands[2])) |
| 2917 |
split_double (operands[2], &high, &low); |
| 2918 |
else |
| 2919 |
{ |
| 2920 |
low = adjust_address (operands[2], SImode, 4); |
| 2921 |
high = operands[2]; |
| 2922 |
} |
| 2923 |
|
| 2924 |
operands[1] = low, operands[2] = high; |
| 2925 |
xoperands[0] = operands[3]; |
| 2926 |
if (GET_CODE (operands[1]) == CONST_INT |
| 2927 |
&& INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0) |
| 2928 |
xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1); |
| 2929 |
else |
| 2930 |
xoperands[1] = operands[2]; |
| 2931 |
|
| 2932 |
output_asm_insn (output_move_simode (xoperands), xoperands); |
| 2933 |
if (GET_CODE (operands[1]) == CONST_INT) |
| 2934 |
{ |
| 2935 |
if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8) |
| 2936 |
return "subq%.l %1,%R0\;subx%.l %3,%0"; |
| 2937 |
else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0) |
| 2938 |
{ |
| 2939 |
operands[1] = GEN_INT (-INTVAL (operands[1])); |
| 2940 |
return "addq%.l %1,%R0\;addx%.l %3,%0"; |
| 2941 |
} |
| 2942 |
} |
| 2943 |
return "sub%.l %1,%R0\;subx%.l %3,%0"; |
| 2944 |
} |
| 2945 |
} |
| 2946 |
else |
| 2947 |
{ |
| 2948 |
gcc_assert (GET_CODE (operands[0]) == MEM); |
| 2949 |
if (GET_CODE (XEXP (operands[0], 0)) == POST_INC) |
| 2950 |
{ |
| 2951 |
operands[1] |
| 2952 |
= gen_rtx_MEM (SImode, plus_constant (Pmode, |
| 2953 |
XEXP (operands[0], 0), -8)); |
| 2954 |
return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1"; |
| 2955 |
} |
| 2956 |
else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC) |
| 2957 |
{ |
| 2958 |
operands[1] = XEXP(operands[0], 0); |
| 2959 |
return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1"; |
| 2960 |
} |
| 2961 |
else |
| 2962 |
{ |
| 2963 |
operands[1] = adjust_address (operands[0], SImode, 4); |
| 2964 |
return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0"; |
| 2965 |
} |
| 2966 |
} |
| 2967 |
} |
| 2968 |
[(set (attr "flags_valid") |
| 2969 |
(if_then_else (match_operand 0 "register_operand") |
| 2970 |
(const_string "noov") |
| 2971 |
(const_string "no")))]) |
| 2972 |
|
| 2973 |
(define_insn "subsi3" |
| 2974 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=md,ma,m,d,a") |
| 2975 |
(minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0,0") |
| 2976 |
(match_operand:SI 2 "general_src_operand" "I,I,dT,mSrT,mSrs")))] |
| 2977 |
"" |
| 2978 |
"@ |
| 2979 |
subq%.l %2, %0 |
| 2980 |
subq%.l %2, %0 |
| 2981 |
sub%.l %2,%0 |
| 2982 |
sub%.l %2,%0 |
| 2983 |
sub%.l %2,%0" |
| 2984 |
[(set_attr "type" "aluq_l,aluq_l,alu_l,alu_l,alu_l") |
| 2985 |
(set_attr "opy" "2") |
| 2986 |
(set_attr "flags_valid" "noov,unchanged,noov,noov,unchanged")]) |
| 2987 |
|
| 2988 |
(define_insn "" |
| 2989 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=a") |
| 2990 |
(minus:SI (match_operand:SI 1 "general_operand" "0") |
| 2991 |
(sign_extend:SI |
| 2992 |
(match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))] |
| 2993 |
"!TARGET_COLDFIRE" |
| 2994 |
"sub%.w %2,%0") |
| 2995 |
|
| 2996 |
(define_insn "subhi3" |
| 2997 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=m,r") |
| 2998 |
(minus:HI (match_operand:HI 1 "general_operand" "0,0") |
| 2999 |
(match_operand:HI 2 "general_src_operand" "dn,rmSn")))] |
| 3000 |
"!TARGET_COLDFIRE" |
| 3001 |
"sub%.w %2,%0" |
| 3002 |
[(set_attr "flags_valid" "noov")]) |
| 3003 |
|
| 3004 |
(define_insn "" |
| 3005 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 3006 |
(minus:HI (match_dup 0) |
| 3007 |
(match_operand:HI 1 "general_src_operand" "dn,rmSn")))] |
| 3008 |
"!TARGET_COLDFIRE" |
| 3009 |
"sub%.w %1,%0" |
| 3010 |
[(set_attr "flags_valid" "noov")]) |
| 3011 |
|
| 3012 |
(define_insn "subqi3" |
| 3013 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=m,d") |
| 3014 |
(minus:QI (match_operand:QI 1 "general_operand" "0,0") |
| 3015 |
(match_operand:QI 2 "general_src_operand" "dn,dmSn")))] |
| 3016 |
"!TARGET_COLDFIRE" |
| 3017 |
"sub%.b %2,%0" |
| 3018 |
[(set_attr "flags_valid" "noov")]) |
| 3019 |
|
| 3020 |
(define_insn "" |
| 3021 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 3022 |
(minus:QI (match_dup 0) |
| 3023 |
(match_operand:QI 1 "general_src_operand" "dn,dmSn")))] |
| 3024 |
"!TARGET_COLDFIRE" |
| 3025 |
"sub%.b %1,%0" |
| 3026 |
[(set_attr "flags_valid" "noov")]) |
| 3027 |
|
| 3028 |
(define_expand "sub<mode>3" |
| 3029 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 3030 |
(minus:FP (match_operand:FP 1 "general_operand" "") |
| 3031 |
(match_operand:FP 2 "general_operand" "")))] |
| 3032 |
"TARGET_HARD_FLOAT" |
| 3033 |
"") |
| 3034 |
|
| 3035 |
(define_insn "sub<mode>3_floatsi_68881" |
| 3036 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3037 |
(minus:FP (match_operand:FP 1 "general_operand" "0") |
| 3038 |
(float:FP (match_operand:SI 2 "general_operand" "dmi"))))] |
| 3039 |
"TARGET_68881" |
| 3040 |
"f<FP:round>sub%.l %2,%0" |
| 3041 |
[(set_attr "type" "falu") |
| 3042 |
(set_attr "opy" "2")]) |
| 3043 |
|
| 3044 |
(define_insn "sub<mode>3_floathi_68881" |
| 3045 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3046 |
(minus:FP (match_operand:FP 1 "general_operand" "0") |
| 3047 |
(float:FP (match_operand:HI 2 "general_operand" "dmn"))))] |
| 3048 |
"TARGET_68881" |
| 3049 |
"f<FP:round>sub%.w %2,%0" |
| 3050 |
[(set_attr "type" "falu") |
| 3051 |
(set_attr "opy" "2")]) |
| 3052 |
|
| 3053 |
(define_insn "sub<mode>3_floatqi_68881" |
| 3054 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3055 |
(minus:FP (match_operand:FP 1 "general_operand" "0") |
| 3056 |
(float:FP (match_operand:QI 2 "general_operand" "dmn"))))] |
| 3057 |
"TARGET_68881" |
| 3058 |
"f<FP:round>sub%.b %2,%0" |
| 3059 |
[(set_attr "type" "falu") |
| 3060 |
(set_attr "opy" "2")]) |
| 3061 |
|
| 3062 |
(define_insn "sub<mode>3_68881" |
| 3063 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3064 |
(minus:FP (match_operand:FP 1 "general_operand" "0") |
| 3065 |
(match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))] |
| 3066 |
"TARGET_68881" |
| 3067 |
{ |
| 3068 |
if (FP_REG_P (operands[2])) |
| 3069 |
return "f<FP:round>sub%.x %2,%0"; |
| 3070 |
return "f<FP:round>sub%.<FP:prec> %f2,%0"; |
| 3071 |
} |
| 3072 |
[(set_attr "type" "falu") |
| 3073 |
(set_attr "opy" "2")]) |
| 3074 |
|
| 3075 |
(define_insn "sub<mode>3_cf" |
| 3076 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3077 |
(minus:FP (match_operand:FP 1 "general_operand" "0") |
| 3078 |
(match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))] |
| 3079 |
"TARGET_COLDFIRE_FPU" |
| 3080 |
{ |
| 3081 |
if (FP_REG_P (operands[2])) |
| 3082 |
return "f<FP:prec>sub%.d %2,%0"; |
| 3083 |
return "f<FP:prec>sub%.<FP:prec> %2,%0"; |
| 3084 |
} |
| 3085 |
[(set_attr "type" "falu") |
| 3086 |
(set_attr "opy" "2")]) |
| 3087 |
|
| 3088 |
;; multiply instructions |
| 3089 |
|
| 3090 |
(define_insn "mulhi3" |
| 3091 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=d") |
| 3092 |
(mult:HI (match_operand:HI 1 "general_operand" "%0") |
| 3093 |
(match_operand:HI 2 "general_src_operand" "dmSn")))] |
| 3094 |
"" |
| 3095 |
{ |
| 3096 |
return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0"; |
| 3097 |
} |
| 3098 |
[(set_attr "type" "mul_w") |
| 3099 |
(set_attr "opy" "2")]) |
| 3100 |
|
| 3101 |
(define_insn "mulhisi3" |
| 3102 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 3103 |
(mult:SI (sign_extend:SI |
| 3104 |
(match_operand:HI 1 "nonimmediate_operand" "%0")) |
| 3105 |
(sign_extend:SI |
| 3106 |
(match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))] |
| 3107 |
"" |
| 3108 |
{ |
| 3109 |
return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0"; |
| 3110 |
} |
| 3111 |
[(set_attr "type" "mul_w") |
| 3112 |
(set_attr "opy" "2")]) |
| 3113 |
|
| 3114 |
(define_insn "*mulhisisi3_s" |
| 3115 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 3116 |
(mult:SI (sign_extend:SI |
| 3117 |
(match_operand:HI 1 "nonimmediate_operand" "%0")) |
| 3118 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 3119 |
"INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff" |
| 3120 |
{ |
| 3121 |
return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0"; |
| 3122 |
} |
| 3123 |
[(set_attr "type" "mul_w") |
| 3124 |
(set_attr "opy" "2")]) |
| 3125 |
|
| 3126 |
(define_expand "mulsi3" |
| 3127 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 3128 |
(mult:SI (match_operand:SI 1 "general_operand" "") |
| 3129 |
(match_operand:SI 2 "general_operand" "")))] |
| 3130 |
"TARGET_68020 || TARGET_COLDFIRE" |
| 3131 |
"") |
| 3132 |
|
| 3133 |
(define_insn "*mulsi3_68020" |
| 3134 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 3135 |
(mult:SI (match_operand:SI 1 "general_operand" "%0") |
| 3136 |
(match_operand:SI 2 "general_src_operand" "dmSTK")))] |
| 3137 |
|
| 3138 |
"TARGET_68020" |
| 3139 |
"muls%.l %2,%0" |
| 3140 |
[(set_attr "type" "mul_l") |
| 3141 |
(set_attr "opy" "2")]) |
| 3142 |
|
| 3143 |
(define_insn "*mulsi3_cf" |
| 3144 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 3145 |
(mult:SI (match_operand:SI 1 "general_operand" "%0") |
| 3146 |
(match_operand:SI 2 "general_operand" "d<Q>")))] |
| 3147 |
"TARGET_COLDFIRE" |
| 3148 |
"muls%.l %2,%0" |
| 3149 |
[(set_attr "type" "mul_l") |
| 3150 |
(set_attr "opy" "2")]) |
| 3151 |
|
| 3152 |
(define_insn "umulhisi3" |
| 3153 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 3154 |
(mult:SI (zero_extend:SI |
| 3155 |
(match_operand:HI 1 "nonimmediate_operand" "%0")) |
| 3156 |
(zero_extend:SI |
| 3157 |
(match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))] |
| 3158 |
"" |
| 3159 |
{ |
| 3160 |
return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0"; |
| 3161 |
} |
| 3162 |
[(set_attr "type" "mul_w") |
| 3163 |
(set_attr "opy" "2")]) |
| 3164 |
|
| 3165 |
(define_insn "*mulhisisi3_z" |
| 3166 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 3167 |
(mult:SI (zero_extend:SI |
| 3168 |
(match_operand:HI 1 "nonimmediate_operand" "%0")) |
| 3169 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 3170 |
"INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff" |
| 3171 |
{ |
| 3172 |
return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0"; |
| 3173 |
} |
| 3174 |
[(set_attr "type" "mul_w") |
| 3175 |
(set_attr "opy" "2")]) |
| 3176 |
|
| 3177 |
;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the |
| 3178 |
;; proper matching constraint. This is because the matching is between |
| 3179 |
;; the high-numbered word of the DImode operand[0] and operand[1]. |
| 3180 |
(define_expand "umulsidi3" |
| 3181 |
[(parallel |
| 3182 |
[(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4) |
| 3183 |
(mult:SI (match_operand:SI 1 "register_operand" "") |
| 3184 |
(match_operand:SI 2 "register_operand" ""))) |
| 3185 |
(set (subreg:SI (match_dup 0) 0) |
| 3186 |
(truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1)) |
| 3187 |
(zero_extend:DI (match_dup 2))) |
| 3188 |
(const_int 32))))])] |
| 3189 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3190 |
"") |
| 3191 |
|
| 3192 |
(define_insn "" |
| 3193 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3194 |
(mult:SI (match_operand:SI 1 "register_operand" "%0") |
| 3195 |
(match_operand:SI 2 "nonimmediate_operand" "dm"))) |
| 3196 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3197 |
(truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1)) |
| 3198 |
(zero_extend:DI (match_dup 2))) |
| 3199 |
(const_int 32))))] |
| 3200 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3201 |
"mulu%.l %2,%3:%0") |
| 3202 |
|
| 3203 |
; Match immediate case. For 2.4 only match things < 2^31. |
| 3204 |
; It's tricky with larger values in these patterns since we need to match |
| 3205 |
; values between the two parallel multiplies, between a CONST_DOUBLE and |
| 3206 |
; a CONST_INT. |
| 3207 |
(define_insn "" |
| 3208 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3209 |
(mult:SI (match_operand:SI 1 "register_operand" "%0") |
| 3210 |
(match_operand:SI 2 "const_int_operand" "n"))) |
| 3211 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3212 |
(truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1)) |
| 3213 |
(match_dup 2)) |
| 3214 |
(const_int 32))))] |
| 3215 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE |
| 3216 |
&& (unsigned) INTVAL (operands[2]) <= 0x7fffffff" |
| 3217 |
"mulu%.l %2,%3:%0") |
| 3218 |
|
| 3219 |
(define_expand "mulsidi3" |
| 3220 |
[(parallel |
| 3221 |
[(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4) |
| 3222 |
(mult:SI (match_operand:SI 1 "register_operand" "") |
| 3223 |
(match_operand:SI 2 "register_operand" ""))) |
| 3224 |
(set (subreg:SI (match_dup 0) 0) |
| 3225 |
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1)) |
| 3226 |
(sign_extend:DI (match_dup 2))) |
| 3227 |
(const_int 32))))])] |
| 3228 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3229 |
"") |
| 3230 |
|
| 3231 |
(define_insn "" |
| 3232 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3233 |
(mult:SI (match_operand:SI 1 "register_operand" "%0") |
| 3234 |
(match_operand:SI 2 "nonimmediate_operand" "dm"))) |
| 3235 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3236 |
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1)) |
| 3237 |
(sign_extend:DI (match_dup 2))) |
| 3238 |
(const_int 32))))] |
| 3239 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3240 |
"muls%.l %2,%3:%0") |
| 3241 |
|
| 3242 |
(define_insn "" |
| 3243 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3244 |
(mult:SI (match_operand:SI 1 "register_operand" "%0") |
| 3245 |
(match_operand:SI 2 "const_int_operand" "n"))) |
| 3246 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3247 |
(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1)) |
| 3248 |
(match_dup 2)) |
| 3249 |
(const_int 32))))] |
| 3250 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3251 |
"muls%.l %2,%3:%0") |
| 3252 |
|
| 3253 |
(define_expand "umulsi3_highpart" |
| 3254 |
[(parallel |
| 3255 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3256 |
(truncate:SI |
| 3257 |
(lshiftrt:DI |
| 3258 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "")) |
| 3259 |
(zero_extend:DI (match_operand:SI 2 "general_operand" ""))) |
| 3260 |
(const_int 32)))) |
| 3261 |
(clobber (match_dup 3))])] |
| 3262 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3263 |
{ |
| 3264 |
operands[3] = gen_reg_rtx (SImode); |
| 3265 |
|
| 3266 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 3267 |
{ |
| 3268 |
operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff, |
| 3269 |
0, DImode); |
| 3270 |
|
| 3271 |
/* We have to adjust the operand order for the matching constraints. */ |
| 3272 |
emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3], |
| 3273 |
operands[1], operands[2])); |
| 3274 |
DONE; |
| 3275 |
} |
| 3276 |
}) |
| 3277 |
|
| 3278 |
(define_insn "" |
| 3279 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3280 |
(truncate:SI |
| 3281 |
(lshiftrt:DI |
| 3282 |
(mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1")) |
| 3283 |
(zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm"))) |
| 3284 |
(const_int 32)))) |
| 3285 |
(clobber (match_operand:SI 1 "register_operand" "=d"))] |
| 3286 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3287 |
"mulu%.l %3,%0:%1") |
| 3288 |
|
| 3289 |
(define_insn "const_umulsi3_highpart" |
| 3290 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3291 |
(truncate:SI |
| 3292 |
(lshiftrt:DI |
| 3293 |
(mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1")) |
| 3294 |
(match_operand:DI 3 "const_uint32_operand" "n")) |
| 3295 |
(const_int 32)))) |
| 3296 |
(clobber (match_operand:SI 1 "register_operand" "=d"))] |
| 3297 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3298 |
"mulu%.l %3,%0:%1") |
| 3299 |
|
| 3300 |
(define_expand "smulsi3_highpart" |
| 3301 |
[(parallel |
| 3302 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3303 |
(truncate:SI |
| 3304 |
(lshiftrt:DI |
| 3305 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "")) |
| 3306 |
(sign_extend:DI (match_operand:SI 2 "general_operand" ""))) |
| 3307 |
(const_int 32)))) |
| 3308 |
(clobber (match_dup 3))])] |
| 3309 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3310 |
{ |
| 3311 |
operands[3] = gen_reg_rtx (SImode); |
| 3312 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 3313 |
{ |
| 3314 |
/* We have to adjust the operand order for the matching constraints. */ |
| 3315 |
emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3], |
| 3316 |
operands[1], operands[2])); |
| 3317 |
DONE; |
| 3318 |
} |
| 3319 |
}) |
| 3320 |
|
| 3321 |
(define_insn "" |
| 3322 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3323 |
(truncate:SI |
| 3324 |
(lshiftrt:DI |
| 3325 |
(mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1")) |
| 3326 |
(sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm"))) |
| 3327 |
(const_int 32)))) |
| 3328 |
(clobber (match_operand:SI 1 "register_operand" "=d"))] |
| 3329 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3330 |
"muls%.l %3,%0:%1") |
| 3331 |
|
| 3332 |
(define_insn "const_smulsi3_highpart" |
| 3333 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3334 |
(truncate:SI |
| 3335 |
(lshiftrt:DI |
| 3336 |
(mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1")) |
| 3337 |
(match_operand:DI 3 "const_sint32_operand" "n")) |
| 3338 |
(const_int 32)))) |
| 3339 |
(clobber (match_operand:SI 1 "register_operand" "=d"))] |
| 3340 |
"TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE" |
| 3341 |
"muls%.l %3,%0:%1") |
| 3342 |
|
| 3343 |
(define_expand "mul<mode>3" |
| 3344 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 3345 |
(mult:FP (match_operand:FP 1 "general_operand" "") |
| 3346 |
(match_operand:FP 2 "general_operand" "")))] |
| 3347 |
"TARGET_HARD_FLOAT" |
| 3348 |
"") |
| 3349 |
|
| 3350 |
(define_insn "mul<mode>3_floatsi_68881" |
| 3351 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3352 |
(mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi")) |
| 3353 |
(match_operand:FP 1 "general_operand" "0")))] |
| 3354 |
"TARGET_68881" |
| 3355 |
{ |
| 3356 |
return TARGET_68040 |
| 3357 |
? "f<FP:round>mul%.l %2,%0" |
| 3358 |
: "f<FP:round_mul>mul%.l %2,%0"; |
| 3359 |
} |
| 3360 |
[(set_attr "type" "fmul") |
| 3361 |
(set_attr "opy" "2")]) |
| 3362 |
|
| 3363 |
(define_insn "mul<mode>3_floathi_68881" |
| 3364 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3365 |
(mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn")) |
| 3366 |
(match_operand:FP 1 "general_operand" "0")))] |
| 3367 |
"TARGET_68881" |
| 3368 |
{ |
| 3369 |
return TARGET_68040 |
| 3370 |
? "f<FP:round>mul%.w %2,%0" |
| 3371 |
: "f<FP:round_mul>mul%.w %2,%0"; |
| 3372 |
} |
| 3373 |
[(set_attr "type" "fmul") |
| 3374 |
(set_attr "opy" "2")]) |
| 3375 |
|
| 3376 |
(define_insn "mul<mode>3_floatqi_68881" |
| 3377 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3378 |
(mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn")) |
| 3379 |
(match_operand:FP 1 "general_operand" "0")))] |
| 3380 |
"TARGET_68881" |
| 3381 |
{ |
| 3382 |
return TARGET_68040 |
| 3383 |
? "f<FP:round>mul%.b %2,%0" |
| 3384 |
: "f<FP:round_mul>mul%.b %2,%0"; |
| 3385 |
} |
| 3386 |
[(set_attr "type" "fmul") |
| 3387 |
(set_attr "opy" "2")]) |
| 3388 |
|
| 3389 |
(define_insn "muldf_68881" |
| 3390 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=f") |
| 3391 |
(mult:DF (match_operand:DF 1 "general_operand" "%0") |
| 3392 |
(match_operand:DF 2 "general_operand" "fmG")))] |
| 3393 |
"TARGET_68881" |
| 3394 |
{ |
| 3395 |
if (GET_CODE (operands[2]) == CONST_DOUBLE |
| 3396 |
&& floating_exact_log2 (operands[2]) && !TUNE_68040_60) |
| 3397 |
{ |
| 3398 |
int i = floating_exact_log2 (operands[2]); |
| 3399 |
operands[2] = GEN_INT (i); |
| 3400 |
return "fscale%.l %2,%0"; |
| 3401 |
} |
| 3402 |
if (REG_P (operands[2])) |
| 3403 |
return "f%&mul%.x %2,%0"; |
| 3404 |
return "f%&mul%.d %f2,%0"; |
| 3405 |
}) |
| 3406 |
|
| 3407 |
(define_insn "mulsf_68881" |
| 3408 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=f") |
| 3409 |
(mult:SF (match_operand:SF 1 "general_operand" "%0") |
| 3410 |
(match_operand:SF 2 "general_operand" "fdmF")))] |
| 3411 |
"TARGET_68881" |
| 3412 |
{ |
| 3413 |
if (FP_REG_P (operands[2])) |
| 3414 |
return (TARGET_68040 |
| 3415 |
? "fsmul%.x %2,%0" |
| 3416 |
: "fsglmul%.x %2,%0"); |
| 3417 |
return (TARGET_68040 |
| 3418 |
? "fsmul%.s %f2,%0" |
| 3419 |
: "fsglmul%.s %f2,%0"); |
| 3420 |
}) |
| 3421 |
|
| 3422 |
(define_insn "mulxf3_68881" |
| 3423 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=f") |
| 3424 |
(mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0") |
| 3425 |
(match_operand:XF 2 "nonimmediate_operand" "fm")))] |
| 3426 |
"TARGET_68881" |
| 3427 |
{ |
| 3428 |
return "fmul%.x %f2,%0"; |
| 3429 |
}) |
| 3430 |
|
| 3431 |
(define_insn "fmul<mode>3_cf" |
| 3432 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3433 |
(mult:FP (match_operand:FP 1 "general_operand" "%0") |
| 3434 |
(match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))] |
| 3435 |
"TARGET_COLDFIRE_FPU" |
| 3436 |
{ |
| 3437 |
if (FP_REG_P (operands[2])) |
| 3438 |
return "f<FP:prec>mul%.d %2,%0"; |
| 3439 |
return "f<FP:prec>mul%.<FP:prec> %2,%0"; |
| 3440 |
} |
| 3441 |
[(set_attr "type" "fmul") |
| 3442 |
(set_attr "opy" "2")]) |
| 3443 |
|
| 3444 |
;; divide instructions |
| 3445 |
|
| 3446 |
(define_expand "div<mode>3" |
| 3447 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 3448 |
(div:FP (match_operand:FP 1 "general_operand" "") |
| 3449 |
(match_operand:FP 2 "general_operand" "")))] |
| 3450 |
"TARGET_HARD_FLOAT" |
| 3451 |
"") |
| 3452 |
|
| 3453 |
(define_insn "div<mode>3_floatsi_68881" |
| 3454 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3455 |
(div:FP (match_operand:FP 1 "general_operand" "0") |
| 3456 |
(float:FP (match_operand:SI 2 "general_operand" "dmi"))))] |
| 3457 |
"TARGET_68881" |
| 3458 |
{ |
| 3459 |
return TARGET_68040 |
| 3460 |
? "f<FP:round>div%.l %2,%0" |
| 3461 |
: "f<FP:round_mul>div%.l %2,%0"; |
| 3462 |
}) |
| 3463 |
|
| 3464 |
(define_insn "div<mode>3_floathi_68881" |
| 3465 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3466 |
(div:FP (match_operand:FP 1 "general_operand" "0") |
| 3467 |
(float:FP (match_operand:HI 2 "general_operand" "dmn"))))] |
| 3468 |
"TARGET_68881" |
| 3469 |
{ |
| 3470 |
return TARGET_68040 |
| 3471 |
? "f<FP:round>div%.w %2,%0" |
| 3472 |
: "f<FP:round_mul>div%.w %2,%0"; |
| 3473 |
}) |
| 3474 |
|
| 3475 |
(define_insn "div<mode>3_floatqi_68881" |
| 3476 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3477 |
(div:FP (match_operand:FP 1 "general_operand" "0") |
| 3478 |
(float:FP (match_operand:QI 2 "general_operand" "dmn"))))] |
| 3479 |
"TARGET_68881" |
| 3480 |
{ |
| 3481 |
return TARGET_68040 |
| 3482 |
? "f<FP:round>div%.b %2,%0" |
| 3483 |
: "f<FP:round_mul>div%.b %2,%0"; |
| 3484 |
}) |
| 3485 |
|
| 3486 |
(define_insn "div<mode>3_68881" |
| 3487 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3488 |
(div:FP (match_operand:FP 1 "general_operand" "0") |
| 3489 |
(match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))] |
| 3490 |
"TARGET_68881" |
| 3491 |
{ |
| 3492 |
if (FP_REG_P (operands[2])) |
| 3493 |
return (TARGET_68040 |
| 3494 |
? "f<FP:round>div%.x %2,%0" |
| 3495 |
: "f<FP:round_mul>div%.x %2,%0"); |
| 3496 |
return (TARGET_68040 |
| 3497 |
? "f<FP:round>div%.<FP:prec> %f2,%0" |
| 3498 |
: "f<FP:round_mul>div%.<FP:prec> %f2,%0"); |
| 3499 |
}) |
| 3500 |
|
| 3501 |
(define_insn "div<mode>3_cf" |
| 3502 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 3503 |
(div:FP (match_operand:FP 1 "general_operand" "0") |
| 3504 |
(match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))] |
| 3505 |
"TARGET_COLDFIRE_FPU" |
| 3506 |
{ |
| 3507 |
if (FP_REG_P (operands[2])) |
| 3508 |
return "f<FP:prec>div%.d %2,%0"; |
| 3509 |
return "f<FP:prec>div%.<FP:prec> %2,%0"; |
| 3510 |
} |
| 3511 |
[(set_attr "type" "fdiv") |
| 3512 |
(set_attr "opy" "2")]) |
| 3513 |
|
| 3514 |
;; Remainder instructions. |
| 3515 |
|
| 3516 |
(define_expand "divmodsi4" |
| 3517 |
[(parallel |
| 3518 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3519 |
(div:SI (match_operand:SI 1 "general_operand" "") |
| 3520 |
(match_operand:SI 2 "general_src_operand" ""))) |
| 3521 |
(set (match_operand:SI 3 "register_operand" "") |
| 3522 |
(mod:SI (match_dup 1) (match_dup 2)))])] |
| 3523 |
"TARGET_68020 || TARGET_CF_HWDIV" |
| 3524 |
"") |
| 3525 |
|
| 3526 |
(define_insn "" |
| 3527 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3528 |
(div:SI (match_operand:SI 1 "general_operand" "0") |
| 3529 |
(match_operand:SI 2 "general_src_operand" "d<Q>U"))) |
| 3530 |
(set (match_operand:SI 3 "register_operand" "=&d") |
| 3531 |
(mod:SI (match_dup 1) (match_dup 2)))] |
| 3532 |
"TARGET_CF_HWDIV" |
| 3533 |
{ |
| 3534 |
if (find_reg_note (insn, REG_UNUSED, operands[3])) |
| 3535 |
return "divs%.l %2,%0"; |
| 3536 |
else if (find_reg_note (insn, REG_UNUSED, operands[0])) |
| 3537 |
return "rems%.l %2,%3:%0"; |
| 3538 |
else |
| 3539 |
return "rems%.l %2,%3:%0\;divs%.l %2,%0"; |
| 3540 |
} |
| 3541 |
[(set_attr "type" "div_l") |
| 3542 |
(set_attr "opy" "2")]) |
| 3543 |
|
| 3544 |
(define_insn "" |
| 3545 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3546 |
(div:SI (match_operand:SI 1 "general_operand" "0") |
| 3547 |
(match_operand:SI 2 "general_src_operand" "dmSTK"))) |
| 3548 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3549 |
(mod:SI (match_dup 1) (match_dup 2)))] |
| 3550 |
"TARGET_68020" |
| 3551 |
{ |
| 3552 |
if (find_reg_note (insn, REG_UNUSED, operands[3])) |
| 3553 |
return "divs%.l %2,%0"; |
| 3554 |
else |
| 3555 |
return "divsl%.l %2,%3:%0"; |
| 3556 |
}) |
| 3557 |
|
| 3558 |
(define_expand "udivmodsi4" |
| 3559 |
[(parallel |
| 3560 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3561 |
(udiv:SI (match_operand:SI 1 "general_operand" "0") |
| 3562 |
(match_operand:SI 2 "general_src_operand" "dmSTK"))) |
| 3563 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3564 |
(umod:SI (match_dup 1) (match_dup 2)))])] |
| 3565 |
"TARGET_68020 || TARGET_CF_HWDIV" |
| 3566 |
"") |
| 3567 |
|
| 3568 |
(define_insn "" |
| 3569 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3570 |
(udiv:SI (match_operand:SI 1 "general_operand" "0") |
| 3571 |
(match_operand:SI 2 "general_src_operand" "d<Q>U"))) |
| 3572 |
(set (match_operand:SI 3 "register_operand" "=&d") |
| 3573 |
(umod:SI (match_dup 1) (match_dup 2)))] |
| 3574 |
"TARGET_CF_HWDIV" |
| 3575 |
{ |
| 3576 |
if (find_reg_note (insn, REG_UNUSED, operands[3])) |
| 3577 |
return "divu%.l %2,%0"; |
| 3578 |
else if (find_reg_note (insn, REG_UNUSED, operands[0])) |
| 3579 |
return "remu%.l %2,%3:%0"; |
| 3580 |
else |
| 3581 |
return "remu%.l %2,%3:%0\;divu%.l %2,%0"; |
| 3582 |
} |
| 3583 |
[(set_attr "type" "div_l") |
| 3584 |
(set_attr "opy" "2")]) |
| 3585 |
|
| 3586 |
(define_insn "" |
| 3587 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3588 |
(udiv:SI (match_operand:SI 1 "general_operand" "0") |
| 3589 |
(match_operand:SI 2 "general_src_operand" "dmSTK"))) |
| 3590 |
(set (match_operand:SI 3 "register_operand" "=d") |
| 3591 |
(umod:SI (match_dup 1) (match_dup 2)))] |
| 3592 |
"TARGET_68020 && !TARGET_COLDFIRE" |
| 3593 |
{ |
| 3594 |
if (find_reg_note (insn, REG_UNUSED, operands[3])) |
| 3595 |
return "divu%.l %2,%0"; |
| 3596 |
else |
| 3597 |
return "divul%.l %2,%3:%0"; |
| 3598 |
}) |
| 3599 |
|
| 3600 |
(define_insn "divmodhi4" |
| 3601 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 3602 |
(div:HI (match_operand:HI 1 "general_operand" "0") |
| 3603 |
(match_operand:HI 2 "general_src_operand" "dmSKT"))) |
| 3604 |
(set (match_operand:HI 3 "register_operand" "=d") |
| 3605 |
(mod:HI (match_dup 1) (match_dup 2)))] |
| 3606 |
"!TARGET_COLDFIRE || TARGET_CF_HWDIV" |
| 3607 |
{ |
| 3608 |
output_asm_insn (MOTOROLA ? |
| 3609 |
"ext%.l %0\;divs%.w %2,%0" : |
| 3610 |
"extl %0\;divs %2,%0", |
| 3611 |
operands); |
| 3612 |
if (!find_reg_note(insn, REG_UNUSED, operands[3])) |
| 3613 |
return "move%.l %0,%3\;swap %3"; |
| 3614 |
else |
| 3615 |
return ""; |
| 3616 |
}) |
| 3617 |
|
| 3618 |
(define_insn "udivmodhi4" |
| 3619 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 3620 |
(udiv:HI (match_operand:HI 1 "general_operand" "0") |
| 3621 |
(match_operand:HI 2 "general_src_operand" "dmSKT"))) |
| 3622 |
(set (match_operand:HI 3 "register_operand" "=d") |
| 3623 |
(umod:HI (match_dup 1) (match_dup 2)))] |
| 3624 |
"!TARGET_COLDFIRE || TARGET_CF_HWDIV" |
| 3625 |
{ |
| 3626 |
if (ISA_HAS_MVS_MVZ) |
| 3627 |
output_asm_insn (MOTOROLA ? |
| 3628 |
"mvz%.w %0,%0\;divu%.w %2,%0" : |
| 3629 |
"mvz%.w %0,%0\;divu %2,%0", |
| 3630 |
operands); |
| 3631 |
else |
| 3632 |
output_asm_insn (MOTOROLA ? |
| 3633 |
"and%.l #0xFFFF,%0\;divu%.w %2,%0" : |
| 3634 |
"and%.l #0xFFFF,%0\;divu %2,%0", |
| 3635 |
operands); |
| 3636 |
|
| 3637 |
if (!find_reg_note(insn, REG_UNUSED, operands[3])) |
| 3638 |
return "move%.l %0,%3\;swap %3"; |
| 3639 |
else |
| 3640 |
return ""; |
| 3641 |
}) |
| 3642 |
|
| 3643 |
;; logical-and instructions |
| 3644 |
|
| 3645 |
;; Prevent AND from being made with sp. This doesn't exist in the machine |
| 3646 |
;; and reload will cause inefficient code. Since sp is a FIXED_REG, we |
| 3647 |
;; can't allocate pseudos into it. |
| 3648 |
|
| 3649 |
(define_expand "andsi3" |
| 3650 |
[(set (match_operand:SI 0 "not_sp_operand" "") |
| 3651 |
(and:SI (match_operand:SI 1 "general_operand" "") |
| 3652 |
(match_operand:SI 2 "general_src_operand" "")))] |
| 3653 |
"" |
| 3654 |
"") |
| 3655 |
|
| 3656 |
;; produced by split operations after reload finished |
| 3657 |
(define_insn "*andsi3_split" |
| 3658 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 3659 |
(and:SI (match_operand:SI 1 "register_operand" "0") |
| 3660 |
(match_operand:SI 2 "const_int_operand" "i")))] |
| 3661 |
"reload_completed && !TARGET_COLDFIRE" |
| 3662 |
{ |
| 3663 |
return output_andsi3 (operands); |
| 3664 |
}) |
| 3665 |
|
| 3666 |
(define_insn "andsi3_internal" |
| 3667 |
[(set (match_operand:SI 0 "not_sp_operand" "=m,d") |
| 3668 |
(and:SI (match_operand:SI 1 "general_operand" "%0,0") |
| 3669 |
(match_operand:SI 2 "general_src_operand" "dKT,dmSM")))] |
| 3670 |
"!TARGET_COLDFIRE" |
| 3671 |
{ |
| 3672 |
return output_andsi3 (operands); |
| 3673 |
} |
| 3674 |
[(set_attr "flags_valid" "set")]) |
| 3675 |
|
| 3676 |
(define_insn "andsi3_5200" |
| 3677 |
[(set (match_operand:SI 0 "not_sp_operand" "=m,d") |
| 3678 |
(and:SI (match_operand:SI 1 "general_operand" "%0,0") |
| 3679 |
(match_operand:SI 2 "general_src_operand" "d,dmsK")))] |
| 3680 |
"TARGET_COLDFIRE" |
| 3681 |
{ |
| 3682 |
if (ISA_HAS_MVS_MVZ |
| 3683 |
&& DATA_REG_P (operands[0]) |
| 3684 |
&& GET_CODE (operands[2]) == CONST_INT) |
| 3685 |
{ |
| 3686 |
if (INTVAL (operands[2]) == 0x000000ff) |
| 3687 |
return "mvz%.b %0,%0"; |
| 3688 |
else if (INTVAL (operands[2]) == 0x0000ffff) |
| 3689 |
return "mvz%.w %0,%0"; |
| 3690 |
} |
| 3691 |
return output_andsi3 (operands); |
| 3692 |
}) |
| 3693 |
|
| 3694 |
(define_insn "andhi3" |
| 3695 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=m,d") |
| 3696 |
(and:HI (match_operand:HI 1 "general_operand" "%0,0") |
| 3697 |
(match_operand:HI 2 "general_src_operand" "dn,dmSn")))] |
| 3698 |
"!TARGET_COLDFIRE" |
| 3699 |
"and%.w %2,%0" |
| 3700 |
[(set_attr "flags_valid" "yes")]) |
| 3701 |
|
| 3702 |
(define_insn "" |
| 3703 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 3704 |
(and:HI (match_dup 0) |
| 3705 |
(match_operand:HI 1 "general_src_operand" "dn,dmSn")))] |
| 3706 |
"!TARGET_COLDFIRE" |
| 3707 |
"and%.w %1,%0" |
| 3708 |
[(set_attr "flags_valid" "yes")]) |
| 3709 |
|
| 3710 |
(define_insn "" |
| 3711 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 3712 |
(and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn") |
| 3713 |
(match_dup 0)))] |
| 3714 |
"!TARGET_COLDFIRE" |
| 3715 |
"and%.w %1,%0" |
| 3716 |
[(set_attr "flags_valid" "yes")]) |
| 3717 |
|
| 3718 |
(define_insn "andqi3" |
| 3719 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=m,d") |
| 3720 |
(and:QI (match_operand:QI 1 "general_operand" "%0,0") |
| 3721 |
(match_operand:QI 2 "general_src_operand" "dn,dmSn")))] |
| 3722 |
"!TARGET_COLDFIRE" |
| 3723 |
"and%.b %2,%0" |
| 3724 |
[(set_attr "flags_valid" "yes")]) |
| 3725 |
|
| 3726 |
(define_insn "" |
| 3727 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 3728 |
(and:QI (match_dup 0) |
| 3729 |
(match_operand:QI 1 "general_src_operand" "dn,dmSn")))] |
| 3730 |
"!TARGET_COLDFIRE" |
| 3731 |
"and%.b %1,%0" |
| 3732 |
[(set_attr "flags_valid" "yes")]) |
| 3733 |
|
| 3734 |
(define_insn "" |
| 3735 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 3736 |
(and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn") |
| 3737 |
(match_dup 0)))] |
| 3738 |
"!TARGET_COLDFIRE" |
| 3739 |
"and%.b %1,%0") |
| 3740 |
|
| 3741 |
;; inclusive-or instructions |
| 3742 |
|
| 3743 |
(define_insn "iordi_zext" |
| 3744 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=o,d") |
| 3745 |
(ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn")) |
| 3746 |
(match_operand:DI 2 "general_operand" "0,0")))] |
| 3747 |
"!TARGET_COLDFIRE" |
| 3748 |
{ |
| 3749 |
int byte_mode; |
| 3750 |
|
| 3751 |
if (GET_CODE (operands[0]) == REG) |
| 3752 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 3753 |
else |
| 3754 |
operands[0] = adjust_address (operands[0], SImode, 4); |
| 3755 |
if (GET_MODE (operands[1]) == SImode) |
| 3756 |
return "or%.l %1,%0"; |
| 3757 |
byte_mode = (GET_MODE (operands[1]) == QImode); |
| 3758 |
if (GET_CODE (operands[0]) == MEM) |
| 3759 |
operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode, |
| 3760 |
byte_mode ? 3 : 2); |
| 3761 |
if (byte_mode) |
| 3762 |
return "or%.b %1,%0"; |
| 3763 |
else |
| 3764 |
return "or%.w %1,%0"; |
| 3765 |
}) |
| 3766 |
|
| 3767 |
(define_expand "iorsi3" |
| 3768 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 3769 |
(ior:SI (match_operand:SI 1 "general_operand" "") |
| 3770 |
(match_operand:SI 2 "general_src_operand" "")))] |
| 3771 |
"" |
| 3772 |
"") |
| 3773 |
|
| 3774 |
(define_insn "iorsi3_internal" |
| 3775 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=m,d") |
| 3776 |
(ior:SI (match_operand:SI 1 "general_operand" "%0,0") |
| 3777 |
(match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))] |
| 3778 |
"! TARGET_COLDFIRE" |
| 3779 |
{ |
| 3780 |
return output_iorsi3 (operands); |
| 3781 |
} |
| 3782 |
[(set_attr "flags_valid" "set")]) |
| 3783 |
|
| 3784 |
(define_insn "iorsi3_5200" |
| 3785 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=m,d") |
| 3786 |
(ior:SI (match_operand:SI 1 "general_operand" "%0,0") |
| 3787 |
(match_operand:SI 2 "general_src_operand" "d,dmsK")))] |
| 3788 |
"TARGET_COLDFIRE" |
| 3789 |
{ |
| 3790 |
return output_iorsi3 (operands); |
| 3791 |
} |
| 3792 |
[(set_attr "flags_valid" "set")]) |
| 3793 |
|
| 3794 |
(define_insn "iorhi3" |
| 3795 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=m,d") |
| 3796 |
(ior:HI (match_operand:HI 1 "general_operand" "%0,0") |
| 3797 |
(match_operand:HI 2 "general_src_operand" "dn,dmSn")))] |
| 3798 |
"!TARGET_COLDFIRE" |
| 3799 |
"or%.w %2,%0") |
| 3800 |
|
| 3801 |
(define_insn "" |
| 3802 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 3803 |
(ior:HI (match_dup 0) |
| 3804 |
(match_operand:HI 1 "general_src_operand" "dn,dmSn")))] |
| 3805 |
"!TARGET_COLDFIRE" |
| 3806 |
"or%.w %1,%0") |
| 3807 |
|
| 3808 |
(define_insn "" |
| 3809 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d")) |
| 3810 |
(ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn") |
| 3811 |
(match_dup 0)))] |
| 3812 |
"!TARGET_COLDFIRE" |
| 3813 |
"or%.w %1,%0" |
| 3814 |
[(set_attr "flags_valid" "yes")]) |
| 3815 |
|
| 3816 |
(define_insn "iorqi3" |
| 3817 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=m,d") |
| 3818 |
(ior:QI (match_operand:QI 1 "general_operand" "%0,0") |
| 3819 |
(match_operand:QI 2 "general_src_operand" "dn,dmSn")))] |
| 3820 |
"!TARGET_COLDFIRE" |
| 3821 |
"or%.b %2,%0" |
| 3822 |
[(set_attr "flags_valid" "yes")]) |
| 3823 |
|
| 3824 |
(define_insn "" |
| 3825 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 3826 |
(ior:QI (match_dup 0) |
| 3827 |
(match_operand:QI 1 "general_src_operand" "dn,dmSn")))] |
| 3828 |
"!TARGET_COLDFIRE" |
| 3829 |
"or%.b %1,%0" |
| 3830 |
[(set_attr "flags_valid" "yes")]) |
| 3831 |
|
| 3832 |
(define_insn "" |
| 3833 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d")) |
| 3834 |
(ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn") |
| 3835 |
(match_dup 0)))] |
| 3836 |
"!TARGET_COLDFIRE" |
| 3837 |
"or%.b %1,%0" |
| 3838 |
[(set_attr "flags_valid" "yes")]) |
| 3839 |
|
| 3840 |
;; On all 68k models, this makes faster code in a special case. |
| 3841 |
;; See also ashlsi_16, ashrsi_16 and lshrsi_16. |
| 3842 |
|
| 3843 |
(define_insn "iorsi_zexthi_ashl16" |
| 3844 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=&d") |
| 3845 |
(ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn")) |
| 3846 |
(ashift:SI (match_operand:SI 2 "general_operand" "or") |
| 3847 |
(const_int 16))))] |
| 3848 |
"" |
| 3849 |
{ |
| 3850 |
if (GET_CODE (operands[2]) != REG) |
| 3851 |
operands[2] = adjust_address (operands[2], HImode, 2); |
| 3852 |
if (GET_CODE (operands[2]) != REG |
| 3853 |
|| REGNO (operands[2]) != REGNO (operands[0])) |
| 3854 |
output_asm_insn ("move%.w %2,%0", operands); |
| 3855 |
return "swap %0\;mov%.w %1,%0"; |
| 3856 |
}) |
| 3857 |
|
| 3858 |
(define_insn "iorsi_zext" |
| 3859 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=o,d") |
| 3860 |
(ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn")) |
| 3861 |
(match_operand:SI 2 "general_operand" "0,0")))] |
| 3862 |
"!TARGET_COLDFIRE" |
| 3863 |
{ |
| 3864 |
int byte_mode; |
| 3865 |
|
| 3866 |
byte_mode = (GET_MODE (operands[1]) == QImode); |
| 3867 |
if (GET_CODE (operands[0]) == MEM) |
| 3868 |
operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode, |
| 3869 |
byte_mode ? 3 : 2); |
| 3870 |
if (byte_mode) |
| 3871 |
return "or%.b %1,%0"; |
| 3872 |
else |
| 3873 |
return "or%.w %1,%0"; |
| 3874 |
}) |
| 3875 |
|
| 3876 |
;; xor instructions |
| 3877 |
|
| 3878 |
(define_expand "xorsi3" |
| 3879 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 3880 |
(xor:SI (match_operand:SI 1 "general_operand" "") |
| 3881 |
(match_operand:SI 2 "general_operand" "")))] |
| 3882 |
"" |
| 3883 |
"") |
| 3884 |
|
| 3885 |
(define_insn "xorsi3_internal" |
| 3886 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d,o,m") |
| 3887 |
(xor:SI (match_operand:SI 1 "general_operand" "%0, 0,0") |
| 3888 |
(match_operand:SI 2 "general_operand" "di,dK,dKT")))] |
| 3889 |
|
| 3890 |
"!TARGET_COLDFIRE" |
| 3891 |
{ |
| 3892 |
return output_xorsi3 (operands); |
| 3893 |
} |
| 3894 |
[(set_attr "flags_valid" "set")]) |
| 3895 |
|
| 3896 |
(define_insn "xorsi3_5200" |
| 3897 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d") |
| 3898 |
(xor:SI (match_operand:SI 1 "general_operand" "%0,0") |
| 3899 |
(match_operand:SI 2 "general_operand" "d,Ks")))] |
| 3900 |
"TARGET_COLDFIRE" |
| 3901 |
{ |
| 3902 |
return output_xorsi3 (operands); |
| 3903 |
} |
| 3904 |
[(set_attr "flags_valid" "set")]) |
| 3905 |
|
| 3906 |
(define_insn "xorhi3" |
| 3907 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=dm") |
| 3908 |
(xor:HI (match_operand:HI 1 "general_operand" "%0") |
| 3909 |
(match_operand:HI 2 "general_operand" "dn")))] |
| 3910 |
"!TARGET_COLDFIRE" |
| 3911 |
"eor%.w %2,%0" |
| 3912 |
[(set_attr "flags_valid" "yes")]) |
| 3913 |
|
| 3914 |
(define_insn "" |
| 3915 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm")) |
| 3916 |
(xor:HI (match_dup 0) |
| 3917 |
(match_operand:HI 1 "general_operand" "dn")))] |
| 3918 |
"!TARGET_COLDFIRE" |
| 3919 |
"eor%.w %1,%0" |
| 3920 |
[(set_attr "flags_valid" "yes")]) |
| 3921 |
|
| 3922 |
(define_insn "" |
| 3923 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm")) |
| 3924 |
(xor:HI (match_operand:HI 1 "general_operand" "dn") |
| 3925 |
(match_dup 0)))] |
| 3926 |
"!TARGET_COLDFIRE" |
| 3927 |
"eor%.w %1,%0" |
| 3928 |
[(set_attr "flags_valid" "yes")]) |
| 3929 |
|
| 3930 |
(define_insn "xorqi3" |
| 3931 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm") |
| 3932 |
(xor:QI (match_operand:QI 1 "general_operand" "%0") |
| 3933 |
(match_operand:QI 2 "general_operand" "dn")))] |
| 3934 |
"!TARGET_COLDFIRE" |
| 3935 |
"eor%.b %2,%0" |
| 3936 |
[(set_attr "flags_valid" "yes")]) |
| 3937 |
|
| 3938 |
(define_insn "" |
| 3939 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm")) |
| 3940 |
(xor:QI (match_dup 0) |
| 3941 |
(match_operand:QI 1 "general_operand" "dn")))] |
| 3942 |
"!TARGET_COLDFIRE" |
| 3943 |
"eor%.b %1,%0" |
| 3944 |
[(set_attr "flags_valid" "yes")]) |
| 3945 |
|
| 3946 |
(define_insn "" |
| 3947 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm")) |
| 3948 |
(xor:QI (match_operand:QI 1 "general_operand" "dn") |
| 3949 |
(match_dup 0)))] |
| 3950 |
"!TARGET_COLDFIRE" |
| 3951 |
"eor%.b %1,%0" |
| 3952 |
[(set_attr "flags_valid" "yes")]) |
| 3953 |
|
| 3954 |
;; negation instructions |
| 3955 |
|
| 3956 |
(define_expand "negdi2" |
| 3957 |
[(set (match_operand:DI 0 "nonimmediate_operand" "") |
| 3958 |
(neg:DI (match_operand:DI 1 "general_operand" "")))] |
| 3959 |
"" |
| 3960 |
{ |
| 3961 |
if (TARGET_COLDFIRE) |
| 3962 |
emit_insn (gen_negdi2_5200 (operands[0], operands[1])); |
| 3963 |
else |
| 3964 |
emit_insn (gen_negdi2_internal (operands[0], operands[1])); |
| 3965 |
DONE; |
| 3966 |
}) |
| 3967 |
|
| 3968 |
(define_insn "negdi2_internal" |
| 3969 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a") |
| 3970 |
(neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))] |
| 3971 |
"!TARGET_COLDFIRE" |
| 3972 |
{ |
| 3973 |
if (which_alternative == 0) |
| 3974 |
return "neg%.l %0\;negx%.l %0"; |
| 3975 |
if (GET_CODE (operands[0]) == REG) |
| 3976 |
operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 3977 |
else |
| 3978 |
operands[1] = adjust_address (operands[0], SImode, 4); |
| 3979 |
if (ADDRESS_REG_P (operands[0])) |
| 3980 |
return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0"; |
| 3981 |
else |
| 3982 |
return "neg%.l %1\;negx%.l %0"; |
| 3983 |
}) |
| 3984 |
|
| 3985 |
(define_insn "negdi2_5200" |
| 3986 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=d") |
| 3987 |
(neg:DI (match_operand:DI 1 "general_operand" "0")))] |
| 3988 |
"TARGET_COLDFIRE" |
| 3989 |
{ |
| 3990 |
operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 3991 |
return "neg%.l %1\;negx%.l %0"; |
| 3992 |
}) |
| 3993 |
|
| 3994 |
(define_expand "negsi2" |
| 3995 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 3996 |
(neg:SI (match_operand:SI 1 "general_operand" "")))] |
| 3997 |
"" |
| 3998 |
{ |
| 3999 |
if (TARGET_COLDFIRE) |
| 4000 |
emit_insn (gen_negsi2_5200 (operands[0], operands[1])); |
| 4001 |
else |
| 4002 |
emit_insn (gen_negsi2_internal (operands[0], operands[1])); |
| 4003 |
DONE; |
| 4004 |
}) |
| 4005 |
|
| 4006 |
(define_insn "negsi2_internal" |
| 4007 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=dm") |
| 4008 |
(neg:SI (match_operand:SI 1 "general_operand" "0")))] |
| 4009 |
"!TARGET_COLDFIRE" |
| 4010 |
"neg%.l %0" |
| 4011 |
[(set_attr "type" "neg_l") |
| 4012 |
(set_attr "flags_valid" "noov")]) |
| 4013 |
|
| 4014 |
(define_insn "negsi2_5200" |
| 4015 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 4016 |
(neg:SI (match_operand:SI 1 "general_operand" "0")))] |
| 4017 |
"TARGET_COLDFIRE" |
| 4018 |
"neg%.l %0" |
| 4019 |
[(set_attr "type" "neg_l") |
| 4020 |
(set_attr "flags_valid" "noov")]) |
| 4021 |
|
| 4022 |
(define_insn "neghi2" |
| 4023 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=dm") |
| 4024 |
(neg:HI (match_operand:HI 1 "general_operand" "0")))] |
| 4025 |
"!TARGET_COLDFIRE" |
| 4026 |
"neg%.w %0" |
| 4027 |
[(set_attr "flags_valid" "noov")]) |
| 4028 |
|
| 4029 |
(define_insn "" |
| 4030 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm")) |
| 4031 |
(neg:HI (match_dup 0)))] |
| 4032 |
"!TARGET_COLDFIRE" |
| 4033 |
"neg%.w %0" |
| 4034 |
[(set_attr "flags_valid" "noov")]) |
| 4035 |
|
| 4036 |
(define_insn "negqi2" |
| 4037 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm") |
| 4038 |
(neg:QI (match_operand:QI 1 "general_operand" "0")))] |
| 4039 |
"!TARGET_COLDFIRE" |
| 4040 |
"neg%.b %0" |
| 4041 |
[(set_attr "flags_valid" "noov")]) |
| 4042 |
|
| 4043 |
(define_insn "" |
| 4044 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm")) |
| 4045 |
(neg:QI (match_dup 0)))] |
| 4046 |
"!TARGET_COLDFIRE" |
| 4047 |
"neg%.b %0" |
| 4048 |
[(set_attr "flags_valid" "noov")]) |
| 4049 |
|
| 4050 |
;; If using software floating point, just flip the sign bit. |
| 4051 |
|
| 4052 |
(define_expand "negsf2" |
| 4053 |
[(set (match_operand:SF 0 "nonimmediate_operand" "") |
| 4054 |
(neg:SF (match_operand:SF 1 "general_operand" "")))] |
| 4055 |
"" |
| 4056 |
{ |
| 4057 |
if (!TARGET_HARD_FLOAT) |
| 4058 |
{ |
| 4059 |
rtx result; |
| 4060 |
rtx target; |
| 4061 |
|
| 4062 |
target = operand_subword_force (operands[0], 0, SFmode); |
| 4063 |
result = expand_binop (SImode, xor_optab, |
| 4064 |
operand_subword_force (operands[1], 0, SFmode), |
| 4065 |
GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN); |
| 4066 |
gcc_assert (result); |
| 4067 |
|
| 4068 |
if (result != target) |
| 4069 |
emit_move_insn (result, target); |
| 4070 |
|
| 4071 |
/* Make a place for REG_EQUAL. */ |
| 4072 |
emit_move_insn (operands[0], operands[0]); |
| 4073 |
DONE; |
| 4074 |
} |
| 4075 |
}) |
| 4076 |
|
| 4077 |
(define_expand "negdf2" |
| 4078 |
[(set (match_operand:DF 0 "nonimmediate_operand" "") |
| 4079 |
(neg:DF (match_operand:DF 1 "general_operand" "")))] |
| 4080 |
"" |
| 4081 |
{ |
| 4082 |
if (!TARGET_HARD_FLOAT) |
| 4083 |
{ |
| 4084 |
rtx result; |
| 4085 |
rtx target; |
| 4086 |
rtx insns; |
| 4087 |
|
| 4088 |
start_sequence (); |
| 4089 |
target = operand_subword (operands[0], 0, 1, DFmode); |
| 4090 |
result = expand_binop (SImode, xor_optab, |
| 4091 |
operand_subword_force (operands[1], 0, DFmode), |
| 4092 |
GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN); |
| 4093 |
gcc_assert (result); |
| 4094 |
|
| 4095 |
if (result != target) |
| 4096 |
emit_move_insn (result, target); |
| 4097 |
|
| 4098 |
emit_move_insn (operand_subword (operands[0], 1, 1, DFmode), |
| 4099 |
operand_subword_force (operands[1], 1, DFmode)); |
| 4100 |
|
| 4101 |
insns = get_insns (); |
| 4102 |
end_sequence (); |
| 4103 |
|
| 4104 |
emit_insn (insns); |
| 4105 |
DONE; |
| 4106 |
} |
| 4107 |
}) |
| 4108 |
|
| 4109 |
(define_expand "negxf2" |
| 4110 |
[(set (match_operand:XF 0 "nonimmediate_operand" "") |
| 4111 |
(neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))] |
| 4112 |
"" |
| 4113 |
{ |
| 4114 |
if (!TARGET_68881) |
| 4115 |
{ |
| 4116 |
rtx result; |
| 4117 |
rtx target; |
| 4118 |
rtx insns; |
| 4119 |
|
| 4120 |
start_sequence (); |
| 4121 |
target = operand_subword (operands[0], 0, 1, XFmode); |
| 4122 |
result = expand_binop (SImode, xor_optab, |
| 4123 |
operand_subword_force (operands[1], 0, XFmode), |
| 4124 |
GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN); |
| 4125 |
gcc_assert (result); |
| 4126 |
|
| 4127 |
if (result != target) |
| 4128 |
emit_move_insn (result, target); |
| 4129 |
|
| 4130 |
emit_move_insn (operand_subword (operands[0], 1, 1, XFmode), |
| 4131 |
operand_subword_force (operands[1], 1, XFmode)); |
| 4132 |
emit_move_insn (operand_subword (operands[0], 2, 1, XFmode), |
| 4133 |
operand_subword_force (operands[1], 2, XFmode)); |
| 4134 |
|
| 4135 |
insns = get_insns (); |
| 4136 |
end_sequence (); |
| 4137 |
|
| 4138 |
emit_insn (insns); |
| 4139 |
DONE; |
| 4140 |
} |
| 4141 |
}) |
| 4142 |
|
| 4143 |
(define_insn "neg<mode>2_68881" |
| 4144 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f,d") |
| 4145 |
(neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))] |
| 4146 |
"TARGET_68881" |
| 4147 |
{ |
| 4148 |
if (DATA_REG_P (operands[0])) |
| 4149 |
{ |
| 4150 |
operands[1] = GEN_INT (31); |
| 4151 |
return "bchg %1,%0"; |
| 4152 |
} |
| 4153 |
if (FP_REG_P (operands[1])) |
| 4154 |
return "f<FP:round>neg%.x %1,%0"; |
| 4155 |
return "f<FP:round>neg%.<FP:prec> %f1,%0"; |
| 4156 |
}) |
| 4157 |
|
| 4158 |
(define_insn "neg<mode>2_cf" |
| 4159 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f,d") |
| 4160 |
(neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))] |
| 4161 |
"TARGET_COLDFIRE_FPU" |
| 4162 |
{ |
| 4163 |
if (DATA_REG_P (operands[0])) |
| 4164 |
{ |
| 4165 |
operands[1] = GEN_INT (31); |
| 4166 |
return "bchg %1,%0"; |
| 4167 |
} |
| 4168 |
if (FP_REG_P (operands[1])) |
| 4169 |
return "f<FP:prec>neg%.d %1,%0"; |
| 4170 |
return "f<FP:prec>neg%.<FP:prec> %1,%0"; |
| 4171 |
}) |
| 4172 |
|
| 4173 |
;; Sqrt instruction for the 68881 |
| 4174 |
|
| 4175 |
(define_expand "sqrt<mode>2" |
| 4176 |
[(set (match_operand:FP 0 "nonimmediate_operand" "") |
| 4177 |
(sqrt:FP (match_operand:FP 1 "general_operand" "")))] |
| 4178 |
"TARGET_HARD_FLOAT" |
| 4179 |
"") |
| 4180 |
|
| 4181 |
(define_insn "sqrt<mode>2_68881" |
| 4182 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 4183 |
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))] |
| 4184 |
"TARGET_68881" |
| 4185 |
{ |
| 4186 |
if (FP_REG_P (operands[1])) |
| 4187 |
return "f<FP:round>sqrt%.x %1,%0"; |
| 4188 |
return "f<FP:round>sqrt%.<FP:prec> %1,%0"; |
| 4189 |
} |
| 4190 |
[(set_attr "type" "fsqrt")]) |
| 4191 |
|
| 4192 |
(define_insn "sqrt<mode>2_cf" |
| 4193 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 4194 |
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))] |
| 4195 |
"TARGET_COLDFIRE_FPU" |
| 4196 |
{ |
| 4197 |
if (FP_REG_P (operands[1])) |
| 4198 |
return "f<FP:prec>sqrt%.d %1,%0"; |
| 4199 |
return "f<FP:prec>sqrt%.<FP:prec> %1,%0"; |
| 4200 |
} |
| 4201 |
[(set_attr "type" "fsqrt")]) |
| 4202 |
;; Absolute value instructions |
| 4203 |
;; If using software floating point, just zero the sign bit. |
| 4204 |
|
| 4205 |
(define_expand "abssf2" |
| 4206 |
[(set (match_operand:SF 0 "nonimmediate_operand" "") |
| 4207 |
(abs:SF (match_operand:SF 1 "general_operand" "")))] |
| 4208 |
"" |
| 4209 |
{ |
| 4210 |
if (!TARGET_HARD_FLOAT) |
| 4211 |
{ |
| 4212 |
rtx result; |
| 4213 |
rtx target; |
| 4214 |
|
| 4215 |
target = operand_subword_force (operands[0], 0, SFmode); |
| 4216 |
result = expand_binop (SImode, and_optab, |
| 4217 |
operand_subword_force (operands[1], 0, SFmode), |
| 4218 |
GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN); |
| 4219 |
gcc_assert (result); |
| 4220 |
|
| 4221 |
if (result != target) |
| 4222 |
emit_move_insn (result, target); |
| 4223 |
|
| 4224 |
/* Make a place for REG_EQUAL. */ |
| 4225 |
emit_move_insn (operands[0], operands[0]); |
| 4226 |
DONE; |
| 4227 |
} |
| 4228 |
}) |
| 4229 |
|
| 4230 |
(define_expand "absdf2" |
| 4231 |
[(set (match_operand:DF 0 "nonimmediate_operand" "") |
| 4232 |
(abs:DF (match_operand:DF 1 "general_operand" "")))] |
| 4233 |
"" |
| 4234 |
{ |
| 4235 |
if (!TARGET_HARD_FLOAT) |
| 4236 |
{ |
| 4237 |
rtx result; |
| 4238 |
rtx target; |
| 4239 |
rtx insns; |
| 4240 |
|
| 4241 |
start_sequence (); |
| 4242 |
target = operand_subword (operands[0], 0, 1, DFmode); |
| 4243 |
result = expand_binop (SImode, and_optab, |
| 4244 |
operand_subword_force (operands[1], 0, DFmode), |
| 4245 |
GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN); |
| 4246 |
gcc_assert (result); |
| 4247 |
|
| 4248 |
if (result != target) |
| 4249 |
emit_move_insn (result, target); |
| 4250 |
|
| 4251 |
emit_move_insn (operand_subword (operands[0], 1, 1, DFmode), |
| 4252 |
operand_subword_force (operands[1], 1, DFmode)); |
| 4253 |
|
| 4254 |
insns = get_insns (); |
| 4255 |
end_sequence (); |
| 4256 |
|
| 4257 |
emit_insn (insns); |
| 4258 |
DONE; |
| 4259 |
} |
| 4260 |
}) |
| 4261 |
|
| 4262 |
(define_expand "absxf2" |
| 4263 |
[(set (match_operand:XF 0 "nonimmediate_operand" "") |
| 4264 |
(abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))] |
| 4265 |
"" |
| 4266 |
{ |
| 4267 |
if (!TARGET_68881) |
| 4268 |
{ |
| 4269 |
rtx result; |
| 4270 |
rtx target; |
| 4271 |
rtx insns; |
| 4272 |
|
| 4273 |
start_sequence (); |
| 4274 |
target = operand_subword (operands[0], 0, 1, XFmode); |
| 4275 |
result = expand_binop (SImode, and_optab, |
| 4276 |
operand_subword_force (operands[1], 0, XFmode), |
| 4277 |
GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN); |
| 4278 |
gcc_assert (result); |
| 4279 |
|
| 4280 |
if (result != target) |
| 4281 |
emit_move_insn (result, target); |
| 4282 |
|
| 4283 |
emit_move_insn (operand_subword (operands[0], 1, 1, XFmode), |
| 4284 |
operand_subword_force (operands[1], 1, XFmode)); |
| 4285 |
emit_move_insn (operand_subword (operands[0], 2, 1, XFmode), |
| 4286 |
operand_subword_force (operands[1], 2, XFmode)); |
| 4287 |
|
| 4288 |
insns = get_insns (); |
| 4289 |
end_sequence (); |
| 4290 |
|
| 4291 |
emit_insn (insns); |
| 4292 |
DONE; |
| 4293 |
} |
| 4294 |
}) |
| 4295 |
|
| 4296 |
(define_insn "abs<mode>2_68881" |
| 4297 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f,d") |
| 4298 |
(abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))] |
| 4299 |
"TARGET_68881" |
| 4300 |
{ |
| 4301 |
if (DATA_REG_P (operands[0])) |
| 4302 |
{ |
| 4303 |
operands[1] = GEN_INT (31); |
| 4304 |
return "bclr %1,%0"; |
| 4305 |
} |
| 4306 |
if (FP_REG_P (operands[1])) |
| 4307 |
return "f<FP:round>abs%.x %1,%0"; |
| 4308 |
return "f<FP:round>abs%.<FP:prec> %f1,%0"; |
| 4309 |
}) |
| 4310 |
|
| 4311 |
(define_insn "abs<mode>2_cf" |
| 4312 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f,d") |
| 4313 |
(abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))] |
| 4314 |
"TARGET_COLDFIRE_FPU" |
| 4315 |
{ |
| 4316 |
if (DATA_REG_P (operands[0])) |
| 4317 |
{ |
| 4318 |
operands[1] = GEN_INT (31); |
| 4319 |
return "bclr %1,%0"; |
| 4320 |
} |
| 4321 |
if (FP_REG_P (operands[1])) |
| 4322 |
return "f<FP:prec>abs%.d %1,%0"; |
| 4323 |
return "f<FP:prec>abs%.<FP:prec> %1,%0"; |
| 4324 |
} |
| 4325 |
[(set_attr "type" "bitrw,fneg")]) |
| 4326 |
|
| 4327 |
;; bit indexing instructions |
| 4328 |
|
| 4329 |
(define_expand "clzsi2" |
| 4330 |
[(set (match_operand:SI 0 "register_operand" "") |
| 4331 |
(clz:SI (match_operand:SI 1 "general_operand" "")))] |
| 4332 |
"ISA_HAS_FF1 || (TARGET_68020 && TARGET_BITFIELD)" |
| 4333 |
{ |
| 4334 |
if (ISA_HAS_FF1) |
| 4335 |
operands[1] = force_reg (SImode, operands[1]); |
| 4336 |
}) |
| 4337 |
|
| 4338 |
(define_insn "*clzsi2_68k" |
| 4339 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4340 |
(clz:SI (match_operand:SI 1 "general_operand" "do")))] |
| 4341 |
"TARGET_68020 && TARGET_BITFIELD" |
| 4342 |
"bfffo %1{#0:#0},%0") |
| 4343 |
|
| 4344 |
;; ColdFire ff1 instruction implements clz. |
| 4345 |
(define_insn "*clzsi2_cf" |
| 4346 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4347 |
(clz:SI (match_operand:SI 1 "register_operand" "0")))] |
| 4348 |
"ISA_HAS_FF1" |
| 4349 |
"ff1 %0" |
| 4350 |
[(set_attr "type" "ext")]) |
| 4351 |
|
| 4352 |
;; one complement instructions |
| 4353 |
|
| 4354 |
(define_expand "one_cmplsi2" |
| 4355 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 4356 |
(not:SI (match_operand:SI 1 "general_operand" "")))] |
| 4357 |
"" |
| 4358 |
{ |
| 4359 |
if (TARGET_COLDFIRE) |
| 4360 |
emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1])); |
| 4361 |
else |
| 4362 |
emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1])); |
| 4363 |
DONE; |
| 4364 |
}) |
| 4365 |
|
| 4366 |
(define_insn "one_cmplsi2_internal" |
| 4367 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=dm") |
| 4368 |
(not:SI (match_operand:SI 1 "general_operand" "0")))] |
| 4369 |
"!TARGET_COLDFIRE" |
| 4370 |
"not%.l %0" |
| 4371 |
[(set_attr "flags_valid" "yes")]) |
| 4372 |
|
| 4373 |
(define_insn "one_cmplsi2_5200" |
| 4374 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 4375 |
(not:SI (match_operand:SI 1 "general_operand" "0")))] |
| 4376 |
"TARGET_COLDFIRE" |
| 4377 |
"not%.l %0" |
| 4378 |
[(set_attr "type" "neg_l")]) |
| 4379 |
|
| 4380 |
(define_insn "one_cmplhi2" |
| 4381 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=dm") |
| 4382 |
(not:HI (match_operand:HI 1 "general_operand" "0")))] |
| 4383 |
"!TARGET_COLDFIRE" |
| 4384 |
"not%.w %0" |
| 4385 |
[(set_attr "flags_valid" "yes")]) |
| 4386 |
|
| 4387 |
(define_insn "" |
| 4388 |
[(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm")) |
| 4389 |
(not:HI (match_dup 0)))] |
| 4390 |
"!TARGET_COLDFIRE" |
| 4391 |
"not%.w %0" |
| 4392 |
[(set_attr "flags_valid" "yes")]) |
| 4393 |
|
| 4394 |
(define_insn "one_cmplqi2" |
| 4395 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm") |
| 4396 |
(not:QI (match_operand:QI 1 "general_operand" "0")))] |
| 4397 |
"!TARGET_COLDFIRE" |
| 4398 |
"not%.b %0" |
| 4399 |
[(set_attr "flags_valid" "yes")]) |
| 4400 |
|
| 4401 |
(define_insn "" |
| 4402 |
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm")) |
| 4403 |
(not:QI (match_dup 0)))] |
| 4404 |
"!TARGET_COLDFIRE" |
| 4405 |
"not%.b %0" |
| 4406 |
[(set_attr "flags_valid" "yes")]) |
| 4407 |
|
| 4408 |
;; arithmetic shift instructions |
| 4409 |
;; We don't need the shift memory by 1 bit instruction |
| 4410 |
(define_insn_and_split "ashldi_extsi" |
| 4411 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=ro") |
| 4412 |
(ashift:DI |
| 4413 |
(match_operator:DI 2 "extend_operator" |
| 4414 |
[(match_operand:SI 1 "general_operand" "rm")]) |
| 4415 |
(const_int 32)))] |
| 4416 |
"" |
| 4417 |
"#" |
| 4418 |
"&& reload_completed" |
| 4419 |
[(set (match_dup 3) (match_dup 1)) |
| 4420 |
(set (match_dup 2) (const_int 0))] |
| 4421 |
"split_di(operands, 1, operands + 2, operands + 3);") |
| 4422 |
|
| 4423 |
(define_insn "ashldi_sexthi" |
| 4424 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d") |
| 4425 |
(ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm")) |
| 4426 |
(const_int 32))) |
| 4427 |
(clobber (match_scratch:SI 2 "=a,X"))] |
| 4428 |
"" |
| 4429 |
{ |
| 4430 |
if (GET_CODE (operands[0]) == MEM) |
| 4431 |
{ |
| 4432 |
if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC) |
| 4433 |
return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0"; |
| 4434 |
else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC) |
| 4435 |
return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0"; |
| 4436 |
else |
| 4437 |
{ |
| 4438 |
operands[3] = adjust_address (operands[0], SImode, 4); |
| 4439 |
return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3"; |
| 4440 |
} |
| 4441 |
} |
| 4442 |
else if (DATA_REG_P (operands[0])) |
| 4443 |
return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0"; |
| 4444 |
else |
| 4445 |
return "move%.w %1,%0\;sub%.l %R0,%R0"; |
| 4446 |
}) |
| 4447 |
|
| 4448 |
(define_insn "*ashldi3_const1" |
| 4449 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 4450 |
(ashift:DI (match_operand:DI 1 "register_operand" "0") |
| 4451 |
(const_int 1)))] |
| 4452 |
"!TARGET_COLDFIRE" |
| 4453 |
"add%.l %R0,%R0\;addx%.l %0,%0") |
| 4454 |
|
| 4455 |
(define_split |
| 4456 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4457 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4458 |
(const_int 2)))] |
| 4459 |
"reload_completed && !TARGET_COLDFIRE" |
| 4460 |
[(set (match_dup 0) |
| 4461 |
(ashift:DI (match_dup 1) (const_int 1))) |
| 4462 |
(set (match_dup 0) |
| 4463 |
(ashift:DI (match_dup 0) (const_int 1)))] |
| 4464 |
"") |
| 4465 |
|
| 4466 |
(define_split |
| 4467 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4468 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4469 |
(const_int 3)))] |
| 4470 |
"reload_completed && !TARGET_COLDFIRE" |
| 4471 |
[(set (match_dup 0) |
| 4472 |
(ashift:DI (match_dup 1) (const_int 2))) |
| 4473 |
(set (match_dup 0) |
| 4474 |
(ashift:DI (match_dup 0) (const_int 1)))] |
| 4475 |
"") |
| 4476 |
|
| 4477 |
(define_split |
| 4478 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4479 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4480 |
(const_int 8)))] |
| 4481 |
"reload_completed && !TARGET_COLDFIRE" |
| 4482 |
[(set (match_dup 2) |
| 4483 |
(rotate:SI (match_dup 2) (const_int 8))) |
| 4484 |
(set (match_dup 3) |
| 4485 |
(rotate:SI (match_dup 3) (const_int 8))) |
| 4486 |
(set (strict_low_part (subreg:QI (match_dup 0) 3)) |
| 4487 |
(subreg:QI (match_dup 0) 7)) |
| 4488 |
(set (strict_low_part (subreg:QI (match_dup 0) 7)) |
| 4489 |
(const_int 0))] |
| 4490 |
{ |
| 4491 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 4492 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4493 |
}) |
| 4494 |
|
| 4495 |
(define_split |
| 4496 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4497 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4498 |
(const_int 16)))] |
| 4499 |
"reload_completed && !TARGET_COLDFIRE" |
| 4500 |
[(set (match_dup 2) |
| 4501 |
(rotate:SI (match_dup 2) (const_int 16))) |
| 4502 |
(set (match_dup 3) |
| 4503 |
(rotate:SI (match_dup 3) (const_int 16))) |
| 4504 |
(set (strict_low_part (subreg:HI (match_dup 0) 2)) |
| 4505 |
(subreg:HI (match_dup 0) 6)) |
| 4506 |
(set (strict_low_part (subreg:HI (match_dup 0) 6)) |
| 4507 |
(const_int 0))] |
| 4508 |
{ |
| 4509 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 4510 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4511 |
}) |
| 4512 |
|
| 4513 |
(define_split |
| 4514 |
[(set (match_operand:DI 0 "pre_dec_operand" "") |
| 4515 |
(ashift:DI (match_operand:DI 1 "nonimmediate_operand" "") |
| 4516 |
(const_int 32)))] |
| 4517 |
"reload_completed" |
| 4518 |
[(set (match_dup 0) (const_int 0)) |
| 4519 |
(set (match_dup 0) (match_dup 1))] |
| 4520 |
{ |
| 4521 |
operands[0] = adjust_address(operands[0], SImode, 0); |
| 4522 |
operands[1] = gen_lowpart(SImode, operands[1]); |
| 4523 |
}) |
| 4524 |
|
| 4525 |
(define_split |
| 4526 |
[(set (match_operand:DI 0 "post_inc_operand" "") |
| 4527 |
(ashift:DI (match_operand:DI 1 "nonimmediate_operand" "") |
| 4528 |
(const_int 32)))] |
| 4529 |
"reload_completed" |
| 4530 |
[(set (match_dup 0) (match_dup 1)) |
| 4531 |
(set (match_dup 0) (const_int 0))] |
| 4532 |
{ |
| 4533 |
operands[0] = adjust_address(operands[0], SImode, 0); |
| 4534 |
operands[1] = gen_lowpart(SImode, operands[1]); |
| 4535 |
}) |
| 4536 |
|
| 4537 |
(define_insn_and_split "*ashldi3_const32" |
| 4538 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>") |
| 4539 |
(ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro") |
| 4540 |
(const_int 32)))] |
| 4541 |
"" |
| 4542 |
"#" |
| 4543 |
"&& reload_completed" |
| 4544 |
[(set (match_dup 4) (match_dup 3)) |
| 4545 |
(set (match_dup 2) (const_int 0))] |
| 4546 |
"split_di(operands, 2, operands + 2, operands + 4);") |
| 4547 |
|
| 4548 |
(define_split |
| 4549 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4550 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4551 |
(match_operand 2 "const_int_operand" "")))] |
| 4552 |
"reload_completed && !TARGET_COLDFIRE |
| 4553 |
&& INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40" |
| 4554 |
[(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 2))) |
| 4555 |
(set (match_dup 3) (match_dup 4)) |
| 4556 |
(set (match_dup 4) (const_int 0))] |
| 4557 |
{ |
| 4558 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 32); |
| 4559 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 4560 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 4561 |
}) |
| 4562 |
|
| 4563 |
(define_split |
| 4564 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4565 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4566 |
(const_int 48)))] |
| 4567 |
"reload_completed && !TARGET_COLDFIRE" |
| 4568 |
[(set (match_dup 2) (match_dup 3)) |
| 4569 |
(set (match_dup 2) |
| 4570 |
(rotate:SI (match_dup 2) (const_int 16))) |
| 4571 |
(set (match_dup 3) (const_int 0)) |
| 4572 |
(set (strict_low_part (subreg:HI (match_dup 0) 2)) |
| 4573 |
(const_int 0))] |
| 4574 |
{ |
| 4575 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 4576 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4577 |
}) |
| 4578 |
|
| 4579 |
(define_split |
| 4580 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4581 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4582 |
(match_operand 2 "const_int_operand" "")))] |
| 4583 |
"reload_completed && !TARGET_COLDFIRE |
| 4584 |
&& INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 63" |
| 4585 |
[(set (match_dup 3) (match_dup 2)) |
| 4586 |
(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 3))) |
| 4587 |
(set (match_dup 3) (match_dup 4)) |
| 4588 |
(set (match_dup 4) (const_int 0))] |
| 4589 |
{ |
| 4590 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 32); |
| 4591 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 4592 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 4593 |
}) |
| 4594 |
|
| 4595 |
(define_insn "*ashldi3" |
| 4596 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 4597 |
(ashift:DI (match_operand:DI 1 "register_operand" "0") |
| 4598 |
(match_operand 2 "const_int_operand" "n")))] |
| 4599 |
"!TARGET_COLDFIRE |
| 4600 |
&& ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3) |
| 4601 |
|| INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16 |
| 4602 |
|| (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))" |
| 4603 |
"#") |
| 4604 |
|
| 4605 |
(define_expand "ashldi3" |
| 4606 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4607 |
(ashift:DI (match_operand:DI 1 "register_operand" "") |
| 4608 |
(match_operand:SI 2 "const_int_operand" "")))] |
| 4609 |
"!TARGET_COLDFIRE" |
| 4610 |
{ |
| 4611 |
/* ??? This is a named pattern like this is not allowed to FAIL based |
| 4612 |
on its operands. */ |
| 4613 |
if (GET_CODE (operands[2]) != CONST_INT |
| 4614 |
|| ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3) |
| 4615 |
&& INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16 |
| 4616 |
&& (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63))) |
| 4617 |
FAIL; |
| 4618 |
}) |
| 4619 |
|
| 4620 |
;; On most 68k models, this makes faster code in a special case. |
| 4621 |
|
| 4622 |
(define_insn "ashlsi_16" |
| 4623 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4624 |
(ashift:SI (match_operand:SI 1 "register_operand" "0") |
| 4625 |
(const_int 16)))] |
| 4626 |
"!TUNE_68060" |
| 4627 |
"swap %0\;clr%.w %0") |
| 4628 |
|
| 4629 |
;; ashift patterns : use lsl instead of asl, because lsl always clears the |
| 4630 |
;; overflow bit, allowing more comparisons. |
| 4631 |
|
| 4632 |
;; On the 68000, this makes faster code in a special case. |
| 4633 |
|
| 4634 |
(define_insn "ashlsi_17_24" |
| 4635 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4636 |
(ashift:SI (match_operand:SI 1 "register_operand" "0") |
| 4637 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 4638 |
"TUNE_68000_10 |
| 4639 |
&& INTVAL (operands[2]) > 16 |
| 4640 |
&& INTVAL (operands[2]) <= 24" |
| 4641 |
{ |
| 4642 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 16); |
| 4643 |
return "lsl%.w %2,%0\;swap %0\;clr%.w %0"; |
| 4644 |
}) |
| 4645 |
|
| 4646 |
(define_insn "ashlsi3" |
| 4647 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4648 |
(ashift:SI (match_operand:SI 1 "register_operand" "0") |
| 4649 |
(match_operand:SI 2 "general_operand" "dI")))] |
| 4650 |
"" |
| 4651 |
{ |
| 4652 |
if (operands[2] == const1_rtx) |
| 4653 |
return "add%.l %0,%0"; |
| 4654 |
return "lsl%.l %2,%0"; |
| 4655 |
} |
| 4656 |
[(set (attr "flags_valid") |
| 4657 |
(if_then_else (match_operand 2 "const1_operand") |
| 4658 |
(const_string "noov") |
| 4659 |
(const_string "yes")))]) |
| 4660 |
|
| 4661 |
(define_insn "ashlhi3" |
| 4662 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 4663 |
(ashift:HI (match_operand:HI 1 "register_operand" "0") |
| 4664 |
(match_operand:HI 2 "general_operand" "dI")))] |
| 4665 |
"!TARGET_COLDFIRE" |
| 4666 |
"lsl%.w %2,%0" |
| 4667 |
[(set_attr "flags_valid" "yes")]) |
| 4668 |
|
| 4669 |
(define_insn "" |
| 4670 |
[(set (strict_low_part (match_operand:HI 0 "register_operand" "+d")) |
| 4671 |
(ashift:HI (match_dup 0) |
| 4672 |
(match_operand:HI 1 "general_operand" "dI")))] |
| 4673 |
"!TARGET_COLDFIRE" |
| 4674 |
"lsl%.w %1,%0" |
| 4675 |
[(set_attr "flags_valid" "yes")]) |
| 4676 |
|
| 4677 |
(define_insn "ashlqi3" |
| 4678 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 4679 |
(ashift:QI (match_operand:QI 1 "register_operand" "0") |
| 4680 |
(match_operand:QI 2 "general_operand" "dI")))] |
| 4681 |
"!TARGET_COLDFIRE" |
| 4682 |
"lsl%.b %2,%0" |
| 4683 |
[(set_attr "flags_valid" "yes")]) |
| 4684 |
|
| 4685 |
(define_insn "" |
| 4686 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+d")) |
| 4687 |
(ashift:QI (match_dup 0) |
| 4688 |
(match_operand:QI 1 "general_operand" "dI")))] |
| 4689 |
"!TARGET_COLDFIRE" |
| 4690 |
"lsl%.b %1,%0" |
| 4691 |
[(set_attr "flags_valid" "yes")]) |
| 4692 |
|
| 4693 |
;; On most 68k models, this makes faster code in a special case. |
| 4694 |
|
| 4695 |
(define_insn "ashrsi_16" |
| 4696 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4697 |
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 4698 |
(const_int 16)))] |
| 4699 |
"!TUNE_68060" |
| 4700 |
"swap %0\;ext%.l %0") |
| 4701 |
|
| 4702 |
;; On the 68000, this makes faster code in a special case. |
| 4703 |
|
| 4704 |
(define_insn "" |
| 4705 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4706 |
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 4707 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 4708 |
"TUNE_68000_10 |
| 4709 |
&& INTVAL (operands[2]) > 16 |
| 4710 |
&& INTVAL (operands[2]) <= 24" |
| 4711 |
{ |
| 4712 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 16); |
| 4713 |
return "swap %0\;asr%.w %2,%0\;ext%.l %0"; |
| 4714 |
}) |
| 4715 |
|
| 4716 |
(define_insn "subreghi1ashrdi_const32" |
| 4717 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=rm") |
| 4718 |
(subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro") |
| 4719 |
(const_int 32)) 6))] |
| 4720 |
"" |
| 4721 |
{ |
| 4722 |
if (GET_CODE (operands[1]) != REG) |
| 4723 |
operands[1] = adjust_address (operands[1], HImode, 2); |
| 4724 |
return "move%.w %1,%0"; |
| 4725 |
} |
| 4726 |
[(set_attr "type" "move")]) |
| 4727 |
|
| 4728 |
(define_insn "subregsi1ashrdi_const32" |
| 4729 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm") |
| 4730 |
(subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro") |
| 4731 |
(const_int 32)) 4))] |
| 4732 |
"" |
| 4733 |
{ |
| 4734 |
return "move%.l %1,%0"; |
| 4735 |
} |
| 4736 |
[(set_attr "type" "move_l")]) |
| 4737 |
|
| 4738 |
(define_insn "*ashrdi3_const1" |
| 4739 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 4740 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "0") |
| 4741 |
(const_int 1)))] |
| 4742 |
"!TARGET_COLDFIRE" |
| 4743 |
{ |
| 4744 |
operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 4745 |
return "asr%.l #1,%0\;roxr%.l #1,%1"; |
| 4746 |
}) |
| 4747 |
|
| 4748 |
(define_split |
| 4749 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4750 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4751 |
(const_int 2)))] |
| 4752 |
"reload_completed && !TARGET_COLDFIRE" |
| 4753 |
[(set (match_dup 0) |
| 4754 |
(ashiftrt:DI (match_dup 1) (const_int 1))) |
| 4755 |
(set (match_dup 0) |
| 4756 |
(ashiftrt:DI (match_dup 0) (const_int 1)))] |
| 4757 |
"") |
| 4758 |
|
| 4759 |
(define_split |
| 4760 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4761 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4762 |
(const_int 3)))] |
| 4763 |
"reload_completed && !TARGET_COLDFIRE" |
| 4764 |
[(set (match_dup 0) |
| 4765 |
(ashiftrt:DI (match_dup 1) (const_int 2))) |
| 4766 |
(set (match_dup 0) |
| 4767 |
(ashiftrt:DI (match_dup 0) (const_int 1)))] |
| 4768 |
"") |
| 4769 |
|
| 4770 |
(define_split |
| 4771 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4772 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4773 |
(const_int 8)))] |
| 4774 |
"reload_completed && !TARGET_COLDFIRE" |
| 4775 |
[(set (strict_low_part (subreg:QI (match_dup 0) 7)) |
| 4776 |
(subreg:QI (match_dup 0) 3)) |
| 4777 |
(set (match_dup 2) |
| 4778 |
(ashiftrt:SI (match_dup 2) (const_int 8))) |
| 4779 |
(set (match_dup 3) |
| 4780 |
(rotatert:SI (match_dup 3) (const_int 8)))] |
| 4781 |
{ |
| 4782 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 4783 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4784 |
}) |
| 4785 |
|
| 4786 |
(define_split |
| 4787 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4788 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4789 |
(const_int 16)))] |
| 4790 |
"reload_completed && !TARGET_COLDFIRE" |
| 4791 |
[(set (strict_low_part (subreg:HI (match_dup 0) 6)) |
| 4792 |
(subreg:HI (match_dup 0) 2)) |
| 4793 |
(set (match_dup 2) |
| 4794 |
(rotate:SI (match_dup 2) (const_int 16))) |
| 4795 |
(set (match_dup 3) |
| 4796 |
(rotate:SI (match_dup 3) (const_int 16))) |
| 4797 |
(set (match_dup 2) |
| 4798 |
(sign_extend:SI (subreg:HI (match_dup 2) 2)))] |
| 4799 |
{ |
| 4800 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 4801 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4802 |
}) |
| 4803 |
|
| 4804 |
(define_insn "*ashrdi_const32" |
| 4805 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 4806 |
(ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro") |
| 4807 |
(const_int 32)))] |
| 4808 |
"" |
| 4809 |
{ |
| 4810 |
if (TARGET_68020) |
| 4811 |
return "move%.l %1,%R0\;smi %0\;extb%.l %0"; |
| 4812 |
else |
| 4813 |
return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0"; |
| 4814 |
}) |
| 4815 |
|
| 4816 |
(define_insn "*ashrdi_const32_mem" |
| 4817 |
[(set (match_operand:DI 0 "memory_operand" "=o,<") |
| 4818 |
(ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro,ro") |
| 4819 |
(const_int 32))) |
| 4820 |
(clobber (match_scratch:SI 2 "=d,d"))] |
| 4821 |
"" |
| 4822 |
{ |
| 4823 |
operands[3] = adjust_address (operands[0], SImode, |
| 4824 |
which_alternative == 0 ? 4 : 0); |
| 4825 |
operands[0] = adjust_address (operands[0], SImode, 0); |
| 4826 |
if (TARGET_68020 || TARGET_COLDFIRE) |
| 4827 |
return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0"; |
| 4828 |
else |
| 4829 |
return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0"; |
| 4830 |
}) |
| 4831 |
|
| 4832 |
(define_split |
| 4833 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4834 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4835 |
(const_int 63)))] |
| 4836 |
"reload_completed && !TARGET_COLDFIRE" |
| 4837 |
[(set (match_dup 3) |
| 4838 |
(ashiftrt:SI (match_dup 3) (const_int 31))) |
| 4839 |
(set (match_dup 2) |
| 4840 |
(match_dup 3))] |
| 4841 |
"split_di(operands, 1, operands + 2, operands + 3);") |
| 4842 |
|
| 4843 |
;; The predicate below must be general_operand, because ashrdi3 allows that |
| 4844 |
(define_insn "ashrdi_const" |
| 4845 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 4846 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "0") |
| 4847 |
(match_operand 2 "const_int_operand" "n")))] |
| 4848 |
"!TARGET_COLDFIRE |
| 4849 |
&& ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3) |
| 4850 |
|| INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16 |
| 4851 |
|| INTVAL (operands[2]) == 31 |
| 4852 |
|| (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))" |
| 4853 |
{ |
| 4854 |
operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 4855 |
if (INTVAL (operands[2]) == 48) |
| 4856 |
return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0"; |
| 4857 |
if (INTVAL (operands[2]) == 31) |
| 4858 |
return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0"; |
| 4859 |
if (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63) |
| 4860 |
{ |
| 4861 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 32); |
| 4862 |
output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" : |
| 4863 |
"moveq %2,%1\;asr%.l %1,%0", operands); |
| 4864 |
output_asm_insn ("mov%.l %0,%1\;smi %0", operands); |
| 4865 |
return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" : |
| 4866 |
TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0"; |
| 4867 |
} |
| 4868 |
return "#"; |
| 4869 |
}) |
| 4870 |
|
| 4871 |
(define_expand "ashrdi3" |
| 4872 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4873 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4874 |
(match_operand:SI 2 "const_int_operand" "")))] |
| 4875 |
"!TARGET_COLDFIRE" |
| 4876 |
{ |
| 4877 |
/* ??? This is a named pattern like this is not allowed to FAIL based |
| 4878 |
on its operands. */ |
| 4879 |
if (GET_CODE (operands[2]) != CONST_INT |
| 4880 |
|| ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3) |
| 4881 |
&& INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16 |
| 4882 |
&& (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63))) |
| 4883 |
FAIL; |
| 4884 |
}) |
| 4885 |
|
| 4886 |
;; On all 68k models, this makes faster code in a special case. |
| 4887 |
|
| 4888 |
(define_insn "ashrsi_31" |
| 4889 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4890 |
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 4891 |
(const_int 31)))] |
| 4892 |
"" |
| 4893 |
{ |
| 4894 |
return "add%.l %0,%0\;subx%.l %0,%0"; |
| 4895 |
}) |
| 4896 |
|
| 4897 |
(define_insn "ashrsi3" |
| 4898 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 4899 |
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 4900 |
(match_operand:SI 2 "general_operand" "dI")))] |
| 4901 |
"" |
| 4902 |
"asr%.l %2,%0" |
| 4903 |
[(set_attr "type" "shift") |
| 4904 |
(set_attr "opy" "2") |
| 4905 |
(set_attr "flags_valid" "noov")]) |
| 4906 |
|
| 4907 |
(define_insn "ashrhi3" |
| 4908 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 4909 |
(ashiftrt:HI (match_operand:HI 1 "register_operand" "0") |
| 4910 |
(match_operand:HI 2 "general_operand" "dI")))] |
| 4911 |
"!TARGET_COLDFIRE" |
| 4912 |
"asr%.w %2,%0" |
| 4913 |
[(set_attr "flags_valid" "noov")]) |
| 4914 |
|
| 4915 |
(define_insn "" |
| 4916 |
[(set (strict_low_part (match_operand:HI 0 "register_operand" "+d")) |
| 4917 |
(ashiftrt:HI (match_dup 0) |
| 4918 |
(match_operand:HI 1 "general_operand" "dI")))] |
| 4919 |
"!TARGET_COLDFIRE" |
| 4920 |
"asr%.w %1,%0" |
| 4921 |
[(set_attr "flags_valid" "noov")]) |
| 4922 |
|
| 4923 |
(define_insn "ashrqi3" |
| 4924 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 4925 |
(ashiftrt:QI (match_operand:QI 1 "register_operand" "0") |
| 4926 |
(match_operand:QI 2 "general_operand" "dI")))] |
| 4927 |
"!TARGET_COLDFIRE" |
| 4928 |
"asr%.b %2,%0" |
| 4929 |
[(set_attr "flags_valid" "noov")]) |
| 4930 |
|
| 4931 |
(define_insn "" |
| 4932 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+d")) |
| 4933 |
(ashiftrt:QI (match_dup 0) |
| 4934 |
(match_operand:QI 1 "general_operand" "dI")))] |
| 4935 |
"!TARGET_COLDFIRE" |
| 4936 |
"asr%.b %1,%0" |
| 4937 |
[(set_attr "flags_valid" "noov")]) |
| 4938 |
|
| 4939 |
;; logical shift instructions |
| 4940 |
|
| 4941 |
;; commented out because of reload problems in 950612-1.c |
| 4942 |
;;(define_insn "" |
| 4943 |
;; [(set (cc0) |
| 4944 |
;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro") |
| 4945 |
;; (const_int 32)) 4)) |
| 4946 |
;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm") |
| 4947 |
;; (subreg:SI (lshiftrt:DI (match_dup 0) |
| 4948 |
;; (const_int 32)) 4))] |
| 4949 |
;; "" |
| 4950 |
;;{ |
| 4951 |
;; return "move%.l %0,%1"; |
| 4952 |
;;}) |
| 4953 |
;; |
| 4954 |
;;(define_insn "" |
| 4955 |
;; [(set (cc0) |
| 4956 |
;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro") |
| 4957 |
;; (const_int 32)) 0)) |
| 4958 |
;; (set (match_operand:DI 1 "nonimmediate_operand" "=do") |
| 4959 |
;; (lshiftrt:DI (match_dup 0) |
| 4960 |
;; (const_int 32)))] |
| 4961 |
;; "" |
| 4962 |
;;{ |
| 4963 |
;; if (GET_CODE (operands[1]) == REG) |
| 4964 |
;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 4965 |
;; else |
| 4966 |
;; operands[2] = adjust_address (operands[1], SImode, 4); |
| 4967 |
;; return "move%.l %0,%2\;clr%.l %1"; |
| 4968 |
;;}) |
| 4969 |
|
| 4970 |
(define_insn "subreg1lshrdi_const32" |
| 4971 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm") |
| 4972 |
(subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro") |
| 4973 |
(const_int 32)) 4))] |
| 4974 |
"" |
| 4975 |
"move%.l %1,%0" |
| 4976 |
[(set_attr "type" "move_l")]) |
| 4977 |
|
| 4978 |
(define_insn "*lshrdi3_const1" |
| 4979 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 4980 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "0") |
| 4981 |
(const_int 1)))] |
| 4982 |
"!TARGET_COLDFIRE" |
| 4983 |
{ |
| 4984 |
return "lsr%.l #1,%0\;roxr%.l #1,%R0"; |
| 4985 |
}) |
| 4986 |
|
| 4987 |
(define_split |
| 4988 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4989 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 4990 |
(const_int 2)))] |
| 4991 |
"reload_completed && !TARGET_COLDFIRE" |
| 4992 |
[(set (match_dup 0) |
| 4993 |
(lshiftrt:DI (match_dup 1) (const_int 1))) |
| 4994 |
(set (match_dup 0) |
| 4995 |
(lshiftrt:DI (match_dup 0) (const_int 1)))] |
| 4996 |
"") |
| 4997 |
|
| 4998 |
(define_split |
| 4999 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5000 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5001 |
(const_int 3)))] |
| 5002 |
"reload_completed && !TARGET_COLDFIRE" |
| 5003 |
[(set (match_dup 0) |
| 5004 |
(lshiftrt:DI (match_dup 1) (const_int 2))) |
| 5005 |
(set (match_dup 0) |
| 5006 |
(lshiftrt:DI (match_dup 0) (const_int 1)))] |
| 5007 |
"") |
| 5008 |
|
| 5009 |
(define_split |
| 5010 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5011 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5012 |
(const_int 8)))] |
| 5013 |
"reload_completed && !TARGET_COLDFIRE" |
| 5014 |
[(set (strict_low_part (subreg:QI (match_dup 0) 7)) |
| 5015 |
(subreg:QI (match_dup 0) 3)) |
| 5016 |
(set (match_dup 2) |
| 5017 |
(lshiftrt:SI (match_dup 2) (const_int 8))) |
| 5018 |
(set (match_dup 3) |
| 5019 |
(rotatert:SI (match_dup 3) (const_int 8)))] |
| 5020 |
{ |
| 5021 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 5022 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 5023 |
}) |
| 5024 |
|
| 5025 |
(define_split |
| 5026 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5027 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5028 |
(const_int 16)))] |
| 5029 |
"reload_completed && !TARGET_COLDFIRE" |
| 5030 |
[(set (strict_low_part (subreg:HI (match_dup 0) 6)) |
| 5031 |
(subreg:HI (match_dup 0) 2)) |
| 5032 |
(set (strict_low_part (subreg:HI (match_dup 0) 2)) |
| 5033 |
(const_int 0)) |
| 5034 |
(set (match_dup 3) |
| 5035 |
(rotate:SI (match_dup 3) (const_int 16))) |
| 5036 |
(set (match_dup 2) |
| 5037 |
(rotate:SI (match_dup 2) (const_int 16)))] |
| 5038 |
{ |
| 5039 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 5040 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 5041 |
}) |
| 5042 |
|
| 5043 |
(define_split |
| 5044 |
[(set (match_operand:DI 0 "pre_dec_operand" "") |
| 5045 |
(lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "") |
| 5046 |
(const_int 32)))] |
| 5047 |
"reload_completed" |
| 5048 |
[(set (match_dup 0) (match_dup 1)) |
| 5049 |
(set (match_dup 0) (const_int 0))] |
| 5050 |
{ |
| 5051 |
operands[0] = adjust_address(operands[0], SImode, 0); |
| 5052 |
operands[1] = gen_highpart(SImode, operands[1]); |
| 5053 |
}) |
| 5054 |
|
| 5055 |
(define_split |
| 5056 |
[(set (match_operand:DI 0 "post_inc_operand" "") |
| 5057 |
(lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "") |
| 5058 |
(const_int 32)))] |
| 5059 |
"reload_completed" |
| 5060 |
[(set (match_dup 0) (const_int 0)) |
| 5061 |
(set (match_dup 0) (match_dup 1))] |
| 5062 |
{ |
| 5063 |
operands[0] = adjust_address(operands[0], SImode, 0); |
| 5064 |
operands[1] = gen_highpart(SImode, operands[1]); |
| 5065 |
}) |
| 5066 |
|
| 5067 |
(define_split |
| 5068 |
[(set (match_operand:DI 0 "nonimmediate_operand" "") |
| 5069 |
(lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "") |
| 5070 |
(const_int 32)))] |
| 5071 |
"reload_completed" |
| 5072 |
[(set (match_dup 2) (match_dup 5)) |
| 5073 |
(set (match_dup 4) (const_int 0))] |
| 5074 |
"split_di(operands, 2, operands + 2, operands + 4);") |
| 5075 |
|
| 5076 |
(define_insn "*lshrdi_const32" |
| 5077 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>") |
| 5078 |
(lshiftrt:DI (match_operand:DI 1 "general_operand" "ro") |
| 5079 |
(const_int 32)))] |
| 5080 |
"" |
| 5081 |
"#") |
| 5082 |
|
| 5083 |
(define_split |
| 5084 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5085 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5086 |
(match_operand 2 "const_int_operand" "")))] |
| 5087 |
"reload_completed && !TARGET_COLDFIRE |
| 5088 |
&& INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40" |
| 5089 |
[(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 2))) |
| 5090 |
(set (match_dup 4) (match_dup 3)) |
| 5091 |
(set (match_dup 3) (const_int 0))] |
| 5092 |
{ |
| 5093 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 32); |
| 5094 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 5095 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 5096 |
}) |
| 5097 |
|
| 5098 |
(define_split |
| 5099 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5100 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5101 |
(const_int 48)))] |
| 5102 |
"reload_completed" |
| 5103 |
[(set (match_dup 3) (match_dup 2)) |
| 5104 |
(set (strict_low_part (subreg:HI (match_dup 0) 6)) |
| 5105 |
(const_int 0)) |
| 5106 |
(set (match_dup 2) (const_int 0)) |
| 5107 |
(set (match_dup 3) |
| 5108 |
(rotate:SI (match_dup 3) (const_int 16)))] |
| 5109 |
{ |
| 5110 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 5111 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 5112 |
}) |
| 5113 |
|
| 5114 |
(define_split |
| 5115 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5116 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5117 |
(match_operand 2 "const_int_operand" "")))] |
| 5118 |
"reload_completed && !TARGET_COLDFIRE |
| 5119 |
&& INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 62" |
| 5120 |
[(set (match_dup 4) (match_dup 2)) |
| 5121 |
(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 4))) |
| 5122 |
(set (match_dup 4) (match_dup 3)) |
| 5123 |
(set (match_dup 3) (const_int 0))] |
| 5124 |
{ |
| 5125 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 32); |
| 5126 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 5127 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 5128 |
}) |
| 5129 |
|
| 5130 |
(define_insn "*lshrdi_const63" |
| 5131 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 5132 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "0") |
| 5133 |
(const_int 63)))] |
| 5134 |
"" |
| 5135 |
"add%.l %0,%0\;clr%.l %0\;clr%.l %R1\;addx%.l %R1,%R1") |
| 5136 |
|
| 5137 |
(define_insn "*lshrdi3_const" |
| 5138 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 5139 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "0") |
| 5140 |
(match_operand 2 "const_int_operand" "n")))] |
| 5141 |
"(!TARGET_COLDFIRE |
| 5142 |
&& ((INTVAL (operands[2]) >= 2 && INTVAL (operands[2]) <= 3) |
| 5143 |
|| INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16 |
| 5144 |
|| (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))" |
| 5145 |
"#") |
| 5146 |
|
| 5147 |
(define_expand "lshrdi3" |
| 5148 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5149 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "") |
| 5150 |
(match_operand:SI 2 "const_int_operand" "")))] |
| 5151 |
"!TARGET_COLDFIRE" |
| 5152 |
{ |
| 5153 |
/* ??? This is a named pattern like this is not allowed to FAIL based |
| 5154 |
on its operands. */ |
| 5155 |
if (GET_CODE (operands[2]) != CONST_INT |
| 5156 |
|| ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3) |
| 5157 |
&& INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16 |
| 5158 |
&& (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63))) |
| 5159 |
FAIL; |
| 5160 |
}) |
| 5161 |
|
| 5162 |
;; On all 68k models, this makes faster code in a special case. |
| 5163 |
|
| 5164 |
(define_insn "lshrsi_31" |
| 5165 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5166 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 5167 |
(const_int 31)))] |
| 5168 |
"" |
| 5169 |
{ |
| 5170 |
return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0"; |
| 5171 |
}) |
| 5172 |
|
| 5173 |
;; On most 68k models, this makes faster code in a special case. |
| 5174 |
|
| 5175 |
(define_insn "lshrsi_16" |
| 5176 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5177 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 5178 |
(const_int 16)))] |
| 5179 |
"!TUNE_68060" |
| 5180 |
{ |
| 5181 |
return "clr%.w %0\;swap %0"; |
| 5182 |
}) |
| 5183 |
|
| 5184 |
;; On the 68000, this makes faster code in a special case. |
| 5185 |
|
| 5186 |
(define_insn "lshrsi_17_24" |
| 5187 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5188 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 5189 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 5190 |
"TUNE_68000_10 |
| 5191 |
&& INTVAL (operands[2]) > 16 |
| 5192 |
&& INTVAL (operands[2]) <= 24" |
| 5193 |
{ |
| 5194 |
/* I think lsr%.w sets the CC properly. */ |
| 5195 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 16); |
| 5196 |
return "clr%.w %0\;swap %0\;lsr%.w %2,%0"; |
| 5197 |
}) |
| 5198 |
|
| 5199 |
(define_insn "lshrsi3" |
| 5200 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5201 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0") |
| 5202 |
(match_operand:SI 2 "general_operand" "dI")))] |
| 5203 |
"" |
| 5204 |
"lsr%.l %2,%0" |
| 5205 |
[(set_attr "type" "shift") |
| 5206 |
(set_attr "opy" "2") |
| 5207 |
(set_attr "flags_valid" "yes")]) |
| 5208 |
|
| 5209 |
(define_insn "lshrhi3" |
| 5210 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 5211 |
(lshiftrt:HI (match_operand:HI 1 "register_operand" "0") |
| 5212 |
(match_operand:HI 2 "general_operand" "dI")))] |
| 5213 |
"!TARGET_COLDFIRE" |
| 5214 |
"lsr%.w %2,%0" |
| 5215 |
[(set_attr "flags_valid" "yes")]) |
| 5216 |
|
| 5217 |
(define_insn "" |
| 5218 |
[(set (strict_low_part (match_operand:HI 0 "register_operand" "+d")) |
| 5219 |
(lshiftrt:HI (match_dup 0) |
| 5220 |
(match_operand:HI 1 "general_operand" "dI")))] |
| 5221 |
"!TARGET_COLDFIRE" |
| 5222 |
"lsr%.w %1,%0" |
| 5223 |
[(set_attr "flags_valid" "yes")]) |
| 5224 |
|
| 5225 |
(define_insn "lshrqi3" |
| 5226 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 5227 |
(lshiftrt:QI (match_operand:QI 1 "register_operand" "0") |
| 5228 |
(match_operand:QI 2 "general_operand" "dI")))] |
| 5229 |
"!TARGET_COLDFIRE" |
| 5230 |
"lsr%.b %2,%0" |
| 5231 |
[(set_attr "flags_valid" "yes")]) |
| 5232 |
|
| 5233 |
(define_insn "" |
| 5234 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+d")) |
| 5235 |
(lshiftrt:QI (match_dup 0) |
| 5236 |
(match_operand:QI 1 "general_operand" "dI")))] |
| 5237 |
"!TARGET_COLDFIRE" |
| 5238 |
"lsr%.b %1,%0" |
| 5239 |
[(set_attr "flags_valid" "yes")]) |
| 5240 |
|
| 5241 |
;; rotate instructions |
| 5242 |
|
| 5243 |
(define_insn "rotlsi_16" |
| 5244 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5245 |
(rotate:SI (match_operand:SI 1 "register_operand" "0") |
| 5246 |
(const_int 16)))] |
| 5247 |
"" |
| 5248 |
"swap %0" |
| 5249 |
[(set_attr "type" "shift") |
| 5250 |
(set_attr "flags_valid" "yes")]) |
| 5251 |
|
| 5252 |
(define_insn "rotlsi3" |
| 5253 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5254 |
(rotate:SI (match_operand:SI 1 "register_operand" "0") |
| 5255 |
(match_operand:SI 2 "general_operand" "dINO")))] |
| 5256 |
"!TARGET_COLDFIRE" |
| 5257 |
{ |
| 5258 |
if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16) |
| 5259 |
return "swap %0"; |
| 5260 |
else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16) |
| 5261 |
{ |
| 5262 |
operands[2] = GEN_INT (32 - INTVAL (operands[2])); |
| 5263 |
return "ror%.l %2,%0"; |
| 5264 |
} |
| 5265 |
else |
| 5266 |
return "rol%.l %2,%0"; |
| 5267 |
} |
| 5268 |
[(set_attr "flags_valid" "yes")]) |
| 5269 |
|
| 5270 |
(define_insn "rotlhi3" |
| 5271 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 5272 |
(rotate:HI (match_operand:HI 1 "register_operand" "0") |
| 5273 |
(match_operand:HI 2 "general_operand" "dIP")))] |
| 5274 |
"!TARGET_COLDFIRE" |
| 5275 |
{ |
| 5276 |
if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8) |
| 5277 |
{ |
| 5278 |
operands[2] = GEN_INT (16 - INTVAL (operands[2])); |
| 5279 |
return "ror%.w %2,%0"; |
| 5280 |
} |
| 5281 |
else |
| 5282 |
return "rol%.w %2,%0"; |
| 5283 |
} |
| 5284 |
[(set_attr "flags_valid" "yes")]) |
| 5285 |
|
| 5286 |
(define_insn "*rotlhi3_lowpart" |
| 5287 |
[(set (strict_low_part (match_operand:HI 0 "register_operand" "+d")) |
| 5288 |
(rotate:HI (match_dup 0) |
| 5289 |
(match_operand:HI 1 "general_operand" "dIP")))] |
| 5290 |
"!TARGET_COLDFIRE" |
| 5291 |
{ |
| 5292 |
if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) >= 8) |
| 5293 |
{ |
| 5294 |
operands[1] = GEN_INT (16 - INTVAL (operands[1])); |
| 5295 |
return "ror%.w %1,%0"; |
| 5296 |
} |
| 5297 |
else |
| 5298 |
return "rol%.w %1,%0"; |
| 5299 |
} |
| 5300 |
[(set_attr "flags_valid" "yes")]) |
| 5301 |
|
| 5302 |
(define_insn "rotlqi3" |
| 5303 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 5304 |
(rotate:QI (match_operand:QI 1 "register_operand" "0") |
| 5305 |
(match_operand:QI 2 "general_operand" "dI")))] |
| 5306 |
"!TARGET_COLDFIRE" |
| 5307 |
{ |
| 5308 |
if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4) |
| 5309 |
{ |
| 5310 |
operands[2] = GEN_INT (8 - INTVAL (operands[2])); |
| 5311 |
return "ror%.b %2,%0"; |
| 5312 |
} |
| 5313 |
else |
| 5314 |
return "rol%.b %2,%0"; |
| 5315 |
} |
| 5316 |
[(set_attr "flags_valid" "yes")]) |
| 5317 |
|
| 5318 |
(define_insn "*rotlqi3_lowpart" |
| 5319 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+d")) |
| 5320 |
(rotate:QI (match_dup 0) |
| 5321 |
(match_operand:QI 1 "general_operand" "dI")))] |
| 5322 |
"!TARGET_COLDFIRE" |
| 5323 |
{ |
| 5324 |
if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) >= 4) |
| 5325 |
{ |
| 5326 |
operands[1] = GEN_INT (8 - INTVAL (operands[1])); |
| 5327 |
return "ror%.b %1,%0"; |
| 5328 |
} |
| 5329 |
else |
| 5330 |
return "rol%.b %1,%0"; |
| 5331 |
} |
| 5332 |
[(set_attr "flags_valid" "yes")]) |
| 5333 |
|
| 5334 |
(define_insn "rotrsi3" |
| 5335 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5336 |
(rotatert:SI (match_operand:SI 1 "register_operand" "0") |
| 5337 |
(match_operand:SI 2 "general_operand" "dI")))] |
| 5338 |
"!TARGET_COLDFIRE" |
| 5339 |
"ror%.l %2,%0" |
| 5340 |
[(set_attr "flags_valid" "yes")]) |
| 5341 |
|
| 5342 |
(define_insn "rotrhi3" |
| 5343 |
[(set (match_operand:HI 0 "register_operand" "=d") |
| 5344 |
(rotatert:HI (match_operand:HI 1 "register_operand" "0") |
| 5345 |
(match_operand:HI 2 "general_operand" "dI")))] |
| 5346 |
"!TARGET_COLDFIRE" |
| 5347 |
"ror%.w %2,%0") |
| 5348 |
|
| 5349 |
(define_insn "rotrhi_lowpart" |
| 5350 |
[(set (strict_low_part (match_operand:HI 0 "register_operand" "+d")) |
| 5351 |
(rotatert:HI (match_dup 0) |
| 5352 |
(match_operand:HI 1 "general_operand" "dI")))] |
| 5353 |
"!TARGET_COLDFIRE" |
| 5354 |
"ror%.w %1,%0") |
| 5355 |
|
| 5356 |
(define_insn "rotrqi3" |
| 5357 |
[(set (match_operand:QI 0 "register_operand" "=d") |
| 5358 |
(rotatert:QI (match_operand:QI 1 "register_operand" "0") |
| 5359 |
(match_operand:QI 2 "general_operand" "dI")))] |
| 5360 |
"!TARGET_COLDFIRE" |
| 5361 |
"ror%.b %2,%0" |
| 5362 |
[(set_attr "flags_valid" "yes")]) |
| 5363 |
|
| 5364 |
(define_insn "" |
| 5365 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+d")) |
| 5366 |
(rotatert:QI (match_dup 0) |
| 5367 |
(match_operand:QI 1 "general_operand" "dI")))] |
| 5368 |
"!TARGET_COLDFIRE" |
| 5369 |
"ror%.b %1,%0" |
| 5370 |
[(set_attr "flags_valid" "yes")]) |
| 5371 |
|
| 5372 |
(define_expand "bswapsi2" |
| 5373 |
[(set (match_operand:SI 0 "register_operand") |
| 5374 |
(bswap:SI (match_operand:SI 1 "register_operand")))] |
| 5375 |
"!TARGET_COLDFIRE" |
| 5376 |
{ |
| 5377 |
rtx x = operands[0]; |
| 5378 |
emit_move_insn (x, operands[1]); |
| 5379 |
emit_insn (gen_rotrhi_lowpart (gen_lowpart (HImode, x), GEN_INT (8))); |
| 5380 |
emit_insn (gen_rotlsi3 (x, x, GEN_INT (16))); |
| 5381 |
emit_insn (gen_rotrhi_lowpart (gen_lowpart (HImode, x), GEN_INT (8))); |
| 5382 |
DONE; |
| 5383 |
}) |
| 5384 |
|
| 5385 |
|
| 5386 |
;; Bit set/clear in memory byte. |
| 5387 |
|
| 5388 |
;; set bit, bit number is int |
| 5389 |
(define_insn "bsetmemqi" |
| 5390 |
[(set (match_operand:QI 0 "memory_operand" "+m") |
| 5391 |
(ior:QI (subreg:QI (ashift:SI (const_int 1) |
| 5392 |
(match_operand:SI 1 "general_operand" "d")) 3) |
| 5393 |
(match_dup 0)))] |
| 5394 |
"" |
| 5395 |
"bset %1,%0" |
| 5396 |
[(set_attr "type" "bitrw")]) |
| 5397 |
|
| 5398 |
;; set bit, bit number is (sign/zero)_extended from HImode/QImode |
| 5399 |
(define_insn "*bsetmemqi_ext" |
| 5400 |
[(set (match_operand:QI 0 "memory_operand" "+m") |
| 5401 |
(ior:QI (subreg:QI (ashift:SI (const_int 1) |
| 5402 |
(match_operator:SI 2 "extend_operator" |
| 5403 |
[(match_operand 1 "general_operand" "d")])) 3) |
| 5404 |
(match_dup 0)))] |
| 5405 |
"" |
| 5406 |
"bset %1,%0" |
| 5407 |
[(set_attr "type" "bitrw")]) |
| 5408 |
|
| 5409 |
(define_insn "*bsetdreg" |
| 5410 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5411 |
(ior:SI (ashift:SI (const_int 1) |
| 5412 |
(and:SI (match_operand:SI 1 "register_operand" "d") |
| 5413 |
(const_int 31))) |
| 5414 |
(match_operand:SI 2 "register_operand" "0")))] |
| 5415 |
"" |
| 5416 |
"bset %1,%0" |
| 5417 |
[(set_attr "type" "bitrw")]) |
| 5418 |
|
| 5419 |
(define_insn "*bchgdreg" |
| 5420 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5421 |
(xor:SI (ashift:SI (const_int 1) |
| 5422 |
(and:SI (match_operand:SI 1 "register_operand" "d") |
| 5423 |
(const_int 31))) |
| 5424 |
(match_operand:SI 2 "register_operand" "0")))] |
| 5425 |
"" |
| 5426 |
"bchg %1,%0" |
| 5427 |
[(set_attr "type" "bitrw")]) |
| 5428 |
|
| 5429 |
(define_insn "*bclrdreg" |
| 5430 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5431 |
(and:SI (rotate:SI (const_int -2) |
| 5432 |
(and:SI (match_operand:SI 1 "register_operand" "d") |
| 5433 |
(const_int 31))) |
| 5434 |
(match_operand:SI 2 "register_operand" "0")))] |
| 5435 |
"" |
| 5436 |
"bclr %1,%0" |
| 5437 |
[(set_attr "type" "bitrw")]) |
| 5438 |
|
| 5439 |
;; clear bit, bit number is int |
| 5440 |
(define_insn "bclrmemqi" |
| 5441 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m") |
| 5442 |
(const_int 1) |
| 5443 |
(minus:SI (const_int 7) |
| 5444 |
(match_operand:SI 1 "general_operand" "d"))) |
| 5445 |
(const_int 0))] |
| 5446 |
"" |
| 5447 |
"bclr %1,%0" |
| 5448 |
[(set_attr "type" "bitrw")]) |
| 5449 |
|
| 5450 |
;; clear bit, bit number is (sign/zero)_extended from HImode/QImode |
| 5451 |
(define_insn "*bclrmemqi_ext" |
| 5452 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m") |
| 5453 |
(const_int 1) |
| 5454 |
(minus:SI (const_int 7) |
| 5455 |
(match_operator:SI 2 "extend_operator" |
| 5456 |
[(match_operand 1 "general_operand" "d")]))) |
| 5457 |
(const_int 0))] |
| 5458 |
"" |
| 5459 |
"bclr %1,%0" |
| 5460 |
[(set_attr "type" "bitrw")]) |
| 5461 |
|
| 5462 |
;; Special cases of bit-field insns which we should |
| 5463 |
;; recognize in preference to the general case. |
| 5464 |
;; These handle aligned 8-bit and 16-bit fields, |
| 5465 |
;; which can usually be done with move instructions. |
| 5466 |
|
| 5467 |
; |
| 5468 |
; Special case for 32-bit field in memory. This only occurs when 32-bit |
| 5469 |
; alignment of structure members is specified. |
| 5470 |
; |
| 5471 |
; The move is allowed to be odd byte aligned, because that's still faster |
| 5472 |
; than an odd byte aligned bit-field instruction. |
| 5473 |
; |
| 5474 |
(define_insn "*insv_32_mem" |
| 5475 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o") |
| 5476 |
(const_int 32) |
| 5477 |
(match_operand:SI 1 "const_int_operand" "n")) |
| 5478 |
(match_operand:SI 2 "general_src_operand" "rmSi"))] |
| 5479 |
"TARGET_68020 && TARGET_BITFIELD |
| 5480 |
&& (INTVAL (operands[1]) % 8) == 0 |
| 5481 |
&& ! mode_dependent_address_p (XEXP (operands[0], 0), |
| 5482 |
MEM_ADDR_SPACE (operands[0]))" |
| 5483 |
{ |
| 5484 |
operands[0] |
| 5485 |
= adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8); |
| 5486 |
|
| 5487 |
return "move%.l %2,%0"; |
| 5488 |
}) |
| 5489 |
|
| 5490 |
(define_insn "*insv_8_16_reg" |
| 5491 |
[(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d") |
| 5492 |
(match_operand:SI 1 "const_int_operand" "n") |
| 5493 |
(match_operand:SI 2 "const_int_operand" "n")) |
| 5494 |
(match_operand:SI 3 "register_operand" "d"))] |
| 5495 |
"TARGET_68020 && TARGET_BITFIELD |
| 5496 |
&& IN_RANGE (INTVAL (operands[2]), 0, 31) |
| 5497 |
&& (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16) |
| 5498 |
&& INTVAL (operands[2]) % INTVAL (operands[1]) == 0" |
| 5499 |
{ |
| 5500 |
if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32) |
| 5501 |
return "bfins %3,%0{%b2:%b1}"; |
| 5502 |
|
| 5503 |
if (INTVAL (operands[1]) == 8) |
| 5504 |
return "move%.b %3,%0"; |
| 5505 |
return "move%.w %3,%0"; |
| 5506 |
}) |
| 5507 |
|
| 5508 |
|
| 5509 |
; |
| 5510 |
; Special case for 32-bit field in memory. This only occurs when 32-bit |
| 5511 |
; alignment of structure members is specified. |
| 5512 |
; |
| 5513 |
; The move is allowed to be odd byte aligned, because that's still faster |
| 5514 |
; than an odd byte aligned bit-field instruction. |
| 5515 |
; |
| 5516 |
(define_insn "*extzv_32_mem" |
| 5517 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm") |
| 5518 |
(zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS") |
| 5519 |
(const_int 32) |
| 5520 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 5521 |
"TARGET_68020 && TARGET_BITFIELD |
| 5522 |
&& (INTVAL (operands[2]) % 8) == 0 |
| 5523 |
&& ! mode_dependent_address_p (XEXP (operands[1], 0), |
| 5524 |
MEM_ADDR_SPACE (operands[1]))" |
| 5525 |
{ |
| 5526 |
operands[1] |
| 5527 |
= adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8); |
| 5528 |
|
| 5529 |
return "move%.l %1,%0"; |
| 5530 |
}) |
| 5531 |
|
| 5532 |
(define_insn "*extzv_8_16_reg" |
| 5533 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=&d") |
| 5534 |
(zero_extract:SI (match_operand:SI 1 "register_operand" "d") |
| 5535 |
(match_operand:SI 2 "const_int_operand" "n") |
| 5536 |
(match_operand:SI 3 "const_int_operand" "n")))] |
| 5537 |
"TARGET_68020 && TARGET_BITFIELD |
| 5538 |
&& IN_RANGE (INTVAL (operands[3]), 0, 31) |
| 5539 |
&& (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16) |
| 5540 |
&& INTVAL (operands[3]) % INTVAL (operands[2]) == 0" |
| 5541 |
{ |
| 5542 |
if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32) |
| 5543 |
return "bfextu %1{%b3:%b2},%0"; |
| 5544 |
|
| 5545 |
output_asm_insn ("clr%.l %0", operands); |
| 5546 |
if (INTVAL (operands[2]) == 8) |
| 5547 |
return "move%.b %1,%0"; |
| 5548 |
return "move%.w %1,%0"; |
| 5549 |
}) |
| 5550 |
|
| 5551 |
; |
| 5552 |
; Special case for 32-bit field in memory. This only occurs when 32-bit |
| 5553 |
; alignment of structure members is specified. |
| 5554 |
; |
| 5555 |
; The move is allowed to be odd byte aligned, because that's still faster |
| 5556 |
; than an odd byte aligned bit-field instruction. |
| 5557 |
; |
| 5558 |
(define_insn "*extv_32_mem" |
| 5559 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm") |
| 5560 |
(sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS") |
| 5561 |
(const_int 32) |
| 5562 |
(match_operand:SI 2 "const_int_operand" "n")))] |
| 5563 |
"TARGET_68020 && TARGET_BITFIELD |
| 5564 |
&& (INTVAL (operands[2]) % 8) == 0 |
| 5565 |
&& ! mode_dependent_address_p (XEXP (operands[1], 0), |
| 5566 |
MEM_ADDR_SPACE (operands[1]))" |
| 5567 |
{ |
| 5568 |
operands[1] |
| 5569 |
= adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8); |
| 5570 |
|
| 5571 |
return "move%.l %1,%0"; |
| 5572 |
}) |
| 5573 |
|
| 5574 |
(define_insn "*extv_8_16_reg" |
| 5575 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 5576 |
(sign_extract:SI (match_operand:SI 1 "register_operand" "d") |
| 5577 |
(match_operand:SI 2 "const_int_operand" "n") |
| 5578 |
(match_operand:SI 3 "const_int_operand" "n")))] |
| 5579 |
"TARGET_68020 && TARGET_BITFIELD |
| 5580 |
&& IN_RANGE (INTVAL (operands[3]), 0, 31) |
| 5581 |
&& (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16) |
| 5582 |
&& INTVAL (operands[3]) % INTVAL (operands[2]) == 0" |
| 5583 |
{ |
| 5584 |
if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32) |
| 5585 |
return "bfexts %1{%b3:%b2},%0"; |
| 5586 |
|
| 5587 |
if (INTVAL (operands[2]) == 8) |
| 5588 |
return "move%.b %1,%0\;extb%.l %0"; |
| 5589 |
return "move%.w %1,%0\;ext%.l %0"; |
| 5590 |
}) |
| 5591 |
|
| 5592 |
;; Bit-field instructions, general cases. |
| 5593 |
;; "o,d" constraint causes a nonoffsettable memref to match the "o" |
| 5594 |
;; so that its address is reloaded. |
| 5595 |
|
| 5596 |
(define_expand "extv" |
| 5597 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5598 |
(sign_extract:SI (match_operand:SI 1 "general_operand" "") |
| 5599 |
(match_operand:SI 2 "const_int_operand" "") |
| 5600 |
(match_operand:SI 3 "const_int_operand" "")))] |
| 5601 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5602 |
"") |
| 5603 |
|
| 5604 |
(define_insn "*extv_bfexts_mem" |
| 5605 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5606 |
(sign_extract:SI (match_operand:QI 1 "memory_operand" "o") |
| 5607 |
(match_operand:SI 2 "nonmemory_operand" "dn") |
| 5608 |
(match_operand:SI 3 "nonmemory_operand" "dn")))] |
| 5609 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5610 |
"bfexts %1{%b3:%b2},%0") |
| 5611 |
|
| 5612 |
(define_expand "extzv" |
| 5613 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5614 |
(zero_extract:SI (match_operand:SI 1 "general_operand" "") |
| 5615 |
(match_operand:SI 2 "const_int_operand" "") |
| 5616 |
(match_operand:SI 3 "const_int_operand" "")))] |
| 5617 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5618 |
"") |
| 5619 |
|
| 5620 |
(define_insn "*extzv_bfextu_mem" |
| 5621 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 5622 |
(zero_extract:SI (match_operand:QI 1 "memory_operand" "o") |
| 5623 |
(match_operand:SI 2 "nonmemory_operand" "dn") |
| 5624 |
(match_operand:SI 3 "nonmemory_operand" "dn")))] |
| 5625 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5626 |
{ |
| 5627 |
return "bfextu %1{%b3:%b2},%0"; |
| 5628 |
}) |
| 5629 |
|
| 5630 |
(define_insn "*insv_bfchg_mem" |
| 5631 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o") |
| 5632 |
(match_operand:SI 1 "nonmemory_operand" "dn") |
| 5633 |
(match_operand:SI 2 "nonmemory_operand" "dn")) |
| 5634 |
(xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2)) |
| 5635 |
(match_operand 3 "const_int_operand" "n")))] |
| 5636 |
"TARGET_68020 && TARGET_BITFIELD |
| 5637 |
&& (INTVAL (operands[3]) == -1 |
| 5638 |
|| (GET_CODE (operands[1]) == CONST_INT |
| 5639 |
&& (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))" |
| 5640 |
{ |
| 5641 |
return "bfchg %0{%b2:%b1}"; |
| 5642 |
}) |
| 5643 |
|
| 5644 |
(define_insn "*insv_bfclr_mem" |
| 5645 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o") |
| 5646 |
(match_operand:SI 1 "nonmemory_operand" "dn") |
| 5647 |
(match_operand:SI 2 "nonmemory_operand" "dn")) |
| 5648 |
(const_int 0))] |
| 5649 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5650 |
{ |
| 5651 |
return "bfclr %0{%b2:%b1}"; |
| 5652 |
}) |
| 5653 |
|
| 5654 |
(define_insn "*insv_bfset_mem" |
| 5655 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o") |
| 5656 |
(match_operand:SI 1 "general_operand" "dn") |
| 5657 |
(match_operand:SI 2 "general_operand" "dn")) |
| 5658 |
(const_int -1))] |
| 5659 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5660 |
{ |
| 5661 |
return "bfset %0{%b2:%b1}"; |
| 5662 |
}) |
| 5663 |
|
| 5664 |
(define_expand "insv" |
| 5665 |
[(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "") |
| 5666 |
(match_operand:SI 1 "const_int_operand" "") |
| 5667 |
(match_operand:SI 2 "const_int_operand" "")) |
| 5668 |
(match_operand:SI 3 "reg_or_pow2_m1_operand" ""))] |
| 5669 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5670 |
" |
| 5671 |
{ |
| 5672 |
/* Special case initializing a field to all ones. */ |
| 5673 |
if (GET_CODE (operands[3]) == CONST_INT) |
| 5674 |
{ |
| 5675 |
if (exact_log2 (INTVAL (operands[3]) + 1) != INTVAL (operands[1])) |
| 5676 |
operands[3] = force_reg (SImode, operands[3]); |
| 5677 |
else |
| 5678 |
operands[3] = constm1_rtx; |
| 5679 |
|
| 5680 |
} |
| 5681 |
}") |
| 5682 |
|
| 5683 |
(define_insn "*insv_bfins_mem" |
| 5684 |
[(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o") |
| 5685 |
(match_operand:SI 1 "nonmemory_operand" "dn") |
| 5686 |
(match_operand:SI 2 "nonmemory_operand" "dn")) |
| 5687 |
(match_operand:SI 3 "register_operand" "d"))] |
| 5688 |
"TARGET_68020 && TARGET_BITFIELD" |
| 5689 |
"bfins %3,%0{%b2:%b1}") |
| 5690 |
|
| 5691 |
;; Now recognize bit-field insns that operate on registers |
| 5692 |
;; (or at least were intended to do so). |
| 5693 |
|
| 5694 |
(define_insn "*extv_bfexts_reg" |
| 5695 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 5696 |
(sign_extract:SI (match_operand:SI 1 "register_operand" "d") |
| 5697 |
(match_operand:SI 2 "const_int_operand" "n") |
| 5698 |
(match_operand:SI 3 "const_int_operand" "n")))] |
| 5699 |
"TARGET_68020 && TARGET_BITFIELD && IN_RANGE (INTVAL (operands[3]), 0, 31)" |
| 5700 |
"bfexts %1{%b3:%b2},%0") |
| 5701 |
|
| 5702 |
(define_insn "*extv_bfextu_reg" |
| 5703 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
| 5704 |
(zero_extract:SI (match_operand:SI 1 "register_operand" "d") |
| 5705 |
(match_operand:SI 2 "const_int_operand" "n") |
| 5706 |
(match_operand:SI 3 "const_int_operand" "n")))] |
| 5707 |
"TARGET_68020 && TARGET_BITFIELD && IN_RANGE (INTVAL (operands[3]), 0, 31)" |
| 5708 |
{ |
| 5709 |
return "bfextu %1{%b3:%b2},%0"; |
| 5710 |
}) |
| 5711 |
|
| 5712 |
(define_insn "*insv_bfclr_reg" |
| 5713 |
[(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d") |
| 5714 |
(match_operand:SI 1 "const_int_operand" "n") |
| 5715 |
(match_operand:SI 2 "const_int_operand" "n")) |
| 5716 |
(const_int 0))] |
| 5717 |
"TARGET_68020 && TARGET_BITFIELD && IN_RANGE (INTVAL (operands[2]), 0, 31)" |
| 5718 |
{ |
| 5719 |
return "bfclr %0{%b2:%b1}"; |
| 5720 |
}) |
| 5721 |
|
| 5722 |
(define_insn "*insv_bfset_reg" |
| 5723 |
[(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d") |
| 5724 |
(match_operand:SI 1 "const_int_operand" "n") |
| 5725 |
(match_operand:SI 2 "const_int_operand" "n")) |
| 5726 |
(const_int -1))] |
| 5727 |
"TARGET_68020 && TARGET_BITFIELD && IN_RANGE (INTVAL (operands[2]), 0, 31)" |
| 5728 |
{ |
| 5729 |
return "bfset %0{%b2:%b1}"; |
| 5730 |
}) |
| 5731 |
|
| 5732 |
(define_insn "*insv_bfins_reg" |
| 5733 |
[(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d") |
| 5734 |
(match_operand:SI 1 "const_int_operand" "n") |
| 5735 |
(match_operand:SI 2 "const_int_operand" "n")) |
| 5736 |
(match_operand:SI 3 "register_operand" "d"))] |
| 5737 |
"TARGET_68020 && TARGET_BITFIELD && IN_RANGE (INTVAL (operands[2]), 0, 31)" |
| 5738 |
{ |
| 5739 |
#if 0 |
| 5740 |
/* These special cases are now recognized by a specific pattern. */ |
| 5741 |
if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT |
| 5742 |
&& INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16) |
| 5743 |
return "move%.w %3,%0"; |
| 5744 |
if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT |
| 5745 |
&& INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8) |
| 5746 |
return "move%.b %3,%0"; |
| 5747 |
#endif |
| 5748 |
return "bfins %3,%0{%b2:%b1}"; |
| 5749 |
}) |
| 5750 |
|
| 5751 |
(define_insn "scc0_di" |
| 5752 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm") |
| 5753 |
(match_operator 1 "ordered_comparison_operator" |
| 5754 |
[(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))] |
| 5755 |
"! TARGET_COLDFIRE" |
| 5756 |
{ |
| 5757 |
return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]); |
| 5758 |
}) |
| 5759 |
|
| 5760 |
(define_insn "scc0_di_5200" |
| 5761 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=d") |
| 5762 |
(match_operator 1 "ordered_comparison_operator" |
| 5763 |
[(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))] |
| 5764 |
"TARGET_COLDFIRE" |
| 5765 |
{ |
| 5766 |
return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]); |
| 5767 |
}) |
| 5768 |
|
| 5769 |
(define_insn "scc_di" |
| 5770 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm") |
| 5771 |
(match_operator 1 "ordered_comparison_operator" |
| 5772 |
[(match_operand:DI 2 "general_operand" "ro,r") |
| 5773 |
(match_operand:DI 3 "general_operand" "r,ro")]))] |
| 5774 |
"! TARGET_COLDFIRE" |
| 5775 |
{ |
| 5776 |
return output_scc_di (operands[1], operands[2], operands[3], operands[0]); |
| 5777 |
}) |
| 5778 |
|
| 5779 |
(define_insn "scc_di_5200" |
| 5780 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=d,d") |
| 5781 |
(match_operator 1 "ordered_comparison_operator" |
| 5782 |
[(match_operand:DI 2 "general_operand" "ro,r") |
| 5783 |
(match_operand:DI 3 "general_operand" "r,ro")]))] |
| 5784 |
"TARGET_COLDFIRE" |
| 5785 |
{ |
| 5786 |
return output_scc_di (operands[1], operands[2], operands[3], operands[0]); |
| 5787 |
}) |
| 5788 |
|
| 5789 |
;; Unconditional and other jump instructions |
| 5790 |
(define_insn "jump" |
| 5791 |
[(set (pc) |
| 5792 |
(label_ref (match_operand 0 "" "")))] |
| 5793 |
"" |
| 5794 |
"jra %l0" |
| 5795 |
[(set_attr "type" "bra")]) |
| 5796 |
|
| 5797 |
(define_expand "tablejump" |
| 5798 |
[(parallel [(set (pc) (match_operand 0 "" "")) |
| 5799 |
(use (label_ref (match_operand 1 "" "")))])] |
| 5800 |
"" |
| 5801 |
{ |
| 5802 |
#if CASE_VECTOR_PC_RELATIVE |
| 5803 |
operands[0] = gen_rtx_PLUS (SImode, pc_rtx, |
| 5804 |
TARGET_LONG_JUMP_TABLE_OFFSETS |
| 5805 |
? operands[0] |
| 5806 |
: gen_rtx_SIGN_EXTEND (SImode, operands[0])); |
| 5807 |
#endif |
| 5808 |
}) |
| 5809 |
|
| 5810 |
;; Jump to variable address from dispatch table of absolute addresses. |
| 5811 |
(define_insn "*tablejump_internal" |
| 5812 |
[(set (pc) (match_operand:SI 0 "register_operand" "a")) |
| 5813 |
(use (label_ref (match_operand 1 "" "")))] |
| 5814 |
"" |
| 5815 |
{ |
| 5816 |
return MOTOROLA ? "jmp (%0)" : "jmp %0@"; |
| 5817 |
} |
| 5818 |
[(set_attr "type" "jmp")]) |
| 5819 |
|
| 5820 |
;; Jump to variable address from dispatch table of relative addresses. |
| 5821 |
(define_insn "*tablejump_pcrel_si" |
| 5822 |
[(set (pc) |
| 5823 |
(plus:SI (pc) |
| 5824 |
(match_operand:SI 0 "register_operand" "r"))) |
| 5825 |
(use (label_ref (match_operand 1 "" "")))] |
| 5826 |
"TARGET_LONG_JUMP_TABLE_OFFSETS" |
| 5827 |
{ |
| 5828 |
#ifdef ASM_RETURN_CASE_JUMP |
| 5829 |
ASM_RETURN_CASE_JUMP; |
| 5830 |
#else |
| 5831 |
return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)"; |
| 5832 |
#endif |
| 5833 |
}) |
| 5834 |
|
| 5835 |
(define_insn "*tablejump_pcrel_hi" |
| 5836 |
[(set (pc) |
| 5837 |
(plus:SI (pc) |
| 5838 |
(sign_extend:SI (match_operand:HI 0 "register_operand" "r")))) |
| 5839 |
(use (label_ref (match_operand 1 "" "")))] |
| 5840 |
"!TARGET_LONG_JUMP_TABLE_OFFSETS" |
| 5841 |
{ |
| 5842 |
#ifdef ASM_RETURN_CASE_JUMP |
| 5843 |
ASM_RETURN_CASE_JUMP; |
| 5844 |
#else |
| 5845 |
if (TARGET_COLDFIRE) |
| 5846 |
{ |
| 5847 |
if (ADDRESS_REG_P (operands[0])) |
| 5848 |
return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)"; |
| 5849 |
else if (MOTOROLA) |
| 5850 |
return "ext%.l %0\;jmp (2,pc,%0.l)"; |
| 5851 |
else |
| 5852 |
return "extl %0\;jmp pc@(2,%0:l)"; |
| 5853 |
} |
| 5854 |
else |
| 5855 |
return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)"; |
| 5856 |
#endif |
| 5857 |
}) |
| 5858 |
|
| 5859 |
;; Decrement-and-branch insns. |
| 5860 |
(define_insn "*dbne_hi" |
| 5861 |
[(set (pc) |
| 5862 |
(if_then_else |
| 5863 |
(ne (match_operand:HI 0 "nonimmediate_operand" "+d*g") |
| 5864 |
(const_int 0)) |
| 5865 |
(label_ref (match_operand 1 "" "")) |
| 5866 |
(pc))) |
| 5867 |
(set (match_dup 0) |
| 5868 |
(plus:HI (match_dup 0) |
| 5869 |
(const_int -1)))] |
| 5870 |
"!TARGET_COLDFIRE" |
| 5871 |
{ |
| 5872 |
if (DATA_REG_P (operands[0])) |
| 5873 |
return "dbra %0,%l1"; |
| 5874 |
if (GET_CODE (operands[0]) == MEM) |
| 5875 |
return "subq%.w #1,%0\;jcc %l1"; |
| 5876 |
return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1"; |
| 5877 |
}) |
| 5878 |
|
| 5879 |
(define_insn "*dbne_si" |
| 5880 |
[(set (pc) |
| 5881 |
(if_then_else |
| 5882 |
(ne (match_operand:SI 0 "nonimmediate_operand" "+d*g") |
| 5883 |
(const_int 0)) |
| 5884 |
(label_ref (match_operand 1 "" "")) |
| 5885 |
(pc))) |
| 5886 |
(set (match_dup 0) |
| 5887 |
(plus:SI (match_dup 0) |
| 5888 |
(const_int -1)))] |
| 5889 |
"!TARGET_COLDFIRE" |
| 5890 |
{ |
| 5891 |
if (DATA_REG_P (operands[0])) |
| 5892 |
return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1"; |
| 5893 |
if (GET_CODE (operands[0]) == MEM) |
| 5894 |
return "subq%.l #1,%0\;jcc %l1"; |
| 5895 |
return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1"; |
| 5896 |
}) |
| 5897 |
|
| 5898 |
;; Two dbra patterns that use REG_NOTES info generated by strength_reduce. |
| 5899 |
|
| 5900 |
(define_insn "*dbge_hi" |
| 5901 |
[(set (pc) |
| 5902 |
(if_then_else |
| 5903 |
(ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am") |
| 5904 |
(const_int -1)) |
| 5905 |
(const_int 0)) |
| 5906 |
(label_ref (match_operand 1 "" "")) |
| 5907 |
(pc))) |
| 5908 |
(set (match_dup 0) |
| 5909 |
(plus:HI (match_dup 0) |
| 5910 |
(const_int -1)))] |
| 5911 |
"!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)" |
| 5912 |
{ |
| 5913 |
if (DATA_REG_P (operands[0])) |
| 5914 |
return "dbra %0,%l1"; |
| 5915 |
if (GET_CODE (operands[0]) == MEM) |
| 5916 |
return "subq%.w #1,%0\;jcc %l1"; |
| 5917 |
return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1"; |
| 5918 |
}) |
| 5919 |
|
| 5920 |
(define_expand "decrement_and_branch_until_zero" |
| 5921 |
[(parallel [(set (pc) |
| 5922 |
(if_then_else |
| 5923 |
(ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "") |
| 5924 |
(const_int -1)) |
| 5925 |
(const_int 0)) |
| 5926 |
(label_ref (match_operand 1 "" "")) |
| 5927 |
(pc))) |
| 5928 |
(set (match_dup 0) |
| 5929 |
(plus:SI (match_dup 0) |
| 5930 |
(const_int -1)))])] |
| 5931 |
"" |
| 5932 |
"") |
| 5933 |
|
| 5934 |
(define_insn "*dbge_si" |
| 5935 |
[(set (pc) |
| 5936 |
(if_then_else |
| 5937 |
(ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am") |
| 5938 |
(const_int -1)) |
| 5939 |
(const_int 0)) |
| 5940 |
(label_ref (match_operand 1 "" "")) |
| 5941 |
(pc))) |
| 5942 |
(set (match_dup 0) |
| 5943 |
(plus:SI (match_dup 0) |
| 5944 |
(const_int -1)))] |
| 5945 |
"!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)" |
| 5946 |
{ |
| 5947 |
if (DATA_REG_P (operands[0])) |
| 5948 |
return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1"; |
| 5949 |
if (GET_CODE (operands[0]) == MEM) |
| 5950 |
return "subq%.l #1,%0\;jcc %l1"; |
| 5951 |
return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1"; |
| 5952 |
}) |
| 5953 |
|
| 5954 |
(define_expand "sibcall" |
| 5955 |
[(call (match_operand:QI 0 "memory_operand" "") |
| 5956 |
(match_operand:SI 1 "general_operand" ""))] |
| 5957 |
"" |
| 5958 |
{ |
| 5959 |
operands[0] = m68k_legitimize_sibcall_address (operands[0]); |
| 5960 |
}) |
| 5961 |
|
| 5962 |
(define_insn "*sibcall" |
| 5963 |
[(call (mem:QI (match_operand:SI 0 "sibcall_operand" "")) |
| 5964 |
(match_operand:SI 1 "general_operand" ""))] |
| 5965 |
"SIBLING_CALL_P (insn)" |
| 5966 |
{ |
| 5967 |
return output_sibcall (operands[0]); |
| 5968 |
}) |
| 5969 |
|
| 5970 |
(define_expand "sibcall_value" |
| 5971 |
[(set (match_operand 0 "" "") |
| 5972 |
(call (match_operand:QI 1 "memory_operand" "") |
| 5973 |
(match_operand:SI 2 "general_operand" "")))] |
| 5974 |
"" |
| 5975 |
{ |
| 5976 |
operands[1] = m68k_legitimize_sibcall_address (operands[1]); |
| 5977 |
}) |
| 5978 |
|
| 5979 |
(define_insn "*sibcall_value" |
| 5980 |
[(set (match_operand 0 "" "=rf,rf") |
| 5981 |
(call (mem:QI (match_operand:SI 1 "sibcall_operand" "")) |
| 5982 |
(match_operand:SI 2 "general_operand" "")))] |
| 5983 |
"SIBLING_CALL_P (insn)" |
| 5984 |
{ |
| 5985 |
operands[0] = operands[1]; |
| 5986 |
return output_sibcall (operands[0]); |
| 5987 |
}) |
| 5988 |
|
| 5989 |
;; Call subroutine with no return value. |
| 5990 |
(define_expand "call" |
| 5991 |
[(call (match_operand:QI 0 "memory_operand" "") |
| 5992 |
(match_operand:SI 1 "general_operand" ""))] |
| 5993 |
;; Operand 1 not really used on the m68000. |
| 5994 |
"" |
| 5995 |
{ |
| 5996 |
operands[0] = m68k_legitimize_call_address (operands[0]); |
| 5997 |
}) |
| 5998 |
|
| 5999 |
(define_insn "*call" |
| 6000 |
[(call (mem:QI (match_operand:SI 0 "call_operand" "a,W")) |
| 6001 |
(match_operand:SI 1 "general_operand" "g,g"))] |
| 6002 |
;; Operand 1 not really used on the m68000. |
| 6003 |
"!SIBLING_CALL_P (insn)" |
| 6004 |
{ |
| 6005 |
return output_call (operands[0]); |
| 6006 |
} |
| 6007 |
[(set_attr "type" "jsr")]) |
| 6008 |
|
| 6009 |
;; Call subroutine, returning value in operand 0 |
| 6010 |
;; (which must be a hard register). |
| 6011 |
(define_expand "call_value" |
| 6012 |
[(set (match_operand 0 "" "") |
| 6013 |
(call (match_operand:QI 1 "memory_operand" "") |
| 6014 |
(match_operand:SI 2 "general_operand" "")))] |
| 6015 |
;; Operand 2 not really used on the m68000. |
| 6016 |
"" |
| 6017 |
{ |
| 6018 |
operands[1] = m68k_legitimize_call_address (operands[1]); |
| 6019 |
}) |
| 6020 |
|
| 6021 |
(define_insn "*non_symbolic_call_value" |
| 6022 |
[(set (match_operand 0 "" "=rf,rf") |
| 6023 |
(call (mem:QI (match_operand:SI 1 "non_symbolic_call_operand" "a,W")) |
| 6024 |
(match_operand:SI 2 "general_operand" "g,g")))] |
| 6025 |
;; Operand 2 not really used on the m68000. |
| 6026 |
"!SIBLING_CALL_P (insn)" |
| 6027 |
"jsr %a1" |
| 6028 |
[(set_attr "type" "jsr") |
| 6029 |
(set_attr "opx" "1")]) |
| 6030 |
|
| 6031 |
(define_insn "*symbolic_call_value_jsr" |
| 6032 |
[(set (match_operand 0 "" "=rf,rf") |
| 6033 |
(call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W")) |
| 6034 |
(match_operand:SI 2 "general_operand" "g,g")))] |
| 6035 |
;; Operand 2 not really used on the m68000. |
| 6036 |
"!SIBLING_CALL_P (insn) && m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_JSR" |
| 6037 |
{ |
| 6038 |
operands[0] = operands[1]; |
| 6039 |
return m68k_symbolic_call; |
| 6040 |
} |
| 6041 |
[(set_attr "type" "jsr") |
| 6042 |
(set_attr "opx" "1")]) |
| 6043 |
|
| 6044 |
(define_insn "*symbolic_call_value_bsr" |
| 6045 |
[(set (match_operand 0 "" "=rf,rf") |
| 6046 |
(call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W")) |
| 6047 |
(match_operand:SI 2 "general_operand" "g,g")))] |
| 6048 |
;; Operand 2 not really used on the m68000. |
| 6049 |
"!SIBLING_CALL_P (insn) |
| 6050 |
&& (m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_C |
| 6051 |
|| m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_P)" |
| 6052 |
{ |
| 6053 |
operands[0] = operands[1]; |
| 6054 |
return m68k_symbolic_call; |
| 6055 |
} |
| 6056 |
[(set_attr "type" "bsr") |
| 6057 |
(set_attr "opx" "1")]) |
| 6058 |
|
| 6059 |
;; Call subroutine returning any type. |
| 6060 |
|
| 6061 |
(define_expand "untyped_call" |
| 6062 |
[(parallel [(call (match_operand 0 "" "") |
| 6063 |
(const_int 0)) |
| 6064 |
(match_operand 1 "" "") |
| 6065 |
(match_operand 2 "" "")])] |
| 6066 |
"NEEDS_UNTYPED_CALL" |
| 6067 |
{ |
| 6068 |
int i; |
| 6069 |
|
| 6070 |
emit_call_insn (gen_call (operands[0], const0_rtx)); |
| 6071 |
|
| 6072 |
for (i = 0; i < XVECLEN (operands[2], 0); i++) |
| 6073 |
{ |
| 6074 |
rtx set = XVECEXP (operands[2], 0, i); |
| 6075 |
emit_move_insn (SET_DEST (set), SET_SRC (set)); |
| 6076 |
} |
| 6077 |
|
| 6078 |
/* The optimizer does not know that the call sets the function value |
| 6079 |
registers we stored in the result block. We avoid problems by |
| 6080 |
claiming that all hard registers are used and clobbered at this |
| 6081 |
point. */ |
| 6082 |
emit_insn (gen_blockage ()); |
| 6083 |
|
| 6084 |
DONE; |
| 6085 |
}) |
| 6086 |
|
| 6087 |
;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and |
| 6088 |
;; all of memory. This blocks insns from being moved across this point. |
| 6089 |
|
| 6090 |
(define_insn "blockage" |
| 6091 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)] |
| 6092 |
"" |
| 6093 |
"" |
| 6094 |
[(set_attr "flags_valid" "unchanged")]) |
| 6095 |
|
| 6096 |
(define_insn "nop" |
| 6097 |
[(const_int 0)] |
| 6098 |
"" |
| 6099 |
"nop" |
| 6100 |
[(set_attr "type" "nop") |
| 6101 |
(set_attr "flags_valid" "unchanged")]) |
| 6102 |
|
| 6103 |
(define_expand "prologue" |
| 6104 |
[(const_int 0)] |
| 6105 |
"" |
| 6106 |
{ |
| 6107 |
m68k_expand_prologue (); |
| 6108 |
DONE; |
| 6109 |
}) |
| 6110 |
|
| 6111 |
(define_expand "epilogue" |
| 6112 |
[(return)] |
| 6113 |
"" |
| 6114 |
{ |
| 6115 |
m68k_expand_epilogue (false); |
| 6116 |
DONE; |
| 6117 |
}) |
| 6118 |
|
| 6119 |
(define_expand "sibcall_epilogue" |
| 6120 |
[(return)] |
| 6121 |
"" |
| 6122 |
{ |
| 6123 |
m68k_expand_epilogue (true); |
| 6124 |
DONE; |
| 6125 |
}) |
| 6126 |
|
| 6127 |
;; Used for frameless functions which save no regs and allocate no locals. |
| 6128 |
(define_expand "return" |
| 6129 |
[(return)] |
| 6130 |
"m68k_use_return_insn ()" |
| 6131 |
"") |
| 6132 |
|
| 6133 |
(define_insn "*return" |
| 6134 |
[(return)] |
| 6135 |
"" |
| 6136 |
{ |
| 6137 |
switch (m68k_get_function_kind (current_function_decl)) |
| 6138 |
{ |
| 6139 |
case m68k_fk_interrupt_handler: |
| 6140 |
return "rte"; |
| 6141 |
|
| 6142 |
case m68k_fk_interrupt_thread: |
| 6143 |
return "sleep"; |
| 6144 |
|
| 6145 |
default: |
| 6146 |
if (crtl->args.pops_args) |
| 6147 |
{ |
| 6148 |
operands[0] = GEN_INT (crtl->args.pops_args); |
| 6149 |
return "rtd %0"; |
| 6150 |
} |
| 6151 |
else |
| 6152 |
return "rts"; |
| 6153 |
} |
| 6154 |
} |
| 6155 |
[(set_attr "type" "rts")]) |
| 6156 |
|
| 6157 |
(define_insn "*m68k_store_multiple" |
| 6158 |
[(match_parallel 0 "" [(match_operand 1 "")])] |
| 6159 |
"m68k_movem_pattern_p (operands[0], NULL, 0, true)" |
| 6160 |
{ |
| 6161 |
return m68k_output_movem (operands, operands[0], 0, true); |
| 6162 |
}) |
| 6163 |
|
| 6164 |
(define_insn "*m68k_store_multiple_automod" |
| 6165 |
[(match_parallel 0 "" |
| 6166 |
[(set (match_operand:SI 1 "register_operand" "=a") |
| 6167 |
(plus:SI (match_operand:SI 2 "register_operand" "1") |
| 6168 |
(match_operand:SI 3 "const_int_operand")))])] |
| 6169 |
"m68k_movem_pattern_p (operands[0], operands[1], INTVAL (operands[3]), true)" |
| 6170 |
{ |
| 6171 |
return m68k_output_movem (operands, operands[0], INTVAL (operands[3]), true); |
| 6172 |
}) |
| 6173 |
|
| 6174 |
(define_insn "*m68k_load_multiple" |
| 6175 |
[(match_parallel 0 "" [(match_operand 1 "")])] |
| 6176 |
"m68k_movem_pattern_p (operands[0], NULL, 0, false)" |
| 6177 |
{ |
| 6178 |
return m68k_output_movem (operands, operands[0], 0, false); |
| 6179 |
}) |
| 6180 |
|
| 6181 |
(define_insn "*m68k_load_multiple_automod" |
| 6182 |
[(match_parallel 0 "" |
| 6183 |
[(set (match_operand:SI 1 "register_operand" "=a") |
| 6184 |
(plus:SI (match_operand:SI 2 "register_operand" "1") |
| 6185 |
(match_operand:SI 3 "const_int_operand")))])] |
| 6186 |
"m68k_movem_pattern_p (operands[0], operands[1], |
| 6187 |
INTVAL (operands[3]), false)" |
| 6188 |
{ |
| 6189 |
return m68k_output_movem (operands, operands[0], |
| 6190 |
INTVAL (operands[3]), false); |
| 6191 |
}) |
| 6192 |
|
| 6193 |
(define_expand "link" |
| 6194 |
[(parallel |
| 6195 |
[(set (match_operand:SI 0 "register_operand") |
| 6196 |
(plus:SI (reg:SI SP_REG) (const_int -4))) |
| 6197 |
(set (match_dup 2) |
| 6198 |
(match_dup 0)) |
| 6199 |
(set (reg:SI SP_REG) |
| 6200 |
(plus:SI (reg:SI SP_REG) |
| 6201 |
(match_operand:SI 1 "const_int_operand")))])] |
| 6202 |
"TARGET_68020 || INTVAL (operands[1]) >= -0x8004" |
| 6203 |
{ |
| 6204 |
operands[2] = gen_frame_mem (SImode, |
| 6205 |
plus_constant (Pmode, stack_pointer_rtx, -4)); |
| 6206 |
}) |
| 6207 |
|
| 6208 |
(define_insn "*link" |
| 6209 |
[(set (match_operand:SI 0 "register_operand" "+r") |
| 6210 |
(plus:SI (reg:SI SP_REG) (const_int -4))) |
| 6211 |
(set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4))) |
| 6212 |
(match_dup 0)) |
| 6213 |
(set (reg:SI SP_REG) |
| 6214 |
(plus:SI (reg:SI SP_REG) |
| 6215 |
(match_operand:SI 1 "const_int_operand")))] |
| 6216 |
"TARGET_68020 || INTVAL (operands[1]) >= -0x8004" |
| 6217 |
{ |
| 6218 |
operands[1] = GEN_INT (INTVAL (operands[1]) + 4); |
| 6219 |
if (!MOTOROLA) |
| 6220 |
return "link %0,%1"; |
| 6221 |
else if (INTVAL (operands[1]) >= -0x8000) |
| 6222 |
return "link.w %0,%1"; |
| 6223 |
else |
| 6224 |
return "link.l %0,%1"; |
| 6225 |
} |
| 6226 |
[(set_attr "type" "link")]) |
| 6227 |
|
| 6228 |
(define_expand "unlink" |
| 6229 |
[(parallel |
| 6230 |
[(set (match_operand:SI 0 "register_operand") |
| 6231 |
(match_dup 1)) |
| 6232 |
(set (reg:SI SP_REG) |
| 6233 |
(plus:SI (match_dup 0) |
| 6234 |
(const_int 4)))])] |
| 6235 |
"" |
| 6236 |
{ |
| 6237 |
operands[1] = gen_frame_mem (SImode, copy_rtx (operands[0])); |
| 6238 |
}) |
| 6239 |
|
| 6240 |
(define_insn "*unlink" |
| 6241 |
[(set (match_operand:SI 0 "register_operand" "+r") |
| 6242 |
(mem:SI (match_dup 0))) |
| 6243 |
(set (reg:SI SP_REG) |
| 6244 |
(plus:SI (match_dup 0) |
| 6245 |
(const_int 4)))] |
| 6246 |
"" |
| 6247 |
"unlk %0" |
| 6248 |
[(set_attr "type" "unlk")]) |
| 6249 |
|
| 6250 |
(define_insn "load_got" |
| 6251 |
[(set (match_operand:SI 0 "register_operand" "=a") |
| 6252 |
(unspec:SI [(const_int 0)] UNSPEC_GOT))] |
| 6253 |
"" |
| 6254 |
{ |
| 6255 |
if (TARGET_ID_SHARED_LIBRARY) |
| 6256 |
{ |
| 6257 |
operands[1] = gen_rtx_REG (Pmode, PIC_REG); |
| 6258 |
return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0"; |
| 6259 |
} |
| 6260 |
else if (MOTOROLA) |
| 6261 |
{ |
| 6262 |
if (TARGET_COLDFIRE) |
| 6263 |
/* Load the full 32-bit PC-relative offset of |
| 6264 |
_GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to |
| 6265 |
calculate the absolute value. The offset and "lea" |
| 6266 |
operation word together occupy 6 bytes. */ |
| 6267 |
return ("move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t" |
| 6268 |
"lea (-6, %%pc, %0), %0"); |
| 6269 |
else |
| 6270 |
return "lea (%%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %0"; |
| 6271 |
} |
| 6272 |
else |
| 6273 |
return ("movel #_GLOBAL_OFFSET_TABLE_, %0\n\t" |
| 6274 |
"lea %%pc@(0,%0:l),%0"); |
| 6275 |
}) |
| 6276 |
|
| 6277 |
(define_insn "indirect_jump" |
| 6278 |
[(set (pc) (match_operand:SI 0 "address_operand" "p"))] |
| 6279 |
"" |
| 6280 |
"jmp %a0" |
| 6281 |
[(set_attr "type" "jmp")]) |
| 6282 |
|
| 6283 |
;; This should not be used unless the add/sub insns can't be. |
| 6284 |
|
| 6285 |
(define_insn "*lea" |
| 6286 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=a") |
| 6287 |
(match_operand:QI 1 "address_operand" "p"))] |
| 6288 |
"" |
| 6289 |
"lea %a1,%0") |
| 6290 |
|
| 6291 |
;; This is the first machine-dependent peephole optimization. |
| 6292 |
;; It is useful when a floating value is returned from a function call |
| 6293 |
;; and then is moved into an FP register. |
| 6294 |
;; But it is mainly intended to test the support for these optimizations. |
| 6295 |
|
| 6296 |
(define_peephole2 |
| 6297 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4))) |
| 6298 |
(set (match_operand:DF 0 "register_operand" "") |
| 6299 |
(match_operand:DF 1 "register_operand" ""))] |
| 6300 |
"FP_REG_P (operands[0]) && !FP_REG_P (operands[1])" |
| 6301 |
[(set (mem:SI (reg:SI SP_REG)) (match_dup 1)) |
| 6302 |
(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 2)) |
| 6303 |
(set (match_dup 0) (mem:DF (post_inc:SI (reg:SI SP_REG))))] |
| 6304 |
"split_di(operands + 1, 1, operands + 1, operands + 2);") |
| 6305 |
|
| 6306 |
;; Optimize a stack-adjust followed by a push of an argument. |
| 6307 |
;; This is said to happen frequently with -msoft-float |
| 6308 |
;; when there are consecutive library calls. |
| 6309 |
|
| 6310 |
(define_peephole2 |
| 6311 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4))) |
| 6312 |
(set (match_operand:SF 0 "push_operand" "") |
| 6313 |
(match_operand:SF 1 "general_operand" ""))] |
| 6314 |
"!reg_mentioned_p (stack_pointer_rtx, operands[0])" |
| 6315 |
[(set (match_dup 0) (match_dup 1))] |
| 6316 |
"operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);") |
| 6317 |
|
| 6318 |
(define_peephole2 |
| 6319 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) |
| 6320 |
(match_operand:SI 0 "const_int_operand" ""))) |
| 6321 |
(set (match_operand:SF 1 "push_operand" "") |
| 6322 |
(match_operand:SF 2 "general_operand" ""))] |
| 6323 |
"INTVAL (operands[0]) > 4 |
| 6324 |
&& !reg_mentioned_p (stack_pointer_rtx, operands[2])" |
| 6325 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0))) |
| 6326 |
(set (match_dup 1) (match_dup 2))] |
| 6327 |
{ |
| 6328 |
operands[0] = GEN_INT (INTVAL (operands[0]) - 4); |
| 6329 |
operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx); |
| 6330 |
}) |
| 6331 |
|
| 6332 |
;; Speed up stack adjust followed by a fullword fixedpoint push. |
| 6333 |
;; Constant operands need special care, as replacing a "pea X.w" with |
| 6334 |
;; "move.l #X,(%sp)" is often not a win. |
| 6335 |
|
| 6336 |
;; Already done by the previous csa pass, left as reference. |
| 6337 |
(define_peephole2 |
| 6338 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4))) |
| 6339 |
(set (match_operand:SI 0 "push_operand" "") |
| 6340 |
(match_operand:SI 1 "general_operand" ""))] |
| 6341 |
"!reg_mentioned_p (stack_pointer_rtx, operands[1])" |
| 6342 |
[(set (match_dup 0) (match_dup 1))] |
| 6343 |
"operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);") |
| 6344 |
|
| 6345 |
;; Try to use moveq, after stack push has been changed into a simple move. |
| 6346 |
(define_peephole2 |
| 6347 |
[(match_scratch:SI 2 "d") |
| 6348 |
(set (match_operand:SI 0 "memory_operand" "") |
| 6349 |
(match_operand:SI 1 "const_int_operand" ""))] |
| 6350 |
"GET_CODE (XEXP (operands[0], 0)) != PRE_DEC |
| 6351 |
&& INTVAL (operands[1]) != 0 |
| 6352 |
&& IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f) |
| 6353 |
&& !valid_mov3q_const (INTVAL (operands[1]))" |
| 6354 |
[(set (match_dup 2) (match_dup 1)) |
| 6355 |
(set (match_dup 0) (match_dup 2))]) |
| 6356 |
|
| 6357 |
;; This sequence adds an instruction, but is two bytes shorter. |
| 6358 |
(define_peephole2 |
| 6359 |
[(match_scratch:SI 2 "d") |
| 6360 |
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 12))) |
| 6361 |
(set (match_operand:SI 0 "push_operand" "") |
| 6362 |
(match_operand:SI 1 "const_int_operand" ""))] |
| 6363 |
"INTVAL (operands[1]) != 0 |
| 6364 |
&& IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f) |
| 6365 |
&& !valid_mov3q_const (INTVAL (operands[1]))" |
| 6366 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8))) |
| 6367 |
(set (match_dup 2) (match_dup 1)) |
| 6368 |
(set (match_dup 0) (match_dup 2))] |
| 6369 |
"operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);") |
| 6370 |
|
| 6371 |
;; Changing pea X.w into a move.l is no real win here. |
| 6372 |
(define_peephole2 |
| 6373 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) |
| 6374 |
(match_operand:SI 0 "const_int_operand" ""))) |
| 6375 |
(set (match_operand:SI 1 "push_operand" "") |
| 6376 |
(match_operand:SI 2 "general_operand" ""))] |
| 6377 |
"INTVAL (operands[0]) > 4 |
| 6378 |
&& !reg_mentioned_p (stack_pointer_rtx, operands[2]) |
| 6379 |
&& !(CONST_INT_P (operands[2]) && INTVAL (operands[2]) != 0 |
| 6380 |
&& IN_RANGE (INTVAL (operands[2]), -0x8000, 0x7fff) |
| 6381 |
&& !valid_mov3q_const (INTVAL (operands[2])))" |
| 6382 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0))) |
| 6383 |
(set (match_dup 1) (match_dup 2))] |
| 6384 |
{ |
| 6385 |
operands[0] = GEN_INT (INTVAL (operands[0]) - 4); |
| 6386 |
operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx); |
| 6387 |
}) |
| 6388 |
|
| 6389 |
;; Speed up pushing a single byte/two bytes but leaving four bytes of space |
| 6390 |
;; (which differs slightly between m680x0 and ColdFire). |
| 6391 |
|
| 6392 |
(define_peephole2 |
| 6393 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4))) |
| 6394 |
(set (match_operand:QI 0 "memory_operand" "") |
| 6395 |
(match_operand:QI 1 "register_operand" ""))] |
| 6396 |
"!reg_mentioned_p (stack_pointer_rtx, operands[1]) |
| 6397 |
&& GET_CODE (XEXP (operands[0], 0)) == PLUS |
| 6398 |
&& rtx_equal_p (XEXP (XEXP (operands[0], 0), 0), stack_pointer_rtx) |
| 6399 |
&& CONST_INT_P (XEXP (XEXP (operands[0], 0), 1)) |
| 6400 |
&& INTVAL (XEXP (XEXP (operands[0], 0), 1)) == 3" |
| 6401 |
[(set (match_dup 0) (match_dup 1))] |
| 6402 |
{ |
| 6403 |
rtx addr = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx); |
| 6404 |
operands[0] = adjust_automodify_address (operands[0], SImode, addr, -3); |
| 6405 |
operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0); |
| 6406 |
}) |
| 6407 |
|
| 6408 |
(define_peephole2 |
| 6409 |
[(set (match_operand:QI 0 "push_operand" "") |
| 6410 |
(match_operand:QI 1 "register_operand" "")) |
| 6411 |
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -3)))] |
| 6412 |
"!reg_mentioned_p (stack_pointer_rtx, operands[1])" |
| 6413 |
[(set (match_dup 0) (match_dup 1))] |
| 6414 |
{ |
| 6415 |
operands[0] = adjust_automodify_address (operands[0], SImode, |
| 6416 |
XEXP (operands[0], 0), -3); |
| 6417 |
operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0); |
| 6418 |
}) |
| 6419 |
|
| 6420 |
(define_peephole2 |
| 6421 |
[(set (match_operand:HI 0 "push_operand" "") |
| 6422 |
(match_operand:HI 1 "register_operand" "")) |
| 6423 |
(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))] |
| 6424 |
"!reg_mentioned_p (stack_pointer_rtx, operands[1])" |
| 6425 |
[(set (match_dup 0) (match_dup 1))] |
| 6426 |
{ |
| 6427 |
operands[0] = adjust_automodify_address (operands[0], SImode, |
| 6428 |
XEXP (operands[0], 0), -2); |
| 6429 |
operands[1] = simplify_gen_subreg (SImode, operands[1], HImode, 0); |
| 6430 |
}) |
| 6431 |
|
| 6432 |
;; Optimize a series of strict_low_part assignments |
| 6433 |
|
| 6434 |
(define_peephole2 |
| 6435 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6436 |
(const_int 0)) |
| 6437 |
(set (strict_low_part (match_operand:HI 1 "register_operand" "")) |
| 6438 |
(match_operand:HI 2 "general_operand" ""))] |
| 6439 |
"REGNO (operands[0]) == REGNO (operands[1]) |
| 6440 |
&& strict_low_part_peephole_ok (HImode, insn, operands[0])" |
| 6441 |
[(set (strict_low_part (match_dup 1)) (match_dup 2))] |
| 6442 |
"") |
| 6443 |
|
| 6444 |
(define_peephole2 |
| 6445 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6446 |
(const_int 0)) |
| 6447 |
(set (strict_low_part (match_operand:QI 1 "register_operand" "")) |
| 6448 |
(match_operand:QI 2 "general_operand" ""))] |
| 6449 |
"REGNO (operands[0]) == REGNO (operands[1]) |
| 6450 |
&& strict_low_part_peephole_ok (QImode, insn, operands[0])" |
| 6451 |
[(set (strict_low_part (match_dup 1)) (match_dup 2))] |
| 6452 |
"") |
| 6453 |
|
| 6454 |
;; dbCC peepholes |
| 6455 |
;; |
| 6456 |
;; Turns |
| 6457 |
;; loop: |
| 6458 |
;; [ ... ] |
| 6459 |
;; jCC label ; abnormal loop termination |
| 6460 |
;; dbra dN, loop ; normal loop termination |
| 6461 |
;; |
| 6462 |
;; Into |
| 6463 |
;; loop: |
| 6464 |
;; [ ... ] |
| 6465 |
;; dbCC dN, loop |
| 6466 |
;; jCC label |
| 6467 |
;; |
| 6468 |
;; Which moves the jCC condition outside the inner loop for free. |
| 6469 |
;; |
| 6470 |
(define_mode_iterator DBCC [HI SI]) |
| 6471 |
|
| 6472 |
(define_peephole |
| 6473 |
[(set (pc) (if_then_else (match_operator 3 "ordered_comparison_operator" |
| 6474 |
[(match_operand:CMPMODE 4 "general_operand" "") |
| 6475 |
(match_operand:CMPMODE 5 "general_operand" "")]) |
| 6476 |
(label_ref (match_operand 2 "" "")) |
| 6477 |
(pc))) |
| 6478 |
(parallel |
| 6479 |
[(set (pc) |
| 6480 |
(if_then_else |
| 6481 |
(ne (match_operand:DBCC 0 "register_operand" "") |
| 6482 |
(const_int 0)) |
| 6483 |
(label_ref (match_operand 1 "" "")) |
| 6484 |
(pc))) |
| 6485 |
(set (match_dup 0) |
| 6486 |
(plus:DBCC (match_dup 0) |
| 6487 |
(const_int -1)))])] |
| 6488 |
"!TARGET_COLDFIRE && DATA_REG_P (operands[0])" |
| 6489 |
{ |
| 6490 |
rtx_code code = GET_CODE (operands[3]); |
| 6491 |
code = m68k_output_compare_<CMPMODE:mode> (operands[4], operands[5], code); |
| 6492 |
output_dbcc_and_branch (operands, code); |
| 6493 |
return ""; |
| 6494 |
}) |
| 6495 |
|
| 6496 |
(define_peephole |
| 6497 |
[(set (pc) (if_then_else (match_operator 3 "ordered_comparison_operator" |
| 6498 |
[(match_operand:CMPMODE 4 "general_operand" "") |
| 6499 |
(match_operand:CMPMODE 5 "general_operand" "")]) |
| 6500 |
(label_ref (match_operand 2 "" "")) |
| 6501 |
(pc))) |
| 6502 |
(parallel |
| 6503 |
[(set (pc) |
| 6504 |
(if_then_else |
| 6505 |
(ge (plus:DBCC (match_operand:DBCC 0 "register_operand" "") |
| 6506 |
(const_int -1)) |
| 6507 |
(const_int 0)) |
| 6508 |
(label_ref (match_operand 1 "" "")) |
| 6509 |
(pc))) |
| 6510 |
(set (match_dup 0) |
| 6511 |
(plus:DBCC (match_dup 0) |
| 6512 |
(const_int -1)))])] |
| 6513 |
"!TARGET_COLDFIRE && DATA_REG_P (operands[0])" |
| 6514 |
{ |
| 6515 |
rtx_code code = GET_CODE (operands[3]); |
| 6516 |
code = m68k_output_compare_<CMPMODE:mode> (operands[4], operands[5], code); |
| 6517 |
output_dbcc_and_branch (operands, code); |
| 6518 |
return ""; |
| 6519 |
}) |
| 6520 |
|
| 6521 |
(define_insn "extendsfxf2" |
| 6522 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f") |
| 6523 |
(float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))] |
| 6524 |
"TARGET_68881" |
| 6525 |
{ |
| 6526 |
if (FP_REG_P (operands[0]) && FP_REG_P (operands[1])) |
| 6527 |
{ |
| 6528 |
if (REGNO (operands[0]) == REGNO (operands[1])) |
| 6529 |
{ |
| 6530 |
/* Extending float to double in an fp-reg is a no-op. */ |
| 6531 |
return ""; |
| 6532 |
} |
| 6533 |
return "f%$move%.x %1,%0"; |
| 6534 |
} |
| 6535 |
if (FP_REG_P (operands[0])) |
| 6536 |
{ |
| 6537 |
if (FP_REG_P (operands[1])) |
| 6538 |
return "f%$move%.x %1,%0"; |
| 6539 |
else if (ADDRESS_REG_P (operands[1])) |
| 6540 |
return "move%.l %1,%-\;f%$move%.s %+,%0"; |
| 6541 |
else if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 6542 |
return output_move_const_single (operands); |
| 6543 |
return "f%$move%.s %f1,%0"; |
| 6544 |
} |
| 6545 |
return "fmove%.x %f1,%0"; |
| 6546 |
}) |
| 6547 |
|
| 6548 |
|
| 6549 |
(define_insn "extenddfxf2" |
| 6550 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f") |
| 6551 |
(float_extend:XF |
| 6552 |
(match_operand:DF 1 "general_operand" "f,rmE")))] |
| 6553 |
"TARGET_68881" |
| 6554 |
{ |
| 6555 |
if (FP_REG_P (operands[0]) && FP_REG_P (operands[1])) |
| 6556 |
{ |
| 6557 |
if (REGNO (operands[0]) == REGNO (operands[1])) |
| 6558 |
{ |
| 6559 |
/* Extending float to double in an fp-reg is a no-op. */ |
| 6560 |
return ""; |
| 6561 |
} |
| 6562 |
return "fmove%.x %1,%0"; |
| 6563 |
} |
| 6564 |
if (FP_REG_P (operands[0])) |
| 6565 |
{ |
| 6566 |
if (REG_P (operands[1])) |
| 6567 |
{ |
| 6568 |
rtx xoperands[2]; |
| 6569 |
xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); |
| 6570 |
output_asm_insn ("move%.l %1,%-", xoperands); |
| 6571 |
output_asm_insn ("move%.l %1,%-", operands); |
| 6572 |
return "f%&move%.d %+,%0"; |
| 6573 |
} |
| 6574 |
if (GET_CODE (operands[1]) == CONST_DOUBLE) |
| 6575 |
return output_move_const_double (operands); |
| 6576 |
return "f%&move%.d %f1,%0"; |
| 6577 |
} |
| 6578 |
return "fmove%.x %f1,%0"; |
| 6579 |
}) |
| 6580 |
|
| 6581 |
(define_insn "truncxfdf2" |
| 6582 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r") |
| 6583 |
(float_truncate:DF |
| 6584 |
(match_operand:XF 1 "general_operand" "f,f")))] |
| 6585 |
"TARGET_68881" |
| 6586 |
{ |
| 6587 |
if (REG_P (operands[0])) |
| 6588 |
{ |
| 6589 |
output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands); |
| 6590 |
operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); |
| 6591 |
return "move%.l %+,%0"; |
| 6592 |
} |
| 6593 |
return "fmove%.d %f1,%0"; |
| 6594 |
}) |
| 6595 |
|
| 6596 |
(define_insn "truncxfsf2" |
| 6597 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=dm") |
| 6598 |
(float_truncate:SF |
| 6599 |
(match_operand:XF 1 "general_operand" "f")))] |
| 6600 |
"TARGET_68881" |
| 6601 |
"fmove%.s %f1,%0") |
| 6602 |
|
| 6603 |
(define_insn "sin<mode>2" |
| 6604 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 6605 |
(unspec:FP |
| 6606 |
[(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_SIN))] |
| 6607 |
"TARGET_68881 && flag_unsafe_math_optimizations" |
| 6608 |
{ |
| 6609 |
if (FP_REG_P (operands[1])) |
| 6610 |
return "fsin%.x %1,%0"; |
| 6611 |
else |
| 6612 |
return "fsin%.<FP:prec> %1,%0"; |
| 6613 |
}) |
| 6614 |
|
| 6615 |
(define_insn "cos<mode>2" |
| 6616 |
[(set (match_operand:FP 0 "nonimmediate_operand" "=f") |
| 6617 |
(unspec:FP |
| 6618 |
[(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_COS))] |
| 6619 |
"TARGET_68881 && flag_unsafe_math_optimizations" |
| 6620 |
{ |
| 6621 |
if (FP_REG_P (operands[1])) |
| 6622 |
return "fcos%.x %1,%0"; |
| 6623 |
else |
| 6624 |
return "fcos%.<FP:prec> %1,%0"; |
| 6625 |
}) |
| 6626 |
|
| 6627 |
;; Unconditional traps are assumed to have const_true_rtx for the condition. |
| 6628 |
(define_insn "trap" |
| 6629 |
[(trap_if (const_int -1) (const_int 7))] |
| 6630 |
"" |
| 6631 |
"trap #7" |
| 6632 |
[(set_attr "type" "trap")]) |
| 6633 |
|
| 6634 |
;; ??? Our trap instruction uses constant 7 for operand 3, which is |
| 6635 |
;; also the trap vector used by TRAPcc instruction. By restricting |
| 6636 |
;; these patterns to const1_operand, they will not be generated. |
| 6637 |
;; Left disabled for now, as enabling it seems to cause issues. |
| 6638 |
(define_insn "ctrap<mode>4" |
| 6639 |
[(trap_if (match_operator 0 "ordered_comparison_operator" |
| 6640 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "<cmp1_constraints>") |
| 6641 |
(match_operand:CMPMODE 2 "general_operand" "<cmp2_constraints>")]) |
| 6642 |
(match_operand:SI 3 "const1_operand" ""))] |
| 6643 |
"TARGET_68020 && !TARGET_COLDFIRE" |
| 6644 |
{ |
| 6645 |
rtx_code code = GET_CODE (operands[0]); |
| 6646 |
code = m68k_output_compare_<mode> (operands[1], operands[2], code); |
| 6647 |
switch (code) |
| 6648 |
{ |
| 6649 |
case EQ: return "trapeq"; |
| 6650 |
case NE: return "trapne"; |
| 6651 |
case GT: return "trapgt"; |
| 6652 |
case GTU: return "traphi"; |
| 6653 |
case LT: return "traplt"; |
| 6654 |
case LTU: return "trapcs"; |
| 6655 |
case GE: return "trapge"; |
| 6656 |
case GEU: return "trapcc"; |
| 6657 |
case LE: return "traple"; |
| 6658 |
case LEU: return "trapls"; |
| 6659 |
default: gcc_unreachable (); |
| 6660 |
} |
| 6661 |
}) |
| 6662 |
|
| 6663 |
(define_insn "ctrap<mode>4_cf" |
| 6664 |
[(trap_if (match_operator 0 "ordered_comparison_operator" |
| 6665 |
[(match_operand:CMPMODE 1 "nonimmediate_operand" "<cmp1_cf_constraints>") |
| 6666 |
(match_operand:CMPMODE 2 "general_operand" "<cmp2_cf_constraints>")]) |
| 6667 |
(match_operand:SI 3 "const1_operand" ""))] |
| 6668 |
"TARGET_68020 && TARGET_COLDFIRE" |
| 6669 |
{ |
| 6670 |
rtx_code code = GET_CODE (operands[0]); |
| 6671 |
code = m68k_output_compare_<mode> (operands[1], operands[2], code); |
| 6672 |
switch (code) |
| 6673 |
{ |
| 6674 |
case EQ: return "trapeq"; |
| 6675 |
case NE: return "trapne"; |
| 6676 |
case GT: return "trapgt"; |
| 6677 |
case GTU: return "traphi"; |
| 6678 |
case LT: return "traplt"; |
| 6679 |
case LTU: return "trapcs"; |
| 6680 |
case GE: return "trapge"; |
| 6681 |
case GEU: return "trapcc"; |
| 6682 |
case LE: return "traple"; |
| 6683 |
case LEU: return "trapls"; |
| 6684 |
default: gcc_unreachable (); |
| 6685 |
} |
| 6686 |
}) |
| 6687 |
|
| 6688 |
;; These are to prevent the scheduler from moving stores to the frame |
| 6689 |
;; before the stack adjustment. |
| 6690 |
(define_insn "stack_tie" |
| 6691 |
[(set (mem:BLK (scratch)) |
| 6692 |
(unspec:BLK [(match_operand:SI 0 "register_operand" "r") |
| 6693 |
(match_operand:SI 1 "register_operand" "r")] |
| 6694 |
UNSPEC_TIE))] |
| 6695 |
"" |
| 6696 |
"" |
| 6697 |
[(set_attr "type" "ignore")]) |
| 6698 |
|
| 6699 |
;; Instruction that subscribes one word in ColdFire instruction buffer. |
| 6700 |
;; This instruction is used within scheduler only and should not appear |
| 6701 |
;; in the instruction stream. |
| 6702 |
(define_insn "ib" |
| 6703 |
[(unspec [(const_int 0)] UNSPEC_IB)] |
| 6704 |
"" |
| 6705 |
"#" |
| 6706 |
[(set_attr "type" "ib")]) |
| 6707 |
|
| 6708 |
(include "cf.md") |
| 6709 |
(include "sync.md") |
| 6710 |
|
| 6711 |
;; Convert |
| 6712 |
;; |
| 6713 |
;; move.l 4(%a0),%a0 |
| 6714 |
;; clr.b (%a0,%a1.l) |
| 6715 |
;; |
| 6716 |
;; into |
| 6717 |
;; |
| 6718 |
;; add.l 4(%a0),%a1 |
| 6719 |
;; clr.b (%a1) |
| 6720 |
;; |
| 6721 |
;; The latter is smaller. It is faster on all models except m68060. |
| 6722 |
|
| 6723 |
(define_peephole2 |
| 6724 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6725 |
(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "") |
| 6726 |
(match_operand:SI 2 "const_int_operand" "")))) |
| 6727 |
(set (mem:QI (plus:SI (match_operand:SI 3 "register_operand" "") |
| 6728 |
(match_operand:SI 4 "register_operand" ""))) |
| 6729 |
(const_int 0))] |
| 6730 |
"(optimize_size || !TUNE_68060) |
| 6731 |
&& (operands[0] == operands[3] || operands[0] == operands[4]) |
| 6732 |
&& ADDRESS_REG_P (operands[1]) |
| 6733 |
&& ADDRESS_REG_P ((operands[0] == operands[3]) ? operands[4] : operands[3]) |
| 6734 |
&& peep2_reg_dead_p (2, operands[3]) |
| 6735 |
&& peep2_reg_dead_p (2, operands[4])" |
| 6736 |
[(set (match_dup 5) |
| 6737 |
(plus:SI (match_dup 5) |
| 6738 |
(mem:SI (plus:SI (match_dup 1) |
| 6739 |
(match_dup 2))))) |
| 6740 |
(set (mem:QI (match_dup 5)) |
| 6741 |
(const_int 0))] |
| 6742 |
"operands[5] = (operands[0] == operands[3]) ? operands[4] : operands[3];") |
| 6743 |
|
| 6744 |
;; We want to turn |
| 6745 |
;; moveq const,dX |
| 6746 |
;; cmp.l dX,dY |
| 6747 |
;; je/jne |
| 6748 |
;; |
| 6749 |
;; into |
| 6750 |
;; addq/subq -const,dY |
| 6751 |
;; cmp.l dY, 0 |
| 6752 |
;; je/jne |
| 6753 |
;; |
| 6754 |
;; dX and dY must both be dead at the end of the sequence and the constant |
| 6755 |
;; must be valid for addq/subq. |
| 6756 |
;; |
| 6757 |
;; Essentially we're making it trivial for final to realize the comparison |
| 6758 |
;; is not needed |
| 6759 |
;; |
| 6760 |
;; Testing has shown a variant where the operands are reversed in the |
| 6761 |
;; comparison never hits, so I have not included that variant. |
| 6762 |
;; |
| 6763 |
|
| 6764 |
(define_peephole2 |
| 6765 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6766 |
(match_operand:SI 1 "addq_subq_operand" "")) |
| 6767 |
(set (pc) (if_then_else (match_operator 5 "equality_comparison_operator" |
| 6768 |
[(match_operand:SI 2 "register_operand" "") (match_dup 0)]) |
| 6769 |
(match_operand 3 "pc_or_label_operand") |
| 6770 |
(match_operand 4 "pc_or_label_operand")))] |
| 6771 |
"peep2_reg_dead_p (2, operands[0]) |
| 6772 |
&& peep2_reg_dead_p (2, operands[2]) |
| 6773 |
&& (operands[3] == pc_rtx || operands[4] == pc_rtx) |
| 6774 |
&& DATA_REG_P (operands[2]) |
| 6775 |
&& !rtx_equal_p (operands[0], operands[2])" |
| 6776 |
[(set (match_dup 2) (plus:SI (match_dup 2) (match_dup 6))) |
| 6777 |
(set (pc) (if_then_else (match_op_dup 5 [(match_dup 2) (const_int 0)]) |
| 6778 |
(match_dup 3) |
| 6779 |
(match_dup 4)))] |
| 6780 |
"operands[6] = GEN_INT (-INTVAL (operands[1]));") |
| 6781 |
|
| 6782 |
(define_peephole2 |
| 6783 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6784 |
(match_operand:SI 1 "pow2_m1_operand" "")) |
| 6785 |
(set (pc) (if_then_else (gtu (match_operand:SI 2 "register_operand" "") |
| 6786 |
(match_operand:SI 3 "register_operand" "")) |
| 6787 |
(match_operand 4 "pc_or_label_operand") |
| 6788 |
(match_operand 5 "pc_or_label_operand")))] |
| 6789 |
"INTVAL (operands[1]) <= 255 |
| 6790 |
&& operands[0] == operands[3] |
| 6791 |
&& peep2_reg_dead_p (2, operands[0]) |
| 6792 |
&& peep2_reg_dead_p (2, operands[2]) |
| 6793 |
&& (operands[4] == pc_rtx || operands[5] == pc_rtx) |
| 6794 |
&& (optimize_size || TUNE_68040_60) |
| 6795 |
&& DATA_REG_P (operands[2])" |
| 6796 |
[(set (match_dup 7) (lshiftrt:SI (match_dup 7) (match_dup 6))) |
| 6797 |
(set (pc) (if_then_else (ne (match_dup 7) (const_int 0)) |
| 6798 |
(match_dup 4) (match_dup 5)))] |
| 6799 |
" |
| 6800 |
{ |
| 6801 |
operands[6] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1)); |
| 6802 |
operands[7] = operands[2]; |
| 6803 |
}") |
| 6804 |
|
| 6805 |
(define_peephole2 |
| 6806 |
[(set (pc) (if_then_else (gtu (match_operand:SI 0 "register_operand" "") |
| 6807 |
(match_operand:SI 1 "pow2_m1_operand" "")) |
| 6808 |
(match_operand 2 "pc_or_label_operand") |
| 6809 |
(match_operand 3 "pc_or_label_operand")))] |
| 6810 |
"INTVAL (operands[1]) <= 255 |
| 6811 |
&& peep2_reg_dead_p (1, operands[0]) |
| 6812 |
&& (operands[2] == pc_rtx || operands[3] == pc_rtx) |
| 6813 |
&& (optimize_size || TUNE_68040_60) |
| 6814 |
&& DATA_REG_P (operands[0])" |
| 6815 |
[(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 4))) |
| 6816 |
(set (pc) (if_then_else (ne (match_dup 0) (const_int 0)) |
| 6817 |
(match_dup 2) (match_dup 3)))] |
| 6818 |
"{ operands[4] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1)); }") |
| 6819 |
|
| 6820 |
(define_peephole2 |
| 6821 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6822 |
(match_operand:SI 1 "pow2_m1_operand" "")) |
| 6823 |
(set (pc) (if_then_else (leu (match_operand:SI 2 "register_operand" "") |
| 6824 |
(match_operand:SI 3 "register_operand" "")) |
| 6825 |
(match_operand 4 "pc_or_label_operand") |
| 6826 |
(match_operand 5 "pc_or_label_operand")))] |
| 6827 |
"INTVAL (operands[1]) <= 255 |
| 6828 |
&& operands[0] == operands[3] |
| 6829 |
&& peep2_reg_dead_p (2, operands[0]) |
| 6830 |
&& peep2_reg_dead_p (2, operands[2]) |
| 6831 |
&& (operands[4] == pc_rtx || operands[5] == pc_rtx) |
| 6832 |
&& (optimize_size || TUNE_68040_60) |
| 6833 |
&& DATA_REG_P (operands[2])" |
| 6834 |
[(set (match_dup 7) (lshiftrt:SI (match_dup 7) (match_dup 6))) |
| 6835 |
(set (pc) (if_then_else (eq (match_dup 7) (const_int 0)) |
| 6836 |
(match_dup 4) (match_dup 5)))] |
| 6837 |
" |
| 6838 |
{ |
| 6839 |
operands[6] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1)); |
| 6840 |
operands[7] = operands[2]; |
| 6841 |
}") |
| 6842 |
(define_peephole2 |
| 6843 |
[(set (pc) (if_then_else (leu (match_operand:SI 0 "register_operand" "") |
| 6844 |
(match_operand:SI 1 "pow2_m1_operand" "")) |
| 6845 |
(match_operand 2 "pc_or_label_operand") |
| 6846 |
(match_operand 3 "pc_or_label_operand")))] |
| 6847 |
"INTVAL (operands[1]) <= 255 |
| 6848 |
&& peep2_reg_dead_p (1, operands[0]) |
| 6849 |
&& (operands[2] == pc_rtx || operands[3] == pc_rtx) |
| 6850 |
&& (optimize_size || TUNE_68040_60) |
| 6851 |
&& DATA_REG_P (operands[0])" |
| 6852 |
[(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 4))) |
| 6853 |
(set (pc) (if_then_else (eq (match_dup 0) (const_int 0)) |
| 6854 |
(match_dup 2) (match_dup 3)))] |
| 6855 |
"{ operands[4] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1)); }") |
| 6856 |
|
| 6857 |
;; When optimizing for size or for the original 68000 or 68010, we can |
| 6858 |
;; improve some relational tests against 65536 (which get canonicalized |
| 6859 |
;; internally against 65535). |
| 6860 |
;; The rotate in the output pattern will turn into a swap. |
| 6861 |
(define_peephole2 |
| 6862 |
[(set (pc) (if_then_else (match_operator 1 "swap_peephole_relational_operator" |
| 6863 |
[(match_operand:SI 0 "register_operand" "") |
| 6864 |
(const_int 65535)]) |
| 6865 |
(match_operand 2 "pc_or_label_operand") |
| 6866 |
(match_operand 3 "pc_or_label_operand")))] |
| 6867 |
"peep2_reg_dead_p (1, operands[0]) |
| 6868 |
&& (operands[2] == pc_rtx || operands[3] == pc_rtx) |
| 6869 |
&& (optimize_size || TUNE_68000_10) |
| 6870 |
&& DATA_REG_P (operands[0])" |
| 6871 |
[(set (match_dup 0) (rotate:SI (match_dup 0) (const_int 16))) |
| 6872 |
(set (pc) (if_then_else (match_op_dup 1 [(subreg:HI (match_dup 0) 2) (const_int 0)]) |
| 6873 |
(match_dup 2) (match_dup 3)))] |
| 6874 |
"") |