⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sparc.md

📁 早期freebsd实现
💻 MD
📖 第 1 页 / 共 5 页
字号:
	(ne:SI (match_operand:SI 1 "register_operand" "r") (const_int 0)))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;addx %%g0,0,%0"  [(set_attr "type" "unary")   (set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r")		       (const_int 0))))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;subx %%g0,0,%0"  [(set_attr "type" "unary")   (set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(eq:SI (match_operand:SI 1 "register_operand" "r") (const_int 0)))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;subx %%g0,-1,%0"  [(set_attr "type" "unary")   (set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (eq:SI (match_operand:SI 1 "register_operand" "r")		       (const_int 0))))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;addx %%g0,-1,%0"  [(set_attr "type" "unary")   (set_attr "length" "2")]);; We can also do (x + (i == 0)) and related, so put them in.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(plus:SI (ne:SI (match_operand:SI 1 "register_operand" "r")			(const_int 0))		 (match_operand:SI 2 "register_operand" "r")))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;addx %2,0,%0"  [(set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (match_operand:SI 2 "register_operand" "r")		  (ne:SI (match_operand:SI 1 "register_operand" "r")			 (const_int 0))))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;subx %2,0,%0"  [(set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(plus:SI (eq:SI (match_operand:SI 1 "register_operand" "r")			(const_int 0))		 (match_operand:SI 2 "register_operand" "r")))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;subx %2,-1,%0"  [(set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (match_operand:SI 2 "register_operand" "r")		  (eq:SI (match_operand:SI 1 "register_operand" "r")			 (const_int 0))))   (clobber (reg:CC 0))]  ""  "subcc %%g0,%1,%%g0\;addx %2,-1,%0"  [(set_attr "length" "2")]);; We can also do GEU and LTU directly, but these operate after a;; compare.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(ltu:SI (reg:CC 0) (const_int 0)))]  ""  "addx %%g0,0,%0"  [(set_attr "type" "misc")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (ltu:SI (reg:CC 0) (const_int 0))))]  ""  "subx %%g0,0,%0"  [(set_attr "type" "misc")]);; ??? Combine should canonicalize these next two to the same pattern.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (neg:SI (ltu:SI (reg:CC 0) (const_int 0)))		  (match_operand:SI 1 "arith_operand" "rI")))]  ""  "subx %%g0,%1,%0"  [(set_attr "type" "unary")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (plus:SI (ltu:SI (reg:CC 0) (const_int 0))			 (match_operand:SI 1 "arith_operand" "rI"))))]  ""  "subx %%g0,%1,%0"  [(set_attr "type" "unary")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(geu:SI (reg:CC 0) (const_int 0)))]  ""  "subx %%g0,-1,%0"  [(set_attr "type" "misc")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (geu:SI (reg:CC 0) (const_int 0))))]  ""  "addx %%g0,-1,%0"  [(set_attr "type" "misc")]);; We can also do (x + ((unsigned) i >= 0)) and related, so put them in.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(plus:SI (ltu:SI (reg:CC 0) (const_int 0))		 (match_operand:SI 1 "arith_operand" "rI")))]  ""  "addx %%g0,%1,%0"  [(set_attr "type" "unary")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(plus:SI (ltu:SI (reg:CC 0) (const_int 0))		 (plus:SI (match_operand:SI 1 "arith_operand" "%r")			  (match_operand:SI 2 "arith_operand" "rI"))))]  ""  "addx %1,%2,%0")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (match_operand:SI 1 "register_operand" "r")		  (ltu:SI (reg:CC 0) (const_int 0))))]  ""  "subx %1,0,%0"  [(set_attr "type" "unary")]);; ??? Combine should canonicalize these next two to the same pattern.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")			    (match_operand:SI 2 "arith_operand" "rI"))		  (ltu:SI (reg:CC 0) (const_int 0))))]  ""  "subx %1,%2,%0")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (match_operand:SI 1 "register_operand" "r")		  (plus:SI (ltu:SI (reg:CC 0) (const_int 0))			   (match_operand:SI 2 "arith_operand" "rI"))))]  ""  "subx %1,%2,%0")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(plus:SI (geu:SI (reg:CC 0) (const_int 0))		 (match_operand:SI 1 "register_operand" "r")))]  ""  "subx %1,-1,%0"  [(set_attr "type" "unary")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(minus:SI (match_operand:SI 1 "register_operand" "r")		  (geu:SI (reg:CC 0) (const_int 0))))]  ""  "addx %1,-1,%0"  [(set_attr "type" "unary")]);; Now we have the generic scc insns.  These will be done using a jump.;; We have to exclude the cases above, since we will not want combine to;; turn something that does not require a jump into something that does.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(match_operator:SI 1 "noov_compare_op" [(reg 0) (const_int 0)]))]  ""  "* return output_scc_insn (operands, insn); "  [(set_attr "type" "multi")   (set_attr "length" "3")]);; These control RTL generation for conditional jump insns(define_expand "beq"  [(set (pc)	(if_then_else (eq (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (EQ, sparc_compare_op0, sparc_compare_op1); }")(define_expand "bne"  [(set (pc)	(if_then_else (ne (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (NE, sparc_compare_op0, sparc_compare_op1); }")(define_expand "bgt"  [(set (pc)	(if_then_else (gt (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (GT, sparc_compare_op0, sparc_compare_op1); }")(define_expand "bgtu"  [(set (pc)	(if_then_else (gtu (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (GTU, sparc_compare_op0, sparc_compare_op1);}")(define_expand "blt"  [(set (pc)	(if_then_else (lt (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (LT, sparc_compare_op0, sparc_compare_op1); }")(define_expand "bltu"  [(set (pc)	(if_then_else (ltu (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (LTU, sparc_compare_op0, sparc_compare_op1);}")(define_expand "bge"  [(set (pc)	(if_then_else (ge (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (GE, sparc_compare_op0, sparc_compare_op1); }")(define_expand "bgeu"  [(set (pc)	(if_then_else (geu (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (GEU, sparc_compare_op0, sparc_compare_op1);}")(define_expand "ble"  [(set (pc)	(if_then_else (le (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (LE, sparc_compare_op0, sparc_compare_op1); }")(define_expand "bleu"  [(set (pc)	(if_then_else (leu (match_dup 1) (const_int 0))		      (label_ref (match_operand 0 "" ""))		      (pc)))]  ""  "{ operands[1] = gen_compare_reg (LEU, sparc_compare_op0, sparc_compare_op1);}");; Now match both normal and inverted jump.(define_insn ""  [(set (pc)	(if_then_else (match_operator 0 "noov_compare_op"				      [(reg 0) (const_int 0)])		      (label_ref (match_operand 1 "" ""))		      (pc)))]  ""  "*{  return output_cbranch (operands[0], 1, 0,			 final_sequence && INSN_ANNULLED_BRANCH_P (insn),			 ! final_sequence);}"  [(set_attr "type" "branch")])(define_insn ""  [(set (pc)	(if_then_else (match_operator 0 "noov_compare_op"				      [(reg 0) (const_int 0)])		      (pc)		      (label_ref (match_operand 1 "" ""))))]  ""  "*{  return output_cbranch (operands[0], 1, 1,			 final_sequence && INSN_ANNULLED_BRANCH_P (insn),			 ! final_sequence);}"  [(set_attr "type" "branch")]);; Move instructions(define_expand "movsi"  [(set (match_operand:SI 0 "general_operand" "")	(match_operand:SI 1 "general_operand" ""))]  ""  "{  if (emit_move_sequence (operands, SImode, 0))    DONE;}")(define_expand "reload_insi"  [(set (match_operand:SI 0 "register_operand" "=r")	(match_operand:SI 1 "general_operand" ""))   (clobber (match_operand:SI 2 "register_operand" "=&r"))]  ""  "{  if (emit_move_sequence (operands, SImode, operands[2]))    DONE;  /* We don't want the clobber emitted, so handle this ourselves.  */  emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));  DONE;}");; We must support both 'r' and 'f' registers here, because combine may;; convert SFmode hard registers to SImode hard registers when simplifying;; subreg sets.;; We cannot combine the similar 'r' and 'f' constraints, because it causes;; problems with register allocation.  Reload might try to put an integer;; in an fp register, or an fp number is an integer register.(define_insn ""  [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,f,Q,Q,rf")	(match_operand:SI 1 "move_operand" "rI,K,Q,!Q,rJ,!f,!fr"))]  "register_operand (operands[0], SImode)   || register_operand (operands[1], SImode)   || operands[1] == const0_rtx"  "@   mov %1,%0   sethi %%hi(%a1),%0   ld %1,%0   ld %1,%0   st %r1,%0   st %r1,%0   st %r1,[%%fp-4]\;ld [%%fp-4],%0"  [(set_attr "type" "move,move,load,load,store,store,multi")   (set_attr "length" "*,1,*,*,*,*,*")]);; Special pic pattern, for loading the address of a label into a register.;; It clobbers o7 because the call puts the return address (i.e. pc value);; there.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(match_operand:SI 1 "move_pic_label" "i"))   (set (reg:SI 15) (pc))]  ""  "\\n1:\;call 2f\;sethi %%hi(%l1-1b),%0\\n2:\\tor %0,%%lo(%l1-1b),%0\;add %0,%%o7,%0"  [(set_attr "type" "multi")   (set_attr "length" "4")])(define_insn ""  [(set (match_operand:DI 0 "register_operand" "=r")	(high:DI (match_operand 1 "" "")))]  "check_pic (1)"  "*{  rtx op0 = operands[0];  rtx op1 = operands[1];  if (GET_CODE (op1) == CONST_INT)    {      operands[0] = operand_subword (op0, 1, 0, DImode);      output_asm_insn (\"sethi %%hi(%a1),%0\", operands);      operands[0] = operand_subword (op0, 0, 0, DImode);      if (INTVAL (op1) < 0)	output_asm_insn (\"mov -1,%0\", operands);      else	output_asm_insn (\"mov 0,%0\", operands);    }  else if (GET_CODE (op1) == CONST_DOUBLE)    {      operands[0] = operand_subword (op0, 1, 0, DImode);      operands[1] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (op1));      output_asm_insn (\"sethi %%hi(%a1),%0\", operands);      operands[0] = operand_subword (op0, 0, 0, DImode);      operands[1] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_HIGH (op1));      output_asm_insn (singlemove_string (operands), operands);    }  else    abort ();}"  [(set_attr "type" "move")   (set_attr "length" "2")]);; For PIC, symbol_refs are put inside unspec so that the optimizer won't;; confuse them with real addresses.(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(high:SI (unspec:SI [(match_operand 1 "" "")] 0)))]  "check_pic (1)"  "sethi %%hi(%a1),%0"  [(set_attr "type" "move")   (set_attr "length" "1")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(high:SI (match_operand 1 "" "")))]  "check_pic (1)"  "sethi %%hi(%a1),%0"  [(set_attr "type" "move")   (set_attr "length" "1")])(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -