enum rtx_code ccode;
rtx compare_set = NULL_RTX, test_if, cond;
rtx alu_set = NULL_RTX, addr = NULL_RTX;
+ enum attr_type condgen_type;
if (!any_condjump_p (condjmp))
return false;
|| !modified_in_p (cc_reg_1, condgen))
return false;
- if (get_attr_type (condgen) != TYPE_TEST
- && get_attr_type (condgen) != TYPE_ICMP
- && get_attr_type (condgen) != TYPE_INCDEC
- && get_attr_type (condgen) != TYPE_ALU)
+ condgen_type = get_attr_type (condgen);
+ if (condgen_type == TYPE_MULTI
+ && (INSN_CODE (condgen) == CODE_FOR_stack_protect_test_di
+ || INSN_CODE (condgen) == CODE_FOR_stack_protect_test_si)
+ && TARGET_FUSE_ALU_AND_BRANCH)
+ {
+ /* stack_protect_test_<mode> ends with a sub, which subtracts
+ a non-rip special memory operand from a GPR. */
+ src = NULL_RTX;
+ alu_set = XVECEXP (PATTERN (condgen), 0, 1);
+ goto handle_stack_protect_test;
+ }
+ else if (condgen_type != TYPE_TEST
+ && condgen_type != TYPE_ICMP
+ && condgen_type != TYPE_INCDEC
+ && condgen_type != TYPE_ALU)
return false;
compare_set = single_set (condgen);
- if (compare_set == NULL_RTX
- && !TARGET_FUSE_ALU_AND_BRANCH)
+ if (compare_set == NULL_RTX && !TARGET_FUSE_ALU_AND_BRANCH)
return false;
if (compare_set == NULL_RTX)
/* Macro-fusion for cmp/test MEM-IMM + conditional jmp is not
supported. */
- if ((MEM_P (XEXP (src, 0))
- && CONST_INT_P (XEXP (src, 1)))
- || (MEM_P (XEXP (src, 1))
- && CONST_INT_P (XEXP (src, 0))))
+ if ((MEM_P (XEXP (src, 0)) && CONST_INT_P (XEXP (src, 1)))
+ || (MEM_P (XEXP (src, 1)) && CONST_INT_P (XEXP (src, 0))))
return false;
/* No fusion for RIP-relative address. */
else if (MEM_P (XEXP (src, 1)))
addr = XEXP (XEXP (src, 1), 0);
- if (addr) {
- ix86_address parts;
- int ok = ix86_decompose_address (addr, &parts);
- gcc_assert (ok);
+ if (addr)
+ {
+ ix86_address parts;
+ int ok = ix86_decompose_address (addr, &parts);
+ gcc_assert (ok);
- if (ix86_rip_relative_addr_p (&parts))
- return false;
- }
+ if (ix86_rip_relative_addr_p (&parts))
+ return false;
+ }
+ handle_stack_protect_test:
test_if = SET_SRC (pc_set (condjmp));
cond = XEXP (test_if, 0);
ccode = GET_CODE (cond);
/* Check whether conditional jump use Sign or Overflow Flags. */
if (!TARGET_FUSE_CMP_AND_BRANCH_SOFLAGS
- && (ccode == GE
- || ccode == GT
- || ccode == LE
- || ccode == LT))
+ && (ccode == GE || ccode == GT || ccode == LE || ccode == LT))
return false;
/* Return true for TYPE_TEST and TYPE_ICMP. */
- if (get_attr_type (condgen) == TYPE_TEST
- || get_attr_type (condgen) == TYPE_ICMP)
+ if (condgen_type == TYPE_TEST || condgen_type == TYPE_ICMP)
return true;
/* The following is the case that macro-fusion for alu + jmp. */
/* Macro-fusion for inc/dec + unsigned conditional jump is not
supported. */
- if (get_attr_type (condgen) == TYPE_INCDEC
- && (ccode == GEU
- || ccode == GTU
- || ccode == LEU
- || ccode == LTU))
+ if (condgen_type == TYPE_INCDEC
+ && (ccode == GEU || ccode == GTU || ccode == LEU || ccode == LTU))
return false;
return true;