From: Jan Hubicka Date: Thu, 5 Apr 2001 16:28:44 +0000 (+0200) Subject: i386.c (function_arg): Return constm1_rtx for last argument. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32ee7d1d8d0245ec36a3c842f17da303cd88c28c;p=gcc.git i386.c (function_arg): Return constm1_rtx for last argument. * i386.c (function_arg): Return constm1_rtx for last argument. (ix86_expand_prologue): Update gen_call calls. * i386.h (FUNCTION_BLOCK_PROFILER_EXIT): Likewise. * i386.md (call_pop): Likewise. (call): Second operand is VOIDmode. (call_0): Likewise; Support 64bits. (call_exp): New expander. (call_1): Get to the sync. (call_1_exp): New pattern. (call_value): Support 64bit. (call_value_exp): New pattern. (untyped_call): Update gen_call call. (call_value_pop): Disable for 64bit. (call_value_0_rex64): New pattern. (call_value_1_rex64): Likewise. From-SVN: r41120 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dba10a86473..359435cc980 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +Thu Apr 5 18:25:56 CEST 2001 Jan Hubicka + + * i386.c (function_arg): Return constm1_rtx for last argument. + (ix86_expand_prologue): Update gen_call calls. + * i386.h (FUNCTION_BLOCK_PROFILER_EXIT): Likewise. + * i386.md (call_pop): Likewise. + (call): Second operand is VOIDmode. + (call_0): Likewise; Support 64bits. + (call_exp): New expander. + (call_1): Get to the sync. + (call_1_exp): New pattern. + (call_value): Support 64bit. + (call_value_exp): New pattern. + (untyped_call): Update gen_call call. + (call_value_pop): Disable for 64bit. + (call_value_0_rex64): New pattern. + (call_value_1_rex64): Likewise. + 2001-04-05 Bo Thorsen * i386.md: Don't allow "builtin_setjmp_receiver" for TARGET_64BIT. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c50761cafc7..7d08309bd4f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1105,6 +1105,9 @@ function_arg (cum, mode, type, named) (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode); int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + if (mode == VOIDmode) + return constm1_rtx; + switch (mode) { /* For now, pass fp/complex values on the stack. */ @@ -2510,7 +2513,7 @@ ix86_expand_prologue () sym = gen_rtx_MEM (FUNCTION_MODE, gen_rtx_SYMBOL_REF (Pmode, "_alloca")); - insn = emit_call_insn (gen_call (sym, const0_rtx)); + insn = emit_call_insn (gen_call (sym, const0_rtx, constm1_rtx)); CALL_INSN_FUNCTION_USAGE (insn) = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, arg0), @@ -6842,7 +6845,7 @@ ix86_split_to_parts (operand, parts, mode) operand = change_address (operand, DImode, XEXP (operand, 0)); parts[0] = operand; parts[1] = adj_offsettable_operand (operand, 8); - parts[1] = change_address (parts[1], SImode, XEXP (operand, 0)); + parts[1] = change_address (parts[1], SImode, XEXP (parts[1], 0)); } else if (GET_CODE (operand) == CONST_DOUBLE) { diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index cd9e54aa607..8ccf8911212 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1632,7 +1632,7 @@ typedef struct ix86_args { #define FUNCTION_BLOCK_PROFILER_EXIT \ emit_call_insn (gen_call (gen_rtx_MEM (QImode, \ gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \ - const0_rtx)) + const0_rtx, constm1_rtx)) /* The function `__bb_trace_func' is called in every basic block and is not allowed to change the machine state. Saving (restoring) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 88de477b9f0..51e0c9631a0 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -7232,7 +7232,25 @@ (const_int 32)))) (clobber (match_scratch:SI 3 "=a")) (clobber (reg:CC 17))] - "!TARGET_64BIT" + "" + "mul{l}\\t%2" + [(set_attr "type" "imul") + (set_attr "ppro_uops" "few") + (set_attr "length_immediate" "0") + (set_attr "mode" "SI")]) + +(define_insn "*umulsi3_highpart_zext" + [(set (match_operand:DI 0 "register_operand" "=d") + (zero_extend:DI (truncate:SI + (lshiftrt:DI + (mult:DI (zero_extend:DI + (match_operand:SI 1 "register_operand" "%a")) + (zero_extend:DI + (match_operand:SI 2 "nonimmediate_operand" "rm"))) + (const_int 32))))) + (clobber (match_scratch:SI 3 "=a")) + (clobber (reg:CC 17))] + "TARGET_64BIT" "mul{l}\\t%2" [(set_attr "type" "imul") (set_attr "ppro_uops" "few") @@ -12716,7 +12734,7 @@ { if (operands[3] == const0_rtx) { - emit_insn (gen_call (operands[0], operands[1])); + emit_insn (gen_call (operands[0], operands[1], constm1_rtx)); DONE; } /* Static functions and indirect calls don't need @@ -12770,7 +12788,7 @@ (define_expand "call" [(call (match_operand:QI 0 "" "") - (match_operand:SI 1 "" ""))] + (match_operand 2 "" ""))] ;; Operand 1 not used on the i386. "" " @@ -12781,13 +12799,29 @@ && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0))) current_function_uses_pic_offset_table = 1; + if (! call_insn_operand (XEXP (operands[0], 0), Pmode)) XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); + if (TARGET_64BIT && INTVAL (operands[2]) >= 0) + { + rtx insn; + rtx reg = gen_rtx_REG (QImode, 0); + emit_move_insn (reg, operands[2]); + insn = emit_call_insn (gen_call_exp (operands[0], operands[2])); + use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg); + DONE; + } }") +(define_expand "call_exp" + [(call (match_operand:QI 0 "" "") + (match_operand 1 "" ""))] + "" + "") + (define_insn "*call_0" - [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" "")) - (match_operand:SI 1 "" ""))] + [(call (mem:QI (match_operand 0 "constant_call_address_operand" "")) + (match_operand 1 "" ""))] "" "* { @@ -12800,8 +12834,28 @@ (define_insn "*call_1" [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm")) - (match_operand:SI 1 "" ""))] - "" + (match_operand 1 "" ""))] + "TARGET_64BIT" + "* +{ + if (constant_call_address_operand (operands[0], QImode)) + { + if (SIBLING_CALL_P (insn)) + return \"jmp\\t%P0\"; + else + return \"call\\t%P0\"; + } + if (SIBLING_CALL_P (insn)) + return \"jmp\\t%A0\"; + else + return \"call\\t%A0\"; +}" + [(set_attr "type" "call")]) + +(define_insn "*call_1_rex64" + [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm")) + (match_operand 1 "" ""))] + "!TARGET_64BIT" "* { if (constant_call_address_operand (operands[0], QImode)) @@ -12833,7 +12887,8 @@ { if (operands[4] == const0_rtx) { - emit_insn (gen_call_value (operands[0], operands[1], operands[2])); + emit_insn (gen_call_value (operands[0], operands[1], operands[2], + constm1_rtx)); DONE; } /* Static functions and indirect calls don't need @@ -12849,7 +12904,7 @@ (define_expand "call_value" [(set (match_operand 0 "" "") (call (match_operand:QI 1 "" "") - (match_operand:SI 2 "" "")))] + (match_operand:SI 3 "" "")))] ;; Operand 2 not used on the i386. "" " @@ -12862,8 +12917,25 @@ current_function_uses_pic_offset_table = 1; if (! call_insn_operand (XEXP (operands[1], 0), Pmode)) XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); + if (TARGET_64BIT && INTVAL (operands[3]) >= 0) + { + rtx insn; + rtx reg = gen_rtx_REG (QImode, 0); + emit_move_insn (reg, operands[3]); + insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1], + operands[3])); + use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg); + DONE; + } }") +(define_expand "call_value_exp" + [(set (match_operand 0 "" "") + (call (match_operand:QI 1 "" "") + (match_operand:SI 2 "" "")))] + "" + "") + ;; Call subroutine returning any type. (define_expand "untyped_call" @@ -12883,8 +12955,10 @@ emit_call_insn (TARGET_80387 ? gen_call_value (gen_rtx_REG (XCmode, FIRST_FLOAT_REG), - operands[0], const0_rtx) - : gen_call (operands[0], const0_rtx)); + operands[0], const0_rtx, + GEN_INT (SSE_REGPARM_MAX - 1)) + : gen_call (operands[0], const0_rtx, + GEN_INT (SSE_REGPARM_MAX - 1))); for (i = 0; i < XVECLEN (operands[2], 0); i++) { @@ -12975,7 +13049,7 @@ (plus:SI (match_operand:SI 1 "symbolic_operand" "") (minus:SI (pc) (match_operand 2 "" ""))))] 1)) (clobber (reg:CC 17))] - "" + "!TARGET_64BIT" "* { if (GET_CODE (operands[2]) == LABEL_REF) @@ -16751,7 +16825,21 @@ [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" "")) (match_operand:SI 2 "" "")))] - "" + "!TARGET_64BIT" + "* +{ + if (SIBLING_CALL_P (insn)) + return \"jmp\\t%P1\"; + else + return \"call\\t%P1\"; +}" + [(set_attr "type" "callv")]) + +(define_insn "*call_value_0_rex64" + [(set (match_operand 0 "" "") + (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" "")) + (match_operand:DI 2 "const_int_operand" "")))] + "TARGET_64BIT" "* { if (SIBLING_CALL_P (insn)) @@ -16765,7 +16853,28 @@ [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm")) (match_operand:SI 2 "" "")))] - "" + "!TARGET_64BIT" + "* +{ + if (constant_call_address_operand (operands[1], QImode)) + { + if (SIBLING_CALL_P (insn)) + return \"jmp\\t%P1\"; + else + return \"call\\t%P1\"; + } + if (SIBLING_CALL_P (insn)) + return \"jmp\\t%*%1\"; + else + return \"call\\t%*%1\"; +}" + [(set_attr "type" "callv")]) + +(define_insn "*call_value_1_rex64" + [(set (match_operand 0 "" "") + (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm")) + (match_operand:DI 2 "" "")))] + "TARGET_64BIT" "* { if (constant_call_address_operand (operands[1], QImode))