public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ibuclaw at gdcproject dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug d/114171] [13/14 Regression] gdc -O2 -mavx generates misaligned vmovdqa instruction
Date: Fri, 01 Mar 2024 14:13:05 +0000	[thread overview]
Message-ID: <bug-114171-4-eEovewRQip@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114171-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114171

--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
(In reply to Richard Biener from comment #5)
> Unless gdc somehow guarantees bn->label and init are 128bit aligned
> then "casting" this way is broken.  You can of course use
> build_aligned_type to build a properly (mis-)aligned type to use
> to dereference to.
Right, it looks like the lowering for struct comparisons wasn't taking the
original alignment into account when doing identity comparisons of struct-like
fields.

---
--- a/gcc/d/d-codegen.cc
+++ b/gcc/d/d-codegen.cc
@@ -1006,6 +1006,7 @@ lower_struct_comparison (tree_code code,
StructDeclaration *sd,
              if (tmode == NULL_TREE)
                tmode = make_unsigned_type (GET_MODE_BITSIZE (mode.require
()));

+             tmode = build_aligned_type (tmode, TYPE_ALIGN (stype));
              t1ref = build_vconvert (tmode, t1ref);
              t2ref = build_vconvert (tmode, t2ref);

---


The above change gets reflected in the generated assembly.
---
@@ -326,7 +326,7 @@ _Dmain:
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        call    _D8pr1141718newclassFNbNiZPSQBa14BreakStatement
-       vmovdqa 8(%rax), %xmm0
+       vmovdqu 8(%rax), %xmm0
        xorl    %eax, %eax
        vptest  %xmm0, %xmm0
        sete    %al
---

  parent reply	other threads:[~2024-03-01 14:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 15:53 [Bug d/114171] New: " a.horodniceanu at proton dot me
2024-03-01  4:59 ` [Bug d/114171] " pinskia at gcc dot gnu.org
2024-03-01  6:28 ` liuhongt at gcc dot gnu.org
2024-03-01  7:05 ` rguenth at gcc dot gnu.org
2024-03-01  8:38 ` a.horodniceanu at proton dot me
2024-03-01 13:25 ` ibuclaw at gdcproject dot org
2024-03-01 13:37 ` rguenth at gcc dot gnu.org
2024-03-01 14:13 ` ibuclaw at gdcproject dot org [this message]
2024-03-03  1:33 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:35 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:37 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:39 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:39 ` ibuclaw at gdcproject dot org

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=bug-114171-4-eEovewRQip@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).