📄 predicates.md
字号:
return 0; return ((opl & ~ (unsigned HOST_WIDE_INT) 0xffff) == 0 || (opl & ~ (unsigned HOST_WIDE_INT) 0xffff0000) == 0);});; Return 1 if the operand is a non-special register or a constant that;; can be used as the operand of an OR or XOR.(define_predicate "logical_operand" (ior (match_operand 0 "gpc_reg_operand") (match_operand 0 "logical_const_operand")));; Return 1 if op is a constant that is not a logical operand, but could;; be split into one.(define_predicate "non_logical_cint_operand" (and (match_code "const_int,const_double") (and (not (match_operand 0 "logical_operand")) (match_operand 0 "reg_or_logical_cint_operand"))));; Return 1 if op is a constant that can be encoded in a 32-bit mask,;; suitable for use with rlwinm (no more than two 1->0 or 0->1;; transitions). Reject all ones and all zeros, since these should have;; been optimized away and confuse the making of MB and ME.(define_predicate "mask_operand" (match_code "const_int"){ HOST_WIDE_INT c, lsb; c = INTVAL (op); if (TARGET_POWERPC64) { /* Fail if the mask is not 32-bit. */ if (mode == DImode && (c & ~(unsigned HOST_WIDE_INT) 0xffffffff) != 0) return 0; /* Fail if the mask wraps around because the upper 32-bits of the mask will all be 1s, contrary to GCC's internal view. */ if ((c & 0x80000001) == 0x80000001) return 0; } /* We don't change the number of transitions by inverting, so make sure we start with the LS bit zero. */ if (c & 1) c = ~c; /* Reject all zeros or all ones. */ if (c == 0) return 0; /* Find the first transition. */ lsb = c & -c; /* Invert to look for a second transition. */ c = ~c; /* Erase first transition. */ c &= -lsb; /* Find the second transition (if any). */ lsb = c & -c; /* Match if all the bits above are 1's (or c is zero). */ return c == -lsb;});; Return 1 for the PowerPC64 rlwinm corner case.(define_predicate "mask_operand_wrap" (match_code "const_int"){ HOST_WIDE_INT c, lsb; c = INTVAL (op); if ((c & 0x80000001) != 0x80000001) return 0; c = ~c; if (c == 0) return 0; lsb = c & -c; c = ~c; c &= -lsb; lsb = c & -c; return c == -lsb;});; Return 1 if the operand is a constant that is a PowerPC64 mask;; suitable for use with rldicl or rldicr (no more than one 1->0 or 0->1;; transition). Reject all zeros, since zero should have been;; optimized away and confuses the making of MB and ME.(define_predicate "mask64_operand" (match_code "const_int"){ HOST_WIDE_INT c, lsb; c = INTVAL (op); /* Reject all zeros. */ if (c == 0) return 0; /* We don't change the number of transitions by inverting, so make sure we start with the LS bit zero. */ if (c & 1) c = ~c; /* Find the first transition. */ lsb = c & -c; /* Match if all the bits above are 1's (or c is zero). */ return c == -lsb;});; Like mask64_operand, but allow up to three transitions. This;; predicate is used by insn patterns that generate two rldicl or;; rldicr machine insns.(define_predicate "mask64_2_operand" (match_code "const_int"){ HOST_WIDE_INT c, lsb; c = INTVAL (op); /* Disallow all zeros. */ if (c == 0) return 0; /* We don't change the number of transitions by inverting, so make sure we start with the LS bit zero. */ if (c & 1) c = ~c; /* Find the first transition. */ lsb = c & -c; /* Invert to look for a second transition. */ c = ~c; /* Erase first transition. */ c &= -lsb; /* Find the second transition. */ lsb = c & -c; /* Invert to look for a third transition. */ c = ~c; /* Erase second transition. */ c &= -lsb; /* Find the third transition (if any). */ lsb = c & -c; /* Match if all the bits above are 1's (or c is zero). */ return c == -lsb;});; Like and_operand, but also match constants that can be implemented;; with two rldicl or rldicr insns.(define_predicate "and64_2_operand" (ior (match_operand 0 "mask64_2_operand") (if_then_else (match_test "fixed_regs[CR0_REGNO]") (match_operand 0 "gpc_reg_operand") (match_operand 0 "logical_operand"))));; Return 1 if the operand is either a non-special register or a;; constant that can be used as the operand of a logical AND.(define_predicate "and_operand" (ior (match_operand 0 "mask_operand") (ior (and (match_test "TARGET_POWERPC64 && mode == DImode") (match_operand 0 "mask64_operand")) (if_then_else (match_test "fixed_regs[CR0_REGNO]") (match_operand 0 "gpc_reg_operand") (match_operand 0 "logical_operand")))));; Return 1 if the operand is either a logical operand or a short cint operand.(define_predicate "scc_eq_operand" (ior (match_operand 0 "logical_operand") (match_operand 0 "short_cint_operand")));; Return 1 if the operand is a general non-special register or memory operand.(define_predicate "reg_or_mem_operand" (if_then_else (match_code "mem") (ior (match_operand 0 "memory_operand") (ior (match_test "macho_lo_sum_memory_operand (op, mode)") (match_operand 0 "volatile_mem_operand"))) (match_operand 0 "gpc_reg_operand")));; Return 1 if the operand is either an easy FP constant or memory or reg.(define_predicate "reg_or_none500mem_operand" (if_then_else (match_code "mem") (and (match_test "!TARGET_E500_DOUBLE") (ior (match_operand 0 "memory_operand") (ior (match_test "macho_lo_sum_memory_operand (op, mode)") (match_operand 0 "volatile_mem_operand")))) (match_operand 0 "gpc_reg_operand")));; Return 1 if the operand is CONST_DOUBLE 0, register or memory operand.(define_predicate "zero_reg_mem_operand" (ior (match_operand 0 "zero_fp_constant") (match_operand 0 "reg_or_mem_operand")));; Return 1 if the operand is a general register or memory operand without;; pre_inc or pre_dec, which produces invalid form of PowerPC lwa;; instruction.(define_predicate "lwa_operand" (match_code "reg,subreg,mem"){ rtx inner = op; if (reload_completed && GET_CODE (inner) == SUBREG) inner = SUBREG_REG (inner); return gpc_reg_operand (inner, mode) || (memory_operand (inner, mode) && GET_CODE (XEXP (inner, 0)) != PRE_INC && GET_CODE (XEXP (inner, 0)) != PRE_DEC && (GET_CODE (XEXP (inner, 0)) != PLUS || GET_CODE (XEXP (XEXP (inner, 0), 1)) != CONST_INT || INTVAL (XEXP (XEXP (inner, 0), 1)) % 4 == 0));});; Return 1 if the operand, used inside a MEM, is a SYMBOL_REF.(define_predicate "symbol_ref_operand" (and (match_code "symbol_ref") (match_test "(mode == VOIDmode || GET_MODE (op) == mode) && (DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op))")));; Return 1 if op is an operand that can be loaded via the GOT.;; or non-special register register field no cr0(define_predicate "got_operand" (match_code "symbol_ref,const,label_ref"));; Return 1 if op is a simple reference that can be loaded via the GOT,;; excluding labels involving addition.(define_predicate "got_no_const_operand" (match_code "symbol_ref,label_ref"));; Return 1 if op is a SYMBOL_REF for a TLS symbol.(define_predicate "rs6000_tls_symbol_ref" (and (match_code "symbol_ref") (match_test "RS6000_SYMBOL_REF_TLS_P (op)")));; Return 1 if the operand, used inside a MEM, is a valid first argument;; to CALL. This is a SYMBOL_REF, a pseudo-register, LR or CTR.(define_predicate "call_operand" (if_then_else (match_code "reg") (match_test "REGNO (op) == LINK_REGISTER_REGNUM || REGNO (op) == COUNT_REGISTER_REGNUM || REGNO (op) >= FIRST_PSEUDO_REGISTER") (match_code "symbol_ref")));; Return 1 if the operand is a SYMBOL_REF for a function known to be in;; this file.(define_predicate "current_file_function_operand" (and (match_code "symbol_ref") (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) && (SYMBOL_REF_LOCAL_P (op) || (op == XEXP (DECL_RTL (current_function_decl), 0)))")));; Return 1 if this operand is a valid input for a move insn.(define_predicate "input_operand" (match_code "label_ref,symbol_ref,const,high,reg,subreg,mem, const_double,const_vector,const_int,plus"){ /* Memory is always valid. */ if (memory_operand (op, mode)) return 1; /* For floating-point, easy constants are valid. */ if (GET_MODE_CLASS (mode) == MODE_FLOAT && CONSTANT_P (op) && easy_fp_constant (op, mode)) return 1; /* Allow any integer constant. */ if (GET_MODE_CLASS (mode) == MODE_INT && (GET_CODE (op) == CONST_INT || GET_CODE (op) == CONST_DOUBLE)) return 1; /* Allow easy vector constants. */ if (GET_CODE (op) == CONST_VECTOR && easy_vector_constant (op, mode)) return 1; /* For floating-point or multi-word mode, the only remaining valid type is a register. */ if (GET_MODE_CLASS (mode) == MODE_FLOAT || GET_MODE_SIZE (mode) > UNITS_PER_WORD) return register_operand (op, mode); /* The only cases left are integral modes one word or smaller (we do not get called for MODE_CC values). These can be in any register. */ if (register_operand (op, mode)) return 1; /* A SYMBOL_REF referring to the TOC is valid. */ if (legitimate_constant_pool_address_p (op)) return 1; /* A constant pool expression (relative to the TOC) is valid */ if (toc_relative_expr_p (op)) return 1; /* V.4 allows SYMBOL_REFs and CONSTs that are in the small data region to be valid. */ if (DEFAULT_ABI == ABI_V4 && (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST) && small_data_operand (op, Pmode)) return 1; return 0;});; Return true if OP is an invalid SUBREG operation on the e500.(define_predicate "rs6000_nonimmediate_operand" (match_code "reg,subreg,mem"){ if (TARGET_E500_DOUBLE && GET_CODE (op) == SUBREG && invalid_e500_subreg (op, mode)) return 0; return nonimmediate_operand (op, mode);});; Return true if operand is boolean operator.(define_predicate "boolean_operator" (match_code "and,ior,xor"));; Return true if operand is OR-form of boolean operator.(define_predicate "boolean_or_operator" (match_code "ior,xor"));; Return true if operand is an equality operator.(define_special_predicate "equality_operator" (match_code "eq,ne"));; Return true if operand is MIN or MAX operator.(define_predicate "min_max_operator" (match_code "smin,smax,umin,umax"));; Return 1 if OP is a comparison operation that is valid for a branch;; instruction. We check the opcode against the mode of the CC value.;; validate_condition_mode is an assertion.(define_predicate "branch_comparison_operator" (and (match_operand 0 "comparison_operator") (and (match_test "GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) == MODE_CC") (match_test "validate_condition_mode (GET_CODE (op), GET_MODE (XEXP (op, 0))), 1"))));; Return 1 if OP is a comparison operation that is valid for an SCC insn --;; it must be a positive comparison.(define_predicate "scc_comparison_operator" (and (match_operand 0 "branch_comparison_operator") (match_code "eq,lt,gt,ltu,gtu,unordered")));; Return 1 if OP is a comparison operation that is valid for a branch;; insn, which is true if the corresponding bit in the CC register is set.(define_predicate "branch_positive_comparison_operator" (and (match_operand 0 "branch_comparison_operator") (match_code "eq,lt,gt,ltu,gtu,unordered")));; Return 1 is OP is a comparison operation that is valid for a trap insn.(define_predicate "trap_comparison_operator" (and (match_operand 0 "comparison_operator") (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu")));; Return 1 if OP is a load multiple operation, known to be a PARALLEL.(define_predicate "load_multiple_operation" (match_code "parallel"){ int count = XVECLEN (op, 0); unsigned int dest_regno; rtx src_addr; int i; /* Perform a quick check so we don't blow up below. */ if (count <= 1 || GET_CODE (XVECEXP (op, 0, 0)) != SET || GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != REG || GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != MEM) return 0; dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, 0))); src_addr = XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0); for (i = 1; i < count; i++) { rtx elt = XVECEXP (op, 0, i); if (GET_CODE (elt) != SET || GET_CODE (SET_DEST (elt)) != REG || GET_MODE (SET_DEST (elt)) != SImode || REGNO (SET_DEST (elt)) != dest_regno + i || GET_CODE (SET_SRC (elt)) != MEM || GET_MODE (SET_SRC (elt)) != SImode || GET_CODE (XEXP (SET_SRC (elt), 0)) != PLUS || ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt), 0), 0), src_addr) || GET_CODE (XEXP (XEXP (SET_SRC (elt), 0), 1)) != CONST_INT || INTVAL (XEXP (XEXP (SET_SRC (elt), 0), 1)) != i * 4) return 0; } return 1;});; Return 1 if OP is a store multiple operation, known to be a PARALLEL.;; The second vector element is a CLOBBER.(define_predicate "store_multiple_operation" (match_code "parallel"){ int count = XVECLEN (op, 0) - 1; unsigned int src_regno; rtx dest_addr; int i; /* Perform a quick check so we don't blow up below. */ if (count <= 1 || GET_CODE (XVECEXP (op, 0, 0)) != SET || GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != MEM || GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != REG) return 0; src_regno = REGNO (SET_SRC (XVECEXP (op, 0, 0))); dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, 0)), 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -