i386.md
来自「gcc3.2.1源代码」· Markdown 代码 · 共 2,041 行 · 第 1/5 页
MD
2,041 行
[(set (reg 17) (compare (match_operand:QI 0 "register_operand" "Q") (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_2" [(set (reg 17) (compare (subreg:QI (zero_extract:SI (match_operand 0 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0) (match_operand:QI 1 "const0_operand" "n")))] "ix86_match_ccmode (insn, CCNOmode)" "test{b}\t%h0, %h0" [(set_attr "type" "test") (set_attr "length_immediate" "0") (set_attr "mode" "QI")])(define_expand "cmpqi_ext_3" [(set (reg:CC 17) (compare:CC (subreg:QI (zero_extract:SI (match_operand 0 "ext_register_operand" "") (const_int 8) (const_int 8)) 0) (match_operand:QI 1 "general_operand" "")))] "" "")(define_insn "cmpqi_ext_3_insn" [(set (reg 17) (compare (subreg:QI (zero_extract:SI (match_operand 0 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0) (match_operand:QI 1 "general_operand" "Qmn")))] "!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)" "cmp{b}\t{%1, %h0|%h0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "QI")])(define_insn "cmpqi_ext_3_insn_rex64" [(set (reg 17) (compare (subreg:QI (zero_extract:SI (match_operand 0 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0) (match_operand:QI 1 "nonmemory_operand" "Qn")))] "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)" "cmp{b}\t{%1, %h0|%h0, %1}" [(set_attr "type" "icmp") (set_attr "mode" "QI")])(define_insn "*cmpqi_ext_4" [(set (reg 17) (compare (subreg:QI (zero_extract:SI (match_operand 0 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0) (subreg:QI (zero_extract:SI (match_operand 1 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0)))] "ix86_match_ccmode (insn, CCmode)" "cmp{b}\t{%h1, %h0|%h0, %h1}" [(set_attr "type" "icmp") (set_attr "mode" "QI")]);; These implement float point compares.;; %%% See if we can get away with VOIDmode operands on the actual insns,;; which would allow mix and match FP modes on the compares. Which is what;; the old patterns did, but with many more of them.(define_expand "cmpxf" [(set (reg:CC 17) (compare:CC (match_operand:XF 0 "cmp_fp_expander_operand" "") (match_operand:XF 1 "cmp_fp_expander_operand" "")))] "!TARGET_64BIT && TARGET_80387"{ ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_expand "cmptf" [(set (reg:CC 17) (compare:CC (match_operand:TF 0 "cmp_fp_expander_operand" "") (match_operand:TF 1 "cmp_fp_expander_operand" "")))] "TARGET_80387"{ ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_expand "cmpdf" [(set (reg:CC 17) (compare:CC (match_operand:DF 0 "cmp_fp_expander_operand" "") (match_operand:DF 1 "cmp_fp_expander_operand" "")))] "TARGET_80387 || TARGET_SSE2"{ ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;})(define_expand "cmpsf" [(set (reg:CC 17) (compare:CC (match_operand:SF 0 "cmp_fp_expander_operand" "") (match_operand:SF 1 "cmp_fp_expander_operand" "")))] "TARGET_80387 || TARGET_SSE"{ ix86_compare_op0 = operands[0]; ix86_compare_op1 = operands[1]; DONE;});; FP compares, step 1:;; Set the FP condition codes.;;;; CCFPmode compare with exceptions;; CCFPUmode compare with no exceptions;; %%% It is an unfortunate fact that ftst has no non-popping variant,;; and that fp moves clobber the condition codes, and that there is;; currently no way to describe this fact to reg-stack. So there are;; no splitters yet for this.;; %%% YIKES! This scheme does not retain a strong connection between ;; the real compare and the ultimate cc0 user, so CC_REVERSE does not;; work! Only allow tos/mem with tos in op 0.;;;; Hmm, of course, this is what the actual _hardware_ does. Perhaps;; things aren't as bad as they sound...(define_insn "*cmpfp_0" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand 1 "register_operand" "f") (match_operand 2 "const0_operand" "X"))] 9))] "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && GET_MODE (operands[1]) == GET_MODE (operands[2])"{ if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) return "ftst\;fnstsw\t%0\;fstp\t%y0"; else return "ftst\;fnstsw\t%0";} [(set_attr "type" "multi") (set_attr "mode" "unknownfp")]);; We may not use "#" to split and emit these, since the REG_DEAD notes;; used to manage the reg stack popping would not be preserved.(define_insn "*cmpfp_2_sf" [(set (reg:CCFP 18) (compare:CCFP (match_operand:SF 0 "register_operand" "f") (match_operand:SF 1 "nonimmediate_operand" "fm")))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "fcmp") (set_attr "mode" "SF")])(define_insn "*cmpfp_2_sf_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:SF 1 "register_operand" "f") (match_operand:SF 2 "nonimmediate_operand" "fm"))] 9))] "TARGET_80387" "* return output_fp_compare (insn, operands, 2, 0);" [(set_attr "type" "fcmp") (set_attr "mode" "SF")])(define_insn "*cmpfp_2_df" [(set (reg:CCFP 18) (compare:CCFP (match_operand:DF 0 "register_operand" "f") (match_operand:DF 1 "nonimmediate_operand" "fm")))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "fcmp") (set_attr "mode" "DF")])(define_insn "*cmpfp_2_df_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:DF 1 "register_operand" "f") (match_operand:DF 2 "nonimmediate_operand" "fm"))] 9))] "TARGET_80387" "* return output_fp_compare (insn, operands, 2, 0);" [(set_attr "type" "multi") (set_attr "mode" "DF")])(define_insn "*cmpfp_2_xf" [(set (reg:CCFP 18) (compare:CCFP (match_operand:XF 0 "register_operand" "f") (match_operand:XF 1 "register_operand" "f")))] "!TARGET_64BIT && TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "fcmp") (set_attr "mode" "XF")])(define_insn "*cmpfp_2_tf" [(set (reg:CCFP 18) (compare:CCFP (match_operand:TF 0 "register_operand" "f") (match_operand:TF 1 "register_operand" "f")))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "fcmp") (set_attr "mode" "XF")])(define_insn "*cmpfp_2_xf_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:XF 1 "register_operand" "f") (match_operand:XF 2 "register_operand" "f"))] 9))] "!TARGET_64BIT && TARGET_80387" "* return output_fp_compare (insn, operands, 2, 0);" [(set_attr "type" "multi") (set_attr "mode" "XF")])(define_insn "*cmpfp_2_tf_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:TF 1 "register_operand" "f") (match_operand:TF 2 "register_operand" "f"))] 9))] "TARGET_80387" "* return output_fp_compare (insn, operands, 2, 0);" [(set_attr "type" "multi") (set_attr "mode" "XF")])(define_insn "*cmpfp_2u" [(set (reg:CCFPU 18) (compare:CCFPU (match_operand 0 "register_operand" "f") (match_operand 1 "register_operand" "f")))] "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 0, 1);" [(set_attr "type" "fcmp") (set_attr "mode" "unknownfp")])(define_insn "*cmpfp_2u_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFPU (match_operand 1 "register_operand" "f") (match_operand 2 "register_operand" "f"))] 9))] "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && GET_MODE (operands[1]) == GET_MODE (operands[2])" "* return output_fp_compare (insn, operands, 2, 1);" [(set_attr "type" "multi") (set_attr "mode" "unknownfp")]);; Patterns to match the SImode-in-memory ficom instructions.;;;; %%% Play games with accepting gp registers, as otherwise we have to;; force them to memory during rtl generation, which is no good. We;; can get rid of this once we teach reload to do memory input reloads ;; via pushes.(define_insn "*ficom_1" [(set (reg:CCFP 18) (compare:CCFP (match_operand 0 "register_operand" "f,f") (float (match_operand:SI 1 "nonimmediate_operand" "m,?r"))))] "0 && TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 1)) == GET_MODE (operands[0])" "#");; Split the not-really-implemented gp register case into a;; push-op-pop sequence.;;;; %%% This is most efficient, but am I gonna get in trouble;; for separating cc0_setter and cc0_user?(define_split [(set (reg:CCFP 18) (compare:CCFP (match_operand:SF 0 "register_operand" "") (float (match_operand:SI 1 "register_operand" ""))))] "0 && TARGET_80387 && reload_completed" [(set (mem:SI (pre_dec:SI (reg:SI 7))) (match_dup 1)) (set (reg:CCFP 18) (compare:CCFP (match_dup 0) (match_dup 2))) (parallel [(set (match_dup 1) (mem:SI (reg:SI 7))) (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))])] "operands[2] = gen_rtx_MEM (Pmode, stack_pointer_rtx); operands[2] = gen_rtx_FLOAT (GET_MODE (operands[0]), operands[2]);");; FP compares, step 2;; Move the fpsw to ax.(define_insn "x86_fnstsw_1" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(reg 18)] 9))] "TARGET_80387" "fnstsw\t%0" [(set_attr "length" "2") (set_attr "mode" "SI") (set_attr "i387" "1") (set_attr "ppro_uops" "few")]);; FP compares, step 3;; Get ax into flags, general case.(define_insn "x86_sahf_1" [(set (reg:CC 17) (unspec:CC [(match_operand:HI 0 "register_operand" "a")] 10))] "!TARGET_64BIT" "sahf" [(set_attr "length" "1") (set_attr "athlon_decode" "vector") (set_attr "mode" "SI") (set_attr "ppro_uops" "one")]);; Pentium Pro can do steps 1 through 3 in one go.(define_insn "*cmpfp_i" [(set (reg:CCFP 17) (compare:CCFP (match_operand 0 "register_operand" "f") (match_operand 1 "register_operand" "f")))] "TARGET_80387 && TARGET_CMOVE && !SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[0])" "* return output_fp_compare (insn, operands, 1, 0);" [(set_attr "type" "fcmp") (set_attr "mode" "unknownfp") (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_i_sse" [(set (reg:CCFP 17) (compare:CCFP (match_operand 0 "register_operand" "f#x,x#f") (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))] "TARGET_80387 && SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[0])" "* return output_fp_compare (insn, operands, 1, 0);" [(set_attr "type" "fcmp,sse") (set_attr "mode" "unknownfp") (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_i_sse_only" [(set (reg:CCFP 17) (compare:CCFP (match_operand 0 "register_operand" "x") (match_operand 1 "nonimmediate_operand" "xm")))] "SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[0])" "* return output_fp_compare (insn, operands, 1, 0);" [(set_attr "type" "sse") (set_attr "mode" "unknownfp") (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_iu" [(set (reg:CCFPU 17) (compare:CCFPU (match_operand 0 "register_operand" "f") (match_operand 1 "register_operand" "f")))] "TARGET_80387 && TARGET_CMOVE && !SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 1);" [(set_attr "type" "fcmp") (set_attr "mode" "unknownfp") (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_iu_sse" [(set (reg:CCFPU 17) (compare:CCFPU (match_operand 0 "register_operand" "f#x,x#f") (match_operand 1 "nonimmediate_operand" "f#x,xm#f")))] "TARGET_80387 && SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 1);" [(set_attr "type" "fcmp,sse") (set_attr "mode" "unknownfp") (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_iu_sse_only" [(set (reg:CCFPU 17) (compare:CCFPU (match_operand 0 "register_operand" "x")
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?