public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Antoni Boucher <bouanto@zoho.com>,
	"jit@gcc.gnu.org" <jit@gcc.gnu.org>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libgccjit: Allow comparing aligned int types
Date: Wed, 24 Jan 2024 12:18:30 -0500	[thread overview]
Message-ID: <06d63ba528f086da2c195ea5b5a07ae4dd33c132.camel@redhat.com> (raw)
In-Reply-To: <9e79a3d614b1db87c564b0e50f7091c2c203d246.camel@zoho.com>

On Thu, 2023-12-21 at 08:33 -0500, Antoni Boucher wrote:
> Hi.
> This patch allows comparing aligned integer types as equal.
> There's a TODO in the code about whether we should check that the
> alignment is equal.
> What are your thoughts on this?

I think we should check for equal alignment.

[...snip...]

> diff --git a/gcc/testsuite/jit.dg/test-types.c b/gcc/testsuite/jit.dg/test-types.c
> index a01944e35fa..c2f4d2bcb3d 100644
> --- a/gcc/testsuite/jit.dg/test-types.c
> +++ b/gcc/testsuite/jit.dg/test-types.c
> @@ -485,11 +485,15 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
>  
>    CHECK_VALUE (z.m_FILE_ptr, stderr);
>  
> +  gcc_jit_type *long_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_LONG);
> +  gcc_jit_type *int64_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT64_T);
>    if (sizeof(long) == 8)
> -    CHECK (gcc_jit_compatible_types (
> -      gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_LONG),
> -      gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT64_T)));
> +    CHECK (gcc_jit_compatible_types (long_type, int64_type));
>  
>    CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT)), sizeof (float));
>    CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_DOUBLE)), sizeof (double));
> +
> +  gcc_jit_type *aligned_long = gcc_jit_type_get_aligned (long_type, 4);
> +  gcc_jit_type *aligned_int64 = gcc_jit_type_get_aligned (int64_type, 4);
> +  CHECK (gcc_jit_compatible_types (aligned_long, aligned_int64));

This CHECK should be guarded on sizeof(long) == 8 like the check above.


Dave


  parent reply	other threads:[~2024-01-24 17:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 13:33 Antoni Boucher
2024-01-19 20:59 ` Antoni Boucher
2024-01-24 17:18 ` David Malcolm [this message]
2024-02-22 17:40   ` Antoni Boucher

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=06d63ba528f086da2c195ea5b5a07ae4dd33c132.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=bouanto@zoho.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    /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).