Commit Graph

25 Commits

Author SHA1 Message Date
Niels Dossche
00001c4a0c
Fix GH-15292: Dynamic AVX detection is broken for MSVC
See https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170
For x64, either _M_X64 or _M_AMD64 would work but I'm going with what's
already used in php-src.

Closes GH-15301.
2024-08-09 18:11:46 +02:00
dixyes
3a843f953b
Windows arm64 zend and standard extension support
* Port zend_cpuid for windows arm64
* Fix zend_atomic windows arm64 build
* Fix windows arm64 multiply
* Enable arm64 neon for windows in standard extension
* Enable arm64 neon for windows in zend_hash.c
* Workaround for msvc arm64 optimization bug

Closes GH-9115.
2022-08-09 12:45:14 +02:00
Christoph M. Becker
9d2dc1e9a9
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Avoid void* arithmetic in sockets/multicast.c on NetBSD
2021-12-23 16:21:28 +01:00
David Carlier
3f0bb67361
Avoid void* arithmetic in sockets/multicast.c on NetBSD
On NetBSD, ifconf.ifc_buf member, unlike most of platforms, is a void
pointer.

We also fix the cpuinfo declarations with empty parameter lists.

Closes GH-7819.
2021-12-23 16:17:30 +01:00
Remi Collet
ef2fd0e5b5
fix [-Wstrict-prototypes] buid warnings 2021-11-24 14:55:11 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Nikita Popov
08919578ca Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix build for non-x86
2020-11-27 17:04:50 +01:00
Nikita Popov
3430d856ac Fix build for non-x86 2020-11-27 17:04:17 +01:00
Nikita Popov
4f3cf983dc Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix AVX detection
2020-11-27 14:49:45 +01:00
Nikita Popov
4e30ab33d8 Fix AVX detection
Our CPU detection code currently only checks whether hardware
support for AVX exists. However, we also need to check for operating
system support for XSAVE, as well as whether XCR0 has the SSE and
AVX bits set.

If this is not the case, unset the AVX and AVX2 bits in the cpuinfo
structure.

Hopefully this resolves our issues with CPU support detection.

Closes GH-6460.
2020-11-27 14:49:31 +01:00
Nikita Popov
f35b194029 Assert that cpuinfo is initialized before use
And fix some incorrect indentation.
2020-11-27 11:14:07 +01:00
Peter Kokot
c245898bfa Update and fix remaining year ranges (2019)
This patch follows previous license year ranges updates. With new
approach source code files now have simplified headers with license
information without year ranges.
2019-02-08 23:14:29 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Nikita Popov
5a361c3a54 Possible fix for bug #77357
Don't invoke CPUID with feature levels above the supported maximum.
In this case CPUID will return the highest supported basic information
leaf, which will have unrelated bits in the relevant positions.
2019-01-03 10:24:48 +01:00
Ryan Schmidt
4fb019994a Fix __zend_cpuid on i386 PIC without __cpuid_count
Closes https://bugs.php.net/bug.php?id=76654
2018-12-08 09:52:52 -06:00
Christoph M. Becker
7625f972db Fix #76825: Undefined symbols ___cpuid_count
Apparently, the presence of `cpuid.h` is not necessarily sufficient to
guarantee the availability of `__cpuid_count()`.  We therefore test for
the latter explicitly.
2018-11-05 18:24:39 +01:00
Xinchen Hui
3497b75b73 Fixed bug #76825 (Undefined symbols ___cpuid_count) 2018-09-04 17:26:46 +08:00
Anatol Belski
36857ab52b Fix clang compilation
By usage of -fmodules, all the intrinsic items are loaded automatically.
The headers included come however from Visual Studio, thus bringing some
conflicting declarations. On the other hand, -fmodules is needed to
mitigate linking issues with clang in VS compatibility mode.
2018-08-01 16:19:54 +02:00
Ondřej Surý
1a078117b5 Use __cpuid_count() from cpuid.h instead of custom assembly 2018-07-17 13:59:53 +00:00
Xinchen Hui
08428cf6a7 Fixed cpuinfo in LLVM GCC & Added AVX2 detection
Seems it only defines __builtin_cpu_supports but no __builtin_cpu_init
(Apple LLVM version 9.0.0 (clang-900.0.38))
2018-02-10 17:38:30 +08:00
Xinchen Hui
87b7180480 Fixed cpu feature check in reslover functions 2018-02-10 16:58:27 +08:00
Anatol Belski
74de5461eb The cpu setup is still needed when ifunc is supported 2018-01-16 11:55:19 +01:00
Anatol Belski
811326089f Separate the cpuinfo initialization part and call it at startup 2018-01-16 11:27:18 +01:00
Anatol Belski
560cc32e21 Fix __cpuidex usage 2018-01-16 10:56:46 +01:00
Xinchen Hui
3a3e0493d0 Added ZEND_API zend_cpu_supports 2018-01-16 14:53:00 +08:00