From: Jeff Law <law@redhat.com>
To: coypu@sdf.org, gcc-patches@gcc.gnu.org
Cc: matt@3am-software.com
Subject: Re: [PATCH, VAX] Correct ffs instruction constraint
Date: Thu, 29 Jun 2017 19:44:00 -0000 [thread overview]
Message-ID: <41726b53-19a7-8e01-49f1-09a887b69c5a@redhat.com> (raw)
In-Reply-To: <20170629154705.GC19263@SDF.ORG>
On 06/29/2017 09:47 AM, coypu@sdf.org wrote:
> Ping.
>
> On Tue, Jun 20, 2017 at 08:05:42PM +0000, coypu@sdf.org wrote:
>> VAX' FFS as variable-length bit field instruction uses a "base"
>> operand of type "vb" meaning "byte address".
>> "base" can be 32 bits (SI) and due to the definition of
>> ffssi2/__builtin_ffs() with the operand constraint "m", code can be
>> emitted which incorrectly implies a mode-dependent (= longword, for
>> the 32-bit operand) address.
>> File scsipi_base.c compiled with -Os for our VAX install kernel shows:
>>
>> ffs $0x0,$0x20,0x50(r11)[r0],r9
>>
>> Apparently, 0x50(r11)[r0] as a longword address is assumed to be
>> evaluated in longword context by FFS, but the instruction expects a
>> byte address.
>>
>> Our fix is to change the operand constraint from "m" to "Q", i. e.
>> "operand is a MEM that does not have a mode-dependent address", which
>> results in:
>>
>> moval 0x50(r11)[r0],r1
>> ffs $0x0,$0x20,(r1),r9
>>
>> MOVAL evaluates the source operand/address in longword context, so
>> effectively converts the word address to a byte address for FFS.
>>
>> See NetBSD PR port-vax/51761 (http://gnats.netbsd.org/51761) and
>> discussion on port-vax mailing list
>> (http://mail-index.netbsd.org/port-vax/2017/01/06/msg002954.html).
>>
>> Changlog:
>>
>> 2017-06-20 Maya Rashish <coypu@sdf.org>
>>
>> * gcc/config/vax/builtins.md: Correct ffssi2_internal
>> instruction constraint.
Thanks. Installed.
Ideally we'd like to have a testcase for this in the regression suite.
If you could provide the .i file and options used which generated the
incorrect ffs instruction I can use the reduction tools with a cross
compiler to produce a nice simple test for the testsuite.
jeff
next prev parent reply other threads:[~2017-06-29 19:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 20:06 coypu
2017-06-29 15:47 ` coypu
2017-06-29 19:44 ` Jeff Law [this message]
2017-07-06 17:00 ` Felix Deichmann
2017-07-06 18:53 ` Jeff Law
2017-07-07 14:55 ` Felix Deichmann
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=41726b53-19a7-8e01-49f1-09a887b69c5a@redhat.com \
--to=law@redhat.com \
--cc=coypu@sdf.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=matt@3am-software.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).