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

📄 h8300.md

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 MD
📖 第 1 页 / 共 5 页
字号:
   (set_attr "length" "4")])(define_insn "*stm_h8300s_3"  [(parallel     [(set (reg:SI SP_REG)	   (plus:SI (reg:SI SP_REG) (const_int -12)))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))	   (match_operand:SI 0 "register_operand" ""))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -8)))	   (match_operand:SI 1 "register_operand" ""))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -12)))	   (match_operand:SI 2 "register_operand" ""))])]  "TARGET_H8300S   && ((REGNO (operands[0]) == 0	&& REGNO (operands[1]) == 1	&& REGNO (operands[2]) == 2)       || (REGNO (operands[0]) == 4	   && REGNO (operands[1]) == 5	   && REGNO (operands[2]) == 6))"  "stm.l\\t%S0-%S2,@-er7"  [(set_attr "cc" "none")   (set_attr "length" "4")])(define_insn "*stm_h8300s_4"  [(parallel     [(set (reg:SI SP_REG)	   (plus:SI (reg:SI SP_REG) (const_int -16)))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))	   (match_operand:SI 0 "register_operand" ""))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -8)))	   (match_operand:SI 1 "register_operand" ""))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -12)))	   (match_operand:SI 2 "register_operand" ""))      (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -16)))	   (match_operand:SI 3 "register_operand" ""))])]  "TARGET_H8300S   && REGNO (operands[0]) == 0   && REGNO (operands[1]) == 1   && REGNO (operands[2]) == 2   && REGNO (operands[3]) == 3"  "stm.l\\t%S0-%S3,@-er7"  [(set_attr "cc" "none")   (set_attr "length" "4")]);; ----------------------------------------------------------------------;; EXTEND INSTRUCTIONS;; ----------------------------------------------------------------------(define_expand "zero_extendqihi2"  [(set (match_operand:HI 0 "register_operand" "")	(zero_extend:HI (match_operand:QI 1 "general_operand_src" "")))]  ""  "")(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r,r")	(zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  mov.b	#0,%t0  mov.b	%R1,%s0\;mov.b	#0,%t0"  [(set_attr "length" "2,10")   (set_attr "cc" "clobber,clobber")])(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r,r")	(zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300H || TARGET_H8300S"  "@  extu.w	%T0  mov.b	%R1,%s0\;extu.w	%T0"  [(set_attr "length" "2,10")   (set_attr "cc" "set_znv,set_znv")]);; The compiler can synthesize a H8/300H variant of this which is;; just as efficient as one that we'd create(define_insn "zero_extendqisi2"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(zero_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  mov.b	#0,%x0\;sub.w	%e0,%e0  mov.b	%R1,%w0\;mov.b	#0,%x0\;sub.w	%e0,%e0"  [(set_attr "length" "4,8")   (set_attr "cc" "clobber,clobber")])(define_expand "zero_extendhisi2"  [(set (match_operand:SI 0 "register_operand" "")	(zero_extend:SI (match_operand:HI 1 "register_operand" "")))]  ""  "");; %e prints the high part of a CONST_INT, not the low part.  Arggh.(define_insn "*zero_extendhisi2_h8300"  [(set (match_operand:SI 0 "register_operand" "=r,r,r")	(zero_extend:SI (match_operand:HI 1 "general_operand_src" "0,i,g>")))]  "TARGET_H8300"  "@  sub.w	%e0,%e0  mov.w	%f1,%f0\;sub.w	%e0,%e0  mov.w	%e1,%f0\;sub.w	%e0,%e0"  [(set_attr "length" "2,4,6")   (set_attr "cc" "clobber,clobber,clobber")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(zero_extend:SI (match_operand:HI 1 "register_operand" "0")))]  "TARGET_H8300H || TARGET_H8300S"  "extu.l	%S0"  [(set_attr "length" "2")   (set_attr "cc" "set_znv")])(define_expand "extendqihi2"  [(set (match_operand:HI 0 "register_operand" "")	(sign_extend:HI (match_operand:QI 1 "register_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r,r")	(sign_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  bld	#7,%s0\;subx	%t0,%t0  mov.b	%R1,%s0\;bld	#7,%s0\;subx	%t0,%t0"  [(set_attr "length" "4,8")   (set_attr "cc" "clobber,clobber")])(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r")	(sign_extend:HI (match_operand:QI 1 "register_operand" "0")))]  "TARGET_H8300H || TARGET_H8300S"  "exts.w	%T0"  [(set_attr "length" "2")   (set_attr "cc" "set_znv")]);; The compiler can synthesize a H8/300H variant of this which is;; just as efficient as one that we'd create(define_insn "extendqisi2"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(sign_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0  mov.b	%R1,%w0\;bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0"  [(set_attr "length" "8,12")   (set_attr "cc" "clobber,clobber")])(define_expand "extendhisi2"  [(set (match_operand:SI 0 "register_operand" "")	(sign_extend:SI (match_operand:HI 1 "register_operand" "")))]  ""  "")(define_insn "*extendhisi2_h8300"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(sign_extend:SI (match_operand:HI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  bld	#7,%x0\;subx	%y0,%y0\;subx	%z0,%z0  mov.w	%T1,%f0\;bld	#7,%x0\;subx	%y0,%y0\;subx	%z0,%z0"  [(set_attr "length" "6,10")   (set_attr "cc" "clobber,clobber")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(sign_extend:SI (match_operand:HI 1 "register_operand" "0")))]  "TARGET_H8300H || TARGET_H8300S"  "exts.l	%S0"  [(set_attr "length" "2")   (set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; SHIFTS;; ----------------------------------------------------------------------;;;; We make some attempt to provide real efficient shifting.  One example is;; doing an 8 bit shift of a 16 bit value by moving a byte reg into the other;; reg and moving 0 into the former reg.;;;; We also try to achieve this in a uniform way.  IE: We don't try to achieve;; this in both rtl and at insn emit time.  Ideally, we'd use rtl as that would;; give the optimizer more cracks at the code.  However, we wish to do things;; like optimizing shifting the sign bit to bit 0 by rotating the other way.;; There is rtl to handle this (rotate + and), but the H8/300 doesn't handle;; 16 bit rotates.  Also, if we emit complicated rtl, combine may not be able;; to detect cases it can optimize.;;;; For these and other fuzzy reasons, I've decided to go the less pretty but;; easier "do it at insn emit time" route.;; QI BIT SHIFTS(define_expand "ashlqi3"  [(set (match_operand:QI 0 "register_operand" "")	(ashift:QI (match_operand:QI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (QImode, ASHIFT, operands)) DONE; else FAIL;")(define_expand "ashrqi3"  [(set (match_operand:QI 0 "register_operand" "")	(ashiftrt:QI (match_operand:QI 1 "register_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (QImode, ASHIFTRT, operands)) DONE; else FAIL;")(define_expand "lshrqi3"  [(set (match_operand:QI 0 "register_operand" "")	(lshiftrt:QI (match_operand:QI 1 "register_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (QImode, LSHIFTRT, operands)) DONE; else FAIL;")(define_insn ""  [(set (match_operand:QI 0 "register_operand" "=r,r")	(match_operator:QI 3 "nshift_operator"			[ (match_operand:QI 1 "register_operand" "0,0")			  (match_operand:QI 2 "nonmemory_operand" "R,rn")]))   (clobber (match_scratch:QI 4 "=X,&r"))]  ""  "* return output_a_shift (operands);"  [(set (attr "length")	(symbol_ref "compute_a_shift_length (insn, operands)"))   (set_attr "cc" "clobber")]);; HI BIT SHIFTS(define_expand "ashlhi3"  [(set (match_operand:HI 0 "register_operand" "")	(ashift:HI (match_operand:HI 1 "nonmemory_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (HImode, ASHIFT, operands)) DONE; else FAIL;")(define_expand "lshrhi3"  [(set (match_operand:HI 0 "register_operand" "")	(lshiftrt:HI (match_operand:HI 1 "general_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (HImode, LSHIFTRT, operands)) DONE; else FAIL;")(define_expand "ashrhi3"  [(set (match_operand:HI 0 "register_operand" "")	(ashiftrt:HI (match_operand:HI 1 "register_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (HImode, ASHIFTRT, operands)) DONE; else FAIL;")(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r,r")	(match_operator:HI 3 "nshift_operator"			[ (match_operand:HI 1 "register_operand" "0,0")			  (match_operand:QI 2 "nonmemory_operand" "S,rn")]))   (clobber (match_scratch:QI 4 "=X,&r"))]  ""  "* return output_a_shift (operands);"  [(set (attr "length")	(symbol_ref "compute_a_shift_length (insn, operands)"))   (set_attr "cc" "clobber")]);;  SI BIT SHIFTS(define_expand "ashlsi3"  [(set (match_operand:SI 0 "register_operand" "")	(ashift:SI (match_operand:SI 1 "general_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (SImode, ASHIFT, operands)) DONE; else FAIL;")(define_expand "lshrsi3"  [(set (match_operand:SI 0 "register_operand" "")	(lshiftrt:SI (match_operand:SI 1 "general_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (SImode, LSHIFTRT, operands)) DONE; else FAIL;")(define_expand "ashrsi3"  [(set (match_operand:SI 0 "register_operand" "")	(ashiftrt:SI (match_operand:SI 1 "general_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (SImode, ASHIFTRT, operands)) DONE; else FAIL;")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r,r")	(match_operator:SI 3 "nshift_operator"			[ (match_operand:SI 1 "register_operand" "0,0")			  (match_operand:QI 2 "nonmemory_operand" "T,rn")]))   (clobber (match_scratch:QI 4 "=X,&r"))]  ""  "* return output_a_shift (operands);"  [(set (attr "length")	(symbol_ref "compute_a_shift_length (insn, operands)"))   (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; ROTATIONS;; ----------------------------------------------------------------------(define_expand "rotlqi3"  [(set (match_operand:QI 0 "register_operand" "")	(rotate:QI (match_operand:QI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;")(define_insn "*rotlqi3_1"  [(set (match_operand:QI 0 "register_operand" "=r")	(rotate:QI (match_operand:QI 1 "register_operand" "0")		   (match_operand:QI 2 "immediate_operand" "")))]  ""  "* return emit_a_rotate (ROTATE, operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")])(define_expand "rotlhi3"  [(set (match_operand:HI 0 "register_operand" "")	(rotate:HI (match_operand:HI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;")(define_insn "*rotlhi3_1"  [(set (match_operand:HI 0 "register_operand" "=r")	(rotate:HI (match_operand:HI 1 "register_operand" "0")		   (match_operand:QI 2 "immediate_operand" "")))]  ""  "* return emit_a_rotate (ROTATE, operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")])(define_expand "rotlsi3"  [(set (match_operand:SI 0 "register_operand" "")	(rotate:SI (match_operand:SI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  "TARGET_H8300H || TARGET_H8300S"  "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;")(define_insn "*rotlsi3_1"  [(set (match_operand:SI 0 "register_operand" "=r")	(rotate:SI (match_operand:SI 1 "register_operand" "0")		   (match_operand:QI 2 "immediate_operand" "")))]  "TARGET_H8300H || TARGET_H8300S"  "* return emit_a_rotate (ROTATE, operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")]);; -----------------------------------------------------------------;; BIT FIELDS;; -----------------------------------------------------------------;; The H8/300 has given 1/8th of its opcode space to bitfield;; instructions so let's use them as well as we can.;; You'll never believe all these patterns perform one basic action --;; load a bit from the source, optionally invert the bit, then store it;; in the destination (which is known to be zero).;;;; Combine obviously need some work to better identify this situation and;; canonicalize the form better.;;;; Normal loads with a 16bit destination.;;(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=&r")	(zero_extract:HI (match_operand:HI 1 "register_operand" "r")			 (const_int 1)			 (match_operand:HI 2 "immediate_operand" "n")))]  "TARGET_H8300"  "sub.w	%0,%0\;bld	%Z2,%Y1\;bst	#0,%X0"  [(set_attr "cc" "clobber")   (set_attr "length" "6")]);;;; Inverted loads with a 16bit destination.;;(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=&r")	(zero_extract:HI (xor:HI (match_operand:HI 1 "register_operand" "r")				 (match_operand:HI 3 "const_int_operand" "n"))			 (const_int 1)			 (match_operand:HI 2 "const_int_operand" "n")))]  "TARGET_H8300   && (1 << INTVAL (operands[2])) == INTVAL (operands[3])"  "sub.w	%0,%0\;bild	%Z2,%Y1\;bst	#0,%X0"  [(set_attr "cc" "clobber")   (set_attr "length" "8")]);;;; Normal loads with a 32bit destination.;;(define_insn "*extzv_1_r_h8300"  [(set (match_operand:SI 0 "register_operand" "=&r")	(zero_extract:SI (match_operand:HI 1 "register_operand" "r")			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "TARGET_H8300   && INTVAL (operands[2]) < 16"  "* return output_simode_bld (0, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "8")])(define_insn "*extzv_1_r_h8300hs"  [(set (match_operand:SI 0 "register_operand" "=r")	(zero_extract:SI (match_operand:SI 1 "register_operand" "r")			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "(TARGET_H8300H || TARGET_H8300S)   && INTVAL (operands[2]) < 16"  "* return output_simode_bld (0, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "8")]);;;; Inverted loads with a 32bit destination.;;(define_insn "*extzv_1_r_inv_h8300"  [(set (match_operand:SI 0 "register_operand" "=&r")	(zero_extract:SI (xor:HI (match_operand:HI 1 "register_operand" "r")				 (match_operand:HI 3 "const_int_operand" "n"))			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "TARGET_H8300   && INTVAL (operands[2]) < 16   && (1 << INTVAL (operands[2])) == INTVAL (operands[3])"  "* return output_simode_bld (1, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "8")])(define_insn "*extzv_1_r_inv_h8300hs"  [(set (match_operand:SI 0 "register_operand" "=r")	(zero_extract:SI 

⌨️ 快捷键说明

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