From owner-svn-src-head@freebsd.org Mon Sep 19 14:36:17 2016 Return-Path: Delivered-To: svn-src-head@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 66F84BE1581; Mon, 19 Sep 2016 14:36:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34666A8C; Mon, 19 Sep 2016 14:36:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8JEaGWa098927; Mon, 19 Sep 2016 14:36:16 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8JEaGEK098923; Mon, 19 Sep 2016 14:36:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609191436.u8JEaGEK098923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 19 Sep 2016 14:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305973 - head/contrib/cortex-strings/src/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2016 14:36:17 -0000 Author: andrew Date: Mon Sep 19 14:36:16 2016 New Revision: 305973 URL: https://svnweb.freebsd.org/changeset/base/305973 Log: Fix the asm on the memchr and strchr functions. Add an alias from index to strchr as is done in the libc C implementation. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/contrib/cortex-strings/src/aarch64/memchr.S head/contrib/cortex-strings/src/aarch64/strchr.S head/contrib/cortex-strings/src/aarch64/strchrnul.S Modified: head/contrib/cortex-strings/src/aarch64/memchr.S ============================================================================== --- head/contrib/cortex-strings/src/aarch64/memchr.S Mon Sep 19 13:12:09 2016 (r305972) +++ head/contrib/cortex-strings/src/aarch64/memchr.S Mon Sep 19 14:36:16 2016 (r305973) @@ -107,7 +107,7 @@ def_fn memchr and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */ addp vend.16b, vend.16b, vend.16b /* 128->64 */ - mov synd, vend.2d[0] + mov synd, vend.d[0] /* Clear the soff*2 lower bits */ lsl tmp, soff, #1 lsr synd, synd, tmp @@ -127,7 +127,7 @@ def_fn memchr /* Use a fast check for the termination condition */ orr vend.16b, vhas_chr1.16b, vhas_chr2.16b addp vend.2d, vend.2d, vend.2d - mov synd, vend.2d[0] + mov synd, vend.d[0] /* We're not out of data, loop if we haven't found the character */ cbz synd, .Lloop @@ -137,7 +137,7 @@ def_fn memchr and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */ addp vend.16b, vend.16b, vend.16b /* 128->64 */ - mov synd, vend.2d[0] + mov synd, vend.d[0] /* Only do the clear for the last possible block */ b.hi .Ltail Modified: head/contrib/cortex-strings/src/aarch64/strchr.S ============================================================================== --- head/contrib/cortex-strings/src/aarch64/strchr.S Mon Sep 19 13:12:09 2016 (r305972) +++ head/contrib/cortex-strings/src/aarch64/strchr.S Mon Sep 19 14:36:16 2016 (r305973) @@ -78,7 +78,13 @@ \f: .endm + .macro def_alias f a + .weak \a + .set \a,\f + .endm + def_fn strchr +def_alias strchr index /* Magic constant 0x40100401 to allow us to identify which lane matches the requested byte. Magic constant 0x80200802 used similarly for NUL termination. */ @@ -113,7 +119,7 @@ def_fn strchr addp vend1.16b, vend1.16b, vend2.16b // 128->64 lsr tmp1, tmp3, tmp1 - mov tmp3, vend1.2d[0] + mov tmp3, vend1.d[0] bic tmp1, tmp3, tmp1 // Mask padding bits. cbnz tmp1, .Ltail @@ -128,7 +134,7 @@ def_fn strchr orr vend2.16b, vhas_nul2.16b, vhas_chr2.16b orr vend1.16b, vend1.16b, vend2.16b addp vend1.2d, vend1.2d, vend1.2d - mov tmp1, vend1.2d[0] + mov tmp1, vend1.d[0] cbz tmp1, .Lloop /* Termination condition found. Now need to establish exactly why @@ -142,7 +148,7 @@ def_fn strchr addp vend1.16b, vend1.16b, vend2.16b // 256->128 addp vend1.16b, vend1.16b, vend2.16b // 128->64 - mov tmp1, vend1.2d[0] + mov tmp1, vend1.d[0] .Ltail: /* Count the trailing zeros, by bit reversing... */ rbit tmp1, tmp1 Modified: head/contrib/cortex-strings/src/aarch64/strchrnul.S ============================================================================== --- head/contrib/cortex-strings/src/aarch64/strchrnul.S Mon Sep 19 13:12:09 2016 (r305972) +++ head/contrib/cortex-strings/src/aarch64/strchrnul.S Mon Sep 19 14:36:16 2016 (r305973) @@ -105,7 +105,7 @@ def_fn strchrnul addp vend1.16b, vend1.16b, vend1.16b // 128->64 lsr tmp1, tmp3, tmp1 - mov tmp3, vend1.2d[0] + mov tmp3, vend1.d[0] bic tmp1, tmp3, tmp1 // Mask padding bits. cbnz tmp1, .Ltail @@ -120,7 +120,7 @@ def_fn strchrnul orr vhas_chr2.16b, vhas_nul2.16b, vhas_chr2.16b orr vend1.16b, vhas_chr1.16b, vhas_chr2.16b addp vend1.2d, vend1.2d, vend1.2d - mov tmp1, vend1.2d[0] + mov tmp1, vend1.d[0] cbz tmp1, .Lloop /* Termination condition found. Now need to establish exactly why @@ -130,7 +130,7 @@ def_fn strchrnul addp vend1.16b, vhas_chr1.16b, vhas_chr2.16b // 256->128 addp vend1.16b, vend1.16b, vend1.16b // 128->64 - mov tmp1, vend1.2d[0] + mov tmp1, vend1.d[0] .Ltail: /* Count the trailing zeros, by bit reversing... */ rbit tmp1, tmp1