From patchwork Tue Sep 16 00:02:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Metcalf X-Patchwork-Id: 396013 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2AD8D14017E for ; Fri, 3 Oct 2014 01:59:13 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:from:date:to:subject:mime-version :content-type; q=dns; s=default; b=s3j1ohrJjxh5vYLJmgY1YFUdYDJ+F yMgcRS753cCas1tTEnuEImy4m3xxKz3CbURLChKnwHfgWbLULu6FFaxe1WhoOjcY ucsgKWc+1sj9iMB4iNaYqHehYqwzfRCJZSi6uEHavlkDocgLCSHN5/dPYTe9lc0S YiLVpOj77dT1d0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:from:date:to:subject:mime-version :content-type; s=default; bh=o8UizRjy6y+KgkiX7yVtN/WNhdM=; b=lpA 746Zh4jXXDM3Ruz8cETHI6ncUTBWPYq060kij+Aq2OWFdeFHCUynaNjsSk0OoARB sGo9LqColE/N+1WS++vsmhdI+rYTnvQmYwyIEvwY6Zb1h5kbcI9d7WeRM2RbI5VE tWOEkF4Wu9MnbDpCVKuQRnFdWCAmaLwbn1eKDjTM= Received: (qmail 1645 invoked by alias); 2 Oct 2014 15:59:08 -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 1635 invoked by uid 89); 2 Oct 2014 15:59:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, DATE_IN_PAST_96_XX, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 X-HELO: USMAMAIL.TILERA.COM Message-ID: <201410021559.s92Fx3GF020854@farm-0002.internal.tilera.com> From: Chris Metcalf Date: Mon, 15 Sep 2014 20:02:50 -0400 To: Subject: [PATCH] tilegx: optimize string copy_byte() internal function MIME-Version: 1.0 We can use one "shufflebytes" instruction instead of 3 "bfins" instructions to optimize the string functions. --- sysdeps/tile/tilegx/string-endian.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 2014-10-02 Chris Metcalf * sysdeps/tile/tilegx/string-endian.h (copy_byte): Optimize. diff --git a/sysdeps/tile/tilegx/string-endian.h b/sysdeps/tile/tilegx/string-endian.h index 0c4d51766d70..47333891e072 100644 --- a/sysdeps/tile/tilegx/string-endian.h +++ b/sysdeps/tile/tilegx/string-endian.h @@ -36,12 +36,11 @@ #define REVCZ(x) __insn_ctz(x) #endif -/* Create eight copies of the byte in a uint64_t. */ +/* Create eight copies of the byte in a uint64_t. Byte Shuffle uses + the bytes of srcB as the index into the dest vector to select a + byte. With all indices of zero, the first byte is copied into all + the other bytes. */ static inline uint64_t copy_byte(uint8_t byte) { - uint64_t word = byte; - word = __insn_bfins(word, word, 8, 15); - word = __insn_bfins(word, word, 16, 31); - word = __insn_bfins(word, word, 32, 63); - return word; + return __insn_shufflebytes(byte, 0, 0); }