i386.md
来自「gcc3.2.1源代码」· Markdown 代码 · 共 2,041 行 · 第 1/5 页
MD
2,041 行
(and (eq_attr "cpu" "k6") (eq_attr "type" "idiv")) 17 17);; AMD Athlon Scheduling;;;; The Athlon does contain three pipelined FP units, three integer units and;; three address generation units. ;;;; The predecode logic is determining boundaries of instructions in the 64;; byte cache line. So the cache line straddling problem of K6 might be issue;; here as well, but it is not noted in the documentation.;;;; Three DirectPath instructions decoders and only one VectorPath decoder;; is available. They can decode three DirectPath instructions or one VectorPath;; instruction per cycle.;; Decoded macro instructions are then passed to 72 entry instruction control;; unit, that passes;; it to the specialized integer (18 entry) and fp (36 entry) schedulers.;;;; The load/store queue unit is not attached to the schedulers but;; communicates with all the execution units separately instead.(define_attr "athlon_decode" "direct,vector" (cond [(eq_attr "type" "call,imul,idiv,other,multi,fcmov,fpspc,str,pop,cld,fcmov") (const_string "vector") (and (eq_attr "type" "push") (match_operand 1 "memory_operand" "")) (const_string "vector") (and (eq_attr "type" "fmov") (and (eq_attr "memory" "load,store") (eq_attr "mode" "XF"))) (const_string "vector")] (const_string "direct")))(define_function_unit "athlon_vectordec" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_decode" "vector")) 1 1)(define_function_unit "athlon_directdec" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_decode" "direct")) 1 1)(define_function_unit "athlon_vectordec" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_decode" "direct")) 1 1 [(eq_attr "athlon_decode" "vector")])(define_function_unit "athlon_ieu" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "alu1,negnot,alu,icmp,test,imov,imovx,lea,incdec,ishift,ibr,call,callv,icmov,cld,pop,setcc,push,pop")) 1 1)(define_function_unit "athlon_ieu" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "str")) 15 15)(define_function_unit "athlon_ieu" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "imul")) 5 0)(define_function_unit "athlon_ieu" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "idiv")) 42 0)(define_function_unit "athlon_muldiv" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "imul")) 5 0)(define_function_unit "athlon_muldiv" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "idiv")) 42 42)(define_attr "athlon_fpunits" "none,store,mul,add,muladd,any" (cond [(eq_attr "type" "fop,fop1,fcmp,fistp") (const_string "add") (eq_attr "type" "fmul,fdiv,fpspc,fsgn,fcmov") (const_string "mul") (and (eq_attr "type" "fmov") (eq_attr "memory" "store,both")) (const_string "store") (and (eq_attr "type" "fmov") (eq_attr "memory" "load")) (const_string "any") (and (eq_attr "type" "fmov") (ior (match_operand:SI 1 "register_operand" "") (match_operand 1 "immediate_operand" ""))) (const_string "store") (eq_attr "type" "fmov") (const_string "muladd")] (const_string "none")));; We use latencies 1 for definitions. This is OK to model colisions;; in execution units. The real latencies are modeled in the "fp" pipeline.;; fsin, fcos: 96-192;; fsincos: 107-211;; fsqrt: 19 for SFmode, 27 for DFmode, 35 for XFmode.(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "fpspc")) 100 1);; 16 cycles for SFmode, 20 for DFmode and 24 for XFmode.(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "fdiv")) 24 1)(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "fop,fop1,fmul,fistp")) 4 1);; XFmode loads are slow.;; XFmode store is slow too (8 cycles), but we don't need to model it, because;; there are no dependent instructions.(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "fmov") (and (eq_attr "memory" "load") (eq_attr "mode" "XF")))) 10 1)(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "fmov,fsgn")) 2 1);; fcmp and ftst instructions(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "fcmp") (eq_attr "athlon_decode" "direct"))) 3 1);; fcmpi instructions.(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "fcmp") (eq_attr "athlon_decode" "vector"))) 3 1)(define_function_unit "athlon_fp" 3 0 (and (eq_attr "cpu" "athlon") (eq_attr "type" "fcmov")) 7 1)(define_function_unit "athlon_fp_mul" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_fpunits" "mul")) 1 1)(define_function_unit "athlon_fp_add" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_fpunits" "add")) 1 1)(define_function_unit "athlon_fp_muladd" 2 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_fpunits" "muladd,mul,add")) 1 1)(define_function_unit "athlon_fp_store" 1 0 (and (eq_attr "cpu" "athlon") (eq_attr "athlon_fpunits" "store")) 1 1);; We don't need to model the Address Generation Unit, since we don't model;; the re-order buffer yet and thus we never schedule more than three operations;; at time. Later we may want to experiment with MD_SCHED macros modeling the;; decoders independently on the functional units.;(define_function_unit "athlon_agu" 3 0; (and (eq_attr "cpu" "athlon"); (and (eq_attr "memory" "!none"); (eq_attr "athlon_fpunits" "none"))); 1 1);; Model load unit to avoid too long sequences of loads. We don't need to;; model store queue, since it is hardly going to be bottleneck.(define_function_unit "athlon_load" 2 0 (and (eq_attr "cpu" "athlon") (eq_attr "memory" "load,both")) 1 1);; Compare instructions.;; All compare insns have expanders that save the operands away without;; actually generating RTL. The bCOND or sCOND (emitted immediately;; after the cmp) will actually emit the cmpM.(define_expand "cmpdi" [(set (reg:CC 17) (compare:CC (match_operand:DI 0 "nonimmediate_operand" "") (match_operand:DI 1 "x86_64_general_operand" "")))] ""{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) operands[0] = force_reg (DImode, operands[0]); ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_expand "cmpsi" [(set (reg:CC 17) (compare:CC (match_operand:SI 0 "cmpsi_operand" "") (match_operand:SI 1 "general_operand" "")))] ""{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) operands[0] = force_reg (SImode, operands[0]); ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_expand "cmphi" [(set (reg:CC 17) (compare:CC (match_operand:HI 0 "nonimmediate_operand" "") (match_operand:HI 1 "general_operand" "")))] ""{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) operands[0] = force_reg (HImode, operands[0]); ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_expand "cmpqi" [(set (reg:CC 17) (compare:CC (match_operand:QI 0 "nonimmediate_operand" "") (match_operand:QI 1 "general_operand" "")))] "TARGET_QIMODE_MATH"{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) operands[0] = force_reg (QImode, operands[0]); ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_insn "cmpdi_ccno_1_rex64" [(set (reg 17) (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr") (match_operand:DI 1 "const0_operand" "n,n")))] "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)" "@ test{q}\t{%0, %0|%0, %0} cmp{q}\t{%1, %0|%0, %1}" [(set_attr "type" "test,icmp") (set_attr "length_immediate" "0,1") (set_attr "mode" "DI")])(define_insn "*cmpdi_minus_1_rex64" [(set (reg 17) (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r") (match_operand:DI 1 "x86_64_general_operand" "re,mr")) (const_int 0)))] "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)" "cmp{q}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "DI")])(define_expand "cmpdi_1_rex64" [(set (reg:CC 17) (compare:CC (match_operand:DI 0 "nonimmediate_operand" "") (match_operand:DI 1 "general_operand" "")))] "TARGET_64BIT" "")(define_insn "cmpdi_1_insn_rex64" [(set (reg 17) (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r") (match_operand:DI 1 "x86_64_general_operand" "re,mr")))] "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)" "cmp{q}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "DI")])(define_insn "*cmpsi_ccno_1" [(set (reg 17) (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr") (match_operand:SI 1 "const0_operand" "n,n")))] "ix86_match_ccmode (insn, CCNOmode)" "@ test{l}\t{%0, %0|%0, %0} cmp{l}\t{%1, %0|%0, %1}" [(set_attr "type" "test,icmp") (set_attr "length_immediate" "0,1") (set_attr "mode" "SI")])(define_insn "*cmpsi_minus_1" [(set (reg 17) (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r") (match_operand:SI 1 "general_operand" "ri,mr")) (const_int 0)))] "ix86_match_ccmode (insn, CCGOCmode)" "cmp{l}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "SI")])(define_expand "cmpsi_1" [(set (reg:CC 17) (compare:CC (match_operand:SI 0 "nonimmediate_operand" "rm,r") (match_operand:SI 1 "general_operand" "ri,mr")))] "" "")(define_insn "*cmpsi_1_insn" [(set (reg 17) (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r") (match_operand:SI 1 "general_operand" "ri,mr")))] "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && ix86_match_ccmode (insn, CCmode)" "cmp{l}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "SI")])(define_insn "*cmphi_ccno_1" [(set (reg 17) (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr") (match_operand:HI 1 "const0_operand" "n,n")))] "ix86_match_ccmode (insn, CCNOmode)" "@ test{w}\t{%0, %0|%0, %0} cmp{w}\t{%1, %0|%0, %1}" [(set_attr "type" "test,icmp") (set_attr "length_immediate" "0,1") (set_attr "mode" "HI")])(define_insn "*cmphi_minus_1" [(set (reg 17) (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r") (match_operand:HI 1 "general_operand" "ri,mr")) (const_int 0)))] "ix86_match_ccmode (insn, CCGOCmode)" "cmp{w}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "HI")])(define_insn "*cmphi_1" [(set (reg 17) (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r") (match_operand:HI 1 "general_operand" "ri,mr")))] "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && ix86_match_ccmode (insn, CCmode)" "cmp{w}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "HI")])(define_insn "*cmpqi_ccno_1" [(set (reg 17) (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq") (match_operand:QI 1 "const0_operand" "n,n")))] "ix86_match_ccmode (insn, CCNOmode)" "@ test{b}\t{%0, %0|%0, %0} cmp{b}\t{$0, %0|%0, 0}" [(set_attr "type" "test,icmp") (set_attr "length_immediate" "0,1") (set_attr "mode" "QI")])(define_insn "*cmpqi_1" [(set (reg 17) (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q") (match_operand:QI 1 "general_operand" "qi,mq")))] "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) && ix86_match_ccmode (insn, CCmode)" "cmp{b}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "QI")])(define_insn "*cmpqi_minus_1" [(set (reg 17) (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q") (match_operand:QI 1 "general_operand" "qi,mq")) (const_int 0)))] "ix86_match_ccmode (insn, CCGOCmode)" "cmp{b}\t{%1, %0|%0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "QI")])(define_insn "*cmpqi_ext_1" [(set (reg 17) (compare (match_operand:QI 0 "general_operand" "Qm") (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0)))] "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)" "cmp{b}\t{%h1, %0|%0, %h1}" [(set_attr "type" "icmp") (set_attr "mode" "QI")])(define_insn "*cmpqi_ext_1_rex64"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?