1 ;; Predicate definitions for Frv.
2 ;; Copyright (C) 2005, 2007 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 3, 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 COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
20 ;; Return true if operand is a GPR register.
22 (define_predicate "integer_register_operand"
23 (match_code "reg,subreg")
25 if (GET_MODE (op) != mode && mode != VOIDmode)
28 if (GET_CODE (op) == SUBREG)
30 if (GET_CODE (SUBREG_REG (op)) != REG)
31 return register_operand (op, mode);
36 if (GET_CODE (op) != REG)
39 return GPR_AP_OR_PSEUDO_P (REGNO (op));
42 ;; Return 1 is OP is a memory operand, or will be turned into one by
45 (define_predicate "frv_load_operand"
46 (match_code "reg,subreg,mem")
48 if (GET_MODE (op) != mode && mode != VOIDmode)
51 if (reload_in_progress)
54 if (GET_CODE (tmp) == SUBREG)
55 tmp = SUBREG_REG (tmp);
56 if (GET_CODE (tmp) == REG
57 && REGNO (tmp) >= FIRST_PSEUDO_REGISTER)
58 op = reg_equiv_memory_loc[REGNO (tmp)];
61 return op && memory_operand (op, mode);
64 ;; Return true if operand is a GPR register. Do not allow SUBREG's
65 ;; here, in order to prevent a combine bug.
67 (define_predicate "gpr_no_subreg_operand"
70 if (GET_MODE (op) != mode && mode != VOIDmode)
73 if (GET_CODE (op) != REG)
76 return GPR_OR_PSEUDO_P (REGNO (op));
79 ;; Return 1 if operand is a GPR register or a FPR register.
81 (define_predicate "gpr_or_fpr_operand"
82 (match_code "reg,subreg")
86 if (GET_MODE (op) != mode && mode != VOIDmode)
89 if (GET_CODE (op) == SUBREG)
91 if (GET_CODE (SUBREG_REG (op)) != REG)
92 return register_operand (op, mode);
97 if (GET_CODE (op) != REG)
101 if (GPR_P (regno) || FPR_P (regno) || regno >= FIRST_PSEUDO_REGISTER)
107 ;; Return 1 if operand is a GPR register or 12-bit signed immediate.
109 (define_predicate "gpr_or_int12_operand"
110 (match_code "reg,subreg,const_int,const")
112 if (GET_CODE (op) == CONST_INT)
113 return IN_RANGE_P (INTVAL (op), -2048, 2047);
115 if (got12_operand (op, mode))
118 if (GET_MODE (op) != mode && mode != VOIDmode)
121 if (GET_CODE (op) == SUBREG)
123 if (GET_CODE (SUBREG_REG (op)) != REG)
124 return register_operand (op, mode);
126 op = SUBREG_REG (op);
129 if (GET_CODE (op) != REG)
132 return GPR_OR_PSEUDO_P (REGNO (op));
135 ;; Return 1 if operand is a GPR register, or a FPR register, or a 12
136 ;; bit signed immediate.
138 (define_predicate "gpr_fpr_or_int12_operand"
139 (match_code "reg,subreg,const_int")
143 if (GET_CODE (op) == CONST_INT)
144 return IN_RANGE_P (INTVAL (op), -2048, 2047);
146 if (GET_MODE (op) != mode && mode != VOIDmode)
149 if (GET_CODE (op) == SUBREG)
151 if (GET_CODE (SUBREG_REG (op)) != REG)
152 return register_operand (op, mode);
154 op = SUBREG_REG (op);
157 if (GET_CODE (op) != REG)
161 if (GPR_P (regno) || FPR_P (regno) || regno >= FIRST_PSEUDO_REGISTER)
167 ;; Return 1 if operand is a register or 10-bit signed immediate.
169 (define_predicate "gpr_or_int10_operand"
170 (match_code "reg,subreg,const_int")
172 if (GET_CODE (op) == CONST_INT)
173 return IN_RANGE_P (INTVAL (op), -512, 511);
175 if (GET_MODE (op) != mode && mode != VOIDmode)
178 if (GET_CODE (op) == SUBREG)
180 if (GET_CODE (SUBREG_REG (op)) != REG)
181 return register_operand (op, mode);
183 op = SUBREG_REG (op);
186 if (GET_CODE (op) != REG)
189 return GPR_OR_PSEUDO_P (REGNO (op));
192 ;; Return 1 if operand is a register or an integer immediate.
194 (define_predicate "gpr_or_int_operand"
195 (match_code "reg,subreg,const_int")
197 if (GET_CODE (op) == CONST_INT)
200 if (GET_MODE (op) != mode && mode != VOIDmode)
203 if (GET_CODE (op) == SUBREG)
205 if (GET_CODE (SUBREG_REG (op)) != REG)
206 return register_operand (op, mode);
208 op = SUBREG_REG (op);
211 if (GET_CODE (op) != REG)
214 return GPR_OR_PSEUDO_P (REGNO (op));
217 ;; Return true if operand is something that can be an input for a move
220 (define_predicate "move_source_operand"
221 (match_code "reg,subreg,const_int,mem,const_double,const,symbol_ref,label_ref")
226 switch (GET_CODE (op))
233 return immediate_operand (op, mode);
236 if (GET_MODE (op) != mode && mode != VOIDmode)
239 subreg = SUBREG_REG (op);
240 code = GET_CODE (subreg);
242 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
243 reload_completed, FALSE, FALSE);
245 return (code == REG);
248 if (GET_MODE (op) != mode && mode != VOIDmode)
254 return frv_legitimate_memory_operand (op, mode, FALSE);
260 ;; Return true if operand is something that can be an output for a
263 (define_predicate "move_destination_operand"
264 (match_code "reg,subreg,mem")
269 switch (GET_CODE (op))
275 if (GET_MODE (op) != mode && mode != VOIDmode)
278 subreg = SUBREG_REG (op);
279 code = GET_CODE (subreg);
281 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
282 reload_completed, FALSE, FALSE);
284 return (code == REG);
287 if (GET_MODE (op) != mode && mode != VOIDmode)
293 return frv_legitimate_memory_operand (op, mode, FALSE);
299 ;; Return true if we the operand is a valid destination for a movcc_fp
300 ;; instruction. This means rejecting fcc_operands, since we need
301 ;; scratch registers to write to them.
303 (define_predicate "movcc_fp_destination_operand"
304 (match_code "reg,subreg,mem")
306 if (fcc_operand (op, mode))
309 return move_destination_operand (op, mode);
312 ;; Return true if operand is something that can be an input for a
313 ;; conditional move operation.
315 (define_predicate "condexec_source_operand"
316 (match_code "reg,subreg,const_int,mem,const_double")
321 switch (GET_CODE (op))
331 if (GET_MODE (op) != mode && mode != VOIDmode)
334 subreg = SUBREG_REG (op);
335 code = GET_CODE (subreg);
337 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
338 reload_completed, TRUE, FALSE);
340 return (code == REG);
343 if (GET_MODE (op) != mode && mode != VOIDmode)
349 return frv_legitimate_memory_operand (op, mode, TRUE);
355 ;; Return true if operand is something that can be an output for a
356 ;; conditional move operation.
358 (define_predicate "condexec_dest_operand"
359 (match_code "reg,subreg,mem")
364 switch (GET_CODE (op))
370 if (GET_MODE (op) != mode && mode != VOIDmode)
373 subreg = SUBREG_REG (op);
374 code = GET_CODE (subreg);
376 return frv_legitimate_address_p (mode, XEXP (subreg, 0),
377 reload_completed, TRUE, FALSE);
379 return (code == REG);
382 if (GET_MODE (op) != mode && mode != VOIDmode)
388 return frv_legitimate_memory_operand (op, mode, TRUE);
394 ;; Return true if operand is a register of any flavor or a 0 of the
397 (define_predicate "reg_or_0_operand"
398 (match_code "reg,subreg,const_int,const_double")
400 switch (GET_CODE (op))
407 if (GET_MODE (op) != mode && mode != VOIDmode)
410 return register_operand (op, mode);
420 ;; Return true if operand is the link register.
422 (define_predicate "lr_operand"
425 if (GET_CODE (op) != REG)
428 if (GET_MODE (op) != mode && mode != VOIDmode)
431 if (REGNO (op) != LR_REGNO && REGNO (op) < FIRST_PSEUDO_REGISTER)
437 ;; Return true if operand is a gpr register or a valid memory operand.
439 (define_predicate "gpr_or_memory_operand"
440 (match_code "reg,subreg,mem")
442 return (integer_register_operand (op, mode)
443 || frv_legitimate_memory_operand (op, mode, FALSE));
446 ;; Return true if operand is a gpr register, a valid memory operand,
447 ;; or a memory operand that can be made valid using an additional gpr
450 (define_predicate "gpr_or_memory_operand_with_scratch"
451 (match_code "reg,subreg,mem")
455 if (gpr_or_memory_operand (op, mode))
458 if (GET_CODE (op) != MEM)
461 if (GET_MODE (op) != mode)
466 if (GET_CODE (addr) != PLUS)
469 if (!integer_register_operand (XEXP (addr, 0), Pmode))
472 if (GET_CODE (XEXP (addr, 1)) != CONST_INT)
478 ;; Return true if operand is a fpr register or a valid memory
481 (define_predicate "fpr_or_memory_operand"
482 (match_code "reg,subreg,mem")
484 return (fpr_operand (op, mode)
485 || frv_legitimate_memory_operand (op, mode, FALSE));
488 ;; Return 1 if operand is a 12-bit signed immediate.
490 (define_predicate "int12_operand"
491 (match_code "const_int")
493 if (GET_CODE (op) != CONST_INT)
496 return IN_RANGE_P (INTVAL (op), -2048, 2047);
499 ;; Return 1 if operand is an integer constant that takes 2
500 ;; instructions to load up and can be split into sethi/setlo
503 (define_predicate "int_2word_operand"
504 (match_code "const_int,const_double,symbol_ref,label_ref,const")
510 switch (GET_CODE (op))
519 return (flag_pic == 0);
522 if (flag_pic || TARGET_FDPIC)
526 if (GET_CODE (op) == PLUS && GET_CODE (XEXP (op, 1)) == CONST_INT)
528 return GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF;
534 /* small data references are already 1 word */
535 return (flag_pic == 0) && (! SYMBOL_REF_SMALL_P (op));
538 return ! IN_RANGE_P (INTVAL (op), -32768, 32767);
541 if (GET_MODE (op) == SFmode)
543 REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
544 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
546 return ! IN_RANGE_P (value, -32768, 32767);
548 else if (GET_MODE (op) == VOIDmode)
550 value = CONST_DOUBLE_LOW (op);
551 return ! IN_RANGE_P (value, -32768, 32767);
559 ;; Return true if operand is the uClinux PIC register.
561 (define_predicate "fdpic_operand"
567 if (GET_CODE (op) != REG)
570 if (GET_MODE (op) != mode && mode != VOIDmode)
573 if (REGNO (op) != FDPIC_REGNO && REGNO (op) < FIRST_PSEUDO_REGISTER)
579 ;; TODO: Add a comment here.
581 (define_predicate "fdpic_fptr_operand"
584 if (GET_MODE (op) != mode && mode != VOIDmode)
586 if (GET_CODE (op) != REG)
588 if (REGNO (op) != FDPIC_FPTR_REGNO && REGNO (op) < FIRST_PSEUDO_REGISTER)
593 ;; An address operand that may use a pair of registers, an addressing
594 ;; mode that we reject in general.
596 (define_predicate "ldd_address_operand"
597 (match_code "reg,subreg,plus")
599 if (GET_MODE (op) != mode && GET_MODE (op) != VOIDmode)
602 return frv_legitimate_address_p (DImode, op, reload_completed, FALSE, TRUE);
605 ;; TODO: Add a comment here.
607 (define_predicate "got12_operand"
610 struct frv_unspec unspec;
612 if (frv_const_unspec_p (op, &unspec))
613 switch (unspec.reloc)
617 case R_FRV_FUNCDESC_GOT12:
618 case R_FRV_FUNCDESC_GOTOFF12:
620 case R_FRV_TLSMOFF12:
626 ;; Return true if OP is a valid const-unspec expression.
628 (define_predicate "const_unspec_operand"
631 struct frv_unspec unspec;
633 return frv_const_unspec_p (op, &unspec);
636 ;; Return true if operand is an icc register.
638 (define_predicate "icc_operand"
643 if (GET_MODE (op) != mode && mode != VOIDmode)
646 if (GET_CODE (op) != REG)
650 return ICC_OR_PSEUDO_P (regno);
653 ;; Return true if operand is an fcc register.
655 (define_predicate "fcc_operand"
660 if (GET_MODE (op) != mode && mode != VOIDmode)
663 if (GET_CODE (op) != REG)
667 return FCC_OR_PSEUDO_P (regno);
670 ;; Return true if operand is either an fcc or icc register.
672 (define_predicate "cc_operand"
677 if (GET_MODE (op) != mode && mode != VOIDmode)
680 if (GET_CODE (op) != REG)
684 if (CC_OR_PSEUDO_P (regno))
690 ;; Return true if operand is an integer CCR register.
692 (define_predicate "icr_operand"
697 if (GET_MODE (op) != mode && mode != VOIDmode)
700 if (GET_CODE (op) != REG)
704 return ICR_OR_PSEUDO_P (regno);
707 ;; Return true if operand is an fcc register.
709 (define_predicate "fcr_operand"
714 if (GET_MODE (op) != mode && mode != VOIDmode)
717 if (GET_CODE (op) != REG)
721 return FCR_OR_PSEUDO_P (regno);
724 ;; Return true if operand is either an fcc or icc register.
726 (define_predicate "cr_operand"
731 if (GET_MODE (op) != mode && mode != VOIDmode)
734 if (GET_CODE (op) != REG)
738 if (CR_OR_PSEUDO_P (regno))
744 ;; Return true if operand is a FPR register.
746 (define_predicate "fpr_operand"
747 (match_code "reg,subreg")
749 if (GET_MODE (op) != mode && mode != VOIDmode)
752 if (GET_CODE (op) == SUBREG)
754 if (GET_CODE (SUBREG_REG (op)) != REG)
755 return register_operand (op, mode);
757 op = SUBREG_REG (op);
760 if (GET_CODE (op) != REG)
763 return FPR_OR_PSEUDO_P (REGNO (op));
766 ;; Return true if operand is an even GPR or FPR register.
768 (define_predicate "even_reg_operand"
769 (match_code "reg,subreg")
773 if (GET_MODE (op) != mode && mode != VOIDmode)
776 if (GET_CODE (op) == SUBREG)
778 if (GET_CODE (SUBREG_REG (op)) != REG)
779 return register_operand (op, mode);
781 op = SUBREG_REG (op);
784 if (GET_CODE (op) != REG)
788 if (regno >= FIRST_PSEUDO_REGISTER)
792 return (((regno - GPR_FIRST) & 1) == 0);
795 return (((regno - FPR_FIRST) & 1) == 0);
800 ;; Return true if operand is an odd GPR register.
802 (define_predicate "odd_reg_operand"
803 (match_code "reg,subreg")
807 if (GET_MODE (op) != mode && mode != VOIDmode)
810 if (GET_CODE (op) == SUBREG)
812 if (GET_CODE (SUBREG_REG (op)) != REG)
813 return register_operand (op, mode);
815 op = SUBREG_REG (op);
818 if (GET_CODE (op) != REG)
822 /* Assume that reload will give us an even register. */
823 if (regno >= FIRST_PSEUDO_REGISTER)
827 return (((regno - GPR_FIRST) & 1) != 0);
830 return (((regno - FPR_FIRST) & 1) != 0);
835 ;; Return true if operand is an even GPR register.
837 (define_predicate "even_gpr_operand"
838 (match_code "reg,subreg")
842 if (GET_MODE (op) != mode && mode != VOIDmode)
845 if (GET_CODE (op) == SUBREG)
847 if (GET_CODE (SUBREG_REG (op)) != REG)
848 return register_operand (op, mode);
850 op = SUBREG_REG (op);
853 if (GET_CODE (op) != REG)
857 if (regno >= FIRST_PSEUDO_REGISTER)
863 return (((regno - GPR_FIRST) & 1) == 0);
866 ;; Return true if operand is an odd GPR register.
868 (define_predicate "odd_gpr_operand"
869 (match_code "reg,subreg")
873 if (GET_MODE (op) != mode && mode != VOIDmode)
876 if (GET_CODE (op) == SUBREG)
878 if (GET_CODE (SUBREG_REG (op)) != REG)
879 return register_operand (op, mode);
881 op = SUBREG_REG (op);
884 if (GET_CODE (op) != REG)
888 /* Assume that reload will give us an even register. */
889 if (regno >= FIRST_PSEUDO_REGISTER)
895 return (((regno - GPR_FIRST) & 1) != 0);
898 ;; Return true if operand is a quad aligned FPR register.
900 (define_predicate "quad_fpr_operand"
901 (match_code "reg,subreg")
905 if (GET_MODE (op) != mode && mode != VOIDmode)
908 if (GET_CODE (op) == SUBREG)
910 if (GET_CODE (SUBREG_REG (op)) != REG)
911 return register_operand (op, mode);
913 op = SUBREG_REG (op);
916 if (GET_CODE (op) != REG)
920 if (regno >= FIRST_PSEUDO_REGISTER)
926 return (((regno - FPR_FIRST) & 3) == 0);
929 ;; Return true if operand is an even FPR register.
931 (define_predicate "even_fpr_operand"
932 (match_code "reg,subreg")
936 if (GET_MODE (op) != mode && mode != VOIDmode)
939 if (GET_CODE (op) == SUBREG)
941 if (GET_CODE (SUBREG_REG (op)) != REG)
942 return register_operand (op, mode);
944 op = SUBREG_REG (op);
947 if (GET_CODE (op) != REG)
951 if (regno >= FIRST_PSEUDO_REGISTER)
957 return (((regno - FPR_FIRST) & 1) == 0);
960 ;; Return true if operand is an odd FPR register.
962 (define_predicate "odd_fpr_operand"
963 (match_code "reg,subreg")
967 if (GET_MODE (op) != mode && mode != VOIDmode)
970 if (GET_CODE (op) == SUBREG)
972 if (GET_CODE (SUBREG_REG (op)) != REG)
973 return register_operand (op, mode);
975 op = SUBREG_REG (op);
978 if (GET_CODE (op) != REG)
982 /* Assume that reload will give us an even register. */
983 if (regno >= FIRST_PSEUDO_REGISTER)
989 return (((regno - FPR_FIRST) & 1) != 0);
992 ;; Return true if operand is a 2 word memory address that can be
993 ;; loaded in one instruction to load or store. We assume the stack
994 ;; and frame pointers are suitably aligned, and variables in the small
995 ;; data area. FIXME -- at some we should recognize other globals and
996 ;; statics. We can't assume that any old pointer is aligned, given
997 ;; that arguments could be passed on an odd word on the stack and the
998 ;; address taken and passed through to another function.
1000 (define_predicate "dbl_memory_one_insn_operand"
1009 if (GET_CODE (op) != MEM)
1012 if (mode != VOIDmode && GET_MODE_SIZE (mode) != 2*UNITS_PER_WORD)
1015 addr = XEXP (op, 0);
1016 if (GET_CODE (addr) == REG)
1019 else if (GET_CODE (addr) == PLUS)
1021 rtx addr0 = XEXP (addr, 0);
1022 rtx addr1 = XEXP (addr, 1);
1024 if (GET_CODE (addr0) != REG)
1027 if (got12_operand (addr1, VOIDmode))
1030 if (GET_CODE (addr1) != CONST_INT)
1033 if ((INTVAL (addr1) & 7) != 0)
1042 if (addr_reg == frame_pointer_rtx || addr_reg == stack_pointer_rtx)
1048 ;; Return true if operand is a 2 word memory address that needs to use
1049 ;; two instructions to load or store.
1051 (define_predicate "dbl_memory_two_insn_operand"
1054 if (GET_CODE (op) != MEM)
1057 if (mode != VOIDmode && GET_MODE_SIZE (mode) != 2*UNITS_PER_WORD)
1063 return ! dbl_memory_one_insn_operand (op, mode);
1066 ;; Return true if operand is a memory reference suitable for a call.
1068 (define_predicate "call_operand"
1069 (match_code "reg,subreg,const_int,const,symbol_ref")
1071 if (GET_MODE (op) != mode && mode != VOIDmode && GET_CODE (op) != CONST_INT)
1074 if (GET_CODE (op) == SYMBOL_REF)
1075 return !TARGET_LONG_CALLS || SYMBOL_REF_LOCAL_P (op);
1077 /* Note this doesn't allow reg+reg or reg+imm12 addressing (which should
1078 never occur anyway), but prevents reload from not handling the case
1079 properly of a call through a pointer on a function that calls
1080 vfork/setjmp, etc. due to the need to flush all of the registers to stack. */
1081 return gpr_or_int12_operand (op, mode);
1084 ;; Return true if operand is a memory reference suitable for a
1087 (define_predicate "sibcall_operand"
1088 (match_code "reg,subreg,const_int,const")
1090 if (GET_MODE (op) != mode && mode != VOIDmode && GET_CODE (op) != CONST_INT)
1093 /* Note this doesn't allow reg+reg or reg+imm12 addressing (which should
1094 never occur anyway), but prevents reload from not handling the case
1095 properly of a call through a pointer on a function that calls
1096 vfork/setjmp, etc. due to the need to flush all of the registers to stack. */
1097 return gpr_or_int12_operand (op, mode);
1100 ;; Return 1 if operand is an integer constant with the bottom 16 bits
1103 (define_predicate "upper_int16_operand"
1104 (match_code "const_int")
1106 if (GET_CODE (op) != CONST_INT)
1109 return ((INTVAL (op) & 0xffff) == 0);
1112 ;; Return 1 if operand is a 16-bit unsigned immediate.
1114 (define_predicate "uint16_operand"
1115 (match_code "const_int")
1117 if (GET_CODE (op) != CONST_INT)
1120 return IN_RANGE_P (INTVAL (op), 0, 0xffff);
1123 ;; Returns 1 if OP is either a SYMBOL_REF or a constant.
1125 (define_predicate "symbolic_operand"
1126 (match_code "symbol_ref,const,const_int")
1128 enum rtx_code c = GET_CODE (op);
1132 /* Allow (const:SI (plus:SI (symbol_ref) (const_int))). */
1133 return GET_MODE (op) == SImode
1134 && GET_CODE (XEXP (op, 0)) == PLUS
1135 && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
1136 && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT;
1139 return c == SYMBOL_REF || c == CONST_INT;
1142 ;; Return true if operator is a kind of relational operator.
1144 (define_predicate "relational_operator"
1145 (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu")
1147 return (integer_relational_operator (op, mode)
1148 || float_relational_operator (op, mode));
1151 ;; Return true if OP is a relational operator suitable for CCmode,
1152 ;; CC_UNSmode or CC_NZmode.
1154 (define_predicate "integer_relational_operator"
1155 (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu")
1157 if (mode != VOIDmode && mode != GET_MODE (op))
1160 /* The allowable relations depend on the mode of the ICC register. */
1161 switch (GET_CODE (op))
1170 return (GET_MODE (XEXP (op, 0)) == CC_NZmode
1171 || GET_MODE (XEXP (op, 0)) == CCmode);
1175 return GET_MODE (XEXP (op, 0)) == CCmode;
1181 return (GET_MODE (XEXP (op, 0)) == CC_NZmode
1182 || GET_MODE (XEXP (op, 0)) == CC_UNSmode);
1186 ;; Return true if operator is a floating point relational operator.
1188 (define_predicate "float_relational_operator"
1189 (match_code "eq,ne,le,lt,ge,gt")
1191 if (mode != VOIDmode && mode != GET_MODE (op))
1194 switch (GET_CODE (op))
1209 return GET_MODE (XEXP (op, 0)) == CC_FPmode;
1213 ;; Return true if operator is EQ/NE of a conditional execution
1216 (define_predicate "ccr_eqne_operator"
1217 (match_code "eq,ne")
1219 enum machine_mode op_mode = GET_MODE (op);
1224 if (mode != VOIDmode && op_mode != mode)
1227 switch (GET_CODE (op))
1238 if (op1 != const0_rtx)
1242 if (GET_CODE (op0) != REG)
1245 regno = REGNO (op0);
1246 if (op_mode == CC_CCRmode && CR_OR_PSEUDO_P (regno))
1252 ;; Return true if operator is a minimum or maximum operator (both
1253 ;; signed and unsigned).
1255 (define_predicate "minmax_operator"
1256 (match_code "smin,smax,umin,umax")
1258 if (mode != VOIDmode && mode != GET_MODE (op))
1261 switch (GET_CODE (op))
1276 ;; Return true if operator is an integer binary operator that can
1277 ;; executed conditionally and takes 1 cycle.
1279 (define_predicate "condexec_si_binary_operator"
1280 (match_code "plus,minus,and,ior,xor,ashift,ashiftrt,lshiftrt")
1282 enum machine_mode op_mode = GET_MODE (op);
1284 if (mode != VOIDmode && op_mode != mode)
1287 switch (GET_CODE (op))
1304 ;; Return true if operator is an integer binary operator that can be
1305 ;; executed conditionally by a media instruction.
1307 (define_predicate "condexec_si_media_operator"
1308 (match_code "and,ior,xor")
1310 enum machine_mode op_mode = GET_MODE (op);
1312 if (mode != VOIDmode && op_mode != mode)
1315 switch (GET_CODE (op))
1327 ;; Return true if operator is an integer division operator that can
1328 ;; executed conditionally.
1330 (define_predicate "condexec_si_divide_operator"
1331 (match_code "div,udiv")
1333 enum machine_mode op_mode = GET_MODE (op);
1335 if (mode != VOIDmode && op_mode != mode)
1338 switch (GET_CODE (op))
1349 ;; Return true if operator is an integer unary operator that can
1350 ;; executed conditionally.
1352 (define_predicate "condexec_si_unary_operator"
1353 (match_code "not,neg")
1355 enum machine_mode op_mode = GET_MODE (op);
1357 if (mode != VOIDmode && op_mode != mode)
1360 switch (GET_CODE (op))
1371 ;; Return true if operator is an addition or subtraction
1372 ;; expression. Such expressions can be evaluated conditionally by
1373 ;; floating-point instructions.
1375 (define_predicate "condexec_sf_add_operator"
1376 (match_code "plus,minus")
1378 enum machine_mode op_mode = GET_MODE (op);
1380 if (mode != VOIDmode && op_mode != mode)
1383 switch (GET_CODE (op))
1394 ;; Return true if operator is a conversion-type expression that can be
1395 ;; evaluated conditionally by floating-point instructions.
1397 (define_predicate "condexec_sf_conv_operator"
1398 (match_code "abs,neg")
1400 enum machine_mode op_mode = GET_MODE (op);
1402 if (mode != VOIDmode && op_mode != mode)
1405 switch (GET_CODE (op))
1416 ;; Return true if OP is an integer binary operator that can be
1417 ;; combined with a (set ... (compare:CC_NZ ...)) pattern.
1419 (define_predicate "intop_compare_operator"
1420 (match_code "plus,minus,and,ior,xor,ashift,ashiftrt,lshiftrt")
1422 if (mode != VOIDmode && GET_MODE (op) != mode)
1425 switch (GET_CODE (op))
1437 return GET_MODE (op) == SImode;
1441 ;; Return 1 if operand is a register or 6-bit signed immediate.
1443 (define_predicate "fpr_or_int6_operand"
1444 (match_code "reg,subreg,const_int")
1446 if (GET_CODE (op) == CONST_INT)
1447 return IN_RANGE_P (INTVAL (op), -32, 31);
1449 if (GET_MODE (op) != mode && mode != VOIDmode)
1452 if (GET_CODE (op) == SUBREG)
1454 if (GET_CODE (SUBREG_REG (op)) != REG)
1455 return register_operand (op, mode);
1457 op = SUBREG_REG (op);
1460 if (GET_CODE (op) != REG)
1463 return FPR_OR_PSEUDO_P (REGNO (op));
1466 ;; Return 1 if operand is a 6-bit signed immediate.
1468 (define_predicate "int6_operand"
1469 (match_code "const_int")
1471 if (GET_CODE (op) != CONST_INT)
1474 return IN_RANGE_P (INTVAL (op), -32, 31);
1477 ;; Return 1 if operand is a 5-bit signed immediate.
1479 (define_predicate "int5_operand"
1480 (match_code "const_int")
1482 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), -16, 15);
1485 ;; Return 1 if operand is a 5-bit unsigned immediate.
1487 (define_predicate "uint5_operand"
1488 (match_code "const_int")
1490 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), 0, 31);
1493 ;; Return 1 if operand is a 4-bit unsigned immediate.
1495 (define_predicate "uint4_operand"
1496 (match_code "const_int")
1498 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), 0, 15);
1501 ;; Return 1 if operand is a 1-bit unsigned immediate (0 or 1).
1503 (define_predicate "uint1_operand"
1504 (match_code "const_int")
1506 return GET_CODE (op) == CONST_INT && IN_RANGE_P (INTVAL (op), 0, 1);
1509 ;; Return 1 if operand is a valid ACC register number.
1511 (define_predicate "acc_operand"
1512 (match_code "reg,subreg")
1514 return ((mode == VOIDmode || mode == GET_MODE (op))
1515 && REG_P (op) && ACC_P (REGNO (op))
1516 && ((REGNO (op) - ACC_FIRST) & ~ACC_MASK) == 0);
1519 ;; Return 1 if operand is a valid even ACC register number.
1521 (define_predicate "even_acc_operand"
1522 (match_code "reg,subreg")
1524 return acc_operand (op, mode) && ((REGNO (op) - ACC_FIRST) & 1) == 0;
1527 ;; Return 1 if operand is zero or four.
1529 (define_predicate "quad_acc_operand"
1530 (match_code "reg,subreg")
1532 return acc_operand (op, mode) && ((REGNO (op) - ACC_FIRST) & 3) == 0;
1535 ;; Return 1 if operand is a valid ACCG register number.
1537 (define_predicate "accg_operand"
1538 (match_code "reg,subreg")
1540 return ((mode == VOIDmode || mode == GET_MODE (op))
1541 && REG_P (op) && ACCG_P (REGNO (op))
1542 && ((REGNO (op) - ACCG_FIRST) & ~ACC_MASK) == 0);