public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: "Andreas Krebbel" <krebbel@linux.vnet.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PING] Fix PR46399 - missing mode promotion for libcall args
Date: Mon, 25 Apr 2011 19:46:00 -0000	[thread overview]
Message-ID: <mcr8vuyqhtx.fsf@google.com> (raw)
In-Reply-To: <20110418081754.GA3385@bart> (Andreas Krebbel's message of "Mon,	18 Apr 2011 10:17:54 +0200")

"Andreas Krebbel" <krebbel@linux.vnet.ibm.com> writes:

> 2011-04-18  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
>
> 	* calls.c (emit_library_call_value_1): Invoke
> 	promote_function_mode hook on libcall arguments.
> 	* explow.c (promote_function_mode, promote_mode): Handle TYPE
> 	argument being NULL.
> 	* targhooks.c (default_promote_function_mode): Lisewise.
> 	* config/s390/s390.c (s390_promote_function_mode): Likewise.
> 	* config/sparc/sparc.c (sparc_promote_function_mode): Likewise.
>
> 	* doc/tm.texi: Document that TYPE argument might be NULL.

>
>
> Index: gcc/calls.c
> ===================================================================
> *** gcc/calls.c.orig
> --- gcc/calls.c
> *************** emit_library_call_value_1 (int retval, r
> *** 3484,3489 ****
> --- 3484,3490 ----
>       {
>         rtx val = va_arg (p, rtx);
>         enum machine_mode mode = (enum machine_mode) va_arg (p, int);
> +       int unsigned_p = 0;
>   
>         /* We cannot convert the arg value to the mode the library wants here;
>   	 must do it earlier where we know the signedness of the arg.  */
> *************** emit_library_call_value_1 (int retval, r
> *** 3531,3539 ****
>   	  val = force_operand (XEXP (slot, 0), NULL_RTX);
>   	}
>   
> !       argvec[count].value = val;
>         argvec[count].mode = mode;
> ! 
>         argvec[count].reg = targetm.calls.function_arg (&args_so_far, mode,
>   						      NULL_TREE, true);
>   
> --- 3532,3540 ----
>   	  val = force_operand (XEXP (slot, 0), NULL_RTX);
>   	}
>   
> !       mode = promote_function_mode (NULL_TREE, mode, &unsigned_p, NULL_TREE, 0);
>         argvec[count].mode = mode;
> !       argvec[count].value = convert_modes (mode, GET_MODE (val), val, 0);
>         argvec[count].reg = targetm.calls.function_arg (&args_so_far, mode,
>   						      NULL_TREE, true);


It seems to me that you should pass unsigned_p to convert_modes.


> Index: gcc/doc/tm.texi.in
> ===================================================================
> *** gcc/doc/tm.texi.in.orig
> --- gcc/doc/tm.texi.in
> *************** which an incoming parameter is copied, o
> *** 952,957 ****
> --- 952,959 ----
>   then the hook should return the same mode as @code{promote_mode}, though
>   the signedness may be different.
>   
> + @var{type} can be omitted when promoting function arguments of libcalls.
> + 
>   The default is to not promote arguments and return values.  You can
>   also define the hook to @code{default_promote_function_mode_always_promote}
>   if you would like to apply the same rules given by @code{PROMOTE_MODE}.

I think it would be clearer if you s/omitted/NULL/.

The patch is OK with those changes.

Thanks.

Ian

  reply	other threads:[~2011-04-25 18:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 10:54 Andreas Krebbel
2011-04-13 13:31 ` Ian Lance Taylor
2011-04-13 13:59   ` Andreas Krebbel
2011-04-13 14:53     ` Ian Lance Taylor
2011-04-18  9:23       ` Andreas Krebbel
2011-04-25 19:46         ` Ian Lance Taylor [this message]
2011-05-04 13:45         ` Richard Guenther
2011-05-04 13:45           ` Kai Tietz
2011-05-04 13:58             ` Richard Guenther
2011-05-06 16:20               ` NightStrike
  -- strict thread matches above, loose matches on Subject: below --
2011-03-28 13:14 Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcr8vuyqhtx.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).