📄 i386.md
字号:
{ 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;; 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_0_sf" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:SF 1 "register_operand" "f") (match_operand:SF 2 "const0_operand" "X"))] UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "mode" "SF")])(define_insn "*cmpfp_0_df" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:DF 1 "register_operand" "f") (match_operand:DF 2 "const0_operand" "X"))] UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "mode" "DF")])(define_insn "*cmpfp_0_xf" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand:XF 1 "register_operand" "f") (match_operand:XF 2 "const0_operand" "X"))] UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "mode" "XF")])(define_insn "*cmpfp_sf" [(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"))] UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "mode" "SF")])(define_insn "*cmpfp_df" [(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"))] UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "mode" "DF")])(define_insn "*cmpfp_xf" [(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"))] UNSPEC_FNSTSW))] "TARGET_80387" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "mode" "XF")])(define_insn "*cmpfp_u" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFPU (match_operand 1 "register_operand" "f") (match_operand 2 "register_operand" "f"))] UNSPEC_FNSTSW))] "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1])) && GET_MODE (operands[1]) == GET_MODE (operands[2])" "* return output_fp_compare (insn, operands, 0, 1);" [(set_attr "type" "multi") (set (attr "mode") (cond [(match_operand:SF 1 "" "") (const_string "SF") (match_operand:DF 1 "" "") (const_string "DF") ] (const_string "XF")))])(define_insn "*cmpfp_si" [(set (match_operand:HI 0 "register_operand" "=a") (unspec:HI [(compare:CCFP (match_operand 1 "register_operand" "f") (match_operator 3 "float_operator" [(match_operand:SI 2 "memory_operand" "m")]))] UNSPEC_FNSTSW))] "TARGET_80387 && TARGET_USE_FIOP && FLOAT_MODE_P (GET_MODE (operands[1])) && (GET_MODE (operands [3]) == GET_MODE (operands[1]))" "* return output_fp_compare (insn, operands, 0, 0);" [(set_attr "type" "multi") (set_attr "fp_int_src" "true") (set_attr "mode" "SI")]);; 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:CCFP FPSR_REG)] UNSPEC_FNSTSW))] "TARGET_80387" "fnstsw\t%0" [(set_attr "length" "2") (set_attr "mode" "SI") (set_attr "unit" "i387")]);; FP compares, step 3;; Get ax into flags, general case.(define_insn "x86_sahf_1" [(set (reg:CC FLAGS_REG) (unspec:CC [(match_operand:HI 0 "register_operand" "a")] UNSPEC_SAHF))] "!TARGET_64BIT" "sahf" [(set_attr "length" "1") (set_attr "athlon_decode" "vector") (set_attr "mode" "SI")]);; Pentium Pro can do steps 1 through 3 in one go.;; APPLE LOCAL begin 3501055 mainline candidate(define_insn "*cmpfp_i_mixed" [(set (reg:CCFP FLAGS_REG) (compare:CCFP (match_operand 0 "register_operand" "f,x") (match_operand 1 "nonimmediate_operand" "f,xm")))] "TARGET_MIX_SSE_I387 && SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 0);" [(set_attr "type" "fcmp,ssecomi") (set (attr "mode") (if_then_else (match_operand:SF 1 "" "") (const_string "SF") (const_string "DF"))) (set_attr "athlon_decode" "vector")]);; APPLE LOCAL end 3501055 mainline candidate(define_insn "*cmpfp_i_sse" [(set (reg:CCFP FLAGS_REG) (compare:CCFP (match_operand 0 "register_operand" "x") (match_operand 1 "nonimmediate_operand" "xm")))] "TARGET_SSE_MATH && SSE_FLOAT_MODE_P (GET_MODE (operands[0])) && GET_MODE (operands[0]) == GET_MODE (operands[1])" "* return output_fp_compare (insn, operands, 1, 0);" [(set_attr "type" "ssecomi") (set (attr "mode") (if_then_else (match_operand:SF 1 "" "") (const_string "SF") (const_string "DF"))) (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_i_i387" [(set (reg:CCFP FLAGS_REG) (compare:CCFP (match_operand 0 "register_operand" "f") (match_operand 1 "register_operand" "f")))] "TARGET_80387 && TARGET_CMOVE && (!TARGET_SSE_MATH || !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, 0);" [(set_attr "type" "fcmp") (set (attr "mode") (cond [(match_operand:SF 1 "" "") (const_string "SF") (match_operand:DF 1 "" "") (const_string "DF") ] (const_string "XF"))) (set_attr "athlon_decode" "vector")]);; APPLE LOCAL begin 3501055 mainline candidate(define_insn "*cmpfp_iu_mixed" [(set (reg:CCFPU FLAGS_REG) (compare:CCFPU (match_operand 0 "register_operand" "f,x") (match_operand 1 "nonimmediate_operand" "f,xm")))] "TARGET_MIX_SSE_I387 && 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,ssecomi") (set (attr "mode") (if_then_else (match_operand:SF 1 "" "") (const_string "SF") (const_string "DF"))) (set_attr "athlon_decode" "vector")]);; APPLE LOCAL end 3501055 mainline candidate(define_insn "*cmpfp_iu_sse" [(set (reg:CCFPU FLAGS_REG) (compare:CCFPU (match_operand 0 "register_operand" "x") (match_operand 1 "nonimmediate_operand" "xm")))] "TARGET_SSE_MATH && 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" "ssecomi") (set (attr "mode") (if_then_else (match_operand:SF 1 "" "") (const_string "SF") (const_string "DF"))) (set_attr "athlon_decode" "vector")])(define_insn "*cmpfp_iu_387" [(set (reg:CCFPU FLAGS_REG) (compare:CCFPU (match_operand 0 "register_operand" "f") (match_operand 1 "register_operand" "f")))] "TARGET_80387 && TARGET_CMOVE && (!TARGET_SSE_MATH || !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") (cond [(match_operand:SF 1 "" "") (const_string "SF") (match_operand:DF 1 "" "") (const_string "DF") ] (const_string "XF"))) (set_attr "athlon_decode" "vector")]);; Move instructions.;; General case of fullword move.(define_expand "movsi" [(set (match_operand:SI 0 "nonimmediate_operand" "") (match_operand:SI 1 "general_operand" ""))] "" "ix86_expand_move (SImode, operands); DONE;");; Push/pop instructions. They are separate since autoinc/dec is not a;; general_operand.;;;; %%% We don't use a post-inc memory reference because x86 is not a ;; general AUTO_INC_DEC host, which impacts how it is treated in flow.;; Changing this impacts compiler performance on other non-AUTO_INC_DEC;; targets without our curiosities, and it is just as easy to represent;; this differently.(define_insn "*pushsi2" [(set (match_operand:SI 0 "push_operand" "=<") (match_operand:SI 1 "general_no_elim_operand" "ri*m"))] "!TARGET_64BIT" "push{l}\t%1" [(set_attr "type" "push") (set_attr "mode" "SI")]);; For 64BIT abi we always round up to 8 bytes.(define_insn "*pushsi2_rex64" [(set (match_operand:SI 0 "push_operand" "=X") (match_operand:SI 1 "nonmemory_no_elim_operand" "ri"))] "TARGET_64BIT" "push{q}\t%q1" [(set_attr "type" "push") (set_attr "mode" "SI")])(define_insn "*pushsi2_prologue" [(set (match_operand:SI 0 "push_operand" "=<") (match_operand:SI 1 "general_no_elim_operand" "ri*m")) (clobber (mem:BLK (scratch)))] "!TARGET_64BIT" "push{l}\t%1" [(set_attr "type" "push") (set_attr "mode" "SI")])(define_insn "*popsi1_epilogue" [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m") (mem:SI (reg:SI SP_REG))) (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4))) (clobber (mem:BLK (scratch)))] "!TARGET_64BIT" "pop{l}\t%0" [(set_attr "type" "pop") (set_attr "mode" "SI")])(define_insn "popsi1" [(set (match_operand:SI 0 "nonimmediate_operand" "=r*m") (mem:SI (reg:SI SP_REG))) (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))] "!TARGET_64BIT" "pop{l}\t%0" [(set_attr "type" "pop") (set_attr "mode" "SI")])(define_insn "*movsi_xor" [(set (match_operand:SI 0 "register_operand" "=r") (match_operand:SI 1 "const0_operand" "i")) (clobber (reg:CC FLAGS_REG))] "reload_completed && (!TARGET_USE_MOV0 || optimize_size)" "xor{l}\t{%0, %0|%0, %0}" [(set_attr "type" "alu1") (set_attr "mode" "SI") (set_attr "length_immediate" "0")]) (define_insn "*movsi_or" [(set (match_operand:SI 0 "register_operand" "=r") (match_operand:SI 1 "immediate_operand" "i")) (clobber (reg:CC FLAGS_REG))] "reload_completed && operands[1] == constm1_rtx && (TARGET_PENTIUM || optimize_size)"{ operands[1] = constm1_rtx; return "or{l}\t{%1, %0|%0, %1}";} [(set_attr "type" "alu1") (set_attr "mode" "SI") (set_attr "length_immediate" "1")])(define_insn "*movsi_1" [(set (match_operand:SI 0 "nonimmediate_operand" "=r ,m ,*y,*y,?rm,?*y,*x,*x,?r,m ,?*Y,*x") (match_operand:SI 1 "general_operand" "rinm,rin,C ,*y,*y ,rm ,C ,*x,*Y,*x,r ,m "))] "!(MEM_P (operands[0]) && MEM_P (operands[1]))"{ switch (get_attr_type (insn)) { case TYPE_SSELOG1: if (get_attr_mode (insn) == MODE_TI) return "pxor\t%0, %0"; return "xorps\t%0, %0"; case TYPE_SSEMOV: switch (get_attr_mode (insn)) { case MODE_TI: return "movdqa\t{%1, %0|%0, %1}"; case MODE_V4SF: return "movaps\t{%1, %0|%0, %1}"; case MODE_SI: return "movd\t{%1, %0|%0, %1}"; case MODE_SF: return "movss\t{%1, %0|%0, %1}"; default: gcc_unreachable (); } case TYPE_MMXADD: return "pxor\t%0, %0"; case TYPE_MMXMOV: if (get_attr_mode (insn) == MODE_DI) return "movq\t{%1, %0|%0, %1}"; return "movd\t{%1, %0|%0, %1}"; case TYPE_LEA: return "lea{l}\t{%1, %0|%0, %1}"; default: if (flag_pic && !LEGITIMATE_PIC_OPERAND_P (operands[1])) abort(); return "mov{l}\t{%1, %0|%0, %1}"; }} [(set (attr "type") (cond [(eq_attr "alternative" "2") (const_string "mmx") (eq_attr "alternative" "3,4,5") (const_string "mmxmov") (eq_attr "alternative" "6") (const_string "sselog1") (eq_attr "alternative" "7,8,9,10,11") (const_string "ssemov") (and (ne (symbol_ref "flag_pic") (const_int 0)) (match_operand:SI 1 "symbolic_operand" "")) (const_string "lea") ] (const_string "imov"))) (set (attr "mode") (cond [(eq_attr "alternative" "2,3") (const_string "DI") (eq_attr "alternative" "6,7") (if_then_else (eq (symbol_ref "TARGET_SSE2") (const_int 0)) (const_string "V4SF") (const_string "TI")) (and (eq_attr "alternative" "8,9,10,11") (eq (symbol_ref "TARGET_SSE2") (const_int 0))) (const_string "SF") ] (const_string "SI")))])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -