From owner-freebsd-ppc@freebsd.org Mon Dec 5 16:27:13 2016 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97DB9C68503; Mon, 5 Dec 2016 16:27:13 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (mail.vlakno.cz [91.217.96.224]) by mx1.freebsd.org (Postfix) with ESMTP id 29F4C106F; Mon, 5 Dec 2016 16:27:12 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: by vlakno.cz (Postfix, from userid 1002) id 503AEA35642; Mon, 5 Dec 2016 17:19:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=vlakno.cz; s=mail; t=1480954745; bh=E1KmZY+c9aRqJBBWpfR4XjDFEXTf8EqaCsyi39U/SaQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Z0jQCaVVoJaEGDuHW2+x2YD1RgM2+tCVk8DHLaJn1kVDbw7HZWsJew5isxxLC2I9/ u3bf1f0UWF1X7ScJEf9JvOdZ20bM2og3dem1Ujf/qed1n2X7Sa75w3+1g1lC9yH16P n5vUUo9gALDtMV3Ke0lvc+AC5dl0RE93Lj0qImkw= Date: Mon, 5 Dec 2016 17:19:05 +0100 From: Roman Divacky To: Mark Millard Cc: Justin Hibbits , FreeBSD Toolchain , FreeBSD PowerPC ML Subject: Re: clang 3.9.0 buildkernel on old powerpc64's vs. trying to build hwpmc_e500.o and the like. . . Message-ID: <20161205161904.GA7889@vlakno.cz> References: <300CB7A2-34BB-407F-B2E9-D263B119A989@dsl-only.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <300CB7A2-34BB-407F-B2E9-D263B119A989@dsl-only.net> User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2016 16:27:13 -0000 Can you try this patch? Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrInfo.td (revision 288675) +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td (working copy) @@ -2373,6 +2373,12 @@ def MFTB : XFXForm_1<31, 371, (outs gprc:$RT), (ins i32imm:$SPR), "mftb $RT, $SPR", IIC_SprMFTB>; +def MFPMR : XFXForm_1<31, 334, (outs gprc:$RT), (ins i32imm:$PMRN), + "mfpmr $RT, $PMRN", IIC_IntGeneral>; + +def MTPMR : XFXForm_1<31, 462, (outs), (ins i32imm:$PMRN, gprc:$RS), + "mtpmr $PMRN, $RS", IIC_IntGeneral>; + // A pseudo-instruction used to implement the read of the 64-bit cycle counter // on a 32-bit target. let hasSideEffects = 1, usesCustomInserter = 1 in On Sat, Dec 03, 2016 at 08:35:50PM -0800, Mark Millard wrote: > [Note: At present I can buildworld using WITH_LIB32= on > powerpc64 for TARGET_ARCH=powerpc64 via clang 3.9.0 from a > minor variant of head -r309179 . That does not work for > amd64 cross compiling to powerpc64 due to assembler > notation rejections.] > > When I attempt to buildkernel (with WERROR= ) via FreeBSD's > clang 3.9.0 I get the following sorts of error > reports, *even building on powerpc64* : > > --- hwpmc_e500.o --- > /usr/src/sys/modules/hwpmc/../../dev/hwpmc/hwpmc_e500.c:475:19: error: unrecognized instruction mnemonic > uint32_t pmgc0 = mfpmr(PMR_PMGC0); > ^ > ./machine/pmc_mdep.h:24:21: note: expanded from macro 'mfpmr' > __asm __volatile("mfpmr %0,%1" : "=r"(val) : "K"(reg)); \ > ^ > :1:2: note: instantiated into assembly here > mfpmr 3,400 > ^ > . . . > > When I look up these instructions I find that they are not > classic powerpc instructions: > ( http://www.nxp.com/assets/documents/data/en/white-papers/POWRPCARCPRMRM.pdf ) > > > Whereas the classic architecture defines special-purpose registers (SPRs) and > > two instructions to access them (Move to Special-Purpose Register (mtspr) and > > Move from Special-Purpose Register (mfspr)), Book E takes that model and defines > > optional device control registers (DCRs) and mtdcr and mfdcr instructions, and > > the EIS-defined performance monitor APU defines performance monitor registers > > (PMRs) and mtpmr and mfpmr instructions, all based on models provided by the > > UISA. > > . . . > > Does this imply that clang 3.9.0 needs to support more instructions when > it is targeting FreeBSD for GENERIC64 based builds? (I include GENERIC64 > and then override some items for my build activity.) > > If yes, then someone probably needs to make a list of what instructions > need to be present and have someone submit the list into llvm's bugzilla > and have the submittal listed in: > > [META] Using Clang as the FreeBSD/ppc system compiler > > (25780). > > > If GENERIC64 does not need the likes of hwpmc_e500.o built then some > work on the build environment to avoid GENERIC64 including things with > non-classic instruction use would appear to be needed. (No llvm > involvement for this case.) I doubt this is the case as it would > seem that the problem would reoccur when alternate KERNCONF's were > in use instead that do require something like of hwpmc_e500.o to be > built. > > > Note: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214903 is about > this issue from the FreeBSD side of things. I just noticed the status > of the specific instructions involved and also that the cross-build > and on-powerpc64 build get the same result (unlike the recent > WITH_LIB32= discovery). > > === > Mark Millard > markmi at dsl-only.net > > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to "freebsd-toolchain-unsubscribe@freebsd.org"