svn commit: r358672 - head/lib/libc/powerpc64/string
Alfredo Dal'Ava Junior
alfredo at FreeBSD.org
Thu Mar 5 14:13:23 UTC 2020
Author: alfredo
Date: Thu Mar 5 14:13:22 2020
New Revision: 358672
URL: https://svnweb.freebsd.org/changeset/base/358672
Log:
[PowerPC64] restrict memcpy/bcopy optimization to POWER ISA >=V2.07
VSX instructions were added in POWER ISA V2.06 (POWER7), but it
requires data to be word-aligned. Such requirement was removed in
ISA V2.07B (POWER8).
Since current memcpy/bcopy optimization relies on VSX instructions
handling misalignment transparently, and kernel doesn't currently
implement an alignment error handler, this optimzation should be
restrict to ISA V2.07 onwards.
SIGBUS on stxvd2x instruction was reproduced in POWER7+ CPU.
Reviewed by: luporl, jhibbits, bdragon
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D23958
Modified:
head/lib/libc/powerpc64/string/bcopy_resolver.c
Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c
==============================================================================
--- head/lib/libc/powerpc64/string/bcopy_resolver.c Thu Mar 5 14:05:22 2020 (r358671)
+++ head/lib/libc/powerpc64/string/bcopy_resolver.c Thu Mar 5 14:13:22 2020 (r358672)
@@ -61,7 +61,12 @@ FN_RET FN_NAME_VSX FN_PARAMS;
DEFINE_UIFUNC(, FN_RET, FN_NAME, FN_PARAMS)
{
- if (cpu_features & PPC_FEATURE_HAS_VSX)
+ /* VSX instructions were added in POWER ISA 2.06,
+ * however it requires data to be word-aligned.
+ * Since POWER ISA 2.07B this is solved transparently
+ * by the hardware
+ */
+ if (cpu_features2 & PPC_FEATURE2_ARCH_2_07)
return (FN_NAME_VSX);
else
return (FN_NAME_NOVSX);
More information about the svn-src-head
mailing list