History log of /ndk/sources/android/cpufeatures/cpu-features.c
Revision Date Author Comments
e4f17c1301d2499c578b311eb9539cb42cc5af16 20-Apr-2015 Duane Sand <duane.sand@imgtec.com> Add Mips MSA feature to android_getCpuFeatures

Change-Id: Idb5956dad7f540ae2a7d90405d91de9e62e46cf5
5297f237f2d5e40967dcfe19bfd11639b0e7223f 05-Dec-2014 Andrew Hsieh <andrewhsieh@google.com> misc fixes in r10d

1. Remove hack for server where android-13,15,17 were missing
2. Remove --disable-libquadmath
3. Fixed build-gnu-libstdc++.sh thumb build where
"-ffunction-sections -fdata-sections" were dropped
4. Fixed llvm clang3.5/windows build where mingw-64 complains about -fPIC
5. Fixed bashism in make-standalone-toolchain.sh
6. Fixed "package-release.sh --separate-64"
7. Relaxed patch-sources.sh against non-existance patch directory
8. Refresh build/tools/toolchain-patches/gcc/0010-Fix-PR-target-63209.patch
9. Fixed warning about unused vars in cpu-features.c
10. Fixed sources/android/support/Android.mk about -fvisibility-inlines-hidden
is only foo C++
11. Fixed tests/build/check-armeabi-v7a-prebuilts/build.sh on MacOSX 10.6.8
12. Fixed tests/build/issue64679-prctl/build.sh to include GLES2/gl2ext.h
which can be compiled alone now
13. Excluded tests/device/b8708181-Vector4/jni/Vector4.cpp from clang3.4
14. Removed some comments in tests/device/test-libc++-*-full/jni/Android.mk
15. misc run-test.sh fixes
16. Disable integrated-as for clang in tests/build/issue79115-confusing-ld.gold-warning

Change-Id: I0afb2c00642dd61d81fd4842532d1b3c4029655b
50f69434a24623aba2c01d2de45693f8dd4399f0 12-Nov-2014 Andrew Hsieh <andrewhsieh@google.com> White list Krait 300 CPUs

See b.android.com/57637

Change-Id: I4dc6e90bc159347cdf4474715364d58c7384cf9f
3ebb5017c5a6154992928ec2409bf3cc048e585b 22-Aug-2014 Ashok Bhat <ashok.bhat@arm.com> Support for ARMv8 AArch32 optional features

Queries and returns following features if supported
(x) AES - Support for AES instructions
(x) PMULL - Support for 64-bit PMULL/PMULL2 instructions
(x) CRC32 - Support for CRC32 instructions
(x) SHA2 - Support for SHA2 instructions
(x) SHA1 - Support for SHA1 instructions

The features are determined based on the call to
getauxval() in libc with AT_HWCAP2 as parameter.

Change-Id: I9d336c4dbd7b91ebda819d50b27aa92c69793f0a
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
7a9fe36e2d395aee3d28261a0917faca96b12289 02-Jul-2014 Ashok Bhat <ashok.bhat@arm.com> Support for ARM64 features

Queries and returns following features if supported
(x) FP - Support for Floating point instructions
(x) ASIMD - Support for Advanced SIMD instructions
(x) AES - Support for AES instructions
(x) PMULL - Support for 64-bit PMULL/PMULL2 instructions
(x) CRC32 - Support for CRC32 instructions
(x) SHA2 - Support for SHA2 instructions
(x) SHA1 - Support for SHA1 instructions

The features are determined based on the call to getauxval() in libc.

Change-Id: If8c2ab7f143d34ec9e8d0b6c2d3e149a41df39cc
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
882ac8f3392858991a0e1af33b4b7387ec856bd2 17-Apr-2014 David 'Digit' Turner <digit@google.com> cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel.

This addresses several issues related to 32-bit ARM binaries running
on an ARMv8 CPU.

The first one is that API level 20 exposes getauxval() in <sys/auxv.h>
which provides a reliably way to extract the ARM ELF HwCaps, so try
to use it when possible. Note that this adds -ldl as a LDLIBS
export for the library.

The second one is that /proc/self/auxv should always be the preferred
to /proc/cpuinfo for a process to access the 32-bit ARM ELF HWCaps.
Unfortunately, this file is not always accessible on some recent
Android platform versions, even though this may be fixed in the future.

When the file is not accessible, parse /proc/cpuinfo as a fallback,
but deal with the fact that the 'Features' field only list features
that are optional for the device's CPU reference architecture revision.
I.e. when running on an ARMv8 CPU, it will not list the typical
ARMv7 extensions that became mandatory in ARMv8.

+ Refresh and clarify documentation to explain that the output of
android_getCpuFamily() depends on the process' bitness, not the
target device's CPU.

+ Check that android_getCpuFeatures() returns 0 as expected on
anything except 32-bit ARM and 32-bit Intel.

+ Fix the reporting of ARM IDIV instruction by Goldfish kernels
/ Android emulators.

BUG=13679666

Change-Id: Icad8a9d0a7cf651f42a717219c597205586a0a72
baa64155d31c9debf13ae1c6c96e3a6aa07b4238 12-May-2014 David 'Digit' Turner <digit@google.com> Revert "Revert "Revert "cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel."""

There is something fishy in the kingdom of Denmark. Investigating...

This reverts commit 4933fadc341c3452d4d2360e890697c37dcfeaa5.
4933fadc341c3452d4d2360e890697c37dcfeaa5 12-May-2014 David 'Digit' Turner <digit@google.com> Revert "Revert "cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel.""

This reverts commit 85b60dd97d351766fe1023e9eba23df23644953d.

The original patch [1] was reverted because a required dependency
was missing in the libportable module. Fixed in [2], so it is now
safe to re-apply.

[1] https://android-review.googlesource.com/#/c/91380/
[2] https://android-review.googlesource.com/#/c/94181/

Change-Id: I95417e4dccfcc7f7b056df8cf4682424d1940448
85b60dd97d351766fe1023e9eba23df23644953d 12-May-2014 Narayan Kamath <narayan@google.com> Revert "cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel."

This reverts commit 2016d8782c69b0ac6729b47884d874a606ebba52.

Change-Id: I4cdfa6dcc39e5fdd14fc3287d6f44e09eaa910c7
2016d8782c69b0ac6729b47884d874a606ebba52 17-Apr-2014 David 'Digit' Turner <digit@google.com> cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel.

This addresses several issues related to 32-bit ARM binaries running
on an ARMv8 CPU.

The first one is that API level 20 exposes getauxval() in <sys/auxv.h>
which provides a reliably way to extract the ARM ELF HwCaps, so try
to use it when possible. Note that this adds -ldl as a LDLIBS
export for the library.

The second one is that /proc/self/auxv should always be the preferred
to /proc/cpuinfo for a process to access the 32-bit ARM ELF HWCaps.
Unfortunately, this file is not always accessible on some recent
Android platform versions, even though this may be fixed in the future.

When the file is not accessible, parse /proc/cpuinfo as a fallback,
but deal with the fact that the 'Features' field only list features
that are optional for the device's CPU reference architecture revision.
I.e. when running on an ARMv8 CPU, it will not list the typical
ARMv7 extensions that became mandatory in ARMv8.

+ Refresh and clarify documentation to explain that the output of
android_getCpuFamily() depends on the process' bitness, not the
target device's CPU.

+ Check that android_getCpuFeatures() returns 0 as expected on
anything except 32-bit ARM and 32-bit Intel.

+ Fix the reporting of ARM IDIV instruction by Goldfish kernels
/ Android emulators.

BUG=13679666

Change-Id: I003808b0a44c0645a180232ab688f9ce76d10f25
e3f21d482a5f8635c9e5584b44a7942d2b4ee8c7 07-Apr-2014 WenHan Gu <Wenhan.gu@mediatek.com> Add __le64__ check on some sources just like __le32__ before.

Change-Id: Ib1e8232fae5820b16a6290edf044f22cd8697258
9ea9c4e43d71aa812291eed1cabb62dc07cb9810 11-Feb-2014 Rom Lemarchand <romlem@android.com> cpu-features: fix incorrect mips64 family reporting

The 64 bit mips compiler defines both __mips__ and __mips64

Change-Id: I5fe4fd2c4eb4b1176eae986f0ab96e32b4a49d91
9be2452ef9f74edc43260e61bc21ffdd83cabf56 11-Feb-2014 Rom Lemarchand <romlem@android.com> cpu-features: Add support for 64-bit CPU families

Add support for ARM64, X86_64 and MIPS64 CPU families

Change-Id: I7541837035acd8e0480b78dc093f7a232fb0ed25
90d0ca33163cab9aa4454a8ca51f27d73e00311b 23-Sep-2013 Andrew Hsieh <andrewhsieh@google.com> Fix cpu-features.c to use __arm__ and __mips__

Instead of symbol defined in machine/cpu-features.h

Change-Id: I5314ac8bba06e893a9ea25a063828dc79a825259
1991c08b5637581853786078c9cc33841b282cec 17-Sep-2013 WenHan Gu <Wenhan.gu@mediatek.com> Drop obsolete way for cpufeatures on unknown arch.

We have this line within dev/ndk/sources/android/libportable/Android.mk:
LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures
so we need no other changes.

Change-Id: Ibaad10bf411884fc3174e983ecd39088d155719c
324d79f98d5338797721161d557c727165c23bef 15-Jul-2013 David 'Digit' Turner <digit@android.com> cpu-features: Don't assume all VFPv4 devices support IDIV.

Turns out that there are cheap VFPv4 devices which do not support it.
Instead, only add the IDIV feature flags for white-listed devices. For
now, this only means the Nexus 4 kernel.

BUG=57637

Change-Id: If722af2035f63e35241fee112dd9ed064a93c287
7f26cc56c2345217c63b88283be03aa549dd71a6 29-Mar-2013 David 'Digit' Turner <digit@android.com> cpu-features: Add android_getCpuIdArm() and android_setCpuArm()

This allows retrieving the ARM CPUID information easily.

This can be useful to determine the exact ARM CPU design being
used. Experience has shown that Qualcomm and ARM based designs
have very different performance when it comes to FPU or NEON
operations. This can be important for things like JIT compilers.

https://code.google.com/p/android/issues/detail?id=53689

Change-Id: Iff5f56f2eb349dafef2eb91ccff5eb509e15af54
3bb84adae14657a61bba8e30026f054015b2bb79 03-Mar-2013 Martin Storsjo <martin@martin.st> cpu-features: Get rid of a superfluous initialization

The variable is already initialized to this value a few lines above.

This gets rid of warnings about dead initializations if analyzed
with clang static analyzer.

Change-Id: I2b5dafe133b16d26655d69878c019a17a41c417b
1d8f10355045c4b95cee83450091fe702ea1c025 06-Feb-2013 David 'Digit' Turner <digit@android.com> Fix cpufeatures to not parse /proc/self/auxv

Unfortunately, this file is non-readable for regular applications
on recent versions of the platform. This doesn't happen under the
"shell" UID, which is why testing didn't detect that.

http://b.android.com/43055

Change-Id: I09b7780be9ca6666c9b9ba4f81479403585514ea
ef12f2b9ee9cbc8801e0a13fd04ddad17e4978c0 06-Dec-2012 Andrew Hsieh <andrewhsieh@google.com> Revise docs

Change-Id: I324ae0bbced6c569e430e82075ada013afc2f36f
5049b437591600fb0d262e4215cee4226e63c6ce 04-Dec-2012 David 'Digit' Turner <digit@android.com> cpu-features: Add android_setCpu()

This patch adds a new function to the cpu-features library to be able
to set the CPU properties manually, instead of relying on parsing /proc.

This is mostly useful on ARM for sandboxed processes in Android 4.1
and higher, because these don't have permissions to access /proc.

For more context, see http://code.google.com/p/chromium/issues/detail?id=164154

Change-Id: I1c4f22360210bcc3276093d2c81fa8d6c1e0f146
66bc2d1f9959e79982967f728bee2f6c23c46b34 21-Nov-2012 Andrew Hsieh <andrewhsieh@google.com> Fix x86 cpu detection for MOVBE

1. Correct a typo in inline-assembly code which fails to retrieve the
content of %ebx after cpu, and causes vendorIsIntel to be false.
2. Revise ChangeLog a bit

See http://code.google.com/p/android/issues/detail?id=39317

Change-Id: I2d6272cb663f4384fe276d7d639711f776601a69
96ef8f7d9490fb4a2481f1eab0b08ab16b90d476 17-Oct-2012 David 'Digit' Turner <digit@android.com> Update cpu-features library for ARM.

This patch provides an important change to the cpu-features
helper static library. This introduces many new ARM-specific
features with documentation.

+ Support very large /proc/cpuinfo files for recent devices.
+ Parse /proc/self/auxv instead of the "Features" line in
/proc/cpuinfo to get ELF hardware capabilities.
+ Document VFP architecture tree.

Change-Id: Ib792efc9171692fe6ac10553aa48c9da4d20e87f
097812d190ebd3539c82c9c2b24161ae5e75cbb8 30-Mar-2012 Chao-Ying Fu <fu@mips.com> [MIPS] Support to ndk scripts to build MIPS NDK

Change-Id: I36e85a57d409d3f56c37737713bbeb9953b24eaa
a4c9549aee353ff35124cd39c521138540332f22 08-Mar-2012 David 'Digit' Turner <digit@google.com> Fix package build errors

This patch fixes two small errors in our release scripts:

- build-gdbserver.sh didn't properly copy the sysroot to the
temporary build directory. Under certain circumstances, this
resulted in a failed build because the destination sysroot
contained symlinks to invalid locations.

- fix two typos in package-release.sh which prevented the script
to actually put any toolchain binaries in the final packages
(doh)

+ Update documentation for upcoming release.

Change-Id: I4caa86cf838b8088278d8c91b0d0e5aff96bef78
914c9a4d759d07188c789a27cfe9c7306d7c731a 06-Mar-2012 David 'Digit' Turner <digit@google.com> cpufeatures: fix android_getCpuCount() implementation.

This patch fixes the implementation of android_getCpuCount().

The old version did mistakenly parsed /proc/cpuinfo, which only
lists the active cores at a given time. On some multi-core devices,
which enable/disable cores dynamically, calling the function could
result in a value that was lower than the real number of cores.

+ Update the test_cpufeatures.c test to handle ldrex/strex (ARM)
and x86 features.

+ Replace sources/cpufeatures/cpu-features.h with a symlink to
sources/android/cpu-features/cpu-features.h which is the
location of the right header.

This fixes http://code.google.com/p/android/issues/detail?id=26490

Change-Id: Ic2398ec9c8d9e7e5afb1af06fff6d06ae47c5a2d
966161e450fe3abfb13698e8bd6d63cf35eccf0f 09-Dec-2011 David 'Digit' Turner <digit@google.com> cpu-features: Add support for optional x86 CPU features.

This patch add runtime probing on x86 to detect the following
optional CPU features:

- SSSE3
- MOVBE
- POPCNT

Also update the documentation to mention them, as well as
android_getCpuCount() which was introduced in a previous release.

Change-Id: I9a0629efba36a6023f05e5f092e7addcc1b7d2a9
7a6b7eabd10b7dc6899ac9cc08069c23d254d479 10-Mar-2011 David 'Digit' Turner <digit@android.com> cpu-features: Add android_getCpuCount() function.

This new function returns the number of CPU cores detected by
parsing /proc/cpuinfo.

Also add a new ARM feature flag: ANDROID_CPU_FEATURE_ARM_LDREX_STREX
to indicate whether the CPU support the new LDREX/STREX instructions
introduced with ARMv6.

Change-Id: I4bfd455ec517cf94bc44f946c2453a785b3d006b
73aed82e574b59039cd85be912ffe20b2c75bca0 09-Dec-2010 David 'Digit' Turner <digit@google.com> cpufeatures: fix ARM-specific bug

The __ARM_ARCH__ macro is not defined by default anymore by the toolchain
so use __arm__ instead to include <machine/cpu-features.h> for this
platform.

Note: The toolchain does define __ARM_ARCH_5TE__ or __ARM_ARCH_7A__
depending on compiler flags though...

Change-Id: I3da100ece98fe59b1401ea63c17807cb0d5c1f44
6b6e7556db5f4c57302a13272349febac2667be7 26-Oct-2010 David 'Digit' Turner <digit@google.com> Fix the build

Apparently, cpu-features.c is also built for the host in our full build.

Change-Id: I901911fbd5cb0b2f3dbdb340a3f4a29df2916fff
2ffd1df9f0b32978ebe70d8268c0a38dea1cfc07 23-Oct-2010 David 'Digit' Turner <digit@google.com> Update cpufeatures and move it to sources/android/

Move the cpufeatures library from sources/ to sources/android/
Provide compatibility header and Android.mk for legacy code.
Improve CPU architecture and feature detection.
Add change history to the source file.
Update documentation.

Change-Id: I127586e059996c34a011b8acadad9a8f70d3b16a