1 ;; Predicate definitions for Frv.
2 ;; Copyright (C) 2005 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
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 2, or (at your option)
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.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 ;; Boston, MA 02110-1301, USA.
21 ;; Return true if operand is a GPR register.
23 (define_predicate "integer_register_operand"
24 (match_code "reg,subreg")
26 if (GET_MODE (op) != mode && mode != VOIDmode)
29 if (GET_CODE (op) == SUBREG)
31 if (GET_CODE (SUBREG_REG (op)) != REG)
32 return register_operand (op, mode);
37 if (GET_CODE (op) != REG)
40 return GPR_AP_OR_PSEUDO_P (REGNO (op));
43 ;; Return 1 is OP is a memory operand, or will be turned into one by
46 (define_predicate "frv_load_operand"
47 (match_code "reg,subreg,mem")
49 if (GET_MODE (op) != mode && mode != VOIDmode)
52 if (reload_in_progress)
55 if (GET_CODE (tmp) == SUBREG)
56 tmp = SUBREG_REG (tmp);
57 if (GET_CODE (tmp) == REG
58 && REGNO (tmp) >= FIRST_PSEUDO_REGISTER)
59 op = reg_equiv_memory_loc[REGNO (tmp)];
62 return op && memory_operand (op, mode);
65 ;; Return true if operand is a GPR register. Do not allow SUBREG's
66 ;; here, in order to prevent a combine bug.
68 (define_predicate "gpr_no_subreg_operand"
71 if (GET_MODE (op) != mode && mode != VOIDmode)
74 if (GET_CODE (op) != REG)
77 return GPR_OR_PSEUDO_P (REGNO (op));
80 ;; Return 1 if operand is a GPR register or a FPR register.
82 (define_predicate "gpr_or_fpr_operand"
83 (match_code "reg,subreg")
87 if (GET_MODE (op) != mode && mode != VOIDmode)
90 if (GET_CODE (op) == SUBREG)
92 if (GET_CODE (SUBREG_REG (op)) != REG)
93 return register_operand (op, mode);
98 if (GET_CODE (op) != REG)
102 if (GPR_P (regno) || FPR_P (regno) || regno >= FIRST_PSEUDO_REGISTER)
108 ;; Return 1 if operand is a GPR register or 12 bit signed immediate.
110 (define_predicate "gpr_or_int12_operand"
111 (match_code "reg,subreg,const_int,const")
113 if (GET_CODE (op) == CONST_INT)
114 return IN_RANGE_P (INTVAL (op), -2048, 2047);
116 if (got12_operand (op, mode))
119 if (GET_MODE (op) != mode && mode != VOIDmode)
122 if (GET_CODE (op) == SUBREG)
124 if (GET_CODE (SUBREG_REG (op)) != REG)
125 return register_operand (op, mode);
127 op = SUBREG_REG (op);
130 if (GET_CODE (op) != REG)
133 return GPR_OR_PSEUDO_P (REGNO (op));
136 ;; Return 1 if operand is a GPR register, or a FPR register, or a 12
137 ;; bit signed immediate.
139 (define_predicate "gpr_fpr_or_int12_operand"
140 (match_code "reg,subreg,const_int")
144 if (GET_CODE (op) == CONST_INT)
145 return IN_RANGE_P (INTVAL (op), -2048, 2047);
147 if (GET_MODE (op) != mode && mode != VOIDmode)
150 if (GET_CODE (op) == SUBREG)
152 if (GET_CODE (SUBREG_REG (op)) != REG)
153 return register_operand (op, mode);
155 op = SUBREG_REG (op);
158 if (GET_CODE (op) != REG)
162 if (GPR_P (regno) || FPR_P (regno) || regno >= FIRST_PSEUDO_REGISTER)
168 ;; Return 1 if operand is a register or 10 bit signed immediate.
170 (define_predicate "gpr_or_int10_operand"
171 (match_code "reg,subreg,const_int")
173 if (GET_CODE (op) == CONST_INT)
174 return IN_RANGE_P (INTVAL (op), -512, 511);
176 if (GET_MODE (op) != mode && mode != VOIDmode)
179 if (GET_CODE (op) == SUBREG)
181 if (GET_CODE (SUBREG_REG (op)) != REG)
182 return register_operand (op, mode);
184 op = SUBREG_REG (op);
187 if (GET_CODE (op) != REG)
190 return GPR_OR_PSEUDO_P (REGNO (op));
193 ;; Return 1 if operand is a register or an integer immediate.
195 (define_predicate "gpr_or_int_operand"
196 (match_code "reg,subreg,const_int")
198 if (GET_CODE (op) == CONST_INT)
201 if (GET_MODE (op) != mode && mode != VOIDmode)
204 if (GET_CODE (op) == SUBREG)
206 if (GET_CODE (SUBREG_REG (op)) != REG)
207 return register_operand (op, mode);
209 op = SUBREG_REG (op);
212 if (GET_CODE (op) != REG)
215 return GPR_OR_PSEUDO_P (REGNO (op));
218 ;; Return true if operand is something that can be an input for a move
221 (define_predicate "move_source_operand"
222 (match_code "reg,subreg,const_int,mem,const_double,const,symbol_ref,label_ref")
227 switch (GET_CODE (op))
234 return immediate_operand (op, mode);
237 if (GET_MODE (op) != mode && mode != VOIDmode)
240 subreg = SUBREG_REG (op);
241 code = GET_CODE (subreg);
243 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
244 reload_completed, FALSE, FALSE);
246 return (code == REG);
249 if (GET_MODE (op) != mode && mode != VOIDmode)
255 return frv_legitimate_memory_operand (op, mode, FALSE);
261 ;; Return true if operand is something that can be an output for a
264 (define_predicate "move_destination_operand"
265 (match_code "reg,subreg,mem")
270 switch (GET_CODE (op))
276 if (GET_MODE (op) != mode && mode != VOIDmode)
279 subreg = SUBREG_REG (op);
280 code = GET_CODE (subreg);
282 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
283 reload_completed, FALSE, FALSE);
285 return (code == REG);
288 if (GET_MODE (op) != mode && mode != VOIDmode)
294 return frv_legitimate_memory_operand (op, mode, FALSE);
300 ;; Return true if we the operand is a valid destination for a movcc_fp
301 ;; instruction. This means rejecting fcc_operands, since we need
302 ;; scratch registers to write to them.
304 (define_predicate "movcc_fp_destination_operand"
305 (match_code "reg,subreg,mem")
307 if (fcc_operand (op, mode))
310 return move_destination_operand (op, mode);
313 ;; Return true if operand is something that can be an input for a
314 ;; conditional move operation.
316 (define_predicate "condexec_source_operand"
317 (match_code "reg,subreg,const_int,mem,const_double")
322 switch (GET_CODE (op))
332 if (GET_MODE (op) != mode && mode != VOIDmode)
335 subreg = SUBREG_REG (op);
336 code = GET_CODE (subreg);
338 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
339 reload_completed, TRUE, FALSE);
341 return (code == REG);
344 if (GET_MODE (op) != mode && mode != VOIDmode)
350 return frv_legitimate_memory_operand (op, mode, TRUE);
356 ;; Return true if operand is something that can be an output for a
357 ;; conditional move operation.
359 (define_predicate "condexec_dest_operand"
360 (match_code "reg,subreg,mem")
365 switch (GET_CODE (op))
371 if (GET_MODE (op) != mode && mode != VOIDmode)
374 subreg = SUBREG_REG (op);
375 code = GET_CODE (subreg);
377 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
378 reload_completed, TRUE, FALSE);
380 return (code == REG);
383 if (GET_MODE (op) != mode && mode != VOIDmode)
389 return frv_legitimate_memory_operand (op, mode, TRUE);
395 ;; Return true if operand is a register of any flavor or a 0 of the
398 (define_predicate "reg_or_0_operand"
399 (match_code "reg,subreg,const_int,const_double")
401 switch (GET_CODE (op))
408 if (GET_MODE (op) != mode && mode != VOIDmode)
411 return register_operand (op, mode);
421 ;; Return true if operand is the link register.
423 (define_predicate "lr_operand"
426 if (GET_CODE (op) != REG)
429 if (GET_MODE (op) != mode && mode != VOIDmode)
432 if (REGNO (op) != LR_REGNO && REGNO (op) < FIRST_PSEUDO_REGISTER)
438 ;; Return true if operand is a gpr register or a valid memory operand.
440 (define_predicate "gpr_or_memory_operand"
441 (match_code "reg,subreg,mem")
443 return (integer_register_operand (op, mode)
444 || frv_legitimate_memory_operand (op, mode, FALSE));
447 ;; Return true if operand is a gpr register, a valid memory operand,
448 ;; or a memory operand that can be made valid using an additional gpr
451 (define_predicate "gpr_or_memory_operand_with_scratch"
452 (match_code "reg,subreg,mem")
456 if (gpr_or_memory_operand (op, mode))
459 if (GET_CODE (op) != MEM)
462 if (GET_MODE (op) != mode)
467 if (GET_CODE (addr) != PLUS)
470 if (!integer_register_operand (XEXP (addr, 0), Pmode))
473 if (GET_CODE (XEXP (addr, 1)) != CONST_INT)
479 ;; Return true if operand is a fpr register or a valid memory
482 (define_predicate "fpr_or_memory_operand"
483 (match_code "reg,subreg,mem")
485 return (fpr_operand (op, mode)
486 || frv_legitimate_memory_operand (op, mode, FALSE));
489 ;; Return 1 if operand is a 12 bit signed immediate.
491 (define_predicate "int12_operand"
492 (match_code "const_int")
494 if (GET_CODE (op) != CONST_INT)
497 return IN_RANGE_P (INTVAL (op), -2048, 2047);
500 ;; Return 1 if operand is an integer constant that takes 2
501 ;; instructions to load up and can be split into sethi/setlo
504 (define_predicate "int_2word_operand"
505 (match_code "const_int,const_double,symbol_ref,label_ref,const")
511 switch (GET_CODE (op))
520 return (flag_pic == 0);
523 if (flag_pic || TARGET_FDPIC)
527 if (GET_CODE (op) == PLUS && GET_CODE (XEXP (op, 1)) == CONST_INT)
529 return GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF;
535 /* small data references are already 1 word */
536 return (flag_pic == 0) && (! SYMBOL_REF_SMALL_P (op));
539 return ! IN_RANGE_P (INTVAL (op), -32768, 32767);
542 if (GET_MODE (op) == SFmode)
544 REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
545 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
547 return ! IN_RANGE_P (value, -32768, 32767);
549 else if (GET_MODE (op) == VOIDmode)
551 value = CONST_DOUBLE_LOW (op);
552 return ! IN_RANGE_P (value, -32768, 32767);
560 ;; Return true if operand is the uClinux PIC register.
562 (define_predicate "fdpic_operand"
568 if (GET_CODE (op) != REG)
571 if (GET_MODE (op) != mode && mode != VOIDmode)
574 if (REGNO (op) != FDPIC_REGNO && REGNO (op) < FIRST_PSEUDO_REGISTER)
580 ;; TODO: Add a comment here.
582 (define_predicate "fdpic_fptr_operand"
585 if (GET_MODE (op) != mode && mode != VOIDmode)
587 if (GET_CODE (op) != REG)
589 if (REGNO (op) != FDPIC_FPTR_REGNO && REGNO (op) < FIRST_PSEUDO_REGISTER)
594 ;; An address operand that may use a pair of registers, an addressing
595 ;; mode that we reject in general.
597 (define_predicate "ldd_address_operand"
598 (match_code "reg,subreg,plus")
600 if (GET_MODE (op) != mode && GET_MODE (op) != VOIDmode)
603 return frv_legitimate_address_p (DImode, op, reload_completed, FALSE, TRUE);
606 ;; TODO: Add a comment here.
608 (define_predicate "got12_operand"
611 struct frv_unspec unspec;
613 if (frv_const_unspec_p (op, &unspec))
614 switch (unspec.reloc)
618 case R_FRV_FUNCDESC_GOT12:
619 case R_FRV_FUNCDESC_GOTOFF12:
621 case R_FRV_TLSMOFF12:
627 ;; Return true if OP is a valid const-unspec expression.
629 (define_predicate "const_unspec_operand"
632 struct frv_unspec unspec;
634 return frv_const_unspec_p (op, &unspec);
637 ;; Return true if operand is an icc register.
639 (define_predicate "icc_operand"
644 if (GET_MODE (op) != mode && mode != VOIDmode)
647 if (GET_CODE (op) != REG)
651 return ICC_OR_PSEUDO_P (regno);
654 ;; Return true if operand is an fcc register.
656 (define_predicate "fcc_operand"
661 if (GET_MODE (op) != mode && mode != VOIDmode)
664 if (GET_CODE (op) != REG)
668 return FCC_OR_PSEUDO_P (regno);
671 ;; Return true if operand is either an fcc or icc register.
673 (define_predicate "cc_operand"
678 if (GET_MODE (op) != mode && mode != VOIDmode)
681 if (GET_CODE (op) != REG)
685 if (CC_OR_PSEUDO_P (regno))
691 ;; Return true if operand is an integer CCR register.
693 (define_predicate "icr_operand"
698 if (GET_MODE (op) != mode && mode != VOIDmode)
701 if (GET_CODE (op) != REG)
705 return ICR_OR_PSEUDO_P (regno);
708 ;; Return true if operand is an fcc register.
710 (define_predicate "fcr_operand"
715 if (GET_MODE (op) != mode && mode != VOIDmode)
718 if (GET_CODE (op) != REG)
722 return FCR_OR_PSEUDO_P (regno);
725 ;; Return true if operand is either an fcc or icc register.
727 (define_predicate "cr_operand"
732 if (GET_MODE (op) != mode && mode != VOIDmode)
735 if (GET_CODE (op) != REG)
739 if (CR_OR_PSEUDO_P (regno))
745 ;; Return true if operand is a FPR register.
747 (define_predicate "fpr_operand"
748 (match_code "reg,subreg")
750 if (GET_MODE (op) != mode && mode != VOIDmode)
753 if (GET_CODE (op) == SUBREG)
755 if (GET_CODE (SUBREG_REG (op)) != REG)
756 return register_operand (op, mode);
758 op = SUBREG_REG (op);
761 if (GET_CODE (op) != REG)
764 return FPR_OR_PSEUDO_P (REGNO (op));
767 ;; Return true if operand is an even GPR or FPR register.
769 (define_predicate "even_reg_operand"
770 (match_code "reg,subreg")
774 if (GET_MODE (op) != mode && mode != VOIDmode)
777 if (GET_CODE (op) == SUBREG)
779 if (GET_CODE (SUBREG_REG (op)) != REG)
780 return register_operand (op, mode);
782 op = SUBREG_REG (op);
785 if (GET_CODE (op) != REG)
789 if (regno >= FIRST_PSEUDO_REGISTER)
793 return (((regno - GPR_FIRST) & 1) == 0);
796 return (((regno - FPR_FIRST) & 1) == 0);
801 ;; Return true if operand is an odd GPR register.
803 (define_predicate "odd_reg_operand"
804 (match_code "reg,subreg")
808 if (GET_MODE (op) != mode && mode != VOIDmode)
811 if (GET_CODE (op) == SUBREG)
813 if (GET_CODE (SUBREG_REG (op)) != REG)
814 return register_operand (op, mode);
816 op = SUBREG_REG (op);
819 if (GET_CODE (op) != REG)
823 /* Assume that reload will give us an even register. */
824 if (regno >= FIRST_PSEUDO_REGISTER)
828 return (((regno - GPR_FIRST) & 1) != 0);
831 return (((regno - FPR_FIRST) & 1) != 0);
836 ;; Return true if operand is an even GPR register.
838 (define_predicate "even_gpr_operand"
839 (match_code "reg,subreg")
843 if (GET_MODE (op) != mode && mode != VOIDmode)
846 if (GET_CODE (op) == SUBREG)
848 if (GET_CODE (SUBREG_REG (op)) != REG)
849 return register_operand (op, mode);
851 op = SUBREG_REG (op);
854 if (GET_CODE (op) != REG)
858 if (regno >= FIRST_PSEUDO_REGISTER)
864 return (((regno - GPR_FIRST) & 1) == 0);
867 ;; Return true if operand is an odd GPR register.
869 (define_predicate "odd_gpr_operand"
870 (match_code "reg,subreg")
874 if (GET_MODE (op) != mode && mode != VOIDmode)
877 if (GET_CODE (op) == SUBREG)
879 if (GET_CODE (SUBREG_REG (op)) != REG)
880 return register_operand (op, mode);
882 op = SUBREG_REG (op);
885 if (GET_CODE (op) != REG)
889 /* Assume that reload will give us an even register. */
890 if (regno >= FIRST_PSEUDO_REGISTER)
896 return (((regno - GPR_FIRST) & 1) != 0);
899 ;; Return true if operand is a quad aligned FPR register.
901 (define_predicate "quad_fpr_operand"
902 (match_code "reg,subreg")
906 if (GET_MODE (op) != mode && mode != VOIDmode)
909 if (GET_CODE (op) == SUBREG)
911 if (GET_CODE (SUBREG_REG (op)) != REG)
912 return register_operand (op, mode);
914 op = SUBREG_REG (op);
917 if (GET_CODE (op) != REG)
921 if (regno >= FIRST_PSEUDO_REGISTER)
927 return (((regno - FPR_FIRST) & 3) == 0);
930 ;; Return true if operand is an even FPR register.
932 (define_predicate "even_fpr_operand"
933 (match_code "reg,subreg")
937 if (GET_MODE (op) != mode && mode != VOIDmode)
940 if (GET_CODE (op) == SUBREG)
942 if (GET_CODE (SUBREG_REG (op)) != REG)
943 return register_operand (op, mode);
945 op = SUBREG_REG (op);
948 if (GET_CODE (op) != REG)
952 if (regno >= FIRST_PSEUDO_REGISTER)
958 return (((regno - FPR_FIRST) & 1) == 0);
961 ;; Return true if operand is an odd FPR register.
963 (define_predicate "odd_fpr_operand"
964 (match_code "reg,subreg")
968 if (GET_MODE (op) != mode && mode != VOIDmode)
971 if (GET_CODE (op) == SUBREG)
973 if (GET_CODE (SUBREG_REG (op)) != REG)
974 return register_operand (op, mode);
976 op = SUBREG_REG (op);
979 if (GET_CODE (op) != REG)
983 /* Assume that reload will give us an even register. */
984 if (regno >= FIRST_PSEUDO_REGISTER)
990 return (((regno - FPR_FIRST) & 1) != 0);
993 ;; Return true if operand is a 2 word memory address that can be
994 ;; loaded in one instruction to load or store. We assume the stack
995 ;; and frame pointers are suitably aligned, and variables in the small
996 ;; data area. FIXME -- at some we should recognize other globals and
997 ;; statics. We can't assume that any old pointer is aligned, given
998 ;; that arguments could be passed on an odd word on the stack and the
999 ;; address taken and passed through to another function.
1001 (define_predicate "dbl_memory_one_insn_operand"
1010 if (GET_CODE (op) != MEM)
1013 if (mode != VOIDmode && GET_MODE_SIZE (mode) != 2*UNITS_PER_WORD)
1016 addr = XEXP (op, 0);
1017 if (GET_CODE (addr) == REG)
1020 else if (GET_CODE (addr) == PLUS)
1022 rtx addr0 = XEXP (addr, 0);
1023 rtx addr1 = XEXP (addr, 1);
1025 if (GET_CODE (addr0) != REG)
1028 if (got12_operand (addr1, VOIDmode))
1031 if (GET_CODE (addr1) != CONST_INT)
1034 if ((INTVAL (addr1) & 7) != 0)
1043 if (addr_reg == frame_pointer_rtx || addr_reg == stack_pointer_rtx)
1049 ;; Return true if operand is a 2 word memory address that needs to use
1050 ;; two instructions to load or store.
1052 (define_predicate "dbl_memory_two_insn_operand"
1055 if (GET_CODE (op) != MEM)
1058 if (mode != VOIDmode && GET_MODE_SIZE (mode) != 2*UNITS_PER_WORD)
1064 return ! dbl_memory_one_insn_operand (op, mode);
1067 ;; Return true if operand is a memory reference suitable for a call.
1069 (define_predicate "call_operand"
1070 (match_code "reg,subreg,const_int,const,symbol_ref")
1072 if (GET_MODE (op) != mode && mode != VOIDmode && GET_CODE (op) != CONST_INT)
1075 if (GET_CODE (op) == SYMBOL_REF)
1076 return !TARGET_LONG_CALLS || SYMBOL_REF_LOCAL_P (op);
1078 /* Note this doesn't allow reg+reg or reg+imm12 addressing (which should
1079 never occur anyway), but prevents reload from not handling the case
1080 properly of a call through a pointer on a function that calls
1081 vfork/setjmp, etc. due to the need to flush all of the registers to stack. */
1082 return gpr_or_int12_operand (op, mode);
1085 ;; Return true if operand is a memory reference suitable for a
1088 (define_predicate "sibcall_operand"
1089 (match_code "reg,subreg,const_int,const")
1091 if (GET_MODE (op) != mode && mode != VOIDmode && GET_CODE (op) != CONST_INT)
1094 /* Note this doesn't allow reg+reg or reg+imm12 addressing (which should
1095 never occur anyway), but prevents reload from not handling the case
1096 properly of a call through a pointer on a function that calls
1097 vfork/setjmp, etc. due to the need to flush all of the registers to stack. */
1098 return gpr_or_int12_operand (op, mode);
1101 ;; Return 1 if operand is an integer constant with the bottom 16 bits
1104 (define_predicate "upper_int16_operand"
1105 (match_code "const_int")
1107 if (GET_CODE (op) != CONST_INT)
1110 return ((INTVAL (op) & 0xffff) == 0);
1113 ;; Return 1 if operand is a 16 bit unsigned immediate.
1115 (define_predicate "uint16_operand"
1116 (match_code "const_int")
1118 if (GET_CODE (op) != CONST_INT)
1121 return IN_RANGE_P (INTVAL (op), 0, 0xffff);
1124 ;; Returns 1 if OP is either a SYMBOL_REF or a constant.
1126 (define_predicate "symbolic_operand"
1127 (match_code "symbol_ref,const_int")
1129 enum rtx_code c = GET_CODE (op);
1133 /* Allow (const:SI (plus:SI (symbol_ref) (const_int))). */
1134 return GET_MODE (op) == SImode
1135 && GET_CODE (XEXP (op, 0)) == PLUS
1136 && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
1137 && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT;
1140 return c == SYMBOL_REF || c == CONST_INT;
1143 ;; Return true if operator is a kind of relational operator.
1145 (define_predicate "relational_operator"
1146 (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu")
1148 return (integer_relational_operator (op, mode)
1149 || float_relational_operator (op, mode));
1152 ;; Return true if OP is a relational operator suitable for CCmode,
1153 ;; CC_UNSmode or CC_NZmode.
1155 (define_predicate "integer_relational_operator"
1156 (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu")
1158 if (mode != VOIDmode && mode != GET_MODE (op))
1161 /* The allowable relations depend on the mode of the ICC register. */
1162 switch (GET_CODE (op))
1171 return (GET_MODE (XEXP (op, 0)) == CC_NZmode
1172 || GET_MODE (XEXP (op, 0)) == CCmode);
1176 return GET_MODE (XEXP (op, 0)) == CCmode;
1182 return (GET_MODE (XEXP (op, 0)) == CC_NZmode
1183 || GET_MODE (XEXP (op, 0)) == CC_UNSmode);
1187 ;; Return true if operator is a floating point relational operator.
1189 (define_predicate "float_relational_operator"
1190 (match_code "eq,ne,le,lt,ge,gt")
1192 if (mode != VOIDmode && mode != GET_MODE (op))
1195 switch (GET_CODE (op))
1210 return GET_MODE (XEXP (op, 0)) == CC_FPmode;
1214 ;; Return true if operator is EQ/NE of a conditional execution
1217 (define_predicate "ccr_eqne_operator"
1218 (match_code "eq,ne")
1220 enum machine_mode op_mode = GET_MODE (op);
1225 if (mode != VOIDmode && op_mode != mode)
1228 switch (GET_CODE (op))
1239 if (op1 != const0_rtx)
1243 if (GET_CODE (op0) != REG)
1246 regno = REGNO (op0);
1247 if (op_mode == CC_CCRmode && CR_OR_PSEUDO_P (regno))
1253 ;; Return true if operator is a minimum or maximum operator (both
1254 ;; signed and unsigned).
1256 (define_predicate "minmax_operator"
1257 (match_code "smin,smax,umin,umax")
1259 if (mode != VOIDmode && mode != GET_MODE (op))
1262 switch (GET_CODE (op))
1274 if (! integer_register_operand (XEXP (op, 0), mode))
1277 if (! gpr_or_int10_operand (XEXP (op, 1), mode))
1283 ;; Return true if operator is an integer binary operator that can
1284 ;; executed conditionally and takes 1 cycle.
1286 (define_predicate "condexec_si_binary_operator"
1287 (match_code "plus,minus,and,ior,xor,ashift,ashiftrt,lshiftrt")
1289 enum machine_mode op_mode = GET_MODE (op);
1291 if (mode != VOIDmode && op_mode != mode)
1294 switch (GET_CODE (op))
1311 ;; Return true if operator is an integer binary operator that can be
1312 ;; executed conditionally by a media instruction.
1314 (define_predicate "condexec_si_media_operator"
1315 (match_code "and,ior,xor")
1317 enum machine_mode op_mode = GET_MODE (op);
1319 if (mode != VOIDmode && op_mode != mode)
1322 switch (GET_CODE (op))
1334 ;; Return true if operator is an integer division operator that can
1335 ;; executed conditionally.
1337 (define_predicate "condexec_si_divide_operator"
1338 (match_code "div,udiv")
1340 enum machine_mode op_mode = GET_MODE (op);
1342 if (mode != VOIDmode && op_mode != mode)
1345 switch (GET_CODE (op))
1356 ;; Return true if operator is an integer unary operator that can
1357 ;; executed conditionally.
1359 (define_predicate "condexec_si_unary_operator"
1360 (match_code "not,neg")
1362 enum machine_mode op_mode = GET_MODE (op);
1364 if (mode != VOIDmode && op_mode != mode)
1367 switch (GET_CODE (op))
1378 ;; Return true if operator is an addition or subtraction
1379 ;; expression. Such expressions can be evaluated conditionally by
1380 ;; floating-point instructions.
1382 (define_predicate "condexec_sf_add_operator"
1383 (match_code "plus,minus")
1385 enum machine_mode op_mode = GET_MODE (op);
1387 if (mode != VOIDmode && op_mode != mode)
1390 switch (GET_CODE (op))
1401 ;; Return true if operator is a conversion-type expression that can be
1402 ;; evaluated conditionally by floating-point instructions.
1404 (define_predicate "condexec_sf_conv_operator"
1405 (match_code "abs,neg")
1407 enum machine_mode op_mode = GET_MODE (op);
1409 if (mode != VOIDmode && op_mode != mode)
1412 switch (GET_CODE (op))
1423 ;; Return true if OP is an integer binary operator that can be
1424 ;; combined with a (set ... (compare:CC_NZ ...)) pattern.
1426 (define_predicate "intop_compare_operator"
1427 (match_code "plus,minus,and,ior,xor,ashift,ashiftrt,lshiftrt")
1429 if (mode != VOIDmode && GET_MODE (op) != mode)
1432 switch (GET_CODE (op))
1444 return GET_MODE (op) == SImode;
1448 ;; Return 1 if operand is a register or 6 bit signed immediate.
1450 (define_predicate "fpr_or_int6_operand"
1451 (match_code "reg,subreg,const_int")
1453 if (GET_CODE (op) == CONST_INT)
1454 return IN_RANGE_P (INTVAL (op), -32, 31);
1456 if (GET_MODE (op) != mode && mode != VOIDmode)
1459 if (GET_CODE (op) == SUBREG)
1461 if (GET_CODE (SUBREG_REG (op)) != REG)
1462 return register_operand (op, mode);
1464 op = SUBREG_REG (op);
1467 if (GET_CODE (op) != REG)
1470 return FPR_OR_PSEUDO_P (REGNO (op));
1473 ;; Return 1 if operand is a 6 bit signed immediate.
1475 (define_predicate "int6_operand"
1476 (match_code "const_int")
1478 if (GET_CODE (op) != CONST_INT)
1481 return IN_RANGE_P (INTVAL (op), -32, 31);
1484 ;; Return 1 if operand is a 5 bit signed immediate.
1486 (define_predicate "int5_operand"
1487 (match_code "const_int")
1489 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), -16, 15);
1492 ;; Return 1 if operand is a 5 bit unsigned immediate.
1494 (define_predicate "uint5_operand"
1495 (match_code "const_int")
1497 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), 0, 31);
1500 ;; Return 1 if operand is a 4 bit unsigned immediate.
1502 (define_predicate "uint4_operand"
1503 (match_code "const_int")
1505 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), 0, 15);
1508 ;; Return 1 if operand is a 1 bit unsigned immediate (0 or 1).
1510 (define_predicate "uint1_operand"
1511 (match_code "const_int")
1513 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), 0, 1);
1516 ;; Return 1 if operand is a valid ACC register number.
1518 (define_predicate "acc_operand"
1519 (match_code "reg,subreg")
1521 return ((mode == VOIDmode || mode == GET_MODE (op))
1522 && REG_P (op) && ACC_P (REGNO (op))
1523 && ((REGNO (op) - ACC_FIRST) & ~ACC_MASK) == 0);
1526 ;; Return 1 if operand is a valid even ACC register number.
1528 (define_predicate "even_acc_operand"
1529 (match_code "reg,subreg")
1531 return acc_operand (op, mode) && ((REGNO (op) - ACC_FIRST) & 1) == 0;
1534 ;; Return 1 if operand is zero or four.
1536 (define_predicate "quad_acc_operand"
1537 (match_code "reg,subreg")
1539 return acc_operand (op, mode) && ((REGNO (op) - ACC_FIRST) & 3) == 0;
1542 ;; Return 1 if operand is a valid ACCG register number.
1544 (define_predicate "accg_operand"
1545 (match_code "reg,subreg")
1547 return ((mode == VOIDmode || mode == GET_MODE (op))
1548 && REG_P (op) && ACCG_P (REGNO (op))
1549 && ((REGNO (op) - ACCG_FIRST) & ~ACC_MASK) == 0);