public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Jin Ma <jinma@linux.alibaba.com>, gcc-patches@gcc.gnu.org
Cc: richard.sandiford@arm.com, kito.cheng@gmail.com,
	christoph.muellner@vrull.eu, jinma.contrib@gmail.com
Subject: Re: [PATCH] Support libcall __float{,un}sibf by SF when it is not supported for _bf16
Date: Sun, 26 May 2024 08:53:35 -0600	[thread overview]
Message-ID: <4cb68e7d-7f98-4d04-aa5c-764f4b115d3b@gmail.com> (raw)
In-Reply-To: <20231220111748.684-1-jinma@linux.alibaba.com>



On 12/20/23 4:17 AM, Jin Ma wrote:
> We don't have SI -> BF library functions, use SI -> SF -> BF
> instead. Although this can also be implemented in a target
> machine description, it is more appropriate to move
> into target independent code.
> 
> gcc/ChangeLog:
> 
> 	* optabs.cc (expand_float): Split SI -> BF into SI -> SF -> BF.
> ---
>   gcc/optabs.cc | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/gcc/optabs.cc b/gcc/optabs.cc
> index 6a34276c239..c58a0321bbd 100644
> --- a/gcc/optabs.cc
> +++ b/gcc/optabs.cc
> @@ -5727,6 +5727,19 @@ expand_float (rtx to, rtx from, int unsignedp)
>         if (is_narrower_int_mode (GET_MODE (from), SImode))
>   	from = convert_to_mode (SImode, from, unsignedp);
>   
> +#ifdef HAVE_SFmode
> +      if (REAL_MODE_FORMAT (GET_MODE (to)) == &arm_bfloat_half_format
> +	  && REAL_MODE_FORMAT (SFmode) == &ieee_single_format
> +	  && GET_MODE (from) == SImode)
> +	/* We don't have SI -> BF library functions, use SI -> SF -> BF
> +	   instead.  */
> +	{
> +	  target = gen_reg_rtx (SFmode);
> +	  expand_float (target, from, unsignedp);
> +	  goto done;
> +	}
> +#endif
Why do you have the #ifdef HAVE_SFmode?  That seems odd, I think the 
only place we do anything like that is in targhooks.  Why did you add 
those cpp conditionals?

Bring the comment "We don't have SI -> BF ..." inside the open curly and 
indent it two more spaces.  That should be more consistent with GCC style.

So generally OK.  I suspect this can move forward once we figure out why 
you added those cpp conditionals and fix the formatting nit.

jeff

  parent reply	other threads:[~2024-05-26 14:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19  8:44 [RFC 1/2] RISC-V: Add support for _Bfloat16 Jin Ma
2023-09-19  8:46 ` [RFC 2/2] RISC-V: Add 'Zfbfmin' extension Jin Ma
2023-09-29 17:52   ` Jeff Law
2023-09-29 17:46 ` [RFC 1/2] RISC-V: Add support for _Bfloat16 Jeff Law
2023-10-09  6:18   ` Jin Ma
2023-10-09 19:16     ` Jeff Law
2023-10-25 10:15       ` Jin Ma
2023-11-10 21:21         ` Jeff Law
2023-12-20 11:17 ` [PATCH] Support libcall __float{,un}sibf by SF when it is not supported for _bf16 Jin Ma
2024-01-09  9:32   ` Jin Ma
2024-01-09  9:43     ` Jin Ma
2024-05-26 14:53   ` Jeff Law [this message]
2024-06-05  6:18     ` Jin Ma

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=4cb68e7d-7f98-4d04-aa5c-764f4b115d3b@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jinma.contrib@gmail.com \
    --cc=jinma@linux.alibaba.com \
    --cc=kito.cheng@gmail.com \
    --cc=richard.sandiford@arm.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).