public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: FX Coudert <fxcoudert@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Fangrui Song <maskray@google.com>, Iain Sandoe <iain@sandoe.co.uk>
Subject: [PATCH] i386, testsuite: adjust asm patterns
Date: Sat, 10 Feb 2024 19:07:37 +0100	[thread overview]
Message-ID: <CA7326B1-4059-421D-A90B-A3962CFBC257@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

The new testcase gcc.target/i386/asm-raw-symbol.c fails on darwin. This is partly because symbols are prefixed with underscore, and also because the order of operands in the addition is reversed (but I think it’s valid still). The code generated is this:

_func:
LFB0:
        pushq   %rbp
LCFI0:
        movq    %rsp, %rbp
LCFI1:
# 8 "/Users/fx/gcc-upstream/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c" 1
        @ _func
# 0 "" 2
# 9 "/Users/fx/gcc-upstream/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c" 1
        @ 4+_var
# 0 "" 2
        nop
        popq    %rbp
LCFI2:
        ret



I’m adjusting the pattern accordingly.
OK to push?

FX


[-- Attachment #2: 0001-i386-testsuite-adjust-asm-patterns.patch --]
[-- Type: application/octet-stream, Size: 1102 bytes --]

From bfafd28ce6736b033d126284fe30d9fe1ee783f0 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Sat, 10 Feb 2024 19:03:37 +0100
Subject: [PATCH] i386, testsuite: adjust asm patterns

On darwin, symbols are prefixed with underscore, and
the order of operands is reversed.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/asm-raw-symbol.c: Adjust asm patterns.
---
 gcc/testsuite/gcc.target/i386/asm-raw-symbol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c b/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c
index b7854567dd9..001eb660ad7 100644
--- a/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c
+++ b/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c
@@ -9,5 +9,5 @@ func (void)
   __asm__ ("@ %p0" : : "Ws" (&var + 1));
 }
 
-/* { dg-final { scan-assembler "@ func" } } */
-/* { dg-final { scan-assembler "@ var\\+4" } } */
+/* { dg-final { scan-assembler "@ _?func" } } */
+/* { dg-final { scan-assembler "@ (_?var\\+4|4\\+_?var)" } } */
-- 
2.39.3 (Apple Git-145)


             reply	other threads:[~2024-02-10 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10 18:07 FX Coudert [this message]
2024-02-11 19:12 ` Mike Stump
2024-02-12 17:56   ` Fangrui Song

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=CA7326B1-4059-421D-A90B-A3962CFBC257@gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=maskray@google.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).