From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118675 invoked by alias); 29 Jun 2017 19:44:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 118582 invoked by uid 89); 29 Jun 2017 19:44:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Jun 2017 19:44:57 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23F937881D; Thu, 29 Jun 2017 19:44:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 23F937881D Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=law@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 23F937881D Received: from localhost.localdomain (ovpn-117-103.phx2.redhat.com [10.3.117.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB2875C46E; Thu, 29 Jun 2017 19:44:55 +0000 (UTC) Subject: Re: [PATCH, VAX] Correct ffs instruction constraint To: coypu@sdf.org, gcc-patches@gcc.gnu.org Cc: matt@3am-software.com References: <20170620200542.GA17979@SDF.ORG> <20170629154705.GC19263@SDF.ORG> From: Jeff Law Message-ID: <41726b53-19a7-8e01-49f1-09a887b69c5a@redhat.com> Date: Thu, 29 Jun 2017 19:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170629154705.GC19263@SDF.ORG> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg02324.txt.bz2 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 >> >> * 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