From patchwork Fri Oct 20 13:02:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 23727 X-Patchwork-Delegate: tuliom@linux.vnet.ibm.com Received: (qmail 56070 invoked by alias); 20 Oct 2017 13:02:55 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 54407 invoked by uid 89); 20 Oct 2017 13:02:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=sticky X-HELO: mail-pf0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=iwLPLb1sbkKejB3e/qX7g2tkMCCmuR6k9mTX1HnEY7U=; b=d42Mw1jKvRn/yZcnE1GZHxeI/Cp1qgLHOOUqdiw9pYq9N3PjtKUer/W2PtNgKzgqgH +/aGcQ+Zn1KTwJRj+XzHs3jJdEqwq+sMK138jCAa1z2B/eibE/4Am4jtZmRRxaewUfUG PaLNkyVSPljiSDmqQQ/QJW12OHDJkmW1CCu85FmiPRxeVStGS/kc3NuRYaLLrrkrX4ji Foqoh5rpA8EjC0/KGUbxoud5JOcVvXzcv3rkKdezh+9jMmE0mWTXeOf3/2lXYuvBOBKa xaH3HdszGb3SvHTbhQ+qis7tC2C3U2dqOvem28ZbwL1r2yO5/E34HsAifHVA4qB9AOdR SYrw== X-Gm-Message-State: AMCzsaUtQrKkgEMzTTU8ymuY3THN8jepoFYc6NTZHHLc6wxQDOhBqaCo czEMCcyDLcrg6WaGP2uW78qIlQ== X-Google-Smtp-Source: ABhQp+Qpdzwxa8HzxpWYG0rqG42virjOMdejnKAZuV8oRX8u0vsuHAca2HpTaIKR113bfrtANpX+Sg== X-Received: by 10.99.173.74 with SMTP id y10mr4383358pgo.107.1508504567678; Fri, 20 Oct 2017 06:02:47 -0700 (PDT) Date: Fri, 20 Oct 2017 23:32:41 +1030 From: Alan Modra To: libc-alpha@sourceware.org Subject: [POWERPC] Don't override gcc -mcpu with wrong asm .machine Message-ID: <20171020130241.GA27132@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) If powerpc gcc is modified to not pass -many to the assembler, glibc builds break. -many is a sticky option, which means .machine in the source isn't really effective in selecting an instruction set. You do get the insns you want, in particular with the operand variations for the given cpu, but then all other cpu instructions are made available too. So, ".machine power4" in power4/memcmp.S doesn't stop you using power7 insns as used by the little-endian code in that file. However if -many is not in force, power4/memcmp.S won't compile for powerpc64le. It's rather strange that these files use .machine at all. Perhaps that was a workaround for versions of gcc that didn't pass -m (or passed a wrong -m) to the assembler unless -mcpu was given? Even with such a gcc, I believe you'll get the correct -m if the glibc makefiles always pass -mcpu= to gcc. Since I haven't verified that all possible powerpc build variants do that, I haven't completely removed .machine, but instead put the .machine directive inside an ifdef test of a macro defined by gcc. Now if the Makefile passes -mcpu=power8 the assembly won't disagree by using ".machine power7". * sysdeps/powerpc/powerpc64/power4/memcmp.S: Don't emit .machine when __LITTLE_ENDIAN__. * sysdeps/powerpc/powerpc64/power8/strcasecmp.S: Don't emit .machine when _ARCH_PWR8. * sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise. diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S index c366801..6cb4a16 100644 --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S @@ -26,7 +26,9 @@ # define MEMCMP memcmp #endif +#ifndef __LITTLE_ENDIAN__ .machine power4 +#endif ENTRY_TOCLESS (MEMCMP, 4) CALL_MCOUNT 3 diff --git a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S index 88b17a6..0655bd7 100644 --- a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S +++ b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S @@ -98,6 +98,7 @@ # define VPOPCNTD_V8_V8 vpopcntd v8, v8; # define VADDUQM_V7_V8 vadduqm v9, v7, v8; #else + .machine power7 # define VCLZD_V8_v7 .long 0x11003fc2 # define MFVRD_R3_V1 .long 0x7c230067 # define VSUBUDM_V9_V8 .long 0x112944c0 @@ -105,8 +106,6 @@ # define VADDUQM_V7_V8 .long 0x11274100 #endif - .machine power7 - ENTRY (__STRCASECMP) #ifdef USE_AS_STRNCASECMP CALL_MCOUNT 3 diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S index 3f59cb0..c301387 100644 --- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S +++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S @@ -78,13 +78,11 @@ #ifdef _ARCH_PWR8 #define VCLZD_V8_v7 vclzd v8, v7; #else + .machine power7 #define VCLZD_V8_v7 .long 0x11003fc2 #endif #define FRAMESIZE (FRAME_MIN_SIZE+48) -/* TODO: change this to .machine power8 when the minimum required binutils - allows it. */ - .machine power7 ENTRY (STRCASESTR, 4) CALL_MCOUNT 2 mflr r0 /* Load link register LR to r0. */