public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [committed] Fix HImode load mnemonic on microblaze port
Date: Mon, 4 Dec 2023 10:09:19 -0700	[thread overview]
Message-ID: <2fd89c4a-4a37-45fa-9561-54abd7fcbf8c@gmail.com> (raw)

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

The tester recently started failing va-arg-22.c on microblaze-linux:

gcc.c-torture/execute/va-arg-22.c   -O0  (test for excess errors)

It was failing with an undefined reference to "r7" at link time.  This 
was ultimately tracked down to a HImode load using (reg+reg) addressing 
mode, but which used the lhui instruction instead of lhu.  The "i" means 
it's supposed to be (reg+disp) so the assembler tried to interpret "r7" 
as an immediate/symbol.

The port uses %i<opnum> as an output modifier to select between sh/shi 
and various other mnemonics for loads/stores.  The movhi pattern simply 
failed to use it for the two cases where it's loading from memory 
(interestingly enough it was used for stores).

Clearly we aren't using reg+reg much for HImode loads as this didn't fix 
anything else in the testsuite.

Installing on the trunk,
Jeff

[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1710 bytes --]

commit b544ec681bdc9c48587d2e014f9559674097738a
Author: Jeff Law <jlaw@ventanamicro.com>
Date:   Mon Dec 4 10:06:49 2023 -0700

    [committed] Fix HImode load mnemonic on microblaze port
    
    The tester recently started failing va-arg-22.c on microblaze-linux:
    
    gcc.c-torture/execute/va-arg-22.c   -O0  (test for excess errors)
    
    It was failing with an undefined reference to "r7" at link time.  This was
    ultimately tracked down to a HImode load using (reg+reg) addressing mode, but
    which used the lhui instruction instead of lhu.  The "i" means it's supposed to
    be (reg+disp) so the assembler tried to interpret "r7" as an immediate/symbol.
    
    The port uses %i<opnum> as an output modifier to select between sh/shi and
    various other mnemonics for loads/stores.  The movhi pattern simply failed to
    use it for the two cases where it's loading from memory (interestingly enough
    it was used for stores).
    
    Clearly we aren't using reg+reg much for HImode loads as this didn't fix
    anything else in the testsuite.
    
    gcc/
            * config/microblaze/microblaze.md (movhi): Use %i for half-word
            loads to properly select between lhu/lhui.

diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index 671667b537c..a8ee886d36b 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -1089,8 +1089,8 @@ (define_insn "*movhi_internal2"
   "@
    addik\t%0,r0,%1\t# %X1
    addk\t%0,%1,r0
-   lhui\t%0,%1
-   lhui\t%0,%1
+   lhu%i1\t%0,%1
+   lhu%i1\t%0,%1
    sh%i0\t%z1,%0
    sh%i0\t%z1,%0"
   [(set_attr "type"	"arith,move,load,no_delay_load,store,no_delay_store")

                 reply	other threads:[~2023-12-04 17:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2fd89c4a-4a37-45fa-9561-54abd7fcbf8c@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@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).