📄 v850.md
字号:
[(set (match_operand:SI 0 "register_operand" "=r") (gt:SI (cc0) (const_int 0)))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0) return 0; return \"setf gt,%0\";}" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sgtu" [(set (match_operand:SI 0 "register_operand" "=r") (gtu:SI (cc0) (const_int 0)))] "" "setf h,%0" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "seq" [(set (match_operand:SI 0 "register_operand" "=r") (eq:SI (cc0) (const_int 0)))] "" "setf z,%0" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sne" [(set (match_operand:SI 0 "register_operand" "=r") (ne:SI (cc0) (const_int 0)))] "" "setf nz,%0" [(set_attr "length" "4") (set_attr "cc" "none_0hit")]);; ----------------------------------------------------------------------;; CONDITIONAL MOVE INSTRUCTIONS;; ----------------------------------------------------------------------;; Instructions using cc0 aren't allowed to have input reloads, so we must;; hide the fact that this instruction uses cc0. We do so by including the;; compare instruction inside it.;; ??? This is very ugly. The right way to do this is to modify cmpsi so;; that it doesn't emit RTL, and then modify the bcc/scc patterns so that;; they emit RTL for the compare instruction. Unfortunately, this requires;; lots of changes that will be hard to sanitize. So for now, cmpsi still;; emits RTL, and I get the compare operands here from the previous insn.(define_expand "movsicc" [(set (match_operand:SI 0 "register_operand" "=r") (if_then_else:SI (match_operator 1 "comparison_operator" [(match_dup 4) (match_dup 5)]) (match_operand:SI 2 "reg_or_const_operand" "rJ") (match_operand:SI 3 "reg_or_const_operand" "rI")))] "TARGET_V850E" "{ rtx insn = get_last_insn_anywhere (); rtx src; if ( (GET_CODE (operands[2]) == CONST_INT && GET_CODE (operands[3]) == CONST_INT)) { int o2 = INTVAL (operands[2]); int o3 = INTVAL (operands[3]); if (o2 == 1 && o3 == 0) FAIL; /* setf */ if (o3 == 1 && o2 == 0) FAIL; /* setf */ if (o2 == 0 && (o3 < -16 || o3 > 15) && exact_log2 (o3) >= 0) FAIL; /* setf + shift */ if (o3 == 0 && (o2 < -16 || o2 > 15) && exact_log2 (o2) >=0) FAIL; /* setf + shift */ if (o2 != 0) operands[2] = copy_to_mode_reg (SImode, operands[2]); if (o3 !=0 ) operands[3] = copy_to_mode_reg (SImode, operands[3]); } else { if (GET_CODE (operands[2]) != REG) operands[2] = copy_to_mode_reg (SImode,operands[2]); if (GET_CODE (operands[3]) != REG) operands[3] = copy_to_mode_reg (SImode, operands[3]); } gcc_assert (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET && SET_DEST (PATTERN (insn)) == cc0_rtx); src = SET_SRC (PATTERN (insn)); switch (GET_CODE (src)) { case COMPARE: operands[4] = XEXP (src, 0); operands[5] = XEXP (src, 1); break; case REG: case SUBREG: operands[4] = src; operands[5] = const0_rtx; break; default: gcc_unreachable (); }}");; ??? Clobbering the condition codes is overkill.;; ??? We sometimes emit an unnecessary compare instruction because the;; condition codes may have already been set by an earlier instruction,;; but we have no code here to avoid the compare if it is unnecessary.(define_insn "*movsicc_normal" [(set (match_operand:SI 0 "register_operand" "=r") (if_then_else:SI (match_operator 1 "comparison_operator" [(match_operand:SI 4 "register_operand" "r") (match_operand:SI 5 "reg_or_int5_operand" "rJ")]) (match_operand:SI 2 "reg_or_int5_operand" "rJ") (match_operand:SI 3 "reg_or_0_operand" "rI")))] "TARGET_V850E" "cmp %5,%4 ; cmov %c1,%2,%z3,%0" [(set_attr "length" "6") (set_attr "cc" "clobber")])(define_insn "*movsicc_reversed" [(set (match_operand:SI 0 "register_operand" "=r") (if_then_else:SI (match_operator 1 "comparison_operator" [(match_operand:SI 4 "register_operand" "r") (match_operand:SI 5 "reg_or_int5_operand" "rJ")]) (match_operand:SI 2 "reg_or_0_operand" "rI") (match_operand:SI 3 "reg_or_int5_operand" "rJ")))] "TARGET_V850E" "cmp %5,%4 ; cmov %C1,%3,%z2,%0" [(set_attr "length" "6") (set_attr "cc" "clobber")])(define_insn "*movsicc_tst1" [(set (match_operand:SI 0 "register_operand" "=r") (if_then_else:SI (match_operator 1 "comparison_operator" [(zero_extract:SI (match_operand:QI 2 "memory_operand" "m") (const_int 1) (match_operand 3 "const_int_operand" "n")) (const_int 0)]) (match_operand:SI 4 "reg_or_int5_operand" "rJ") (match_operand:SI 5 "reg_or_0_operand" "rI")))] "TARGET_V850E" "tst1 %3,%2 ; cmov %c1,%4,%z5,%0" [(set_attr "length" "8") (set_attr "cc" "clobber")])(define_insn "*movsicc_tst1_reversed" [(set (match_operand:SI 0 "register_operand" "=r") (if_then_else:SI (match_operator 1 "comparison_operator" [(zero_extract:SI (match_operand:QI 2 "memory_operand" "m") (const_int 1) (match_operand 3 "const_int_operand" "n")) (const_int 0)]) (match_operand:SI 4 "reg_or_0_operand" "rI") (match_operand:SI 5 "reg_or_int5_operand" "rJ")))] "TARGET_V850E" "tst1 %3,%2 ; cmov %C1,%5,%z4,%0" [(set_attr "length" "8") (set_attr "cc" "clobber")]);; Matching for sasf requires combining 4 instructions, so we provide a;; dummy pattern to match the first 3, which will always be turned into the;; second pattern by subsequent combining. As above, we must include the;; comparison to avoid input reloads in an insn using cc0.(define_insn "*sasf_1" [(set (match_operand:SI 0 "register_operand" "") (ior:SI (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (ashift:SI (match_operand:SI 2 "register_operand" "") (const_int 1))))] "TARGET_V850E" "* gcc_unreachable ();")(define_insn "*sasf_2" [(set (match_operand:SI 0 "register_operand" "=r") (ior:SI (match_operator 1 "comparison_operator" [(match_operand:SI 3 "register_operand" "r") (match_operand:SI 4 "reg_or_int5_operand" "rJ")]) (ashift:SI (match_operand:SI 2 "register_operand" "0") (const_int 1))))] "TARGET_V850E" "cmp %4,%3 ; sasf %c1,%0" [(set_attr "length" "6") (set_attr "cc" "clobber")])(define_split [(set (match_operand:SI 0 "register_operand" "") (if_then_else:SI (match_operator 1 "comparison_operator" [(match_operand:SI 4 "register_operand" "") (match_operand:SI 5 "reg_or_int5_operand" "")]) (match_operand:SI 2 "const_int_operand" "") (match_operand:SI 3 "const_int_operand" "")))] "TARGET_V850E && ((INTVAL (operands[2]) ^ INTVAL (operands[3])) == 1) && ((INTVAL (operands[2]) + INTVAL (operands[3])) != 1) && (GET_CODE (operands[5]) == CONST_INT || REGNO (operands[0]) != REGNO (operands[5])) && REGNO (operands[0]) != REGNO (operands[4])" [(set (match_dup 0) (match_dup 6)) (set (match_dup 0) (ior:SI (match_op_dup 7 [(match_dup 4) (match_dup 5)]) (ashift:SI (match_dup 0) (const_int 1))))] "{ operands[6] = GEN_INT (INTVAL (operands[2]) >> 1); if (INTVAL (operands[2]) & 0x1) operands[7] = operands[1]; else operands[7] = gen_rtx_fmt_ee (reverse_condition (GET_CODE (operands[1])), GET_MODE (operands[1]), XEXP (operands[1], 0), XEXP (operands[1], 1));}");; ---------------------------------------------------------------------;; BYTE SWAP INSTRUCTIONS;; ---------------------------------------------------------------------(define_expand "rotlhi3" [(set (match_operand:HI 0 "register_operand" "") (rotate:HI (match_operand:HI 1 "register_operand" "") (match_operand:HI 2 "const_int_operand" "")))] "TARGET_V850E" "{ if (INTVAL (operands[2]) != 8) FAIL;}")(define_insn "*rotlhi3_8" [(set (match_operand:HI 0 "register_operand" "=r") (rotate:HI (match_operand:HI 1 "register_operand" "r") (const_int 8)))] "TARGET_V850E" "bsh %1,%0" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_expand "rotlsi3" [(set (match_operand:SI 0 "register_operand" "") (rotate:SI (match_operand:SI 1 "register_operand" "") (match_operand:SI 2 "const_int_operand" "")))] "TARGET_V850E" "{ if (INTVAL (operands[2]) != 16) FAIL;}")(define_insn "*rotlsi3_16" [(set (match_operand:SI 0 "register_operand" "=r") (rotate:SI (match_operand:SI 1 "register_operand" "r") (const_int 16)))] "TARGET_V850E" "hsw %1,%0" [(set_attr "length" "4") (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; JUMP INSTRUCTIONS;; ----------------------------------------------------------------------;; Conditional jump instructions(define_expand "ble" [(set (pc) (if_then_else (le (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bleu" [(set (pc) (if_then_else (leu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bge" [(set (pc) (if_then_else (ge (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bgeu" [(set (pc) (if_then_else (geu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "blt" [(set (pc) (if_then_else (lt (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bltu" [(set (pc) (if_then_else (ltu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bgt" [(set (pc) (if_then_else (gt (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bgtu" [(set (pc) (if_then_else (gtu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "beq" [(set (pc) (if_then_else (eq (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bne" [(set (pc) (if_then_else (ne (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_insn "*branch_normal" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (label_ref (match_operand 0 "" "")) (pc)))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0 && (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LT)) return 0; if (get_attr_length (insn) == 2) return \"b%b1 %l0\"; else return \"b%B1 .+6 ; jr %l0\";}" [(set (attr "length") (if_then_else (lt (abs (minus (match_dup 0) (pc))) (const_int 256)) (const_int 2) (const_int 6))) (set_attr "cc" "none")])(define_insn "*branch_invert" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (pc) (label_ref (match_operand 0 "" ""))))] "" "*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -