From: Andrea Corallo <andrea.corallo@arm.com>
To: David Malcolm via Jit <jit@gcc.gnu.org>
Cc: "jit@gcc.gnu.org" <jit@gcc.gnu.org>, nd <nd@arm.com>,
gcc-patches@gcc.gnu.org, Alex Coplan <Alex.Coplan@arm.com>
Subject: Re: [PATCH] libgccjit: Improve doc and comments regarding type casts
Date: Thu, 06 Aug 2020 09:40:23 +0200 [thread overview]
Message-ID: <gkrimdwnrx4.fsf@arm.com> (raw)
In-Reply-To: <gkr365kym3j.fsf@arm.com> (Andrea Corallo's message of "Wed, 22 Jul 2020 10:45:20 +0200")
Andrea Corallo <andrea.corallo@arm.com> writes:
> Hi Alex,
>
> Looking at the code I believe all these casts are meant to be supported
> (read your intuition was correct).
>
> Also IMO source of confusion is that the doc is mentioning 'int' and
> 'float' but I believe would be better to have like 'integral' and
> 'floating-point' to clearly disambiguates with respect to the C
> types.
>
> AFAIU the set of supported casts should be like:
>
> integral <-> integral
> floating-point <-> floating-point
> integral <-> floating-point
> integral <-> bool
> P* <-> Q* for pointer types P and Q.
>
> I'd propose to install the following patch to make doc and comments
> homogeneous at documenting what do we accept, and I guess we should just
> consider bugs if some of these conversions is not handled correctly or
> leads to ICE.
>
> Bests
>
> Andrea
>
> gcc/jit/ChangeLog
>
> 2020-07-21 Andrea Corallo <andrea.corallo@arm.com>
>
> * docs/_build/texinfo/libgccjit.texi (Type-coercion): Improve doc
> on allowed type casting.
> * docs/topics/expressions.rst (gccjit::context::new_cast)
> (gcc_jit_context_new_cast): Likewise.
> * libgccjit.c: Improve comment on allowed type casting.
> * libgccjit.h: Likewise
>
> From 914b9e86808c947d4bb2b06c6960fd8031125f67 Mon Sep 17 00:00:00 2001
> From: Andrea Corallo <andrea.corallo@arm.com>
> Date: Tue, 21 Jul 2020 20:12:23 +0200
> Subject: [PATCH] libgccjit: improve documentation on type conversions
>
> gcc/jit/ChangeLog
>
> 2020-07-21 Andrea Corallo <andrea.corallo@arm.com>
>
> * docs/_build/texinfo/libgccjit.texi (Type-coercion): Improve doc
> on allowed type casting.
> * docs/topics/expressions.rst (gccjit::context::new_cast)
> (gcc_jit_context_new_cast): Likewise.
> * libgccjit.c: Improve comment on allowed type casting.
> * libgccjit.h: Likewise
> ---
> gcc/jit/docs/_build/texinfo/libgccjit.texi | 30 +++++++++++++++-------
> gcc/jit/docs/topics/expressions.rst | 8 +++---
> gcc/jit/libgccjit.c | 8 +++---
> gcc/jit/libgccjit.h | 7 +++--
> 4 files changed, 36 insertions(+), 17 deletions(-)
>
> diff --git a/gcc/jit/docs/_build/texinfo/libgccjit.texi b/gcc/jit/docs/_build/texinfo/libgccjit.texi
> index 1e14be010426..b170f24d1bb1 100644
> --- a/gcc/jit/docs/_build/texinfo/libgccjit.texi
> +++ b/gcc/jit/docs/_build/texinfo/libgccjit.texi
> @@ -6685,13 +6685,19 @@ Currently only a limited set of conversions are possible:
> @itemize *
>
> @item
> -int <-> float
> +integral <-> integral
>
> @item
> -int <-> bool
> +floating-point <-> floating-point
>
> @item
> -P* <-> Q*, for pointer types P and Q
> +integral <-> floating-point
> +
> +@item
> +integral <-> bool
> +
> +@item
> +P* <-> Q* for pointer types P and Q
> @end itemize
> @end quotation
> @end deffn
> @@ -12964,14 +12970,20 @@ Currently only a limited set of conversions are possible:
>
> @itemize *
>
> -@item
> -int <-> float
> +@item
> +integral <-> integral
>
> -@item
> -int <-> bool
> +@item
> +floating-point <-> floating-point
>
> -@item
> -P* <-> Q*, for pointer types P and Q
> +@item
> +integral <-> floating-point
> +
> +@item
> +integral <-> bool
> +
> +@item
> +P* <-> Q*, for pointer types P and Q
> @end itemize
> @end quotation
> @end deffn
> diff --git a/gcc/jit/docs/topics/expressions.rst b/gcc/jit/docs/topics/expressions.rst
> index d783ceea51a8..051cee5db211 100644
> --- a/gcc/jit/docs/topics/expressions.rst
> +++ b/gcc/jit/docs/topics/expressions.rst
> @@ -504,9 +504,11 @@ Type-coercion
>
> Currently only a limited set of conversions are possible:
>
> - * int <-> float
> - * int <-> bool
> - * P* <-> Q*, for pointer types P and Q
> + * integral <-> integral
> + * floating-point <-> floating-point
> + * integral <-> floating-point
> + * integral <-> bool
> + * P* <-> Q* for pointer types P and Q
>
> Lvalues
> -------
> diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
> index 3d04f6db3aff..403233d5577a 100644
> --- a/gcc/jit/libgccjit.c
> +++ b/gcc/jit/libgccjit.c
> @@ -1629,9 +1629,11 @@ gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt,
>
> We only permit these kinds of cast:
>
> - int <-> float
> - int <-> bool
> - P* <-> Q* for pointer types P and Q. */
> + integral <-> integral
> + floating-point <-> floating-point
> + integral <-> floating-point
> + integral <-> bool
> + P* <-> Q* for pointer types P and Q. */
>
> static bool
> is_valid_cast (gcc::jit::recording::type *src_type,
> diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
> index 1c5a12e9c015..228befa896d7 100644
> --- a/gcc/jit/libgccjit.h
> +++ b/gcc/jit/libgccjit.h
> @@ -996,8 +996,11 @@ gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt,
> /* Type-coercion.
>
> Currently only a limited set of conversions are possible:
> - int <-> float
> - int <-> bool */
> + integral <-> integral
> + floating-point <-> floating-point
> + integral <-> floating-point
> + integral <-> bool
> + P* <-> Q* for pointer types P and Q. */
> extern gcc_jit_rvalue *
> gcc_jit_context_new_cast (gcc_jit_context *ctxt,
> gcc_jit_location *loc,
Ping
Thanks
Andrea
next prev parent reply other threads:[~2020-08-06 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 14:15 libgccjit: Clarifying the permitted type conversions Alex Coplan
2020-07-21 8:27 ` Alex Coplan
2020-07-22 8:45 ` [PATCH] libgccjit: Improve doc and comments regarding type casts (Was: Clarifying the permitted type conversions) Andrea Corallo
2020-08-06 7:40 ` Andrea Corallo [this message]
2020-09-09 7:56 ` [PATCH] libgccjit: Improve doc and comments regarding type casts Andrea Corallo
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=gkrimdwnrx4.fsf@arm.com \
--to=andrea.corallo@arm.com \
--cc=Alex.Coplan@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jit@gcc.gnu.org \
--cc=nd@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).