📄 pdp11.md
字号:
"asr %0" [(set_attr "length" "1,2")]);; lsr(define_insn "" [(set (match_operand:HI 0 "general_operand" "=rR,Q") (lshiftrt:HI (match_operand:HI 1 "general_operand" "0,0") (const_int 1)))] "" "clc\;ror %0" [(set_attr "length" "1,2")])(define_insn "lshrsi3" [(set (match_operand:SI 0 "register_operand" "=r") (lshiftrt:SI (match_operand:SI 1 "general_operand" "0") (const_int 1)))] ""{ rtx lateoperands[2]; lateoperands[0] = operands[0]; operands[0] = gen_rtx_REG (HImode, REGNO (operands[0]) + 1); lateoperands[1] = operands[1]; operands[1] = gen_rtx_REG (HImode, REGNO (operands[1]) + 1); output_asm_insn (\"clc\", operands); output_asm_insn (\"ror %0\", lateoperands); output_asm_insn (\"ror %0\", operands); return \"\";} [(set_attr "length" "5")]);; shift is by arbitrary count is expensive, ;; shift by one cheap - so let's do that, if;; space doesn't matter(define_insn "" [(set (match_operand:HI 0 "general_operand" "=r") (ashift:HI (match_operand:HI 1 "general_operand" "0") (match_operand:HI 2 "expand_shift_operand" "O")))] "! optimize_size" "*{ register int i; for (i = 1; i <= abs(INTVAL(operands[2])); i++) if (INTVAL(operands[2]) < 0) output_asm_insn(\"asr %0\", operands); else output_asm_insn(\"asl %0\", operands); return \"\";}";; longest is 4 [(set (attr "length") (const_int 4))]);; aslb(define_insn "" [(set (match_operand:QI 0 "general_operand" "=r,o") (ashift:QI (match_operand:QI 1 "general_operand" "0,0") (match_operand:HI 2 "const_immediate_operand" "n,n")))] "" "*{ /* allowing predec or post_inc is possible, but hairy! */ int i, cnt; cnt = INTVAL(operands[2]) & 0x0007; for (i=0 ; i < cnt ; i++) output_asm_insn(\"aslb %0\", operands); return \"\";}";; set attribute length ( match_dup 2 & 7 ) *(1 or 2) !!! [(set_attr_alternative "length" [(const_int 7) (const_int 14)])]);;; asr ;(define_insn "" ; [(set (match_operand:HI 0 "general_operand" "=rR,Q"); (ashiftrt:HI (match_operand:HI 1 "general_operand" "0,0"); (const_int 1)))]; ""; "asr %0"; [(set_attr "length" "1,2")]);; asrb(define_insn "" [(set (match_operand:QI 0 "general_operand" "=r,o") (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (match_operand:HI 2 "const_immediate_operand" "n,n")))] "" "*{ /* allowing predec or post_inc is possible, but hairy! */ int i, cnt; cnt = INTVAL(operands[2]) & 0x0007; for (i=0 ; i < cnt ; i++) output_asm_insn(\"asrb %0\", operands); return \"\";}" [(set_attr_alternative "length" [(const_int 7) (const_int 14)])]);; the following is invalid - too complex!!! - just say 14 !!!; [(set (attr "length") (plus (and (match_dup 2); (const_int 7)); (and (match_dup 2); (const_int 7))))]);; can we get +-1 in the next pattern? should ;; have been caught by previous patterns!(define_insn "ashlhi3" [(set (match_operand:HI 0 "register_operand" "=r,r") (ashift:HI (match_operand:HI 1 "register_operand" "0,0") (match_operand:HI 2 "general_operand" "rR,Qi")))] "" "*{ if (GET_CODE(operands[2]) == CONST_INT) { if (INTVAL(operands[2]) == 1) return \"asl %0\"; else if (INTVAL(operands[2]) == -1) return \"asr %0\"; } return \"ash %2,%0\";}" [(set_attr "length" "1,2")]);; Arithmetic right shift on the pdp works by negating the shift count.(define_expand "ashrhi3" [(set (match_operand:HI 0 "register_operand" "=r") (ashift:HI (match_operand:HI 1 "register_operand" "0") (match_operand:HI 2 "general_operand" "g")))] "" "{ operands[2] = negate_rtx (HImode, operands[2]);}");;;;- logical shift instructions;;(define_insn "lshrsi3";; [(set (match_operand:HI 0 "register_operand" "=r");; (lshiftrt:HI (match_operand:HI 1 "register_operand" "0");; (match_operand:HI 2 "arith_operand" "rI")))];; "";; "srl %0,%2");; absolute (define_insn "absdf2" [(set (match_operand:DF 0 "general_operand" "=fR,Q") (abs:DF (match_operand:DF 1 "general_operand" "0,0")))] "TARGET_FPU" "{absd|absf} %0" [(set_attr "length" "1,2")])(define_insn "abshi2" [(set (match_operand:HI 0 "general_operand" "=r,o") (abs:HI (match_operand:HI 1 "general_operand" "0,0")))] "TARGET_ABSHI_BUILTIN" "*{ static int count = 0; char buf[200]; output_asm_insn(\"tst %0\", operands); sprintf(buf, \"bge abshi%d\", count); output_asm_insn(buf, NULL); output_asm_insn(\"neg %0\", operands); sprintf(buf, \"\\nabshi%d:\", count++); output_asm_insn(buf, NULL); return \"\";}" [(set_attr "length" "3,5")]);; define expand abshi - is much better !!! - but;; will it be optimized into an abshi2 ?;; it will leave better code, because the tsthi might be ;; optimized away!!; -- just a thought - don't have time to check ;;(define_expand "abshi2"; [(match_operand:HI 0 "general_operand" ""); (match_operand:HI 1 "general_operand" "")]; ""; ";{; rtx label = gen_label_rtx ();;; /* do I need this? */; do_pending_stack_adjust ();;; emit_move_insn (operands[0], operands[1]);;; emit_insn (gen_tsthi (operands[0]));; emit_insn (gen_bge (label1));;; emit_insn (gen_neghi(operands[0], operands[0]); ; emit_barrier ();;; emit_label (label);;; /* allow REG_NOTES to be set on last insn (labels don't have enough; fields, and can't be used for REG_NOTES anyway). */; emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));; DONE;;}");; negate insns(define_insn "negdf2" [(set (match_operand:DF 0 "general_operand" "=fR,Q") (neg:DF (match_operand:DF 1 "register_operand" "0,0")))] "TARGET_FPU" "{negd|negf} %0" [(set_attr "length" "1,2")])(define_insn "negsi2" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operand:SI 1 "general_operand" "0")))] ""{ rtx lateoperands[2]; lateoperands[0] = operands[0]; operands[0] = gen_rtx_REG (HImode, REGNO (operands[0]) + 1); lateoperands[1] = operands[1]; operands[1] = gen_rtx_REG (HImode, REGNO (operands[1]) + 1); output_asm_insn (\"com %0\", operands); output_asm_insn (\"com %0\", lateoperands); output_asm_insn (\"inc %0\", operands); output_asm_insn (\"adc %0\", lateoperands); return \"\";} [(set_attr "length" "5")])(define_insn "neghi2" [(set (match_operand:HI 0 "general_operand" "=rR,Q") (neg:HI (match_operand:HI 1 "general_operand" "0,0")))] "" "neg %0" [(set_attr "length" "1,2")])(define_insn "negqi2" [(set (match_operand:QI 0 "general_operand" "=rR,Q") (neg:QI (match_operand:QI 1 "general_operand" "0,0")))] "" "negb %0" [(set_attr "length" "1,2")]);; Unconditional and other jump instructions(define_insn "jump" [(set (pc) (label_ref (match_operand 0 "" "")))] "" "jmp %l0" [(set_attr "length" "2")])(define_insn "" [(set (pc) (label_ref (match_operand 0 "" ""))) (clobber (const_int 1))] "" "jmp %l0" [(set_attr "length" "2")])(define_insn "tablejump" [(set (pc) (match_operand:HI 0 "general_operand" "rR,Q")) (use (label_ref (match_operand 1 "" "")))] "" "jmp %0" [(set_attr "length" "1,2")]);; indirect jump - let's be conservative!;; allow only register_operand, even though we could also ;; allow labels etc.(define_insn "indirect_jump" [(set (pc) (match_operand:HI 0 "register_operand" "r"))] "" "jmp (%0)");;- jump to subroutine(define_insn "call" [(call (match_operand:HI 0 "general_operand" "rR,Q") (match_operand:HI 1 "general_operand" "g,g"));; (use (reg:HI 0)) what was that ??? ] ;;- Don't use operand 1 for most machines. "" "jsr pc, %0" [(set_attr "length" "1,2")]);;- jump to subroutine(define_insn "call_value" [(set (match_operand 0 "" "") (call (match_operand:HI 1 "general_operand" "rR,Q") (match_operand:HI 2 "general_operand" "g,g")));; (use (reg:HI 0)) - what was that ???? ] ;;- Don't use operand 2 for most machines. "" "jsr pc, %1" [(set_attr "length" "1,2")]);;- nop instruction(define_insn "nop" [(const_int 0)] "" "nop");;- multiply (define_insn "muldf3" [(set (match_operand:DF 0 "register_operand" "=a,a,a") (mult:DF (match_operand:DF 1 "register_operand" "%0,0,0") (match_operand:DF 2 "general_operand" "fR,Q,F")))] "TARGET_FPU" "{muld|mulf} %2, %0" [(set_attr "length" "1,2,5")]);; 16 bit result multiply:;; currently we multiply only into odd registers, so we don't use two ;; registers - but this is a bit inefficient at times. If we define ;; a register class for each register, then we can specify properly ;; which register need which scratch register ....(define_insn "mulhi3" [(set (match_operand:HI 0 "register_operand" "=d,d") ; multiply regs (mult:HI (match_operand:HI 1 "register_operand" "%0,0") (match_operand:HI 2 "general_operand" "rR,Qi")))] "TARGET_45" "mul %2, %0" [(set_attr "length" "1,2")]);; 32 bit result(define_expand "mulhisi3" [(set (match_dup 3) (match_operand:HI 1 "general_operand" "g,g")) (set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered! (mult:SI (truncate:HI (match_dup 0)) (match_operand:HI 2 "general_operand" "rR,Qi")))] "TARGET_45" "operands[3] = gen_lowpart(HImode, operands[1]);")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered! (mult:SI (truncate:HI (match_operand:SI 1 "register_operand" "%0,0")) (match_operand:HI 2 "general_operand" "rR,Qi")))] "TARGET_45" "mul %2, %0" [(set_attr "length" "1,2")]);(define_insn "mulhisi3"; [(set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered!; (mult:SI (truncate:HI ; (match_operand:SI 1 "register_operand" "%0,0")); (match_operand:HI 2 "general_operand" "rR,Qi")))]; "TARGET_45"; "mul %2, %0"; [(set_attr "length" "1,2")]);;- divide(define_insn "divdf3" [(set (match_operand:DF 0 "register_operand" "=a,a,a") (div:DF (match_operand:DF 1 "register_operand" "0,0,0") (match_operand:DF 2 "general_operand" "fR,Q,F")))] "TARGET_FPU" "{divd|divf} %2, %0" [(set_attr "length" "1,2,5")]) (define_expand "divhi3" [(set (subreg:HI (match_dup 1) 0) (div:HI (match_operand:SI 1 "general_operand" "0") (match_operand:HI 2 "general_operand" "g"))) (set (match_operand:HI 0 "general_operand" "=r") (subreg:HI (match_dup 1) 0))] "TARGET_45" "")(define_insn "" [(set (subreg:HI (match_operand:SI 0 "general_operand" "=r") 0) (div:HI (match_operand:SI 1 "general_operand" "0") (match_operand:HI 2 "general_operand" "g")))] "TARGET_45" "div %2,%0" [(set_attr "length" "2")])(define_expand "modhi3" [(set (subreg:HI (match_dup 1) 2) (mod:HI (match_operand:SI 1 "general_operand" "0") (match_operand:HI 2 "general_operand" "g"))) (set (match_operand:HI 0 "general_operand" "=r") (subreg:HI (match_dup 1) 2))] "TARGET_45" "")(define_insn "" [(set (subreg:HI (match_operand:SI 0 "general_operand" "=r") 2) (mod:HI (match_operand:SI 1 "general_operand" "0") (match_operand:HI 2 "general_operand" "g")))] "TARGET_45" "div %2,%0" [(set_attr "length" "2")]);(define_expand "divmodhi4"; [(parallel [(set (subreg:HI (match_dup 1) 0); (div:HI (match_operand:SI 1 "general_operand" "0"); (match_operand:HI 2 "general_operand" "g"))); (set (subreg:HI (match_dup 1) 2); (mod:HI (match_dup 1); (match_dup 2)))]); (set (match_operand:HI 3 "general_operand" "=r"); (subreg:HI (match_dup 1) 2)); (set (match_operand:HI 0 "general_operand" "=r"); (subreg:HI (match_dup 1) 0))]; "TARGET_45"; "");;(define_insn ""; [(set (subreg:HI (match_operand:SI 0 "general_operand" "=r") 0); (div:HI (match_operand:SI 1 "general_operand" "0"); (match_operand:HI 2 "general_operand" "g"))); (set (subreg:HI (match_dup 0) 2); (mod:HI (match_dup 1); (match_dup 2)))]; "TARGET_45"; "div %2, %0"); ;; is rotate doing the right thing to be included here ????
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -