📄 i960.md
字号:
(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))] "" "ldob %1,%0" [(set_attr "type" "load")])(define_expand "zero_extendqihi2" [(set (match_operand:HI 0 "register_operand" "") (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))] "" "{ if (GET_CODE (operand1) == REG || (GET_CODE (operand1) == SUBREG && GET_CODE (XEXP (operand1, 0)) == REG)) { rtx temp = gen_reg_rtx (SImode); rtx shift_24 = GEN_INT (24); int op0_subreg_byte = 0; int op1_subreg_byte = 0; if (GET_CODE (operand1) == SUBREG) { op1_subreg_byte = SUBREG_BYTE (operand1); operand1 = SUBREG_REG (operand1); } if (GET_MODE (operand1) != SImode) operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_byte); if (GET_CODE (operand0) == SUBREG) { op0_subreg_byte = SUBREG_BYTE (operand0); operand0 = SUBREG_REG (operand0); } if (GET_MODE (operand0) != SImode) operand0 = gen_rtx_SUBREG (SImode, operand0, op0_subreg_byte); emit_insn (gen_ashlsi3 (temp, operand1, shift_24)); emit_insn (gen_lshrsi3 (operand0, temp, shift_24)); DONE; }}")(define_insn "" [(set (match_operand:HI 0 "register_operand" "=d") (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))] "" "ldob %1,%0" [(set_attr "type" "load")]);; Conversions between float and double.(define_insn "extendsfdf2" [(set (match_operand:DF 0 "register_operand" "=*f,d") (float_extend:DF (match_operand:SF 1 "fp_arith_operand" "dGH,fGH")))] "TARGET_NUMERICS" "@ movr %1,%0 movrl %1,%0" [(set_attr "type" "fpmove")])(define_insn "truncdfsf2" [(set (match_operand:SF 0 "register_operand" "=d") (float_truncate:SF (match_operand:DF 1 "fp_arith_operand" "fGH")))] "TARGET_NUMERICS" "movr %1,%0" [(set_attr "type" "fpmove")]);; Conversion between fixed point and floating point.(define_insn "floatsidf2" [(set (match_operand:DF 0 "register_operand" "=f") (float:DF (match_operand:SI 1 "register_operand" "d")))] "TARGET_NUMERICS" "cvtir %1,%0" [(set_attr "type" "fpcvt")])(define_insn "floatsisf2" [(set (match_operand:SF 0 "register_operand" "=d*f") (float:SF (match_operand:SI 1 "register_operand" "d")))] "TARGET_NUMERICS" "cvtir %1,%0" [(set_attr "type" "fpcvt")]);; Convert a float to an actual integer.;; Truncation is performed as part of the conversion.;; The i960 requires conversion from DFmode to DImode to make;; unsigned conversions work properly.(define_insn "fixuns_truncdfdi2" [(set (match_operand:DI 0 "register_operand" "=d") (unsigned_fix:DI (fix:DF (match_operand:DF 1 "fp_arith_operand" "fGH"))))] "TARGET_NUMERICS" "cvtzril %1,%0" [(set_attr "type" "fpcvt")])(define_insn "fixuns_truncsfdi2" [(set (match_operand:DI 0 "register_operand" "=d") (unsigned_fix:DI (fix:SF (match_operand:SF 1 "fp_arith_operand" "fGH"))))] "TARGET_NUMERICS" "cvtzril %1,%0" [(set_attr "type" "fpcvt")])(define_insn "fix_truncdfsi2" [(set (match_operand:SI 0 "register_operand" "=d") (fix:SI (fix:DF (match_operand:DF 1 "fp_arith_operand" "fGH"))))] "TARGET_NUMERICS" "cvtzri %1,%0" [(set_attr "type" "fpcvt")])(define_expand "fixuns_truncdfsi2" [(set (match_operand:SI 0 "register_operand" "") (unsigned_fix:SI (fix:DF (match_operand:DF 1 "fp_arith_operand" ""))))] "TARGET_NUMERICS" "{ rtx temp = gen_reg_rtx (DImode); emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_UNSIGNED_FIX (DImode, gen_rtx_FIX (DFmode, operands[1])))); emit_insn (gen_rtx_SET (VOIDmode, operands[0], gen_rtx_SUBREG (SImode, temp, 0))); DONE;}")(define_insn "fix_truncsfsi2" [(set (match_operand:SI 0 "register_operand" "=d") (fix:SI (fix:SF (match_operand:SF 1 "fp_arith_operand" "dfGH"))))] "TARGET_NUMERICS" "cvtzri %1,%0" [(set_attr "type" "fpcvt")])(define_expand "fixuns_truncsfsi2" [(set (match_operand:SI 0 "register_operand" "") (unsigned_fix:SI (fix:SF (match_operand:SF 1 "fp_arith_operand" ""))))] "TARGET_NUMERICS" "{ rtx temp = gen_reg_rtx (DImode); emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_UNSIGNED_FIX (DImode, gen_rtx_FIX (SFmode, operands[1])))); emit_insn (gen_rtx_SET (VOIDmode, operands[0], gen_rtx_SUBREG (SImode, temp, 0))); DONE;}");; Arithmetic instructions.(define_insn "subsi3" [(set (match_operand:SI 0 "register_operand" "=d") (minus:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "arith_operand" "dI")))] "" "subo %2,%1,%0");; Try to generate an lda instruction when it would be faster than an;; add instruction.;; Some assemblers apparently won't accept two addresses added together.;; ??? The condition should be improved to reject the case of two;; symbolic constants.(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d,d,d") (plus:SI (match_operand:SI 1 "arith32_operand" "%dn,i,dn") (match_operand:SI 2 "arith32_operand" "dn,dn,i")))] "(TARGET_C_SERIES) && (CONSTANT_P (operands[1]) || CONSTANT_P (operands[2]))" "*{ if (GET_CODE (operands[1]) == CONST_INT) { rtx tmp = operands[1]; operands[1] = operands[2]; operands[2] = tmp; } if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (operands[1]) == REG && i960_last_insn_type != I_TYPE_REG) { if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) > -32) return \"subo %n2,%1,%0\"; else if (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32) return \"addo %1,%2,%0\"; } /* Non-canonical results (op1 == const, op2 != const) have been seen in reload output when both operands were symbols before reload, so we deal with it here. This may be a fault of the constraints above. */ if (CONSTANT_P (operands[1])) { if (CONSTANT_P (operands[2])) return \"lda %1+%2,%0\"; else return \"lda %1(%2),%0\"; } return \"lda %2(%1),%0\";}")(define_insn "addsi3" [(set (match_operand:SI 0 "register_operand" "=d") (plus:SI (match_operand:SI 1 "signed_arith_operand" "%dI") (match_operand:SI 2 "signed_arith_operand" "dIK")))] "" "*{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0) return \"subo %n2,%1,%0\"; if (i960_bypass (insn, operands[1], operands[2], 0)) return \"addo %2,%1,%0\"; return \"addo %1,%2,%0\";}")(define_insn "mulsi3" [(set (match_operand:SI 0 "register_operand" "=d") (mult:SI (match_operand:SI 1 "arith_operand" "%dI") (match_operand:SI 2 "arith_operand" "dI")))] "" "*{ if (i960_bypass (insn, operands[1], operands[2], 0)) return \"mulo %2,%1,%0\"; return \"mulo %1,%2,%0\";}" [(set_attr "type" "mult")])(define_insn "umulsidi3" [(set (match_operand:DI 0 "register_operand" "=d") (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d")) (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))] "" "*{ if (i960_bypass (insn, operands[1], operands[2], 0)) return \"emul %2,%1,%0\"; return \"emul %1,%2,%0\";}" [(set_attr "type" "mult")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=d") (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%d")) (match_operand:SI 2 "literal" "I")))] "" "*{ if (i960_bypass (insn, operands[1], operands[2], 0)) return \"emul %2,%1,%0\"; return \"emul %1,%2,%0\";}" [(set_attr "type" "mult")]);; This goes after the move/add/sub/mul instructions ;; because those instructions are better when they apply.(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (match_operand:SI 1 "address_operand" "p"))] "" "lda %a1,%0" [(set_attr "type" "load")]);; This will never be selected because of an "optimization" that GCC does.;; It always converts divides by a power of 2 into a sequence of instructions;; that does a right shift, and then corrects the result if it was negative.;; (define_insn "";; [(set (match_operand:SI 0 "register_operand" "=d");; (div:SI (match_operand:SI 1 "arith_operand" "dI");; (match_operand:SI 2 "power2_operand" "nI")))];; "";; "*{;; operands[2] = GEN_INT (bitpos (INTVAL (operands[2])));;; return \"shrdi %2,%1,%0\";;; }"(define_insn "divsi3" [(set (match_operand:SI 0 "register_operand" "=d") (div:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "arith_operand" "dI")))] "" "divi %2,%1,%0" [(set_attr "type" "div")])(define_insn "udivsi3" [(set (match_operand:SI 0 "register_operand" "=d") (udiv:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "arith_operand" "dI")))] "" "divo %2,%1,%0" [(set_attr "type" "div")]);; We must use `remi' not `modi' here, to ensure that `%' has the effects;; specified by the ANSI C standard.(define_insn "modsi3" [(set (match_operand:SI 0 "register_operand" "=d") (mod:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "arith_operand" "dI")))] "" "remi %2,%1,%0" [(set_attr "type" "div")])(define_insn "umodsi3" [(set (match_operand:SI 0 "register_operand" "=d") (umod:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "arith_operand" "dI")))] "" "remo %2,%1,%0" [(set_attr "type" "div")]);; And instructions (with complement also).(define_insn "andsi3" [(set (match_operand:SI 0 "register_operand" "=d") (and:SI (match_operand:SI 1 "register_operand" "%d") (match_operand:SI 2 "logic_operand" "dIM")))] "" "*{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0) return \"andnot %C2,%1,%0\"; if (i960_bypass (insn, operands[1], operands[2], 0)) return \"and %2,%1,%0\"; return \"and %1,%2,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (and:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "cmplpower2_operand" "n")))] "" "*{ operands[2] = GEN_INT (bitpos (~INTVAL (operands[2]))); return \"clrbit %2,%1,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (and:SI (not:SI (match_operand:SI 1 "register_operand" "d")) (match_operand:SI 2 "logic_operand" "dIM")))] "" "*{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0) return \"nor %C2,%1,%0\"; if (i960_bypass (insn, operands[1], operands[2], 0)) return \"notand %2,%1,%0\"; return \"andnot %1,%2,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (ior:SI (not:SI (match_operand:SI 1 "register_operand" "%d")) (not:SI (match_operand:SI 2 "register_operand" "d"))))] "" "*{ if (i960_bypass (insn, operands[1], operands[2], 0)) return \"nand %2,%1,%0\"; return \"nand %1,%2,%0\";}")(define_insn "iorsi3" [(set (match_operand:SI 0 "register_operand" "=d") (ior:SI (match_operand:SI 1 "register_operand" "%d") (match_operand:SI 2 "logic_operand" "dIM")))] "" "*{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0) return \"ornot %C2,%1,%0\"; if (i960_bypass (insn, operands[1], operands[2], 0)) return \"or %2,%1,%0\"; return \"or %1,%2,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (ior:SI (match_operand:SI 1 "register_operand" "d") (match_operand:SI 2 "power2_operand" "n")))] "" "*{ operands[2] = GEN_INT (bitpos (INTVAL (operands[2]))); return \"setbit %2,%1,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (ior:SI (not:SI (match_operand:SI 1 "register_operand" "d")) (match_operand:SI 2 "logic_operand" "dIM")))] "" "*{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0) return \"nand %C2,%1,%0\"; if (i960_bypass (insn, operands[1], operands[2], 0)) return \"notor %2,%1,%0\"; return \"ornot %1,%2,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (and:SI (not:SI (match_operand:SI 1 "register_operand" "%d")) (not:SI (match_operand:SI 2 "register_operand" "d"))))] "" "*{ if (i960_bypass (insn, operands[1], operands[2], 0)) return \"nor %2,%1,%0\"; return \"nor %1,%2,%0\";}")(define_insn "xorsi3" [(set (match_operand:SI 0 "register_operand" "=d") (xor:SI (match_operand:SI 1 "register_operand" "%d") (match_operand:SI 2 "logic_operand" "dIM")))] "" "*{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0) return \"xnor %C2,%1,%0\"; if (i960_bypass (insn, operands[1], operands[2], 0)) return \"xor %2,%1,%0\"; return \"xor %1,%2,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (xor:SI (match_operand:SI 1 "arith_operand" "dI") (match_operand:SI 2 "power2_operand" "n")))] "" "*{ operands[2] = GEN_INT (bitpos (INTVAL (operands[2]))); return \"notbit %2,%1,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%d") (match_operand:SI 2 "register_operand" "d"))))] "" "*{ if (i960_bypass (insn, operands[1], operands[2], 0)) return \"xnor %2,%1,%0\"; return \"xnor %2,%1,%0\";}")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (ior:SI (ashift:SI (const_int 1) (match_operand:SI 1 "register_operand" "d")) (match_operand:SI 2 "arith_operand" "dI")))] "" "setbit %1,%2,%0");; (not (ashift 1 reg)) canonicalizes to (rotate -2 reg)(define_insn "" [(set (match_operand:SI 0 "register_operand" "=d") (and:SI (rotate:SI (const_int -2) (match_operand:SI 1 "register_operand" "d")) (match_operand:SI 2 "register_operand" "d")))]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -