Date: Mon, 19 Sep 2016 14:36:16 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> 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 Message-ID: <201609191436.u8JEaGEK098923@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609191436.u8JEaGEK098923>