📄 v850.md
字号:
[(set (match_operand:QI 0 "memory_operand" "=m") (subreg:QI (and:SI (subreg:SI (match_dup 0) 0) (match_operand:QI 1 "not_power_of_two_operand" "")) 0))] "" "*{ rtx xoperands[2]; xoperands[0] = operands[0]; xoperands[1] = GEN_INT (~INTVAL (operands[1]) & 0xff); output_asm_insn (\"clr1 %M1,%0\", xoperands); return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "*v850_clr1_2" [(set (match_operand:HI 0 "indirect_operand" "=m") (subreg:HI (and:SI (subreg:SI (match_dup 0) 0) (match_operand:HI 1 "not_power_of_two_operand" "")) 0))] "" "*{ int log2 = exact_log2 (~INTVAL (operands[1]) & 0xffff); rtx xoperands[2]; xoperands[0] = gen_rtx_MEM (QImode, plus_constant (XEXP (operands[0], 0), log2 / 8)); xoperands[1] = GEN_INT (log2 % 8); output_asm_insn (\"clr1 %1,%0\", xoperands); return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "*v850_clr1_3" [(set (match_operand:SI 0 "indirect_operand" "=m") (and:SI (match_dup 0) (match_operand:SI 1 "not_power_of_two_operand" "")))] "" "*{ int log2 = exact_log2 (~INTVAL (operands[1]) & 0xffffffff); rtx xoperands[2]; xoperands[0] = gen_rtx_MEM (QImode, plus_constant (XEXP (operands[0], 0), log2 / 8)); xoperands[1] = GEN_INT (log2 % 8); output_asm_insn (\"clr1 %1,%0\", xoperands); return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "andsi3" [(set (match_operand:SI 0 "register_operand" "=r,r,r") (and:SI (match_operand:SI 1 "register_operand" "%0,0,r") (match_operand:SI 2 "nonmemory_operand" "r,I,M")))] "" "@ and %2,%0 and %.,%0 andi %2,%1,%0" [(set_attr "length" "2,2,4") (set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; OR INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "*v850_set1_1" [(set (match_operand:QI 0 "memory_operand" "=m") (subreg:QI (ior:SI (subreg:SI (match_dup 0) 0) (match_operand 1 "power_of_two_operand" "")) 0))] "" "set1 %M1,%0" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "*v850_set1_2" [(set (match_operand:HI 0 "indirect_operand" "=m") (subreg:HI (ior:SI (subreg:SI (match_dup 0) 0) (match_operand 1 "power_of_two_operand" "")) 0))] "" "*{ int log2 = exact_log2 (INTVAL (operands[1])); if (log2 < 8) return \"set1 %M1,%0\"; else { rtx xoperands[2]; xoperands[0] = gen_rtx_MEM (QImode, plus_constant (XEXP (operands[0], 0), log2 / 8)); xoperands[1] = GEN_INT (log2 % 8); output_asm_insn (\"set1 %1,%0\", xoperands); } return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "*v850_set1_3" [(set (match_operand:SI 0 "indirect_operand" "=m") (ior:SI (match_dup 0) (match_operand 1 "power_of_two_operand" "")))] "" "*{ int log2 = exact_log2 (INTVAL (operands[1])); if (log2 < 8) return \"set1 %M1,%0\"; else { rtx xoperands[2]; xoperands[0] = gen_rtx_MEM (QImode, plus_constant (XEXP (operands[0], 0), log2 / 8)); xoperands[1] = GEN_INT (log2 % 8); output_asm_insn (\"set1 %1,%0\", xoperands); } return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "iorsi3" [(set (match_operand:SI 0 "register_operand" "=r,r,r") (ior:SI (match_operand:SI 1 "register_operand" "%0,0,r") (match_operand:SI 2 "nonmemory_operand" "r,I,M")))] "" "@ or %2,%0 or %.,%0 ori %2,%1,%0" [(set_attr "length" "2,2,4") (set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; XOR INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "*v850_not1_1" [(set (match_operand:QI 0 "memory_operand" "=m") (subreg:QI (xor:SI (subreg:SI (match_dup 0) 0) (match_operand 1 "power_of_two_operand" "")) 0))] "" "not1 %M1,%0" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "*v850_not1_2" [(set (match_operand:HI 0 "indirect_operand" "=m") (subreg:HI (xor:SI (subreg:SI (match_dup 0) 0) (match_operand 1 "power_of_two_operand" "")) 0))] "" "*{ int log2 = exact_log2 (INTVAL (operands[1])); if (log2 < 8) return \"not1 %M1,%0\"; else { rtx xoperands[2]; xoperands[0] = gen_rtx_MEM (QImode, plus_constant (XEXP (operands[0], 0), log2 / 8)); xoperands[1] = GEN_INT (log2 % 8); output_asm_insn (\"not1 %1,%0\", xoperands); } return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "*v850_not1_3" [(set (match_operand:SI 0 "indirect_operand" "=m") (xor:SI (match_dup 0) (match_operand 1 "power_of_two_operand" "")))] "" "*{ int log2 = exact_log2 (INTVAL (operands[1])); if (log2 < 8) return \"not1 %M1,%0\"; else { rtx xoperands[2]; xoperands[0] = gen_rtx_MEM (QImode, plus_constant (XEXP (operands[0], 0), log2 / 8)); xoperands[1] = GEN_INT (log2 % 8); output_asm_insn (\"not1 %1,%0\", xoperands); } return \"\";}" [(set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "xorsi3" [(set (match_operand:SI 0 "register_operand" "=r,r,r") (xor:SI (match_operand:SI 1 "register_operand" "%0,0,r") (match_operand:SI 2 "nonmemory_operand" "r,I,M")))] "" "@ xor %2,%0 xor %.,%0 xori %2,%1,%0" [(set_attr "length" "2,2,4") (set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; NOT INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "one_cmplsi2" [(set (match_operand:SI 0 "register_operand" "=r") (not:SI (match_operand:SI 1 "register_operand" "r")))] "" "not %1,%0" [(set_attr "length" "2") (set_attr "cc" "set_znv")]);; -----------------------------------------------------------------;; BIT FIELDS;; -----------------------------------------------------------------;; ??? Is it worth defining insv and extv for the V850 series?!?;; An insv pattern would be useful, but does not get used because;; store_bit_field never calls insv when storing a constant value into a;; single-bit bitfield.;; extv/extzv patterns would be useful, but do not get used because;; optimize_bitfield_compare in fold-const usually converts single;; bit extracts into an AND with a mask.;; -----------------------------------------------------------------;; Scc INSTRUCTIONS;; -----------------------------------------------------------------(define_insn "sle" [(set (match_operand:SI 0 "register_operand" "=r") (le:SI (cc0) (const_int 0)))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0) return 0; return \"setf le,%0\";}" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sleu" [(set (match_operand:SI 0 "register_operand" "=r") (leu:SI (cc0) (const_int 0)))] "" "setf nh,%0" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sge" [(set (match_operand:SI 0 "register_operand" "=r") (ge:SI (cc0) (const_int 0)))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0) return 0; return \"setf ge,%0\";}" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sgeu" [(set (match_operand:SI 0 "register_operand" "=r") (geu:SI (cc0) (const_int 0)))] "" "setf nl,%0" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "slt" [(set (match_operand:SI 0 "register_operand" "=r") (lt:SI (cc0) (const_int 0)))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0) return 0; return \"setf lt,%0\";}" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sltu" [(set (match_operand:SI 0 "register_operand" "=r") (ltu:SI (cc0) (const_int 0)))] "" "setf l,%0" [(set_attr "length" "4") (set_attr "cc" "none_0hit")])(define_insn "sgt" [(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 (); 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]); } if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET && SET_DEST (PATTERN (insn)) == cc0_rtx) { rtx src = SET_SRC (PATTERN (insn)); if (GET_CODE (src) == COMPARE) { operands[4] = XEXP (src, 0); operands[5] = XEXP (src, 1); } else if (GET_CODE (src) == REG || GET_CODE (src) == SUBREG) { operands[4] = src; operands[5] = const0_rtx; } else abort (); } else abort ();}");; ??? 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")])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -