2419 Commits
0.3.0 ... 0.5.0

Author SHA1 Message Date
Andrew Kelley
0dd8adcdb4 Release 0.5.0 2019-09-30 10:09:33 -04:00
Andrew Kelley
e0eb045b5f remove unhelpful/outdated/unused doc file 2019-09-30 08:33:04 -04:00
Andrew Kelley
0e9f86b1db docs: docgen supports release safe exe code examples
and make the type names of `@hasDecl` and `@hasField` consistent
2019-09-29 17:28:30 -04:00
Andrew Kelley
ffaf37a7e7 Merge pull request #3343 from ziglang/windows-libc-um-dir
detect the windows um include directory
2019-09-29 15:47:01 -04:00
Andrew Kelley
339f621735 detect the shared windows include dir as well 2019-09-29 14:12:06 -04:00
Andrew Kelley
c8e967f43d detect the windows um include directory 2019-09-29 14:04:23 -04:00
Andrew Kelley
ec545859b9 docgen: support code examples for riscv target 2019-09-29 14:03:49 -04:00
Nick Erdmann
ff9c3c6e5b std/os/uefi: fix Guid alignment in rng protocol 2019-09-29 12:28:14 -04:00
Andrew Kelley
bd46c1c328 RISC-V: get to the linking phase of behavior tests
See #3338 and #3339
2019-09-29 12:21:22 -04:00
Andrew Kelley
543e729398 Merge pull request #3331 from meme/android-ndk
Support Android NDK
2019-09-28 13:30:19 -04:00
meme
030abfa0d2 minor tweaks 2019-09-28 13:21:29 -04:00
meme
0c556095f4 do not link against gcc runtime on Android target 2019-09-28 12:48:13 -04:00
Andrew Kelley
ce0e794092 fix glibc builds on aarch64-linux-gnu
There was a missing include path in the compilation line, leading to
incorrect fstat ABI.

closes #3291
2019-09-27 18:19:21 -04:00
Andrew Kelley
579301c2af avoid duplicated code of specifying the default glibc version 2019-09-27 17:39:11 -04:00
meme
308e7d5314 fix building static Android executables 2019-09-27 17:33:07 -04:00
Andrew Kelley
dc299166cf std.os.fstat: EINVAL => unreachable
Related: #3291
2019-09-27 17:17:24 -04:00
meme
f7bf61a983 support Android NDK and bionic 2019-09-27 16:51:42 -04:00
Andrew Kelley
878aece87b Merge branch 'LemonBoy-fix-3138'
closes #3213
2019-09-27 15:58:39 -04:00
Andrew Kelley
09575bc0d6 fully specify padding bytes when necessary
This is what I was going for originally - either we understand that
LLVM's padding is sufficient, or we do the entire padding ourselves.
2019-09-27 15:53:30 -04:00
LemonBoy
67bd0267db Correct calculation of padding length in struct
Make sure the resulting type is in-sync with the one produced and used
by LLVM.

Fixes #3138
2019-09-27 15:39:19 -04:00
Andrew Kelley
70e934f116 Merge pull request #3326 from LemonBoy/misc-misc
Miscellaneous and very small patches regarding mipsel and musl libc
2019-09-27 14:53:52 -04:00
LemonBoy
9ad0541f2c Enable mipsel+libc tests on CI 2019-09-27 18:44:49 +02:00
LemonBoy
a220648198 Backport patch for Musl libc
Allows musl to compile for mipsel targets.

https://www.openwall.com/lists/musl/2019/09/27/1/2
2019-09-27 18:20:00 +02:00
LemonBoy
5aaa7d0fbb Avoid truncating mmap2 offsets if not multiple of page size 2019-09-27 18:18:38 +02:00
Andrew Kelley
805f9b309b add regression test for alignment of constants
closes #1741
2019-09-27 10:58:39 -04:00
Andrew Kelley
a1a3e46e0a Merge pull request #3323 from nrdmn/uefi
some minor UEFI improvements
2019-09-27 10:41:26 -04:00
Nick Erdmann
4527110e02 std/os/uefi: add some hii support 2019-09-27 07:56:14 +02:00
Nick Erdmann
a4f324e9ea std/os/uefi: add exitBootServices and allocatePool 2019-09-27 07:56:02 +02:00
Andrew Kelley
23a82b5ffd fix mipsel regression in previous commit
I think that should actually be a compile error, it's a usingnamespace
that depends on itself. This workaround is fine for now.
2019-09-26 21:38:04 -04:00
Andrew Kelley
ebe79329a2 fix some linux declarations not getting exposed 2019-09-26 18:49:37 -04:00
Andrew Kelley
4d65373a3d Merge pull request #3311 from LemonBoy/mips
Initial support for mipsel architecture
2019-09-26 13:44:36 -04:00
LemonBoy
2c8864f634 Don't warn about redeclaration for the same var node
Closes #3316
2019-09-26 13:39:09 -04:00
Andrew Kelley
b89a09af4b docgen: add "process terminated by signal" to exe_err 2019-09-26 13:11:07 -04:00
LemonBoy
a94372231c Errno changes for MIPS 2019-09-26 18:07:39 +02:00
Andrew Kelley
94e9b9c625 docs: mention release-small along with release-fast 2019-09-26 12:05:49 -04:00
LemonBoy
dfb4446d09 Add comments about the test cases that have been disabled 2019-09-26 17:42:58 +02:00
LemonBoy
c8e4108c5b Export _start as __start for MIPS targets 2019-09-26 17:13:57 +02:00
Michael Dusan
efea7958f8 doc: usingnamespace imports only public decls 2019-09-26 10:55:13 -04:00
LemonBoy
a9be62f085 Fix wrong IOCTL value 2019-09-26 11:49:49 +02:00
LemonBoy
4ebcf64864 Initial support for mipsel architecture¬ 2019-09-26 09:31:55 +02:00
Andrew Kelley
2f20833097 add -DZIG_SKIP_INSTALL_LIB_FILES cmake option
closes #2221
2019-09-26 02:21:29 -04:00
Andrew Kelley
68bb394570 Merge pull request #3315 from ziglang/mv-std-lib
Move std/ to lib/std/
2019-09-26 01:54:45 -04:00
Andrew Kelley
4637e8f969 zig additionally looks for lib/std/std.zig
previously zig would search up directory parents for
lib/zig/std/std.zig. It still does that, but now it also accepts
lib/std/std.zig. This will probably be how we start shipping windows
.zip files, since the extra directory is pointless.

It also means you can run zig binaries from subdirectories of the zig
source tree without lib files being installed.
2019-09-26 00:30:51 -04:00
Andrew Kelley
dc7016344e remove --override-std-dir. fix issues caused by moving std lib 2019-09-25 23:59:07 -04:00
Andrew Kelley
ed36dbbd9c mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00
Andrew Kelley
6128bc728d macos ci: display system info before running anything 2019-09-25 22:50:21 -04:00
Andrew Kelley
568c183d2a docgen: slightly better caching 2019-09-25 17:59:52 -04:00
Andrew Kelley
f112e8af27 Merge pull request #3312 from ziglang/armv8-linux-musleabihf
Enable test coverage for armv8-linux-musleabihf
2019-09-25 17:04:51 -04:00
Andrew Kelley
d1705baa74 enable test coverage for armv8-linux-musleabihf
* fix libc prototypes of offsets to have correct integer sizes and
   signedness. This gets all behavior tests to pass for
   armv8-linux-musleabihf
 * fix linux mmap syscall to have correct integer size and signedness
   for offset
 * disable failing armv8-linux-musleabihf std lib tests. See 3289. I
   suspect compiler-rt issue. Note these tests fail with this target
   triple regardless of whether musl is actually linked (-lc).
2019-09-25 16:21:04 -04:00
Andrew Kelley
40e77dad83 musl [PATCH] arm: fix setjmp and longjmp asm for armv8-a
From: Szabolcs Nagy <szabolcs.nagy@arm.com>

armv8 removed the coprocessor instructions other than cp14, so
on an armv8 system the related hwcaps should never be set.

new llvm complains about the use of coprocessor instructions in
armv8-a mode (even though they are never executed at runtime),
so ifdef them out when musl is built for armv8.

<dalias> i think the patch looks ok
2019-09-25 15:15:52 -04:00
Andrew Kelley
dc3c4197c6 disable known-to-be-failing tests for linux-aarch64-gnueabihf
See #3288. Root cause appears to be #3291.
2019-09-25 14:17:46 -04:00
Andrew Kelley
c9690916e5 fix building musl on eabihf abis, incorrect include dirs
See #3286. The issue is not fully solved however because this has
uncovered another issue.
2019-09-25 14:03:26 -04:00
Vexu
14ae23326e ran zig fmt on stdlib 2019-09-25 12:44:11 -04:00
Vexu
29e6541db1 add noasync to zig fmt 2019-09-25 12:44:11 -04:00
LemonBoy
3907e3b675 Fix llseek behavior 2019-09-25 12:10:58 -04:00
Andrew Kelley
48c9e17aa1 Merge pull request #3308 from LemonBoy/riscv-things
Miscellaneous RISC-V related commits
2019-09-25 12:08:47 -04:00
LemonBoy
a56b767c35 Add DTP bias according to RISCV ABI 2019-09-25 18:07:17 +02:00
LemonBoy
453157595e Correct some RISCV64 bits 2019-09-25 09:30:44 +02:00
Andrew Kelley
993d5bc9c9 add docs for usingnamespace
closes #1589
2019-09-24 21:23:12 -04:00
Andrew Kelley
53210b2304 better default enabled features for riscv
Until ability to specify target CPU features (#2883) is done, this
commit gives riscv target better default features.

This side-steps #3275 which is a deficiency in compiler-rt when features
do not include 32 bit integer division.

With this commit, RISC-V compiler-rt tests pass and Hello World works
both pure-zig and with musl libc.
2019-09-24 20:56:04 -04:00
Michael Dusan
9983501ff2 add VarDecl support for struct-method call syntax
implements #3306
2019-09-24 19:24:48 -04:00
Andrew Kelley
56b1818beb docgen: test blocks support linking libc 2019-09-24 11:41:19 -04:00
Andrew Kelley
c0b937ba12 docgen: slightly cleaner display of libc cli args 2019-09-24 11:36:59 -04:00
LemonBoy
5fb7af26ab Fix result loc unwrapping with optional in error union
Fixes #2899
2019-09-24 01:09:26 -04:00
LemonBoy
93367adaa7 Fix assignment to optional payload
Closes #3081
2019-09-24 00:31:35 -04:00
Jay Weisskopf
0bdc85181c Create user-specified output-dir
Fixes #2637
2019-09-24 00:20:29 -04:00
LemonBoy
663e665843 Prevent crash with invalid extern type
Fixes #3240
2019-09-23 17:30:28 -04:00
LemonBoy
db988f42a7 Fix computation of switch coverage
Closes #3258
2019-09-23 16:13:28 -04:00
Andrew Kelley
53ae03ebe9 make type_allowed_in_extern more robust
Previously if the type parameter was a pointer, it would assert that the
size of the type was resolved. It used to be that the size of pointers was
always resolved, however with lazy values, pointers gained the
possibility of not having their size resolved.

Now, type_allowed_in_extern triggers the resolution of whether a pointer
is zero bits, and returns a possible error if the resolution fails.

This fixes a compiler assertion when building the
[zootdeck project](https://github.com/donpdonp/zootdeck). I do not have
a test case reduction for the issue.
2019-09-23 15:02:38 -04:00
Andrew Kelley
29b82d20a4 zig build: linkSystemLibrary integrates with pkg-config
* add -D CLI option for setting C macros
 * add std.ascii.allocLowerString
 * add std.ascii.eqlIgnoreCase
 * add std.ascii.indexOfIgnoreCasePos
 * add std.ascii.indexOfIgnoreCase
2019-09-23 14:45:14 -04:00
Andrew Kelley
35c1d8cefc Merge pull request #3290 from ziglang/more-test-coverage
significantly increase test coverage
2019-09-22 21:18:27 -04:00
Andrew Kelley
55925b6e25 windows CI: fix name collision
Previously the CMAKE_BUILD_TYPE=Release was conflicting with the
"distribution" directory `release`. I renamed this to `dist` so that
it won't conflict with any build types.
2019-09-22 19:47:07 -04:00
Andrew Kelley
96affd683a enable test coverage for cross compiling windows mingw-w64
closes #3285
2019-09-22 19:11:41 -04:00
Andrew Kelley
c161ce3f7c mingw-w64 libc: fix incorrect detection of _xgetbv
It was using __GNUC__ < 8 to check if _xgetbv intrinsic is available.
Since we always use zig cc with this header, we know we have clang 9,
which does have this intrinsic.
2019-09-22 19:10:27 -04:00
Andrew Kelley
23f339f1b4 add emscripten to std.build.Target.defaultAbi
After upgrading to LLVM 9 we now have the emscripten OS available. Fix
the compile error in this function by specifying the default ABI for
emscripten.
2019-09-22 19:10:18 -04:00
Andrew Kelley
989cd4233e Merge pull request #3298 from ziglang/gethostname
gethostname
2019-09-22 18:19:37 -04:00
Andrew Kelley
d6f7b573aa silence nonportable include path warnings when building glibc on windows 2019-09-22 18:15:30 -04:00
Andrew Kelley
f14ba904d7 tolerate windows newlines in glibc text files 2019-09-22 18:14:53 -04:00
Andrew Kelley
2c8495b4bb git, I love you, but please stop mangling my files 2019-09-22 18:11:55 -04:00
Andrew Kelley
a239c7439f more helpful error message when failing to parse glibc abi.txt 2019-09-22 17:41:15 -04:00
Andrew Kelley
31b72da84a more info in assertion failures 2019-09-22 16:40:48 -04:00
Andrew Kelley
028011e59a libc implementation of gethostname 2019-09-22 16:07:21 -04:00
Andrew Kelley
65b495af58 windows CI: use MinSizeRel to work around MSVC bug
See #3024
2019-09-22 15:59:06 -04:00
Andrew Kelley
1d6d6d5228 remove redundant assert 2019-09-22 15:58:57 -04:00
Andrew Kelley
12b195f9d5 ci: update windows image to MSVC 2019 2019-09-22 15:32:52 -04:00
Andrew Kelley
cf4cc9b148 do the release tests last because they take longer 2019-09-22 14:41:47 -04:00
Andrew Kelley
786052c7d3 disable running cross compiled macos tests
due to #3295
2019-09-22 14:40:54 -04:00
Andrew Kelley
9627a75b07 clean up compiler_rt with some enum literals 2019-09-22 14:00:05 -04:00
Andrew Kelley
e63daca92e linux implementation of std.net.getHostName 2019-09-22 11:48:53 -04:00
Euan Torano
8a15537c6e Fix #3272 - update docs 2019-09-22 11:23:00 -04:00
Andrew Kelley
2510edeb71 fix linux stat struct on aarch64
The ABI was incorrect.
2019-09-22 11:22:22 -04:00
Andrew Kelley
dc2463d9a9 windows ci: make the case of file names agree 2019-09-22 11:22:22 -04:00
Andrew Kelley
ffef5d26b6 significantly increase test coverage
* add zig build option `-Dskip-libc` to skip tests that build libc
   (e.g. if you don't want to wait for musl to build)
 * add `-Denable-wine` option which uses wine to run cross compiled
   windows tests on non-windows hosts
 * add `-Denable-qemu` option which uses qemu to run cross compiled
   foreign architecture tests
 * add `-Denable-foreign-glibc=path` option which combined with
   `-Denable-qemu` enables running cross compiled tests that link
   against glibc. See
   https://github.com/ziglang/zig/wiki/Updating-libc#glibc for how to
   produce this directory.
 * the test matrix is done manually. release test builds are only
   enabled by default for the native target. this should save us some CI
   time, while still providing decent coverage of release builds.
   - add test coverage for `x86_64-linux-musl -lc` (building musl libc)
   - add test coverage for `x86_64-linux-gnu -lc` (building glibc)
   - add test coverage for `aarch64v8_5a-linux-none`
   - add test coverage for `aarch64v8_5a-linux-musl -lc` (building musl libc)
   - add test coverage for `aarch64v8_5a-linux-gnu -lc` (building glibc)
   - add test coverage for `arm-linux-none`
   - test coverage for `arm-linux-musleabihf -lc` (building musl libc) is
     disabled due to #3286
   - test coverage for `arm-linux-gnueabihf -lc` (building glibc) is disabled
     due to #3287
   - test coverage for `x86_64-windows-gnu -lc` (building mingw-w64) is
     disabled due to #3285
 * enable qemu testing on the Linux CI job. There's not really a good
   reason to enable wine, since we have a Windows CI job as well.
 * remove the no longer needed `--build-file ../build.zig` from CI
   scripts
 * fix bug in glibc compilation where it wasn't properly reading the abi
   list txt files, resulting in "key not found" error.
 * std.build.Target gains:
   - isNetBSD
   - isLinux
   - osRequiresLibC
   - getArchPtrBitWidth
   - getExternalExecutor
 * zig build system gains support for enabling wine and enabling qemu.
   `artifact.enable_wine = true;`, `artifact.enable_qemu = true;`. This
   communicates that the system has these tools installed and the build
   system will use them to run tests.
 * zig build system gains support for overriding the dynamic linker of
   an executable artifact.
 * fix std.c.lseek prototype. makes behavior tests for
   arm-linux-musleabihf pass.
 * disable std lib tests that are failing on ARM. See #3288, #3289
 * provide `std.os.off_t`.
 * disable some of the compiler_rt symbols for arm 32 bit. Fixes
   compiler_rt tests for arm 32 bit
 * add __stack_chk_guard when linking against glibc. Fixes std lib tests
   for aarch64-linux-gnu
 * workaround for "unable to inline function" using `@inlineCall`. Fixes
   compiler_rt tests for arm 32 bit.
2019-09-22 11:22:17 -04:00
Michael Dusan
c5716715d5 stage1: fix lost argv[0]
- bug presented on FreeBSD when `/proc` filesystem is not mounted
- bogus `cc` was used as exename, causing incorrect executable spawn
- llvm::sys::fs::getMainExecutable() has platform-specific code
  to get exename and fallback is to use param argv0
- linux fallback is rare because `/proc` is usually mounted
- *BSD fallback is not rare because `/proc` is often not mounted
- macOS doesn't ever fallback: bug cannot present
- windows doesn't ever fallback: bug cannot present
- other Posix will always present
2019-09-22 11:21:22 -04:00
LemonBoy
a11c20e26a Fix TLS for VariantI arches with a twist 2019-09-21 19:53:39 -04:00
Andrew Kelley
4dd17a7c9e zig test: don't skip execution when explicit command provided 2019-09-21 15:57:09 -04:00
Andrew Kelley
2c681d7ba1 add behavior test for float widening f16 to f128
it's disabled on aarch64, see #3282
2019-09-21 14:22:23 -04:00
Andrew Kelley
f3a7c346dd Merge pull request #3278 from LemonBoy/struct-gen
A few steps towards AArch64 & ARM passing the behavior tests
2019-09-21 13:46:13 -04:00
Andrew Kelley
533aff3a6a Merge pull request #3238 from Tetralux/fixed-allocator-reset
FixedBufferAllocator.reset
2019-09-21 12:48:45 -04:00
Tetralux
86b6790b6a Remove 'inline', as per @andrewrk 2019-09-21 15:42:26 +00:00
LemonBoy
34d02f249b Fix a test on ARM due to the use of undefined ptr 2019-09-21 11:39:50 +02:00
LemonBoy
57f751a864 Adjust tests for AArch64 2019-09-21 11:39:50 +02:00
LemonBoy
093ffe9f16 Correct stack alignment for new stack 2019-09-21 11:39:50 +02:00
LemonBoy
75ec7e4e00 Fix generation of tail fields for packed struct 2019-09-21 11:39:43 +02:00
Andrew Kelley
3377044ebe Merge pull request #3183 from LemonBoy/fix-3128
Don't forget to resolve the pointee type
2019-09-20 18:01:42 -04:00
Andrew Kelley
257fded70c avoid setting tail for @panic
Currently, slices are passed via reference, even though it would be
better to pass the ptr and len as separate arguments (#561). This means
that any function call with a slice parameter cannot be a tail call,
because according to LLVM spec:

> Both [tail,musttail] markers imply that the callee does not access
> allocas from the caller

There was one other place we were setting `tail` and I made that
conditional on whether or not the argument referenced allocas in the
caller.

This was causing undefined behavior in the compiler when it hit asserts,
causing it to print garbage memory to the terminal. See #3262 for
example.
2019-09-20 17:48:24 -04:00
Andrew Kelley
f663bcd6b2 add more RISCV64 linux bits to std lib 2019-09-20 15:24:50 -04:00
Andrew Kelley
ea776c287b Merge branch 'daurnimator-linux-5.3'
closes #3266
2019-09-20 15:10:25 -04:00
Andrew Kelley
aab1ec5c43 fix typo 2019-09-20 15:02:47 -04:00
daurnimator
2a8facafde std: update for linux 5.3 2019-09-20 15:01:47 -04:00
daurnimator
edea0d431b std: update riscv64 syscalls 2019-09-20 15:01:47 -04:00
Sahnvour
74d0b5bf7c reject types of automatic container layout in packed unions 2019-09-20 13:25:32 -04:00
Andrew Kelley
c9a5a6b83a add test case for already fixed bug
closes #3046
2019-09-20 13:19:29 -04:00
Timon Kruiper
3b4a6679a6 Fix comptime bitcast inside an expression 2019-09-20 13:13:26 -04:00
Andrew Kelley
695695c852 update README
Also I verified that muldi3 has not changed since the previous ported
reference commit.
2019-09-20 12:58:00 -04:00
Andrew Kelley
ee200aaa8c fix typo in docs
closes #3267
2019-09-20 11:48:35 -04:00
Michael Dusan
d60f9d0d4b stage1: fix gcc 9.1.0 compiler error on archlinux 2019-09-19 23:30:48 -04:00
Andrew Kelley
e81156b873 Merge pull request #3260 from ziglang/llvm9
LLVM 9
2019-09-19 21:12:57 -04:00
Andrew Kelley
b76d16c7c7 update remaining llvm 8.0.0 references to 9.0.0 2019-09-19 20:55:02 -04:00
Andrew Kelley
14d2e16b60 macos ci: RISCV is no longer experimental 2019-09-19 18:32:40 -04:00
Andrew Kelley
00cd988438 update CI scripts llvm 8 to 9 2019-09-19 17:04:27 -04:00
Andrew Kelley
8a30edcde8 Merge remote-tracking branch 'origin/master' into llvm9 2019-09-19 17:02:32 -04:00
stratact
925ffbce7f Disable Channel, Future, and Lock tests for FreeBSD (#3253)
* Disable Channel, Future, and Lock tests for FreeBSD
2019-09-19 13:45:54 -04:00
Andrew Kelley
ef3f7ecc19 update std.zig.tokenizer 2019-09-19 13:07:30 -04:00
Andrew Kelley
cd3068b4eb Merge pull request #3017 from fengb/tokenize-cleaner-errors
Update stage2 parser errors to match compiler friendliness
2019-09-19 12:36:07 -04:00
daurnimator
3b297f58f7 src: use zig_panic rather than having LLVM abort 2019-09-19 11:51:39 -04:00
Shawn Landden
ff9f3275de docs: clarify @clz and @ctz terminology to not be endian-specific.
This was brought up in IRC a few days ago.
2019-09-19 11:47:02 -04:00
Shawn Landden
c9937f4a2b Allow Zig programs to implement their own startup (_start) for ELF executables.
/home/shawn/git/zig-simd/build/lib/zig/std/special/start.zig:23:40: error: exported symbol collision: '_start'
        @export("_start", _start, .Strong);
        ^
/home/shawn/git/zig-simd/build/d.zig:1:1: note: other symbol is here
pub export fn _start() void {
^
/home/shawn/git/zig-simd/build/lib/zig/std/special/start.zig:124:35: error: root source file has no member called 'main'
    switch (@typeInfo(@typeOf(root.main).ReturnType)) {
2019-09-19 11:43:00 -04:00
ScorrMorr
7ebb7ca580 pass param as ref in ZigList::append 2019-09-19 11:41:18 -04:00
Andrew Kelley
1eb33966b1 Merge branch 'merge-shawnl-simd5'
This is the commit from Shawn's SIMD patchset regarding `@splat`,
plus my fixups.
2019-09-19 11:15:07 -04:00
Andrew Kelley
28c7fe60b6 add docs for @splat 2019-09-19 11:14:42 -04:00
Andrew Kelley
005a54a853 fixups for @splat
* Fix codegen for splat - instead of giving vectors of length N
   to shufflevector for both of the operands, it gives vectors of length
   1. The mask vector is the only one that needs N elements.
 * Separate Splat into SplatSrc and SplatGen; the `len` is not needed
   once it gets to codegen since it is redundant with the result type.
 * Refactor compile error for wrong vector element type so that the
   compile error message is not duplicated in zig source code
 * Improve implementation to correctly handle comptime values such as
   undefined and lazy values.
 * Improve compile error for bad vector element type to point to the
   correct place.
 * Delete dead code.
 * Modify behavior test to use an array cast instead of vector element
   indexing since I'm merging this splat commit out-of-order from
   Shawn's patch set.
2019-09-19 10:58:12 -04:00
Shawn Landden
01577a3af4 @splat 2019-09-19 10:11:06 -04:00
Andrew Kelley
0048bcbd71 Merge branch 'merge-shawnl-simd5'
This is the commit from Shawn's SIMD patchset regarding `@byteSwap`,
plus my fixups.
2019-09-19 01:05:12 -04:00
Andrew Kelley
380c8ec2c9 implement runtime @byteSwap and other fixups
* update docs for `@byteSwap`.
 * fix hash & eql functions for ZigLLVMFnIdBswap not updated to
   include vector len. this was causing incorrect bswap function
   being called in unrelated code
 * fix `@byteSwap` behavior tests only testing comptime and not
   runtime operations
 * implement runtime `@byteSwap`
 * fix incorrect logic in ir_render_vector_to_array and
   ir_render_array_to_vector with regards to whether or not to bitcast
 * `@byteSwap` accepts an array operand which it will cast to vector
 * simplify `@byteSwap` semantic analysis code and various fixes
2019-09-19 00:59:04 -04:00
Shawn Landden
76f5396077 @byteSwap on vectors 2019-09-18 16:49:14 -04:00
Andrew Kelley
86209e1a92 Merge branch 'merge-shawnl-simd5'
This is the first 3 commits of #2945, plus my fixups.
2019-09-18 16:35:57 -04:00
Andrew Kelley
ef0f3ba905 relax std.auto_hash requirements regarding vectors
Previously, auto hash tests required vectors of different types to not
hash to the same value. Now, this is allowed.
2019-09-18 16:34:36 -04:00
Andrew Kelley
2038f4d45a rework the implementation
* update documentation
   - move `@shuffle` to be sorted alphabetically
   - remove mention of LLVM
   - minor clarifications & rewording
 * introduce ir_resolve_vector_elem_type to avoid duplicate compile
   error message and duplicate vector element checking logic
 * rework ir_analyze_shuffle_vector to solve various issues
 * improve `@shuffle` to allow implicit cast of arrays
 * the shuffle tests weren't being run
2019-09-18 16:15:19 -04:00
Shawn Landden
193604c837 stage1: add @shuffle() shufflevector support
I change the semantics of the mask operand, to make it a little more
flexible. There is no real danger in this because it is a compile-error
if you do it the LLVM way (and there is an appropiate error to tell you
this).

v2: avoid problems with double-free
2019-09-18 11:26:45 -04:00
Andrew Kelley
9e4065fa73 remove TODO regarding lazy values
The question was:

> // TODO do we need lazy values on vector comparisons?

Nope, in fact the existing code already was returning ErrorNotLazy
for that particular type, and would already goto
never_mind_just_calculate_it_normally. So the explicit check for
ZigTypeIdVector is not needed. I appreciate the caution though.
2019-09-18 10:54:45 -04:00
Shawn Landden
74ce5e9e13 stage1: proper return type on vector comparisons 2019-09-18 10:36:10 -04:00
Andrew Kelley
558b4ac1f0 adjust codegen of casting between arrays and vectors
* bitcasting is still better when the size_in_bits aligns with the ABI
   size of the element type. Logic is reworked to do bitcasting when
   possible
 * rather than using insertelement/extractelement to work with arrays,
   store/load elements directly. This matches codegen for arrays
   elsewhere.
2019-09-18 10:24:28 -04:00
Shawn Landden
0e3ca4c63e Fix array->vector and vector->array for many types. Allow vector of bool.
Vectors do not have the same packing as arrays, and just bitcasting
is not the correct way to convert them.
2019-09-18 09:52:58 -04:00
Andrew Kelley
914ad1ec2e fix peer result location with typed parent, ...
...runtime condition, comptime prongs.

closes #3244
2019-09-17 22:30:49 -04:00
Andrew Kelley
c6e77f248d fix tripping llvm assert
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```

We've had this problem and solved it before; see #579.
2019-09-16 14:31:41 -04:00
Andrew Kelley
1cefe14424 update clone on arm32 to latest musl implementation
See musl commit 05870abeaac0588fb9115cfd11f96880a0af2108
by Rich Felker.

Commit message from musl reproduced here:

fix code path where child function returns in arm __clone built as thumb

mov lr,pc is not a valid way to save the return address in thumb mode
since it omits the thumb bit. use a chain of bl and bx to emulate blx.
this could be avoided by converting to a .S file with preprocessor
conditions to use blx if available, but the time cost here is
dominated by the syscall anyway.

while making this change, also remove the remnants of support for
pre-bx ISA levels. commit 9f290a49bf9ee247d540d3c83875288a7991699c
removed the hack from the parent code paths, but left the unnecessary
code in the child. keeping it would require rewriting two code paths
rather than one, and is useless for reasons described in that commit.
2019-09-16 14:23:43 -04:00
Andrew Kelley
5e34fb3597 fix tripping llvm assert
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```

We've had this problem and solved it before; see #579.
2019-09-16 14:02:00 -04:00
Jay Weisskopf
cddd6b46d8 Fix typos: "seperate" to "separate"
Fixes #3236
2019-09-15 23:39:36 -04:00
Tetralux
537b260349 Add FixedBufferAllocator.reset 2019-09-16 02:40:14 +00:00
Andrew Kelley
c4416b224d Merge remote-tracking branch 'origin/master' into llvm9 2019-09-15 20:59:53 -04:00
Andrew Kelley
8223aca09b no-stack-arg-probe only for UEFI 2019-09-13 14:46:22 -04:00
Andrew Kelley
2b698888ce fix regression from incorrect conflict resolution in prev commit
thanks for catching this LemonBoy
2019-09-13 14:42:30 -04:00
Andrew Kelley
187a6d198f Merge branch 'nrdmn-uefi'
closes #2944
2019-09-13 14:11:00 -04:00
LemonBoy
eb7d36ae0d Make single-element enum default to u0
* Allow comptime_int as explicit enum tag type

Closes #2997
2019-09-13 15:13:10 -04:00
stratact
742abc71c7 Add missing C dl_iterate_phdr function for FreeBSD 2019-09-13 15:10:35 -04:00
Andrew Kelley
c15e464320 Merge branch 'uefi' of https://github.com/nrdmn/zig into nrdmn-uefi 2019-09-13 14:10:42 -04:00
LemonBoy
774f770056 Correct AT_FDCWD definition 2019-09-12 13:15:50 -04:00
Andrew Kelley
cf4bccf765 improvements targeted at improving async functions
* Reuse bytes of async function frames when non-async functions
   make `noasync` calls. This prevents explosive stack growth.
 * Zig now passes a stack size argument to the linker when linking ELF
   binaries. Linux ignores this value, but it is available as a program
   header called GNU_STACK. I prototyped some code that memory maps
   extra space to the stack using this program header, but there was
   still a problem when accessing stack memory very far down. Stack
   probing is needed or not working or something. I also prototyped
   using `@newStackCall` to call main and that does work around the
   issue but it also brings its own issues. That code is commented out
   for now in std/special/start.zig. I'm on a plane with no Internet,
   but I plan to consult with the musl community for advice when I get a
   chance.
 * Added `noasync` to a bunch of function calls in std.debug. It's very
   messy but it's a workaround that makes stack traces functional with
   evented I/O enabled. Eventually these will be cleaned up as the root
   bugs are found and fixed. Programs built in blocking mode are
   unaffected.
 * Lowered the default stack size of std.io.InStream (for the async
   version) to 1 MiB instead of 4. Until we figure out how to get
   choosing a stack size working (see 2nd bullet point above), 4 MiB
   tends to cause segfaults due to stack size running out, or usage of
   stack memory too far apart, or something like that.
 * Default thread stack size is bumped from 8 MiB to 16 to match the
   size we give for the main thread. It's planned to eventually remove
   this hard coded value and have Zig able to determine this value
   during semantic analysis, with call graph analysis and function
   pointer annotations and extern function annotations.
2019-09-12 01:40:58 -04:00
Andrew Kelley
68b49f74c4 consolidate std.debug.parseDie and std.debug.parseDie1 2019-09-12 01:40:55 -04:00
LemonBoy
f36b8fd7b2 Recognize & skip the UTF-8 BOM 2019-09-11 15:20:18 -04:00
Andrew Kelley
0eddee449d add behavior test for @enumToInt(enum(u1){x}.x)
closes #2737
2019-09-11 15:05:00 -04:00
Andrew Kelley
67491a4222 disable runtime safety in std.io.InStream
Let's not be writing 0xaa in safe modes for upwards of 4 MiB for every
stream read. This is equivalent to the fact that we don't memset the
entire call stack to 0xaa for every function call.
2019-09-11 15:01:54 -04:00
Andrew Kelley
c9b2210fcf async function calls re-use frame buffers
See #3069
2019-09-10 22:59:00 -04:00
Andrew Kelley
92a427437c Merge remote-tracking branch 'origin/master' into llvm9 2019-09-10 16:53:11 -04:00
Andrew Kelley
7101e583d6 update glibc src files to 2.30 2019-09-10 16:40:54 -04:00
stratact
a165cc0535 Get more of the tests passing for FreeBSD (#3197)
* Add missing <stdint.h> include for uint8_t type declaration

* Add needed FreeBSD check to link to libpthread

* Apply patch to enable more tests in the FreeBSD CI
2019-09-10 14:50:54 -04:00
Michael Dusan
68d159ea9d fix build on macOS + xcode + clang 2019-09-10 14:38:39 -04:00
Andrew Kelley
3cd035ba3b update C header files to clang 9.0.0rc4 2019-09-10 13:30:43 -04:00
Andrew Kelley
e92d74958c lld: apply patch: [mach-o] Extend LC_DATA_IN_CODE support to x86_64
This applies 91864f82c7d7bd1a151fdfd076a3a67a2893b868 from LLVM trunk to
the embedded LLD.

Once Zig upgrades to LLD 10, there will be no difference between Zig's
fork and upstream, and Zig's fork can be dropped.
2019-09-10 13:25:20 -04:00
Andrew Kelley
016a59e3a1 update embedded LLD to 9.0.0rc4 2019-09-10 13:10:12 -04:00
LemonBoy
8b5cb8df99 Don't forget to resolve the pointee type
Fixes #3128
2019-09-10 19:07:04 +02:00
Andrew Kelley
185cb13278 Merge remote-tracking branch 'origin/master' into llvm9 2019-09-10 13:00:35 -04:00
LemonBoy
ba4d83af3e Resolve lazy arguments passed to @compileLog
Closes #3193
2019-09-10 11:22:40 -04:00
LemonBoy
e2c68fce89 Accept void argument for @cDefine value
Closes #2612
2019-09-10 11:16:50 -04:00
Andrew Kelley
e657b73f30 Merge branch 'async-std-lib'
This introduces the concept of "IO mode" which is configurable by the
root source file (e.g. next to `pub fn main`). Applications can put this
in their root source file:

```
pub const io_mode = .evented;
```

This will populate `std.io.mode` to be `std.io.Mode.evented`. When I/O
mode is evented, `std.os.read` handles EAGAIN by suspending until the
file descriptor becomes available for reading. Although the std lib
event loop supports epoll, kqueue, and Windows I/O Completion Ports,
this integration with `std.os.read` currently only works on Linux.

This integration is currently only hooked up to `std.os.read`, and not,
for example, `std.os.write`, child processes, and timers. The fact that
we can do this and still have a working master branch is thanks to Zig's
lazy analysis, comptime, and inferred async. We can continue to make
incremental progress on async std lib features, enabling more and more
test cases and coverage.

In addition to `std.io.mode` there is `std.io.is_async` which is equal
to `std.io.mode == .evented`. In case I/O mode is async, `std.io.InStream`
notices this and the read function pointer becomes an async function
pointer rather than a blocking function pointer. Even in this case,
`std.io.InStream` can *still be used as a blocking input stream*.
Users of the API control whether it is blocking or async at runtime by whether
or not the read function suspends. In case of file descriptors, for
example, this might correspond to whether it was opened with `O_NONBLOCK`.
The `noasync` keyword makes a function call or `await` assert that no
suspension happens. This assertion has runtime safety enabled.

`std.io.InStream`, in the case of async I/O, uses by default a 4 MiB
frame size for calling the read function. If this is too large or too
small, the application can globally increase the frame size used by
declaring `pub const stack_size_std_io_InStream = 1234;` in their root
source file. This way, `std.io.InStream` will only be generated once,
avoiding bloat, and as long as this number is configured to be high
enough, everything works fine. Zig has runtime safety to detect when
`@asyncCall` is given too small of a buffer for the frame size.

This merge introduces -fstack-report which can help identify large async
function frame sizes and explain what is making them so big. Until #3069 is
solved, it's recommended to stick with blocking IO mode.

-fstack-report outputs JSON format, which can then be viewed in a GUI
that represents the tree structure. As an example, Firefox does a decent
job of this.

One feature that is currently missing is detecting that the call stack
upper bound is greater than the default for a given target, and passing
this upper bound to the linker. As an example, if Zig detects that 20
MiB stack upper bound is needed - which would be quite reasonable -
currently on Linux the application would only be given the default of 16
MiB.

Unrelated miscellaneous change: added std.c.readv
2019-09-10 10:39:27 -04:00
Andrew Kelley
ff051f8f5d -fstack-report outputs JSON
See #3069
2019-09-10 10:26:54 -04:00
Andrew Kelley
0489d06c24 make the std lib support event-based I/O
also add -fstack-report
2019-09-10 10:26:52 -04:00
daurnimator
a29ce78651 std: add BloomFilter data structure 2019-09-10 10:20:30 -04:00
LemonBoy
8fbae77770 Force LLVM to generate byte-aligned packed unions
Sometimes the frontend and LLVM would disagree on the ABI alignment of a
packed union. Solve the problem by telling LLVM we're gonna manage the
struct layout by ourselves.

Closes #3184
2019-09-10 10:07:32 -04:00
Sahnvour
a06f84fcc6 forbid opaque types in function return types 2019-09-10 10:11:49 -04:00
Michael Dusan
8bd5681651 fix tests.addPkgTests to always run native target
- include native-target when native-target ∉ cross_targets

old behavior:

- do nothing when `-Dskip-non-native`
- never execute pkg tests for non-members of cross_targets
2019-09-10 10:10:14 -04:00
Andrew Kelley
852679c369 fix a var decl in scope preventing for loop spills 2019-09-09 16:44:23 -04:00
Andrew Kelley
a3993465fe Merge pull request #3200 from LemonBoy/eq-tagged-union
Allow comparison between union tag and enum literal
2019-09-09 16:17:45 -04:00
LemonBoy
fec795cd29 Adjust the stdlib to be 32bit compatible 2019-09-09 16:16:13 -04:00
Andrew Kelley
f50bfb94b5 fix bad LLVM IR when for target expr needs to be spilled
Also reduce the size of ZigVar in memory by making the name
a `const char *` rather than a `Buf`.
2019-09-09 15:59:16 -04:00
LemonBoy
e4c3067617 Fix typo in TLS initialization code 2019-09-09 13:54:31 -04:00
LemonBoy
4b1cd45472 Comptime folding of enum/union comparisons 2019-09-09 19:09:56 +02:00
LemonBoy
cc63760587 Allow comparison between union tag and enum literal
Closes #2810
2019-09-09 18:51:13 +02:00
Andrew Kelley
f7721ac37c implement spilling when returning error union async function call
closes #3190
2019-09-09 12:15:39 -04:00
Andrew Kelley
2482bdf22b release builds of stage1 have llvm ir verification
the stage2 zig code however gets compiled in release mode,
and stripped.
2019-09-09 09:33:33 -04:00
Sahnvour
19cf9bd062 use /debug:fastlink when building with msvc and debug info 2019-09-09 00:26:39 -04:00
Michael Dusan
0d9a78a852 test-stack-traces: add FreeBSD 2019-09-09 00:25:21 -04:00
Andrew Kelley
071ca00574 Merge branch 'gustavolsson-clang-frameworks-dir' 2019-09-08 15:09:51 -04:00
Andrew Kelley
5dde3cd3bd move logic for propagating framework dirs to zig cc 2019-09-08 15:09:05 -04:00
Gustav Olsson
ec13fa3f4a forward framework dirs to embedded clang in addition to linker on osx 2019-09-08 14:46:25 +02:00
Andrew Kelley
229323e13a fix suspensions inside for loops generating invalid LLVM IR
closes #3076
2019-09-07 17:37:17 -04:00
Andrew Kelley
d3cf040c90 Merge branch 'glibc-2.30'
closes #3098
2019-09-07 15:08:47 -04:00
Andrew Kelley
b21ad07767 update glibc ABI lists to 2.30 2019-09-07 15:04:09 -04:00
Andrew Kelley
45ab9d5fd6 update glibc headers to 2.30 2019-09-07 14:59:38 -04:00
Andrew Kelley
99fd42404a update process_headers tool for glibc 2.30 2019-09-07 14:46:59 -04:00
Andrew Kelley
9a18db8a80 properly spill expressions with async function calls 2019-09-07 00:27:45 -04:00
Andrew Kelley
d1a98ccff4 implement spills when expressions used across suspend points
closes #3077
2019-09-07 00:13:12 -04:00
Andrew Kelley
9ca8d9e21a fix await used in an expression generating bad LLVM 2019-09-07 00:13:12 -04:00
emekoi
9423d382fb fixed compiler error for gcc 9.2.0 2019-09-06 19:20:25 -04:00
Andrew Kelley
7d303ae861 runtime safety for noasync function calls
See #3157
2019-09-06 13:08:44 -04:00
Andrew Kelley
0a3c6dbda9 implement noasync function calls
See #3157
2019-09-05 21:55:32 -04:00
Timon Kruiper
ca70ca7e26 Add compiler error when negating invalid type 2019-09-05 15:27:50 -04:00
Andrew Kelley
4a5bc89862 add -l as an alias for --library 2019-09-05 15:17:23 -04:00
Andrew Kelley
b564e7ca59 os: raise maximum file descriptor limit
Do a binary search for the maximum RLIMIT_NOFILE.

Patch lifted from node.js commit
6820054d2d42ff9274ea0755bea59cfc4f26f353
2019-09-05 15:09:13 -04:00
Andrew Kelley
2045b4d932 prefer result type casting to peer type resolution
See #2749
2019-09-05 14:56:52 -04:00
Andrew Kelley
8f0df86937 I'm pretty sure sp is the stack pointer on all ARM 2019-09-05 14:15:39 -04:00
Timon Kruiper
866c253e0e Add compile error when shifting amount is not an int type 2019-09-05 13:10:39 -04:00
LemonBoy
8e3c56b912 Always resolve the struct field types
Packed structs used to skip the zero-sized types and trip some
assertions that expected the type reference not to be null.

Fixes #3143
2019-09-05 13:07:04 -04:00
LemonBoy
0107b19124 Resolve lazy values when checking for definedness
Fixes #3154
2019-09-05 13:09:43 -04:00
Jonathan Marler
9a358d2d33 Add Array support to @Type 2019-09-05 13:08:45 -04:00
Vesa Kaihlavirta
847a262efd Shorten @field documentation and add an example 2019-09-05 13:07:04 -04:00
Michael Dusan
fe153ad2a4 stage1 enhance IR print
- print fn name in pass1
- replace scalar with enum IrPass for clarity
2019-09-05 13:06:10 -04:00
LemonBoy
fabf45f5fc Add the noinline keyword for function declarations 2019-09-05 13:04:58 -04:00
Andrew Kelley
a7fd14096c fix typo with tls initialization
I tested that hello world cross compiles to armv7 now.

closes #3167
2019-09-04 14:44:16 -04:00
Andrew Kelley
090f2ffb82 Merge pull request #3152 from Snektron/arm-support-improvement
Arm support improvement (part 1)
2019-09-04 14:39:36 -04:00
Timon Kruiper
e540e5b8ec Implicit cast from enum literal to optional enum and implicit cast to payload of error union 2019-09-04 12:30:23 -04:00
Robin Voetter
df06976e73 Only check for TLS support on arm if TLS segment exists 2019-09-04 17:48:01 +02:00
Andrew Kelley
53a6aea216 Merge branch 'marler8997-typeBuiltin' 2019-09-04 11:12:24 -04:00
Andrew Kelley
ac7703f65f fixups and add documentation for @Type 2019-09-04 11:12:14 -04:00
Robin Voetter
77d04c03e3 Implement remaining requested changes
- Replace @intCast with a checked version (std/debug.zig)
- Replace @intCast with i64() when casting from a smaller type (std/fs/file.zig)
- Replace `nakedcc` with appropriate calling convention for linking with c (std/os/linux/arm-eabi.zig)
- Only check if hwcap contains TLS when the hwcap field actually exists (std/os/linux/tls.zig)
2019-09-04 16:23:25 +02:00
Robin Voetter
6a76298740 Add missing clobbers on arm-eabi and arm64 syscall conventions 2019-09-04 15:59:51 +02:00
Robin Voetter
5308eb7045 Merge remote-tracking branch 'upstream/master' into arm-support-improvement 2019-09-04 15:55:54 +02:00
Jonathan Marler
b728cb6d4e Add @Type builtin 2019-09-03 22:50:29 -06:00
Andrew Kelley
77a5f888be emit a compile error if a test becomes async
See #3117
2019-09-03 22:09:47 -04:00
Andrew Kelley
6b27290c68 Merge branch 'Vexu-comment-in-array' 2019-09-03 21:51:23 -04:00
Andrew Kelley
8a7e2e3479 Merge branch 'comment-in-array' of https://github.com/Vexu/zig into Vexu-comment-in-array 2019-09-03 21:49:35 -04:00
Sahnvour
ce14c543d1 error message and test for alignment of variables of zero-bit types 2019-09-03 21:14:40 -04:00
Andrew Kelley
a4ce10df80 Merge pull request #3169 from Sahnvour/string_hash_map
Using StringHashMap everywhere it's needed
2019-09-03 20:30:26 -04:00
Andrew Kelley
42cc4a406b Merge branch 'marler8997-fixSegfault' 2019-09-03 18:26:10 -04:00
Andrew Kelley
1862075652 fix union field ptr ir instruction 2019-09-03 18:25:00 -04:00
Andrew Kelley
a81e4351a2 Merge branch 'fixSegfault' of https://github.com/marler8997/zig into marler8997-fixSegfault 2019-09-03 18:15:01 -04:00
Sahnvour
9d6f236728 add fastpath for std.mem.eql and simplify std.hash_map.eqlString
this should also be friendlier to the optimizer
2019-09-03 23:56:04 +02:00
Sahnvour
f08c6e4fe6 changing occurrences of HashMap with []const u8 as keys for StringHashMap 2019-09-03 23:53:05 +02:00
Andrew Kelley
fc0f8d0359 zig build: make install prefix available to build.zig and
prevent accident of '/' showing up in application/library names
2019-09-03 16:19:10 -04:00
Andrew Kelley
be17a4b6c1 fix compiler crash in struct field pointers
when the llvm type has not been fully analyzed. This is a regression
from lazy values.
2019-09-03 14:51:34 -04:00
Andrew Kelley
e673d865fb fix stack traces on macos when passing absolute path to root source file
The comment added by this commit is copied here:

For macOS stack traces, we want to avoid having to parse the compilation unit debug
info. As long as each debug info file has a path independent of the compilation unit
directory (DW_AT_comp_dir), then we never have to look at the compilation unit debug
info. If we provide an absolute path to LLVM here for the compilation unit debug info,
LLVM will emit DWARF info that depends on DW_AT_comp_dir. To avoid this, we pass "."
for the compilation unit directory. This forces each debug file to have a directory
rather than be relative to DW_AT_comp_dir. According to DWARF 5, debug files will
no longer reference DW_AT_comp_dir, for the purpose of being able to support the
common practice of stripping all but the line number sections from an executable.

closes #2700
2019-09-03 13:46:08 -04:00
Vesa Kaihlavirta
e9530ce97b Fix addition direction, remove superfluous loop counter, add tests 2019-09-03 13:45:02 -04:00
Andrew Kelley
bdac2ba9dd Merge branch 'mikdusan-issue.2485'
closes #2544
2019-09-03 10:09:26 -04:00
Andrew Kelley
aba67ecf44 rename test-compare-panic to test-stack-traces 2019-09-03 10:08:39 -04:00
Andrew Kelley
1fd24791a7 rename compare-panic to compare-stack-traces 2019-09-03 10:05:19 -04:00
Michael Dusan
a19e73d8ae test: add compare-panic
`zig build test-compare-panic`

Create basic tests to compare panic output. The address field
is replaced by a symbolic constant and each expected output is
specific to os. Tests will only run for explicitly defined
platforms.

see also #2485
2019-09-03 09:59:43 -04:00
Andrew Kelley
d74b8567cf omit prefix data for async functions sometimes
When `@frameSize` is never called, and `@asyncCall` on a runtime-known
pointer is never used, no prefix data for async functions is needed.

Related: #3160
2019-09-02 21:31:26 -04:00
Michael Dusan
00d82e34df cmake: improve building without git repository
- quiet `fatal: not a git repository` message
- if git probe fails skip ZIG_VERSION modification
2019-09-02 21:36:16 -04:00
Andrew Kelley
058050f22c Merge remote-tracking branch 'origin/master' into llvm9 2019-09-02 20:56:31 -04:00
Andrew Kelley
4a5b0cde13 fix const result loc, runtime if cond, else unreachable
Closes #2791. See that issue for more details; I documented the
debugging process quite thoroughly on this one.
2019-09-02 20:28:25 -04:00
Nick Erdmann
5e874a89b9 std/os/uefi: fix ordering of packed bit fields 2019-09-02 22:31:59 +02:00
Nick Erdmann
8db41b7adb std/os/uefi: add support for getting memory map 2019-09-02 22:10:50 +02:00
Andrew Kelley
ab4cba14c8 fix recursive call of await @asyncCall with struct return type 2019-09-02 14:35:41 -04:00
Nick Erdmann
03abc6edf4 std/os/uefi: add global_variable guid 2019-09-02 20:34:00 +02:00
Andrew Kelley
d291d3c8c0 fix using @typeOf on a generic function call 2019-09-02 13:07:44 -04:00
Andrew Kelley
0fe28855c5 add ability to specify darwin framework search dirs 2019-09-02 11:48:06 -04:00
Andrew Kelley
0c4d47c6d5 add regression test for already fixed bug
closes #2692
2019-09-01 23:35:58 -04:00
Robin Voetter
d62f7c6b60 Merge remote-tracking branch 'upstream/master' into arm-support-improvement 2019-09-01 23:45:51 +02:00
Robin Voetter
e7912dee9b Fix up preadv, preadv2, pwritev and pwritev2 2019-09-01 16:10:36 +02:00
Robin Voetter
e9d795b025 Fix up seteuid and setegid 2019-09-01 12:08:02 +02:00
Robin Voetter
e39c93a2f3 Replace legacy 16-bit syscalls with 32-bit versions when appropriate 2019-09-01 11:54:57 +02:00
Andrew Kelley
8b1900e5df Revert "Merge pull request #2991 from emekoi/mingw-ci"
This reverts commit ec7d7a5b14, reversing
changes made to 81c441f885.

It looks like this broke colors in Windows Command Prompt (#3147)
and this method of detecting native C ABI isn't working well (#3121).
2019-09-01 00:33:02 -04:00
Andrew Kelley
ec6f15b0f5 fix @typeOf an async function call of generic fn with error union type 2019-09-01 00:27:22 -04:00
Michael Dusan
1f99899408 stage1 enhance IR print
- pass2 now prints missing instructions in a trailing fashion
- instruction struct name added to print as column 2
2019-08-31 22:42:58 -04:00
Andrew Kelley
5c3a9a1a3e improvements to @asyncCall
* `await @asyncCall` generates better code. See #3065
 * `@asyncCall` works with a real `@Frame(func)` in addition to
   a byte slice. Closes #3072
 * `@asyncCall` allows passing `{}` (a void value) as the result
   pointer, which uses the result location inside the frame.
   Closes #3068
 * support `await @asyncCall` on a non-async function. This is in
   preparation for safe recursion (#1006).
2019-08-31 18:50:16 -04:00
Andrew Kelley
a223063923 @typeOf now guarantees no runtime side effects
related: #1627
2019-08-31 11:00:31 -04:00
Andrew Kelley
6ab8b2aab4 support recursive async and non-async functions
which heap allocate their own frames

related: #1006
2019-08-30 20:06:02 -04:00
Andrew Kelley
2148943fff Merge pull request #3139 from hspak/zig-fmt-nested-if
zig fmt: fix nested if
2019-08-30 15:48:07 -04:00
Robin Voetter
7a2b4cb9a1 Merge remote-tracking branch 'upstream/master' into arm-support-improvement 2019-08-30 21:37:46 +02:00
Andrew Kelley
fed5c12d9a musl: fix alltypes.h and syscall.h not being correct
The previous
[instructions](https://github.com/ziglang/zig/wiki/Updating-libc) for
updating musl libc headers had this (repeated for each architecture):

make DESTDIR=build-all/arm install-headers ARCH=arm

However musl's build system does not properly rebuild alltypes.h and
syscall.h from source, instead using whatever is cached from the
previous build. In the case of the previous time that I updated to musl
1.1.23, this happened to be the aarch64 architecture.

As a workaround, one can remove the obj/ directory to force rebuilding
this file. Now the instructions say this (repeated for each architecture):

rm -rf obj/ && make DESTDIR=build-all/arm install-headers ARCH=arm

This commit updates the resulting headers after this workaround is
applied and the process headers tool is run again.
2019-08-30 15:02:23 -04:00
Andrew Kelley
37ef490fc6 update process_headers.zig for latest zig 2019-08-30 15:01:37 -04:00
Andrew Kelley
d9fed5cdfd align(@alignOf(T)) T does not force resolution of T 2019-08-30 14:53:44 -04:00
Michael Dusan
966670645a fix stage1 to build on macOS + xcode/clang 2019-08-30 09:01:29 -04:00
Robin Voetter
ca2aa4880f Merge remote-tracking branch 'upstream/master' into arm-support-improvement 2019-08-30 13:02:28 +02:00
Robin Voetter
4b8325f381 Remove unneeded os check 2019-08-30 13:02:15 +02:00
Robin Voetter
c1f8b201a1 Improve comments near un-implemented functionality 2019-08-30 12:58:44 +02:00
Hong Shick Pak
19964f5dc8 run new zig fmt and remove stale comment 2019-08-29 21:23:49 -07:00
Hong Shick Pak
9f4d44bc49 zig fmt: fix nested if 2019-08-29 21:10:26 -07:00
Andrew Kelley
10541c8fc8 Merge branch 'lazy-sizeof' 2019-08-29 22:44:21 -04:00
Andrew Kelley
e9a4bcbcc6 fix regressions 2019-08-29 22:44:07 -04:00
Andrew Kelley
03910925f0 await does not force async if callee is blocking
closes #3067
2019-08-29 21:51:37 -04:00
Andrew Kelley
8e93991634 avoid unnecessarily requiring alignment for array elem pointers 2019-08-29 16:25:58 -04:00
Andrew Kelley
0512beca9d comparing against zero participates in lazy values 2019-08-29 14:46:22 -04:00
Andrew Kelley
d9f0446b1f make @sizeOf lazy 2019-08-29 12:43:56 -04:00
Robin Voetter
2323da3a68 add __aeabi_read_tp 2019-08-29 18:12:58 +02:00
Andrew Kelley
94bbb46ca6 fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:29:48 -04:00
Andrew Kelley
f7f8692730 fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:24:24 -04:00
Shritesh
834a789bb9 Use LLVM path provided by homebrew 2019-08-29 10:19:35 -04:00
Robin Voetter
e4c262b804 Don't print line info if source is not available 2019-08-29 10:52:50 +02:00
Robin Voetter
108a51b110 fix issues with debug.zig
- Use sys_*stat*64 instead of sys_*stat* where appropriate
- Fix overflow when calculating atime, ctime and mtime on File.stat()
- Fix compilation error casting getEndPos to usize.
2019-08-29 10:34:05 +02:00
Robin Voetter
b3ac323a44 TLS initialization, clone definition and _start functionality 2019-08-29 01:14:43 +02:00
Robin Voetter
57de61084e Make mmap use SYS_mmap2 if it exists 2019-08-29 00:55:22 +02:00
Robin Voetter
223b773e03 Add more syscall constants 2019-08-29 00:54:57 +02:00
Andrew Kelley
928ce5e326 Merge remote-tracking branch 'origin/master' into llvm9 2019-08-28 16:59:35 -04:00
Andrew Kelley
e8a9caa3dd add suggestion to AutoHash compile error message 2019-08-28 14:38:55 -04:00
Andrew Kelley
af90da1531 fix implicit cast from zero sized array ptr to slice
closes #1850
2019-08-28 12:16:52 -04:00
Andrew Kelley
d5b3d97c23 Merge pull request #2760 from Vexu/fmt-comment-fix
Fix non-empty comments getting removed with empty comments
2019-08-28 12:01:08 -04:00
yvt
c98f792ff8 Improve the handling of zig fmt: off/on
This commit reworks the handling of `zig fmt: off/on`. A motivating
example is shown below:

    const c = d;
    // zig fmt: off
    // comment
    const a = b;
    // zig fmt: on

Before processing the decl `const a = b;`, `renderRoot` looks for
`zig fmt: off` that appears between this decl and the previous one. If
it finds one, it searches for the next `zig fmt: on` that re-enables
reformatting (or EOF if none was found), and copies the input code
between `zig fmt: off` and `zig fmt: on` to the output stream. After
that, it proceeds to the next decl.

The important thing to notice here is that `renderTopLevelDecl` emits
line comment tokens that follow the decl. Therefore, when copying code,
we must be careful not to copy the line comment tokens that already have
been written to the output stream. The original code failed to take this
fact into consideration. It did skip `// zig fmt: off`, but not the
remaining ones. As a result, when the above example is fed as input, it
duplicated the line `// comment`.
2019-08-28 11:57:01 -04:00
Robin Voetter
50c37c75d1 add arm32 syscall conventions 2019-08-28 17:41:49 +02:00
Andrew Kelley
7139eef4cf implement lazy values for error union types
closes #3129
2019-08-28 11:17:20 -04:00
Robin Voetter
32f4606cec add arm32 linux bits definitions 2019-08-28 16:35:23 +02:00
Marc Tiehuis
ac477f3c9a Merge pull request #3060 from Sahnvour/hashing
auto_hash with deep/shallow hashing
2019-08-28 21:25:50 +12:00
Andrew Kelley
47fcbfdc51 add regression test for already fixed bug
closes #3112
2019-08-27 17:39:06 -04:00
Andrew Kelley
f4519c520a support self-referential struct through a slice of optional
by making optionals even more lazy

closes #1805
2019-08-27 16:55:58 -04:00
Andrew Kelley
c1fd7ed6e2 add regression test for struct with optional list of self
closes #1735
2019-08-27 14:06:17 -04:00
Andrew Kelley
428a2fdedd better handle struct depends on itself via optional field
closes #1995
2019-08-27 13:59:18 -04:00
Andrew Kelley
e1b258f39f add regression test for bug fixed by lazy values
closes #624
2019-08-27 13:44:04 -04:00
Marc Tiehuis
fbcdf78cbd Simplify wyhash and improve speed
This removes the exposed stateless variant since the standard variant
has similar speed now.

Using `./benchmark --filter wyhash --count 1024`, the speed change has
changed from:

    wyhash
       iterative: 4093 MiB/s [6f76b0d5db7db34c]
      small keys: 3132 MiB/s [28c2f43c70000000]

to

    wyhash
       iterative: 6515 MiB/s [673e9bb86da93ea4]
      small keys: 10487 MiB/s [28c2f43c70000000]
2019-08-27 19:42:37 +02:00
Andrew Kelley
8fef23a525 add regression test for bug fixed by lazy values
closes #1310
2019-08-27 13:36:42 -04:00
Andrew Kelley
35a374efe0 Merge pull request #3115 from ziglang/fix-field-alignment-kludge
fix field alignment kludge by implementing lazy values
2019-08-27 13:02:31 -04:00
Andrew Kelley
d9ed55f017 fix not properly casting align values
and add check for alignment specified on enum fields
2019-08-27 12:54:50 -04:00
Andrew Kelley
7d34e55a71 add a TODO compile error for union field alignment syntax
See #3125
2019-08-27 10:45:28 -04:00
Andrew Kelley
ffac0b02e7 implement and test struct field explicit alignment 2019-08-27 10:14:11 -04:00
Marc Tiehuis
326b7b794b Improve siphash performance for small keys by up to 30% (#3124)
This removes the partial buffer handling from the full slice api.

`./benchmark --filter siphash --count 1024`

old

    siphash(1,3)
       iterative: 3388 MiB/s [67532e53a0d210bf]
      small keys: 1258 MiB/s [948c91176a000000]
    siphash(2,4)
       iterative: 2061 MiB/s [f792d39bff42f819]
      small keys:  902 MiB/s [e1ecba6614000000]

new

    siphash(1,3)
       iterative: 3410 MiB/s [67532e53a0d210bf]
      small keys: 1639 MiB/s [948c91176a000000]
    siphash(2,4)
       iterative: 2053 MiB/s [f792d39bff42f819]
      small keys: 1074 MiB/s [e1ecba6614000000]
2019-08-27 20:13:57 +12:00
Andrew Kelley
a2e8ef77e2 fix regression in one of the doc examples 2019-08-26 22:50:12 -04:00
Andrew Kelley
db50cf7049 fix more compile error regressions 2019-08-26 22:38:45 -04:00
Andrew Kelley
1df75da918 remove no longer needed gcc8 workaround. add gcc9 workaround
Occasionally LLVM headers generate warnings with newer gcc versions and
since we use -Werror this has to be worked around.
2019-08-26 21:40:44 -04:00
Andrew Kelley
bad4b040cc miscellaneous fixes regarding compile errors 2019-08-26 18:35:36 -04:00
Andrew Kelley
ca145a6d5a fix regression in ir_get_ref 2019-08-26 15:43:39 -04:00
Andrew Kelley
ae65c236c5 fix regression with global variable assignment...
...with optional unwrapping with var initialized to undefined
2019-08-26 15:24:24 -04:00
Andrew Kelley
d316f70450 fix regression on struct field with undefined type 2019-08-26 14:01:59 -04:00
Andrew Kelley
73a7747a9c fix some compile error regressions 2019-08-26 12:43:36 -04:00
Andrew Kelley
6569bfc85e fix some std lib dependency loops 2019-08-26 11:23:25 -04:00
Andrew Kelley
e1a4bcbdfd fix dependency loop errors with zig build 2019-08-26 10:43:07 -04:00
Andrew Kelley
ede0c22a67 make @alignOf lazily evaluate the target type
this case works now:

```zig
const Foo = struct {
    field: Bar(@alignOf(*Foo)),
};
fn Bar(comptime alignment: u29) type {
    return struct {
        field: *align(alignment) Foo,
    };
}
```
2019-08-26 10:03:30 -04:00
Andrew Kelley
b13af0750f fix assertion tripped instead of reporting compile error 2019-08-25 21:45:11 -04:00
Andrew Kelley
720302a640 fix resolution detection of pointer types 2019-08-25 21:28:16 -04:00
Andrew Kelley
a7f3158185 behavior tests passing 2019-08-25 21:16:03 -04:00
Andrew Kelley
64e9b0ee46 make the zero-bit-ness of pointers lazy
this case works now:

```zig
const Foo = struct {
    field: @typeOf(func).ReturnType,
};
fn func(self: *Foo) void {}
```
2019-08-25 20:27:56 -04:00
Andrew Kelley
8f41da2216 fix behavior test regressions with unions 2019-08-25 11:42:19 -04:00
Andrew Kelley
fa6c20a02d hook up unions with lazy values
this case works now:

```zig
const Expr = union(enum) {
    Literal: u8,
    Question: *Expr,
};
```
2019-08-25 11:34:07 -04:00
Jonathan Marler
1b19c28c79 Fix issue 3058: zig build segfault 2019-08-24 10:47:27 -06:00
Sahnvour
90e921f7a7 wyhash: readd the stateful streaming version so that both are available
and rename the stateless one so that's it is not the default option
2019-08-24 15:37:47 +02:00
Sahnvour
4c882e731f hash_map: adding a StringHashMap for convenience 2019-08-24 15:30:23 +02:00
Sahnvour
1498ccac2a auto_hash: better generic hashing implementation
autoHash forbids slices as input
hash was added to handle all types from autoHash plus slices, with a specified strategy
2019-08-24 15:30:23 +02:00
Marc Tiehuis
50a80261dc Merge pull request #3118 from ziglang/revert-crc-poly-api
std/hash: Revert crc32 api change
2019-08-24 20:47:45 +12:00
Marc Tiehuis
a610352271 std/hash: Revert crc32 api change
This is user specified and the user doesn't necessarily have to use one
of the provided polynomials declared hence we can't use an enum.

Thanks @daurnimator for catching this.
2019-08-24 19:05:05 +12:00
Andrew Kelley
d277a1196b tracking these issues on github now 2019-08-23 17:54:01 -04:00
Andrew Kelley
e8bad1e12a fix regression on @ptrCast
this case regressed and now fixed:

```zig
const a: ?*i32 = undefined;
const b: ?*f32 = @ptrCast(?*f32, a);
```
2019-08-23 17:39:56 -04:00
Andrew Kelley
101440c199 add lazy value support for optional types
this case works now:

```zig
const Node = struct {
    node: ?*Node,
};
```
2019-08-23 17:14:51 -04:00
Andrew Kelley
f0034495fa fix regression with simple pointer to self 2019-08-23 15:59:37 -04:00
Andrew Kelley
ac4dd9d665 better handling of lazy structs
this case works now:

```zig
const A = struct {
    b_list_pointer: *const []B,
};
const B = struct {
    a_pointer: *const A,
};

const b_list: []B = [_]B{};
const a = A{ .b_list_pointer = &b_list };
const obj = B{ .a_pointer = &a };
```
2019-08-23 15:54:51 -04:00
Andrew Kelley
be0a9a7277 pointer types lazily evaluate their element type 2019-08-23 15:05:15 -04:00
Andrew Kelley
1dd658d1d0 allow top level declarations to be lazy
this case now works:

```zig
const A = struct {
    b: B,
};
const B = fn (A) void;
```
2019-08-23 14:07:34 -04:00
Andrew Kelley
20049caaba add lazy value for fn prototypes
this case now works:

```zig
const Node = struct {
    field: fn (*Node) *Node,
};
```
2019-08-23 13:28:26 -04:00
Andrew Kelley
3865b6ad8f Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludge 2019-08-23 11:43:37 -04:00
Andrew Kelley
ec2f9ef4e8 Merge pull request #3114 from Tetralux/align-on-struct-fields
parsing and rendering of align(N) on struct fields
2019-08-23 11:19:27 -04:00
Jonathan Marler
9322eee80a Encapsulate bigint representation, assert on cast data loss 2019-08-23 11:14:08 -04:00
Tetralux
43587af01a rendering of align(N) on struct fields 2019-08-22 22:58:38 +00:00
Tetralux
3ec10ea174 parsing of align(N) on struct fields 2019-08-22 22:58:02 +00:00
Andrew Kelley
79a4b7a236 fix regressions 2019-08-22 18:24:15 -04:00
Andrew Kelley
26b79ac90e simple self-referential struct is working now 2019-08-22 14:46:26 -04:00
Andrew Kelley
0d6a6c76ea add missing "referenced here" notes for lazy values 2019-08-22 12:56:35 -04:00
Andrew Kelley
8460d5617c introduce lazy values
see #2174
2019-08-22 12:08:04 -04:00
Marc Tiehuis
0e75fef1de Merge pull request #3106 from ziglang/hash-tooling-changes
Hash tooling changes
2019-08-21 21:54:12 -10:00
Andrew Kelley
efdbede7ab breaking: remove field alignment kludge
This breaks behavior tests as well as compile error notes for generic
function calls. However it introduces better circular dependency compile
errors.

The next step is to add Lazy Values to fix the regressions.
2019-08-21 19:27:51 -04:00
Andrew Kelley
ec7d7a5b14 Merge pull request #2991 from emekoi/mingw-ci
mingw improvements
2019-08-21 12:29:42 -04:00
Marc Tiehuis
16fa255f48 Inline full slice hashing
This gives moderate speed improvements when hashing small keys.
The crc/adler/fnv inlining did not provide enough speed up to warrant
the change.

OLD:

wyhash
  small keys: 2277 MiB/s [c14617a1e3800000]
siphash(1,3)
  small keys:  937 MiB/s [b2919222ed400000]
siphash(2,4)
  small keys:  722 MiB/s [3c3d974cc2800000]
fnv1a
  small keys: 1580 MiB/s [70155e1cb7000000]
adler32
  small keys: 1898 MiB/s [00013883ef800000]
crc32-slicing-by-8
  small keys: 2323 MiB/s [0035bf3dcac00000]
crc32-half-byte-lookup
  small keys:  218 MiB/s [0035bf3dcac00000]

NEW:

wyhash
  small keys: 2775 MiB/s [c14617a1e3800000]
siphash(1,3)
  small keys: 1086 MiB/s [b2919222ed400000]
siphash(2,4)
  small keys:  789 MiB/s [3c3d974cc2800000]
fnv1a
  small keys: 1604 MiB/s [70155e1cb7000000]
adler32
  small keys: 1856 MiB/s [00013883ef800000]
crc32-slicing-by-8
  small keys: 2336 MiB/s [0035bf3dcac00000]
crc32-half-byte-lookup
  small keys:  218 MiB/s [0035bf3dcac00000]
2019-08-21 21:38:02 +12:00
Marc Tiehuis
7854a52a6b Add iterative-only filter to hash benchmark 2019-08-21 21:02:24 +12:00
Marc Tiehuis
48410943cb Add more hash functions to benchmark scripts
Changed CRC api so the polynomial is specified as an enum for simpler
construction.
2019-08-21 20:46:15 +12:00
Marc Tiehuis
c050ec4e57 Update hash/crypto benchmark scripts 2019-08-21 20:34:12 +12:00
Andrew Kelley
81c441f885 remove incorrect assert regarding 128-bit integers
LLVM incorrectly reports 8 as the alignment of i128 on x86_64 but it
correctly reports 16 as the alignment of i128 on aarch64.

closes #3101
2019-08-20 21:17:57 -04:00
Andrew Kelley
2f3ad48c9b LLD patch: workaround for buggy MACH-O code
This reapplies 5ce1a965e0
to the embedded LLD.
2019-08-20 19:42:41 -04:00
Andrew Kelley
8bb6bf6818 update libcxx to 9.0.0-rc2
upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
2019-08-20 19:36:26 -04:00
Andrew Kelley
37a06f4dcf update embedded LLD to 9.0.0-rc2
upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
2019-08-20 19:33:58 -04:00
Andrew Kelley
c0bd2eb398 update C headers to clang 9.0.0-rc2
upstream commit 67a4a12d61bfb10b2410b53c5a43ef9b4a03de7d
2019-08-20 19:16:06 -04:00
Andrew Kelley
5f3d59f0ac Merge branch 'master' into llvm9 2019-08-20 19:09:52 -04:00
Andrew Kelley
3b5a8858c2 Merge branch 'euantorano-fix/3012-os-getrandom-fill-buffer'
Closes #3016
Closes #3012

Thanks @euantorano!
2019-08-20 15:54:09 -04:00
Andrew Kelley
9bf283c085 fixups
* getrandom libc prototypes had the wrong return type
 * `total_read` local variable was unnecessary since the sub-slice
   buffer has a length
 * I was able to get rid of all the integer casts
 * the err == 0 check can be a switch case
 * add missing `return` statement
2019-08-20 15:25:30 -04:00
Euan Torano
79354243e3 fix os.getrandom logic to fill the entire buffer 2019-08-20 14:52:38 -04:00
Euan Torano
8c32c09807 Fix InStream.readNoEof 2019-08-20 14:52:10 -04:00
Andrew Kelley
c175e53564 add std.c.printf 2019-08-20 14:42:39 -04:00
Andrew Kelley
f0a141f799 Merge branch 'FireFox317-fix-issue-3030'
closes #3084
closes #3030
2019-08-20 14:42:02 -04:00
Andrew Kelley
276eb4402b specify the target for the newest test case 2019-08-20 14:40:57 -04:00
Timon Kruiper
2addec8ea1 compiler error when variable in asm template cannot be found 2019-08-20 14:11:03 -04:00
Marc Tiehuis
2aa18b9097 Merge pull request #3090 from ziglang/fmt-internal
fmt changes
2019-08-19 19:48:05 -10:00
Andrew Kelley
3dbed54294 fix @bitCast of packed struct literal
closes #3042
2019-08-19 17:50:37 -04:00
Andrew Kelley
07c5e90601 Merge branch 'mikdusan-issue.3010'
closes #3022
closes #3010

thanks @mikdusan
2019-08-19 17:36:35 -04:00
Andrew Kelley
6bc520ab95 solve it a slightly different way
the error handling of result locations is a bit awkward but it should
basically be the same everywhere
2019-08-19 17:35:19 -04:00
Michael Dusan
24deb1a7fe fix @bitCast segfault with literal array param
closes #3010
2019-08-19 17:24:14 -04:00
Aaron Klapatch
efc2237e5a added documentation for field access to C pointers (#3088) 2019-08-19 16:47:16 -04:00
Andrew Kelley
d067a037cc fix void array as a local variable initializer
Related: #1767
2019-08-19 15:58:31 -04:00
Andrew Kelley
44fb5275c1 fix array multiplication not setting parent value info
closes #3095
2019-08-19 14:46:12 -04:00
Andrew Kelley
3f7f520036 don't put libc on the elf linker line for objects
closes #3093
2019-08-19 12:33:36 -04:00
Marc Tiehuis
e0447c6ddd std/fmt: Make FormatOptions arguments non-comptime
No need and should help avoid exessive function monomorphizaton.
2019-08-19 22:28:13 +12:00
Marc Tiehuis
98859c885e std/fmt.zig: Pass full options struct to all internal functions
The fill specifier is now handled in some cases. The default fill of '0'
is now ' ' for integers and non-byte sequences.
2019-08-19 22:15:15 +12:00
Nick Erdmann
5a0275c247 fix error message when dependency requires position independent code 2019-08-18 19:33:25 -04:00
Andrew Kelley
ea1734773b add compile error for async frames depending on themselves 2019-08-17 19:47:49 -04:00
Marc Tiehuis
6844dafeca std/fmt: Move pointer parsing out of main state machine
This allows us to format a pointer with alignment/padding as we would
with any other format specifier.

e.g. {*:5}
2019-08-18 11:06:54 +12:00
Andrew Kelley
57b90d2d98 allow implicit cast of fn to async fn
it forces the fn to be async. closes #3079
2019-08-17 17:22:20 -04:00
Andrew Kelley
66a490c27c detect non-async function pointer of inferred async function
closes #3075
2019-08-17 16:49:23 -04:00
Vexu
0ff396c34f add compile error for incorrect atomic ordering in fence #3082 2019-08-17 16:05:41 -04:00
Andrew Kelley
4d8a6f6fea fix compiler not checking alignment of function frames
closes #3086
2019-08-17 13:04:50 -04:00
Andrew Kelley
456a244d62 fix event loop regression on macos 2019-08-17 11:40:48 -04:00
Andrew Kelley
e24cc2e77b std.event.Loop: fix not waking up after file system I/O
for single threaded event loops
2019-08-16 23:19:13 -04:00
Andrew Kelley
3dce41b61a improvements to std lib for event-based I/O 2019-08-16 21:29:29 -04:00
Andrew Kelley
c39bb3ebc4 target: add missing switch case 2019-08-16 16:52:45 -04:00
Andrew Kelley
6529658ad8 Merge remote-tracking branch 'origin/master' into llvm9 2019-08-16 16:43:56 -04:00
Andrew Kelley
bf7b6fbbdb add missing compile error for fn call bad implicit cast
when the function's return type handle is a pointer but the result
location's result value type handle is not a pointer

closes #3055
2019-08-16 16:30:24 -04:00
Andrew Kelley
cbca6586e7 add test for struct parameter to async function being copied
closes #1155
2019-08-16 13:56:26 -04:00
Andrew Kelley
5a2cbe239f fix and test case for returning from suspend block
See #3063
2019-08-16 13:07:07 -04:00
Vexu
c3407ed097 Merge branch 'master' into comment-in-array 2019-08-16 20:02:47 +03:00
yvt
2cb1f93894 correct LLVM subarch names for arm 2019-08-16 08:46:18 -07:00
Andrew Kelley
13c584d325 add compile error for casting const frame to anyframe
See #3063
2019-08-16 11:38:41 -04:00
Andrew Kelley
cba3b8291a codegen: LLVMConstSub instead of LLVMBuildSub in one place 2019-08-16 11:19:01 -04:00
Andrew Kelley
7798054b58 add tests for bad implicit casting of anyframe types
See #3063
2019-08-16 11:00:21 -04:00
Andrew Kelley
4ea2331e3d add test for async call of generic function
See #3063
2019-08-16 10:54:45 -04:00
Andrew Kelley
5df89dafef add test for wrong frame type used for async call
See #3063
2019-08-16 10:49:00 -04:00
Andrew Kelley
1254a453b9 add compile error for @Frame() of generic function
See #3063
2019-08-16 10:44:51 -04:00
Vexu
92a81252cb Merge branch 'master' into fmt-comment-fix 2019-08-16 17:40:20 +03:00
Andrew Kelley
49c88e23af zig fmt 2019-08-16 10:13:40 -04:00
Andrew Kelley
7874d5a40b zig fmt: add more test cases 2019-08-16 10:11:53 -04:00
Vexu
2151f84d59 implement new async syntax in self-hosted compiler 2019-08-16 06:17:28 -07:00
Andrew Kelley
1e3b6816a8 note that -mllvm is unsupported
closes #3045
2019-08-15 22:57:06 -04:00
Andrew Kelley
ff7e826b82 fix crash with sometimes type not being resolved 2019-08-15 18:54:23 -04:00
Andrew Kelley
0b08ae581e add assertion about control flow to fix gcc warning 2019-08-15 18:38:20 -04:00
Andrew Kelley
7e75e1075e zig fmt 2019-08-15 18:19:04 -04:00
Andrew Kelley
8b97a1aee2 Merge pull request #3033 from ziglang/rewrite-coroutines
rework async function semantics
2019-08-15 14:01:01 -07:00
Andrew Kelley
d3672493cc basic docs for new async/await semantics 2019-08-15 16:46:43 -04:00
Andrew Kelley
55f5cee86b fix error return traces for async calls of blocking functions 2019-08-15 15:06:05 -04:00
Andrew Kelley
729807203a force static libs for vendored dependencies 2019-08-15 14:34:52 -04:00
Andrew Kelley
13b5a4bf8c remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley
64c293f8a4 codegen for async call of blocking function 2019-08-14 12:52:20 -04:00
Andrew Kelley
f3f838cc01 add compile error for await in exported function 2019-08-14 11:22:12 -04:00
Andrew Kelley
7799423f24 rename behavior test files 2019-08-14 00:38:27 -04:00
Andrew Kelley
5749dc49d8 respect local variable alignment in async functions 2019-08-14 00:35:51 -04:00
Andrew Kelley
dd8c8c0802 get_struct_type accepts field alignment overrides 2019-08-13 18:14:38 -04:00
Andrew Kelley
5092634103 avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -04:00
Andrew Kelley
82d4ebe53a organize TODOs 2019-08-13 13:28:05 -04:00
Andrew Kelley
12ff91c1c9 alignment of structs no longer depends on LLVM
fixes async function tests in optimized builds
2019-08-13 12:44:30 -04:00
Andrew Kelley
8a9289996a Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-13 11:39:32 -04:00
Andrew Kelley
98183e4743 flip the order of fields in error unions
to prepare for fixing u128 alignment issues
2019-08-13 11:33:01 -04:00
Andrew Kelley
24d5ec0783 fix async function frames not aligned enough 2019-08-11 22:35:12 -04:00
Andrew Kelley
911b1a0428 fix no-longer-correct nonnull attribute on merge err ret traces fn 2019-08-11 22:05:09 -04:00
Andrew Kelley
62c5bc6058 fix cancel invoking branch on undefined memory 2019-08-11 21:14:19 -04:00
Andrew Kelley
4d8d513e16 all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley
3aed7de0c4 README: link to community projects 2019-08-11 16:09:23 -04:00
Andrew Kelley
af8c6ccb4b fix canceling async functions which have error return tracing 2019-08-11 14:26:34 -04:00
Andrew Kelley
b87686dfa0 fix enum with one member and custom tag type 2019-08-11 13:43:44 -04:00
Andrew Kelley
1b83ee78a4 allow comptime_int to implicit cast to comptime_float 2019-08-11 12:01:02 -04:00
data-man
4bd4c5e06d Fixed tiny typo in the math module (shr's description) 2019-08-11 08:15:42 -07:00
Nick Erdmann
70e62b8612 std/os/uefi: some more events 2019-08-11 15:50:03 +02:00
Nick Erdmann
a9b3700c6e src/codegen: configure stack probes explicitly 2019-08-11 00:29:24 +02:00
Andrew Kelley
3f5c6d7a89 add test case for typical async/await usage 2019-08-10 18:03:36 -04:00
Andrew Kelley
77d098e92d fix returning a const error from async function 2019-08-10 17:23:45 -04:00
Andrew Kelley
22428a7546 fix try in an async function with error union and non-zero-bit payload 2019-08-10 15:20:08 -04:00
Nick Erdmann
47ce736abe std/os/uefi: add basic Event support 2019-08-10 19:14:47 +02:00
Nick Erdmann
9445b3f057 std/os/uefi: change type of Handle from @OpaqueType to *@OpaqueType 2019-08-10 19:14:31 +02:00
Andrew Kelley
b9d1d45dfd fix combining try with errdefer cancel 2019-08-09 21:49:40 -04:00
Andrew Kelley
2e7f53f1f0 fix cancel inside an errdefer 2019-08-09 17:34:06 -04:00
Andrew Kelley
e6ebc41a07 add a little compile error to make Future Andy's life easier 2019-08-09 17:10:39 -04:00
Andrew Kelley
0bf6796b76 fix regression in std.math.min
closes #3035
2019-08-09 10:22:02 -04:00
Andrew Kelley
614cab5d68 fix passing string literals to async functions 2019-08-08 19:08:41 -04:00
Andrew Kelley
da56959a9a closer to std lib event stuff working 2019-08-08 16:41:38 -04:00
Andrew Kelley
93840f8610 fix var args call on non-generic function 2019-08-08 15:34:41 -04:00
Andrew Kelley
cfe84423c9 fix segfault with var args 2019-08-08 15:13:05 -04:00
Andrew Kelley
bfa1d12fba better compile errors when frame depends on itself 2019-08-08 13:44:57 -04:00
Andrew Kelley
8be95af480 add compile error for unable to determine async fn frame 2019-08-08 13:07:05 -04:00
Andrew Kelley
8d4cb85285 async functions in single threaded mode do not use atomic ops 2019-08-08 12:30:22 -04:00
Andrew Kelley
d813805f77 more debuggable safety for awaiting twice 2019-08-08 12:02:56 -04:00
Andrew Kelley
34bfdf193a cancel, defer, errdefer all working as intended now 2019-08-08 11:37:49 -04:00
Andrew Kelley
e6ef00233e Merge pull request #3025 from euantorano/fix/3015-std-os-window-rtlgenrandom
Fix #3015 - fix RtlGenRandom function signature
2019-08-07 14:21:54 -07:00
Euan Torano
f2bef0447a Remove unneeded casts. 2019-08-07 22:19:25 +01:00
Sam Tebbs
8621e3b5bd Don't emit clang error if source or filename pointer is null 2019-08-07 14:11:18 -07:00
Andrew Kelley
2cd5e55581 std.math.min: return a more restrictive type sometimes 2019-08-07 16:28:23 -04:00
Ryan Saunderson
8fcf21fefc modify header precedence for zig cc, resolves intrinsics issues (#3027) 2019-08-07 10:51:30 -07:00
Andrew Kelley
e11cafbd4f cancel works on non-pointers 2019-08-07 10:56:37 -04:00
Andrew Kelley
f587fa1cd7 clean up the bitcasting of awaiter fn ptr 2019-08-07 10:56:19 -04:00
Andrew Kelley
7e1fcb55b3 implement cancel
all behavior tests passing in this branch
2019-08-07 00:53:04 -04:00
Andrew Kelley
1afbb53661 fix awaiting when result type is a struct 2019-08-06 19:07:25 -04:00
Andrew Kelley
966c9ea63c error return trace across suspend points 2019-08-06 18:47:09 -04:00
Andrew Kelley
17199b0879 passing the error return trace async function test 2019-08-06 18:29:56 -04:00
Andrew Kelley
400500a3af improve async function semantics
* add safety panic for resuming a function which is returning, pending
   an await
 * remove IrInstructionResultPtr
 * add IrInstructionReturnBegin. This does the early return in async
   functions; does nothing in normal functions.
 * `await` gets a result location
 * `analyze_fn_async` will call `analyze_fn_body` if necessary.
 * async function frames have a result pointer field for themselves
   to access and one for the awaiter to supply before the atomic rmw.
   when returning, async functions copy the result to the awaiter result
   pointer, if it is non-null.
 * async function frames have a stack trace pointer which is supplied by
   the awaiter before the atomicrmw. Later in the frame is a stack trace
   struct and addresses, which is used for its own calls and awaits.
 * when awaiting an async function, if an early return occurred, the
   awaiter tail resumes the frame.
 * when an async function returns, early return does a suspend
   (in IrInstructionReturnBegin) before copying
   the error return trace data, result, and running the defers.
   After the last defer runs, the frame will no longer be accessed.
 * proper acquire/release atomic ordering attributes in async functions.
2019-08-06 16:53:22 -04:00
Euan Torano
2d25348f63 Fix function signature and use a loop to ensure buffer is filled. 2019-08-06 19:32:22 +01:00
Nick Erdmann
88fdb303ff std/os/uefi: replace init() with default values 2019-08-06 18:06:18 +02:00
Benjamin Feng
23ee619fc5 Output token symbols similar to stage1 2019-08-05 21:37:16 -05:00
Benjamin Feng
b4172e5151 Humanize tokenized symbol names 2019-08-05 21:03:46 -05:00
Andrew Kelley
7f23dac6dc update readme 2019-08-05 13:49:17 -04:00
Euan Torano
7b8c96612f Fix #2993 - use getrandom on freebsd 2019-08-05 09:31:38 -07:00
Nick Erdmann
20ce0b9952 std/os/uefi: replace integer bit fields with packed structs 2019-08-05 18:26:13 +02:00
Euan T
8aa87ec441 Add misisng newline 2019-08-05 09:23:15 -07:00
Euan Torano
0157365872 Add missing S_IS* for NetBSD 2019-08-05 09:23:15 -07:00
Andrew Kelley
20f63e588e async functions have error return traces where appropriate
however the traces are not merged on `await` or async function calls
yet.

When an async function has an error set or error union as its return
type, it has a `StackTrace` before the args in the frame, so that it is
accessible from `anyframe->T` awaiters. However when it does not have an
errorable return type, but it does call or await an errorable, it has a
stack trace just before the locals. This way when doing an `@asyncCall`
on an async function pointer, it can populate the args (which are after
the `StackTrace`) because it knows the offset of the args based only on
the return type.

This sort of matches normal functions, where a stack trace pointer could
be supplied by a parameter, or it could be supplied by the stack of the
function, depending on whether the function itself is errorable.
2019-08-05 03:10:14 -04:00
Andrew Kelley
dfe8c5a2e9 add a src() method to AstNode to aid debugging 2019-08-05 03:09:17 -04:00
Andrew Kelley
a7763c06f9 delete IrInstructionMarkErrRetTracePtr
this IR instruction is no longer needed
2019-08-05 00:44:39 -04:00
Andrew Kelley
0d8c9fcb18 support async functions with inferred error sets 2019-08-05 00:41:49 -04:00
Andrew Kelley
f27e5d439c refactor logic for determining if there is a frame pointer 2019-08-04 20:44:52 -04:00
Andrew Kelley
b7c94be688 Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-04 19:10:36 -04:00
Andrew Kelley
fbf21efd24 simpler, less memory intensive suspend/resume implementation 2019-08-04 18:58:14 -04:00
Andrew Kelley
042914de75 move state from ZigFn to CodeGen to save memory 2019-08-04 18:26:37 -04:00
Andrew Kelley
fa30ebfbe5 suspension points inside branching control flow 2019-08-04 18:24:10 -04:00
Nick Erdmann
b979fc1bcd initial work torwards std lib support for uefi 2019-08-04 21:53:49 +02:00
Andrew Kelley
30466bccef update CONTRIBUTING.md 2019-08-04 15:15:25 -04:00
Sahnvour
8c99a51993 Merge pull request #2797 from Sahnvour/hashing
hash algorithm improvements
2019-08-04 21:02:00 +02:00
Sahnvour
54255ee32e autohash: force inlining of integer hashing so that the optimizer can see the fast path based on key's size which is known at comptime
otherwise it will always outline the call to hasher.update, resulting in much worse performance
2019-08-04 12:34:37 +02:00
Sahnvour
3faf5d3857 wyhash: stateless is faster for both iterative hashing and small keys. 2019-08-04 12:34:37 +02:00
Sahnvour
4b5172d287 move autoHash into its own module since it can be used with any hash function implementing a streaming interface 2019-08-04 12:34:37 +02:00
Sahnvour
5bf63bfbf1 make use of hashing streaming interface in autoHash 2019-08-04 12:34:05 +02:00
Sahnvour
8805a7b509 adapt http/headers.zig to wyhash's new interface 2019-08-04 12:34:05 +02:00
Marc Tiehuis
4c93ccab5a Add throughput test program for hash functions 2019-08-04 12:34:05 +02:00
Marc Tiehuis
83dffc70af Add iterative wyhash api 2019-08-04 12:34:05 +02:00
Sahnvour
c9ce43f59f fix hashmap using strings as keys 2019-08-04 12:34:05 +02:00
Sahnvour
5bd407b278 use wyhash in std's hashmap, and improve autoHash to handle more types and behave more correctly 2019-08-04 12:34:05 +02:00
Sahnvour
6150da3df9 direct port of wyhash v2
also inspired by https://github.com/ManDeJan/zig-wyhash
2019-08-04 12:34:02 +02:00
Andrew Kelley
f01cb8cc16 Merge pull request #2998 from daurnimator/return-elf
std: return Elf object from constructors instead of filling in pointer
2019-08-04 00:21:38 -07:00
daurnimator
887eac0219 std: remove elf.auto_close_stream and elf.prealloc_file 2019-08-04 16:27:36 +10:00
Andrew Kelley
12924477a5 fix regression in calling extern functions 2019-08-03 20:33:16 -04:00
emekoi
59e2c87b4b move windows abi detection to get_native_target 2019-08-03 18:40:27 -05:00
Andrew Kelley
87710a1cc2 implement @asyncCall which supports async function pointers 2019-08-03 16:17:42 -04:00
Andrew Kelley
5ce1a965e0 LLD patch: workaround for buggy MACH-O code
This reapplies 182cd0e4c0
to the embedded LLD.
2019-08-03 12:56:35 -04:00
Andrew Kelley
ffab950e0c update embedded LLD to 9.0.0rc1 2019-08-03 12:56:35 -04:00
Andrew Kelley
63ebd9d12e Merge remote-tracking branch 'origin/master' into llvm9 2019-08-03 12:39:15 -04:00
Andrew Kelley
5687323cd2 Merge pull request #2994 from euantorano/fix/1626-os-getRandomBytesDevURandom
Check if /dev/urandom is a character device
2019-08-02 23:55:43 -07:00
Euan T
08251fbc54 Omit system namespace.
Co-Authored-By: Andrew Kelley <andrew@ziglang.org>
2019-08-03 07:51:36 +01:00
Euan T
8e157ccb23 Update returned error return when not a character device.
Co-Authored-By: Andrew Kelley <andrew@ziglang.org>
2019-08-03 07:50:30 +01:00
Andrew Kelley
c879209661 add compile error for calling async function pointer 2019-08-03 02:40:38 -04:00
Andrew Kelley
e444e737b7 add runtime safety for resuming an awaiting function 2019-08-03 02:11:52 -04:00
daurnimator
521aaf3501 std: return Elf object from constructors instead of filling in pointer 2019-08-03 15:56:25 +10:00
Andrew Kelley
24d78177ee add compile error for async call of function pointer 2019-08-03 01:06:14 -04:00
Christoffer Rasmussen
57830e43ee Fix public function lookup
Previously it did not work, as lookup did not pass a correct parent type
to doLookup. Expected *?*Node, got ?*Node.
2019-08-02 21:48:30 -07:00
emekoi
102d3f30c4 accept unix style paths on windows-gnu 2019-08-02 19:39:33 -05:00
emekoi
f15ec9a59b implemented runtime abi detetction for windows 2019-08-02 19:32:46 -05:00
Andrew Kelley
0920bb0872 implement async functions returning structs 2019-08-02 19:27:27 -04:00
Andrew Kelley
e68fee3984 docs: add atomicrmw operations list 2019-08-02 18:54:15 -04:00
Andrew Kelley
1823a5979a Merge pull request #2985 from fengb/fix-build-references
Fix build references
2019-08-02 15:49:16 -07:00
Andrew Kelley
5bd330e76c add heap allocated async function frame test 2019-08-02 16:32:24 -04:00
Andrew Kelley
b3b6a98451 Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-02 16:31:43 -04:00
Andrew Kelley
f07f09a373 Merge branch 'master' into rewrite-coroutines 2019-08-02 16:13:36 -04:00
Andrew Kelley
b2d94f9af2 Merge branch 'assignment-result-loc'
With this merge, assignments participate in result location
semantics.
2019-08-02 16:10:45 -04:00
Andrew Kelley
d105769926 fix regressions regarding writing through const pointers 2019-08-02 16:09:40 -04:00
Andrew Kelley
9069ee957c fix discarding function call results 2019-08-02 15:17:02 -04:00
Andrew Kelley
90e64bc620 fix cmpxchg with discarded result 2019-08-02 14:47:26 -04:00
Andrew Kelley
a5cb0f77d1 assignment participates in result location
fix one regression with optionals but there are more
2019-08-02 13:54:58 -04:00
Euan Torano
24fbd1f1d5 Add S_* values for freebsd. 2019-08-02 16:05:03 +01:00
Euan Torano
1583efda69 Fix call to S_ISCHR and implement for Mac 2019-08-02 15:55:56 +01:00
Euan Torano
c0c228b758 Check if /dev/urandom is a character device 2019-08-02 13:19:49 +01:00
Andrew Kelley
056c4e2c98 implement async await and return 2019-08-02 01:06:00 -04:00
Andrew Kelley
0f879d02a4 more passing coroutine tests 2019-08-01 19:14:48 -04:00
Andrew Kelley
1dd0c3d49f fix calling an inferred async function 2019-08-01 16:41:30 -04:00
Andrew Kelley
e7ae4e4645 reimplement async with function splitting instead of switch 2019-08-01 16:08:52 -04:00
Andrew Kelley
6cb4cac5cd disable behavior test for 128-bit cmpxchg
once #2883 is done this can be revisited
2019-08-01 03:36:03 -04:00
Andrew Kelley
38b5812c48 allow 128 bit cmpxchg on x86_64 2019-08-01 02:46:37 -04:00
Benjamin Feng
723aea8369 Default wasm-lib prefix to empty 2019-07-31 22:07:17 -05:00
Benjamin Feng
327abdba0b More current style for error handling 2019-07-31 21:28:25 -05:00
Benjamin Feng
e40513e97f Add builder.findProgram test and fix references 2019-07-31 21:26:39 -05:00
Andrew Kelley
dbdc4d62d0 improve support for anyframe and anyframe->T
* add implicit cast from `*@Frame(func)` to `anyframe->T` or `anyframe`.
 * add implicit cast from `anyframe->T` to `anyframe`.
 * `resume` works on `anyframe->T` and `anyframe` types.
2019-07-29 19:32:49 -04:00
Andrew Kelley
ceec2393cf Merge pull request #2965 from Sahnvour/zig-stack-traces
Stage1 stack traces on windows
2019-07-29 17:50:11 -04:00
Sahnvour
c087525eda pdb: improved stream reading performance, printing stack trace from a stage1 crash is now 10x faster 2019-07-29 23:40:18 +02:00
Sahnvour
05032c8693 coff & pdb: improved correctness of our implementation, it is now able to handle stage1's pdb and print its stack traces 2019-07-29 23:40:18 +02:00
Sahnvour
d08425a0a5 os: missing accessW since recent refactoring 2019-07-29 23:33:58 +02:00
Michael Dusan
bc982e65cf fix std.fmt to handle std.SegmentedList
- add guards for use of prealloc_exp in SegmentedList
- define prealloc_exp even when invalid because std.fmt comptime
  triggers lazy-init
- fix std.fmt to print arrays of length 0 as style "[0]<typename>"
  because "<typename>@address" is n/a without address
2019-07-29 16:32:26 -04:00
Nick Erdmann
8736a5be2a std/build.zig: fix stack checking option 2019-07-29 16:30:21 -04:00
Michael Dusan
7e436006be fix std.rb.Node.getParent to return optional
closes #2962
2019-07-29 16:29:29 -04:00
Andrew Kelley
d694f298d8 Merge pull request #2958 from emekoi/mingw-cmake
fix backtraces on mingw
2019-07-29 16:27:35 -04:00
Marc Tiehuis
c47b75312d Merge pull request #2969 from evangrayk/zero-width-structs
fix zero-width structs in zig.fmt.format
2019-07-29 19:19:47 +12:00
Evan Krause
a0ebfa64d9 support zero-sized structs in zig.fmt.format 2019-07-28 18:37:35 -07:00
Nick Erdmann
6e8ef5b6f2 std/build.zig: add checks for UEFI 2019-07-29 00:21:21 +02:00
Nick Erdmann
63d56c532d src/target.cpp: UEFI improvements 2019-07-29 00:19:40 +02:00
emekoi
357fb4f143 avoid passing -static to msvc when static linking 2019-07-27 17:54:20 -05:00
emekoi
10b1017702 fixed backtraces when linking libc on mingw 2019-07-27 17:50:44 -05:00
Andrew Kelley
ee64a22045 add the anyframe and anyframe->T types 2019-07-26 19:52:35 -04:00
emekoi
5593c63e12 improved CMake file for MinGW 2019-07-26 16:26:01 -05:00
Joachim Henke
74abc5ad2f avoid a register copy when fetching the stack pointer in _start 2019-07-26 17:12:42 -04:00
Andrew Kelley
018a89c7a1 async functions return void, no more GetSize resume block 2019-07-26 17:07:19 -04:00
Andrew Kelley
7b3686861f @frameSize works via PrefixData 2019-07-25 22:24:01 -04:00
Andrew Kelley
538c0cd225 implement @frameSize 2019-07-25 15:05:55 -04:00
Andrew Kelley
70bced5dcf implement @frame and @Frame 2019-07-25 01:47:56 -04:00
Andrew Kelley
ead2d32be8 calling an inferred async function 2019-07-25 00:03:06 -04:00
Andrew Kelley
9e11f67f0d add test for previous commit 2019-07-24 15:05:39 -04:00
Michael Dusan
8e4f3a6f15 align src for IrInstructionArrayToVector
closes #2942
2019-07-24 15:04:32 -04:00
Andrew Kelley
e220812f2f implement local variables in async functions 2019-07-24 02:59:51 -04:00
Andrew Kelley
19ee495750 add error for function with ccc indirectly calling async function 2019-07-23 19:35:41 -04:00
Andrew Kelley
7e9760de10 inferring async from async calls 2019-07-23 18:54:45 -04:00
Timon Kruiper
59850c1ce1 Fixed an integer overflow in zig fmt and added testcase 2019-07-23 14:51:30 -04:00
Vexu
57aa8997bd fix escape sequence rendering 2019-07-23 14:49:19 -04:00
Andrew Kelley
317d1ecb2c Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-07-22 14:37:08 -04:00
Andrew Kelley
fcadeb50c0 fix multiple coroutines existing clobbering each other 2019-07-22 14:36:14 -04:00
Andrew Kelley
650e07ebd9 fix suspend at end of function 2019-07-22 13:04:22 -04:00
Andrew Kelley
16be70cbbf compiler-rt: add __muldi3 2019-07-22 12:49:26 -04:00
Andrew Kelley
bc31c1280e disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:41:59 -04:00
Andrew Kelley
a3327f0fbd fix usingnamespace analyzing the expression multiple times 2019-07-22 12:33:24 -04:00
Andrew Kelley
5b69a9cd83 disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:15:16 -04:00
Andrew Kelley
d6d0bb0542 zig build: adjust DESTDIR logic
now if DESTDIR is provided then the default install prefix is /usr.
otherwise the default install prefix is still zig-cache directly.

DESTDIR is prepended to the prefix to match what make install does.
2019-07-22 10:45:59 -04:00
Andrew Kelley
32d0ac1355 fix wrong calling convention on async resume 2019-07-22 00:07:48 -04:00
Andrew Kelley
59bf9ca58c implement async function parameters 2019-07-21 23:27:47 -04:00
Andrew Kelley
11bd50f2b2 implement coroutine resume 2019-07-21 20:54:08 -04:00
Andrew Kelley
78e03c466c simple async function passing test 2019-07-21 19:56:37 -04:00
Andrew Kelley
77c2ac3fcd zig build: support DESTDIR environment variable
closes #2929
2019-07-21 18:04:23 -04:00
Andrew Kelley
56c08eb302 returning from async fn adds bad resume safety 2019-07-21 17:17:44 -04:00
Andrew Kelley
6053ca4f69 fix not jumping to entry 2019-07-21 17:10:16 -04:00
Andrew Kelley
27a5f2c4fa remove errors for async calling convention 2019-07-21 16:43:43 -04:00
Andrew Kelley
72e983670e simple async function call working 2019-07-21 16:21:16 -04:00
Andrew Kelley
a2e1be0346 docs: don't try to run the undefined behavior example test 2019-07-20 13:59:18 -04:00
Andrew Kelley
2c1e955de7 always give the type to byval attribute 2019-07-20 13:32:50 -04:00
Andrew Kelley
54e716afdc remove coroutines implementation and promise type 2019-07-19 18:18:44 -04:00
Andrew Kelley
05454123d4 update clang driver code to llvm9
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 18:07:31 -04:00
Andrew Kelley
f429f4dcab Merge branch 'fengb-tokenize-ampamp'
closes #2723
closes #2660
2019-07-19 17:55:12 -04:00
Andrew Kelley
8ea8cff491 slightly simpler implementation 2019-07-19 17:54:06 -04:00
Benjamin Feng
111d3792e0 Docgen invalid for && 2019-07-19 17:11:58 -04:00
Benjamin Feng
484f8a4cc2 Switch old switch / @TagType() to use inferred enums 2019-07-19 17:11:58 -04:00
Benjamin Feng
4708fb23c0 Generate parse error from && 2019-07-19 17:11:58 -04:00
Benjamin Feng
d4ff27180b Tokenize '&&' as AmpersandAmpersand 2019-07-19 17:11:58 -04:00
Andrew Kelley
af8661405b fix usingnamespace
It used to be that usingnamespace was only allowed at top level. This
made it OK to put the state inside the AST node data structure. However,
now usingnamespace can occur inside any aggregate data structure, and
therefore the state must be in the TopLevelDeclaration rather than in
the AST node.

There were two other problems with the usingnamespace implementation:

 * It was passing the wrong destination ScopeDecl, so it could cause an
   incorrect error such as "import of file outside package path".
 * When doing `usingnamespace` on a file that already had
   `pub usingnamespace` in it would "steal" the usingnamespace, causing
   incorrect "use of undeclared identifier" errors in the target file.

closes #2632
closes #2580
2019-07-19 16:56:44 -04:00
Andrew Kelley
70e05c67ce update libcxx to llvm9
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 16:55:59 -04:00
Andrew Kelley
dab0cf6428 update libunwind to llvm9
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 16:54:00 -04:00
Andrew Kelley
2117fbdae3 update C headers to llvm9
upstream commit 1931d3cb20a00da732c5210b123656632982fde0
2019-07-19 16:50:45 -04:00
Andrew Kelley
1d07bbbef2 zig build: add valgrind cli options 2019-07-18 20:03:38 -04:00
Andrew Kelley
70da0762f7 better riscv syscalls 2019-07-18 18:15:50 -04:00
Michael Dusan
e5d032982e closes #2916 2019-07-18 16:42:56 -04:00
Andrew Kelley
03a3b1ca39 riscv workarounds for llvm not having good asm integration 2019-07-18 15:20:58 -04:00
Andrew Kelley
a3854d042e basic riscv support
llvm is giving me `error: couldn't allocate output register for
constraint '{a0}'` which is a bug that needs to be fixed upstream.
2019-07-18 15:03:21 -04:00
Andrew Kelley
07f0de6a8a compiler-rt: add __muldi3 2019-07-18 13:54:22 -04:00
Andrew Kelley
afbf99c846 riscv musl: only add the +a feature 2019-07-18 12:28:24 -04:00
Andrew Kelley
d4ca337e6b improvements to riscv support 2019-07-18 12:21:57 -04:00
Andrew Kelley
04ce5376a8 carry some upstream patches to musl to fix riscv inline asm
Upstream commits:
 * 8eb49e0485fc547eead9e47200bbee6d81f391c1
 * 2dcbeabd917e404a0dde0195388da401b849b9a4
 * f0eb2e77b2132a88e2f00d8e06ffa7638c40b4bc

These will be in the next version of musl, so no harm carrying them
here.
2019-07-18 11:43:39 -04:00
Andrew Kelley
aaa4bf75d3 msvc libc: provide _fltused symbol 2019-07-17 18:11:03 -04:00
Andrew Kelley
e816d592e8 update zig codebase to llvm 9 2019-07-17 17:47:39 -04:00
Andrew Kelley
3879bebc37 WIN32 -> _WIN32 2019-07-17 16:10:54 -04:00
Andrew Kelley
95e04e3874 back to msvc as the default C ABI on Windows
Zig provides a libc for the GNU C ABI on Windows, and cannot (at least
yet) provide one for the MSVC C ABI. However when not linking libc,
zig has no problem targeting MSVC as the C ABI. And this should be the
default.

Related: #2911
2019-07-17 12:40:48 -04:00
dimenus
d64bd30690 fixed slice length in getEnvVarOwned 2019-07-17 12:13:50 -04:00
Andrew Kelley
8f92a49dfd update to llvm9 trunk 2019-07-16 22:23:48 -04:00
Andrew Kelley
c0b4121ff2 libc headers before C language headers, and disable libunwind on arm32 2019-07-16 21:38:18 -04:00
Andrew Kelley
ec92739022 Merge branch 'update-musl'
closes #2601
2019-07-16 20:07:05 -04:00
Andrew Kelley
d994379173 update bundled musl source to 1.1.23 2019-07-16 19:54:14 -04:00
Andrew Kelley
f70ce707e2 update musl headers to musl v1.1.23 2019-07-16 19:02:51 -04:00
Vexu
34d2a1465c Merge branch 'master' into fmt-comment-fix 2019-07-17 01:22:20 +03:00
Vexu
f8e753e19c Merge branch 'master' into comment-in-array 2019-07-17 01:20:59 +03:00
Andrew Kelley
b1f8b53d20 rename internal names regarding usingnamespace 2019-07-16 16:20:54 -04:00
Andrew Kelley
158e2312ea Merge branch 'JohnathanFL-master'
closes #2900
closes #2894
2019-07-16 13:14:11 -04:00
Andrew Kelley
23dd7f4527 organize the docs and some rewording 2019-07-16 13:13:21 -04:00
JohnathanFL
475a181028 Add multidimensional array example 2019-07-16 13:02:30 -04:00
Andrew Kelley
15ed47921f Merge branch 'msvc-libc-2064' of https://github.com/dimenus/zig into dimenus-msvc-libc-2064 2019-07-16 12:51:02 -04:00
daurnimator
3a67c13b5d cmake: allow user to select static vs dynamic LLVM 2019-07-16 12:33:13 -04:00
Andrew Kelley
9dcddc2249 retire the example/ folder, rename test-build-examples to "standalone"
closes #2759
2019-07-16 12:15:46 -04:00
Andrew Kelley
92e781baa1 fix documentation regarding mixing object files
closes #2905
2019-07-16 11:50:34 -04:00
Andrew Kelley
9a9a7daef0 Merge branch 'SamTebbs33-main-return' 2019-07-16 11:50:17 -04:00
Andrew Kelley
741c74e427 cleanups 2019-07-16 11:50:00 -04:00
Andrew Kelley
45cc488cef Merge branch 'main-return-!u8' of https://github.com/SamTebbs33/zig into SamTebbs33-main-return 2019-07-16 11:27:11 -04:00
emekoi
0435026474 fixed size of ZigClangAPValue on mingw-w64 2019-07-16 09:34:02 -04:00
Andrew Kelley
68149f2039 fix gitattributes 2019-07-16 00:05:12 -04:00
Andrew Kelley
5345044edf Merge branch 'hryx-translate-c-userland' 2019-07-16 00:01:31 -04:00
Andrew Kelley
776423bbf7 fix result location alignment in ir_render_call 2019-07-15 23:44:44 -04:00
Andrew Kelley
6fe3b20962 Merge branch 'translate-c-userland' of https://github.com/hryx/zig into hryx-translate-c-userland 2019-07-15 22:19:54 -04:00
Andrew Kelley
3f4abe97bd Merge pull request #2892 from ziglang/install-with-zig-build
move some of the installation from cmake to zig build
2019-07-15 20:46:12 -04:00
Andrew Kelley
aff90c2252 avoid shipping junk files
I did a diff of the shipped file list with master branch and it looks
good after this commit.
2019-07-15 20:35:34 -04:00
Nick Erdmann
33eaaadd01 fix documentation of assert 2019-07-15 19:52:07 -04:00
Andrew Kelley
eaf545e24c fix build on windows 2019-07-15 19:50:56 -04:00
Andrew Kelley
c3d20373ee std.unicode.utf8ToUtf16Le: improve performance
on a simple test input:

original utf8ToUtf16Le: elapsed: 111384483 ns (111 ms)
new utf8ToUtf16Le: elapsed: 138570 ns (0 ms)

it's 800x faster in debug mode and ~4500x faster in release-fast mode.

this was slowing down installation of files on windows in build scripts.
2019-07-15 19:35:10 -04:00
Andrew Kelley
851a7288a9 mingw libc can link against ntdll 2019-07-15 18:25:13 -04:00
Andrew Kelley
49d1a4c562 move lib dirs to lib subdir
also start prefering NtDll API. so far:
 * NtQueryInformationFile
 * NtClose

adds a performance workaround for windows unicode conversion. but that
should probably be removed before merging
2019-07-15 17:54:50 -04:00
Andrew Kelley
51a3938b04 fix the build on macos
Stat structs gain methods to abstract over the platform differences with
regards to mtime, ctime, atime.
2019-07-15 12:28:39 -04:00
Andrew Kelley
0cd660462f move install_files.h to not be generated code 2019-07-15 01:47:26 -04:00
Andrew Kelley
6237380b01 fix the build on linux 2019-07-15 01:45:26 -04:00
Andrew Kelley
b23ace27db fix the build on windows 2019-07-15 01:45:26 -04:00
Andrew Kelley
aa170a7eff implement std.fs.File.updateTimes for windows 2019-07-15 01:45:26 -04:00
Andrew Kelley
95fdff3feb std.fs.updateFile: make path if necessary 2019-07-15 01:45:26 -04:00
Andrew Kelley
40a562f26d cmake: fix incorrect dependencies 2019-07-15 01:45:26 -04:00
Andrew Kelley
6096dc5f94 move some of the installation from cmake to zig build
This moves the installation of shipped source files from large
CMakeLists.txt lists to zig build recursive directory installation.

On my computer a cmake `make install` takes 2.4 seconds even when it has
to do nothing, and prints a lot of unnecessary lines to stdout that say
"up-to-date: [some file it is installing]".

After this commit, the default output of `make` is down to 1
second, and it does not print any junk to stdout. Further, a `make
install` is no longer required and `make` is sufficient.

This closes #2874.

It also closes #2585. `make` now always invokes `zig build` for
installing files and libuserland.a, and zig's own caching system makes
that go fast.
2019-07-15 01:45:26 -04:00
Andrew Kelley
7d9ee5d6d5 Merge pull request #2882 from andersfr/hash-branch
Implementation of MurmurHash and CityHash
2019-07-13 20:08:18 -04:00
emekoi
1547692d18 fixed static linking on mingw-w64 2019-07-13 20:05:13 -04:00
Andrew Kelley
9c39d5720f ir: add an assertion in phi analysis 2019-07-13 18:38:52 -04:00
Andrew Kelley
c0489abcdb translate-c: fix incorrectly translated double function pointer
closes #2887
2019-07-13 12:38:10 -04:00
andersfr
69129c2e93 Intentional wraparound used + 2019-07-13 13:59:15 +02:00
andersfr
9684c99dd3 Proper use of @truncate instead of @intCast 2019-07-13 13:59:15 +02:00
andersfr
0619b525b9 Better testing and bugfix in hashUint* functions 2019-07-13 13:59:15 +02:00
andersfr
dfbe65e8cd Ported CityHash and Murmur hashing algorithms to native zig 2019-07-13 13:59:15 +02:00
emekoi
bdfb31420a fixed compilation on mingw-w64 2019-07-12 19:40:51 -04:00
Andrew Kelley
107e57484f Merge pull request #2868 from ziglang/windows-libc
provide a libc for windows using mingw-w64
2019-07-12 18:12:27 -04:00
Andrew Kelley
39b850c6cf mingw libc: delete dead linker code regarding using system libc 2019-07-12 18:10:53 -04:00
Andrew Kelley
3621d54e57 handle mingw libc defs better
also zig build handles --verbose and linkSystemLibrary better
2019-07-12 17:25:25 -04:00
Andrew Kelley
5a62ab3ef1 fix build.zig 2019-07-12 16:14:54 -04:00
Andrew Kelley
2f8983e2f6 update zig build system for mingw static lib conventions 2019-07-12 15:10:32 -04:00
Andrew Kelley
7b8ba871a9 mingw libc: solve the segfault having to do with destructors
* fixed --verbose-cc printing an extra "zig" before the rest of
   the command line
 * windows-gnu targets use libfoo.a, foo.o extensions to match mingw
   conventions.
2019-07-12 14:44:34 -04:00
Andrew Kelley
4e58855a4a translate-c: better detection of pointer to struct demoted to opaque 2019-07-12 12:11:26 -04:00
daurnimator
52f0300505 std: add new linux 5.2 constants 2019-07-12 11:52:32 -04:00
thomas
02b1aea291 fix typo in help text for bundle-compiler-rt 2019-07-12 10:23:39 -04:00
Andrew Kelley
d9c4c96bf2 add -Wno-pragma-pack when targeting windows-gnu
windows.h has files such as pshpack1.h which do #pragma packing,
triggering a clang warning. So for this target, this warning is
disabled.

this commit also improves the error message printed when no libc can be
used, printing the "zig triple" rather than the "llvm triple".
2019-07-11 23:48:13 -04:00
Michael Dusan
1766bd8a08 doc clarify struct size and ABI-alignment 2019-07-11 20:36:30 -04:00
Andrew Kelley
c7a976972f funding: I've been accepted into the GitHub Sponsors program 2019-07-11 13:00:39 -04:00
Andrew Kelley
b4bbfe8c05 the msvc target abi will have to be solved a different way 2019-07-11 12:56:51 -04:00
Andrew Kelley
e0670557b4 fix windows not able to build mingw 2019-07-10 20:20:53 -04:00
Andrew Kelley
3714d524c3 add some more windows defs 2019-07-10 19:40:46 -04:00
Andrew Kelley
2bb93784c6 mingw: build and link mingwex.lib
zig can now cross compile hello.c targeting windows
2019-07-10 17:41:34 -04:00
dimenus
540a40e2d9 fixing non system library linking 2019-07-10 15:37:25 -05:00
Andrew Kelley
67f3bc9101 mingw: building and linking msvcrt-os.lib 2019-07-10 16:19:51 -04:00
Andrew Kelley
ea90a3a9a1 mingw: building and linking mingw32.lib 2019-07-10 14:13:00 -04:00
dimenus
e9331dc5cf resolved #2064 & fixed hello_world libc build 2019-07-10 11:40:20 -05:00
Andrew Kelley
1c7f21852f ship with mingw-w64 v6.0.0
See #514
2019-07-09 23:34:16 -04:00
Andrew Kelley
ae2345b742 zig build: add standardTargetOptions and deprecate setTarget
in favor of setTheTarget
2019-07-09 13:31:42 -04:00
Andrew Kelley
038946288c Revert "fixed path with spaces in llvm-config (#2854)"
This reverts commit d23798a296.

This caused build problems for several people.
2019-07-09 13:31:13 -04:00
Ian Lilley
d23798a296 fixed path with spaces in llvm-config (#2854)
* fixed path with spaces in llvm-config
2019-07-09 11:48:25 -04:00
Andrew Kelley
eebb00193d zig build: install .pdb files along with binaries
closes #2848
2019-07-08 18:48:03 -04:00
Andrew Kelley
1d2fc446bd cap getdents length argument to INT_MAX
the linux syscall treats this argument as having type int, so passing
extremely long buffer sizes would be misinterpreted by the kernel.
since "short reads" are always acceptable, just cap it down.

patch based on musl commit 3d178a7e2b75066593fbd5705742c5808395d90d
2019-07-08 17:52:28 -04:00
Andrew Kelley
fc9e28ea37 std.os.getrandom does a libc version check
closes #397
2019-07-08 14:42:28 -04:00
Andrew Kelley
4953e84902 Merge pull request #2847 from ziglang/glibc-abi-versioning
support glibc version as part of the target
2019-07-08 13:51:48 -04:00
Andrew Kelley
201033d83b avoid dependency on linux/limits.h header
it was causing a problem on the CI
2019-07-08 11:38:14 -04:00
Andrew Kelley
8692c6fc0d zero initialize target
Fixes glibc_version being set to garbage. I've made this mistake
before so this is an attempt to prevent future bugs. Zig doesn't
have zero-initialization, so are we being a hypocrite by using this
C feature? No, because C doesn't have the feature that forces you to
initialize all fields. That would have prevented this bug every single
time.
2019-07-08 02:10:26 -04:00
Andrew Kelley
f04782785f fix not setting a target glibc version on non-linux 2019-07-07 19:24:44 -04:00
Andrew Kelley
56d8185650 expose glibc version in builtin 2019-07-07 17:56:43 -04:00
Andrew Kelley
3e36cad1c1 remove debug log 2019-07-07 17:56:43 -04:00
Andrew Kelley
336ddb8011 add -target-glibc to cli help and zig build 2019-07-07 17:56:43 -04:00
Andrew Kelley
7ccf7807b3 ability to target any glibc version 2019-07-07 17:56:08 -04:00
Andrew Kelley
3b97940fb3 add an update_glibc tool, delete dummy libc files
This is the beginning of supporting minimum GLIBC version as part of the
target. See #2509 for the motivation.

The dummy libc zig files are removed. A future commit will build them
on-the-fly, using the generated text files generated by the new tool,
which are checked into source control and distributed along with zig.

These generated text files are, together, 142KB (20KB gzipped).
Compare that to a naive bundling of the .abilist files, which would be
2.2MiB (375KB gzipped).

This is based on glibc 2.29.
2019-07-07 17:56:07 -04:00
Andrew Kelley
d39dcd6d9d zig build: add setLibCFile API 2019-07-07 11:31:07 -04:00
Andrew Kelley
38ba412729 Merge pull request #2837 from daurnimator/linux-AT_
std: improvements to linux constants
2019-07-07 09:53:05 -04:00
Andrew Kelley
e12eb5e7f6 Merge pull request #2835 from hryx/de-keyword-anyerror
Make anyerror not a keyword
2019-07-07 09:44:48 -04:00
daurnimator
111e5ed0a2 std: MAP_FAILED is a libc concept on linux 2019-07-07 17:15:30 +10:00
daurnimator
e197968734 std: Make linux MAP_ definitions match kernel 2019-07-07 14:31:27 +10:00
daurnimator
7610d39413 std: Linux AT_ constants are the same across architectures 2019-07-07 14:11:43 +10:00
hryx
28b59a0be7 Remove reference to Keyword_anyerror in docgen 2019-07-06 18:19:04 -07:00
hryx
cce11a724c Make anyerror not a keyword 2019-07-06 15:57:32 -07:00
SamTebbs33
b118806c69 Add implicit cast for *[N]T to [*c]T 2019-07-06 17:02:17 -04:00
Andrew Kelley
21c60922e3 Merge pull request #2823 from hryx/unicode-escape
Unicode escapes: support u{N...}
2019-07-06 13:14:43 -04:00
hryx
7f618184ad Prevent unreachable when file ends with struct field 2019-07-06 13:09:07 -04:00
Andrew Kelley
9471f16c79 zig fmt ignores "zig fmt: off" directive for whitespace fixes 2019-07-05 15:09:22 -04:00
Andrew Kelley
4f43a4b30f zig fmt: fix whitespace
closes #2819
closes #2825
2019-07-05 14:46:21 -04:00
Andrew Kelley
5b42c76951 code formatting 2019-07-05 14:14:25 -04:00
Andrew Kelley
273c2b5c25 docs: mention @unionInit in the union section 2019-07-05 14:10:50 -04:00
Andrew Kelley
3ad9349f09 add std.os.windows.subsystem
The original issue that #2445 wanted to fix was solved in the previous
commit. However it also exposed the subsystem in the standard library,
which is still useful. So that's done in this commit, and #2445 can be
closed.
2019-07-05 14:08:56 -04:00
Andrew Kelley
0d84d52e37 std.os.abort no longer calls msvcrt abort() when linking libc
closes #2071
2019-07-05 12:53:36 -04:00
hryx
e35d49c4d0 Unicode escapes: documentation and grammar 2019-07-04 22:52:17 -07:00
hryx
6bfa8546bb Unicode escapes: stage1 tokenizer and behavior tests 2019-07-04 22:40:19 -07:00
hryx
8365a7aab4 Unicode escapes: stage2 tokenizer and parser test 2019-07-04 14:48:23 -07:00
Andrew Kelley
72800f176e zig build: search upwards for build.zig file
closes #2587
2019-07-04 17:44:33 -04:00
Michael Dusan
47addd87ac stage1: add missing help for --override-lib-dir 2019-07-04 15:36:34 -04:00
Andrew Kelley
a8b3b5f11c zig build: install is now the default step; default prefix is zig-cache
closes #2817
2019-07-04 15:32:44 -04:00
Andrew Kelley
79e1fcfdda Merge pull request #2787 from emekoi/fix-2768
forward error code in build.zig
2019-07-04 10:57:25 -04:00
SamTebbs33
f24b8f2a4a Support returning !u8 from main 2019-07-04 14:26:05 +01:00
emekoi
9e3189f1f4 forward error code on non-exits 2019-07-03 23:48:42 -05:00
emekoi
d8135c9e6e forward error code build.zig 2019-07-03 23:48:42 -05:00
Andrew Kelley
b109155528 Merge branch 'emekoi-impl-1107' 2019-07-04 00:35:47 -04:00
Andrew Kelley
96fd103073 improve the error message and test coverage 2019-07-04 00:35:28 -04:00
Andrew Kelley
bfe0bf695b Merge branch 'impl-1107' of https://github.com/emekoi/zig into emekoi-impl-1107 2019-07-03 23:40:47 -04:00
Andrew Kelley
c2cf04086a add docs for enum literals
closes #683
2019-07-03 23:09:58 -04:00
Andrew Kelley
d1cda00b36 workaround for no equality operator for enum literal and tagged union 2019-07-03 18:41:52 -04:00
Andrew Kelley
372b615ace Merge branch 'timonkruiper-function-sections' 2019-07-03 15:47:40 -04:00
Andrew Kelley
4606baee07 add -ffunction-sections arg when building C objects
the other changes in this commit are minor tidying up
2019-07-03 15:46:27 -04:00
Andrew Kelley
2f4faf306d Merge branch 'function-sections' of https://github.com/timonkruiper/zig into timonkruiper-function-sections 2019-07-03 14:43:33 -04:00
emekoi
a1b952f4b0 added tests for #1107 and a note in the reference 2019-07-03 13:12:14 -05:00
emekoi
53ca4118bd added segfault handler support for windows 2019-07-03 14:02:48 -04:00
Andrew Kelley
a1359ac3ab Merge branch 'rbscott-comptime-union-init' 2019-07-03 13:55:50 -04:00
Andrew Kelley
4bae87764f update @unionInit to integrate with result location semantics 2019-07-03 13:40:40 -04:00
Andrew Kelley
9da054095c Merge branch 'comptime-union-init' of https://github.com/rbscott/zig into rbscott-comptime-union-init 2019-07-03 11:26:55 -04:00
Andrew Kelley
9daf0140e5 add missing compile error for comptime continue inside runtime catch
See #2604
2019-07-02 21:14:42 -04:00
Andrew Kelley
b84ff1dd32 update the default panic handler on freestanding
Now the infinite loop has a `@breakpoint()` in there.
2019-07-02 19:44:49 -04:00
Andrew Kelley
57d6724186 Merge branch 'shawnl-has-field' 2019-07-02 16:53:08 -04:00
Andrew Kelley
df11512f85 fixups 2019-07-02 16:52:55 -04:00
Andrew Kelley
140335b99f Merge branch 'has-field' of https://github.com/shawnl/zig into shawnl-has-field 2019-07-02 16:21:40 -04:00
Andrew Kelley
b05b5649df print dir name on failure to write to cache dir
closes #2429
2019-07-02 16:11:05 -04:00
Andrew Kelley
04b32d6a8a docs: mention the standard library documentation
also mention the FAQ in the README.

also link to the other documentation versions.
2019-07-02 15:21:58 -04:00
emekoi
9d42a40a9f return FileNotFound for PATH_NOT_FOUND in DeleteFileW 2019-07-02 14:49:48 -04:00
Andrew Kelley
06733c3ff5 Merge pull request #2788 from emekoi/pdb-fix
fixed coff header parsing
2019-07-02 14:48:45 -04:00
Andrew Kelley
704444a6e3 improved logic on whether to include start files 2019-07-02 14:26:54 -04:00
Timon Kruiper
bbc0d440b8 Added ZigLLVMCreateTargetMachine and pass function-sections flag
Also added extra cache line

Added the ZigLVVMCreateTargetMachine to self hosted zig code
2019-07-02 19:54:29 +02:00
Andrew Kelley
7d4a0cfed0 enable segfault stack traces in stage1 compiler 2019-07-02 13:41:17 -04:00
Andrew Kelley
1a1598c58c stack traces on segfault by default for linux-x86_64
closes #2355
2019-07-02 13:41:16 -04:00
Timon Kruiper
7586f613d5 Added function-section functionality 2019-07-01 17:49:08 +02:00
emekoi
2d85ff9465 added invalid switch prong error
added error for switch prong with different payloads and support for capturing payload on switch prongs with payloads of the same type
2019-07-01 00:27:55 -05:00
Marc Tiehuis
0dd2e93e4c Update for new fmt.zig formatting 2019-06-30 22:25:03 +12:00
hryx
0e38f7215b Define different struct size for APValue on Windows (thanks @Sahnvour) 2019-06-29 14:34:00 -07:00
emekoi
027517a0c9 added init function for Coff 2019-06-29 13:56:23 -05:00
emekoi
92b68c57b3 fix formatting 2019-06-29 13:21:27 -04:00
emekoi
8156a61de8 fix syntax highlighting 2019-06-29 13:21:27 -04:00
Michael Dusan
7a2b0cc9c4 fix stack escape in add_source_file() 2019-06-29 13:19:39 -04:00
hryx
247e567422 Don't return a slice pointing to a deceased stack address 2019-06-28 18:01:41 -07:00
hryx
102bf5200c Fix string literal: not null-terminated (thanks @mikdusan) 2019-06-28 17:40:20 -07:00
emekoi
b780dee3e8 initialize sections in openSelfDebugInfoWindows 2019-06-28 18:22:02 -05:00
emekoi
fbb0c8d639 fixed debug info on windows 2019-06-28 17:59:34 -05:00
hryx
cc74bf5136 Translate IntegralCast; add stage2 test coverage 2019-06-27 23:12:33 -07:00
Andrew Kelley
4b7e04f75a rename std/special/bootstrap.zig to std/special/start.zig 2019-06-28 02:00:56 -04:00
hryx
646268875e Use new width format option 2019-06-27 22:16:31 -07:00
hryx
2060c7c39b Merge branch 'master' into translate-c-userland 2019-06-27 22:12:34 -07:00
hryx
3e0ff32bd8 Separate with space instead of LF to prevent rendering excessive indentation 2019-06-27 21:17:27 -07:00
hryx
b4bd52cc51 Create and render big.Int from IntegerLiteral; group BinaryOperator 2019-06-27 21:02:48 -07:00
Andrew Kelley
ae72a98224 Merge pull request #2775 from SamTebbs33/alignment-docs
Add doc comments to alignment functions
2019-06-27 20:37:28 -04:00
Andrew Kelley
ff477361b0 Merge branch 'emekoi-root-import' 2019-06-27 19:16:24 -04:00
Andrew Kelley
69c7c5de09 fixups
* better detection for already seen packages
 * "root" instead of "@root"
2019-06-27 19:15:33 -04:00
Andrew Kelley
fe2d89007b Merge branch 'root-import' of https://github.com/emekoi/zig into emekoi-root-import 2019-06-27 18:38:28 -04:00
SamTebbs33
623dbb73df Add check for power of 2 to std.mem.alignBackward 2019-06-27 22:23:09 +01:00
Andrew Kelley
0a0c11685f fix for with null and T peer types and inferred result location type
See #2762
2019-06-27 17:22:35 -04:00
SamTebbs33
14abf0fda5 Add doc comments to alignment functions 2019-06-27 22:22:17 +01:00
Andrew Kelley
1b23c46138 fix switch with null and T peer types and inferred result location type
closes #2762
2019-06-27 16:54:19 -04:00
Andrew Kelley
d422d5753b avoid std.debug.global_allocator in http headers tests 2019-06-27 15:38:40 -04:00
Andrew Kelley
8a251c411d Merge branch 'daurnimator-http.headers' 2019-06-27 14:07:27 -04:00
Andrew Kelley
39112d9052 update format function for new std fmt changes 2019-06-27 14:06:29 -04:00
Andrew Kelley
ba29435f67 Merge branch 'http.headers' of https://github.com/daurnimator/zig into daurnimator-http.headers 2019-06-27 13:37:40 -04:00
Andrew Kelley
1ccf6a2c9e compile error for using slice as array init expr type
when there are more than 0 elements.

closes #2764
2019-06-27 12:24:13 -04:00
Andrew Kelley
6cd3995754 Merge branch 'daurnimator-logging-allocator' 2019-06-27 12:05:12 -04:00
Andrew Kelley
0041e00a78 fixups
* move LoggingAllocator to its own file
 * style conventions
 * add documentation
 * use `anyerror` instead of `error{}` for the stream
2019-06-27 12:04:14 -04:00
Andrew Kelley
c346b257bb Merge branch 'logging-allocator' of https://github.com/daurnimator/zig into daurnimator-logging-allocator 2019-06-27 11:20:00 -04:00
Andrew Kelley
516b5e649f better CLI error message for missing sub-architecture 2019-06-27 11:05:12 -04:00
Marc Tiehuis
3c914c63a5 Remove #2725 workaround
These were no longer being hit after the copy-elision branch was merged.

Closes #2725.
2019-06-27 21:50:24 +12:00
Andrew Kelley
6c195ede54 add test case for defer modifying return value before returned
See #961
2019-06-26 23:25:53 -04:00
Vexu
de369de312 fix comments getting removed after empty comments 2019-06-27 02:00:30 +03:00
Andrew Kelley
01ff0d4d62 Merge pull request #2602 from ziglang/copy-elision-3
result location mechanism (part of no-copy semantics)
2019-06-26 18:29:19 -04:00
Vexu
0063953d16 added better test cases 2019-06-27 00:30:34 +03:00
Andrew Kelley
517bdea754 fix incorrectly omitting variable declarations
in non-debug modes
2019-06-26 16:27:24 -04:00
Andrew Kelley
3085d29af8 Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-26 14:44:01 -04:00
Andrew Kelley
5cd4753bea add missing error code for DeleteFileW 2019-06-26 14:32:19 -04:00
Andrew Kelley
33f996bb16 all tests passing on linux 2019-06-26 14:00:44 -04:00
Luna
07c0d484ee net: quickfix on non-existing Address.family 2019-06-26 13:24:51 -04:00
Vexu
22194efe68 Merge branch 'master' into comment-in-array 2019-06-26 20:06:12 +03:00
Vexu
7325f80bb2 improved comment indentation in arrays 2019-06-26 20:03:38 +03:00
Andrew Kelley
32c6f643ae disable building self hosted compiler in test suite
Rather than fixing regressions with deprecated coroutines, I'm going
to let them regress more until #2377 is solved.
2019-06-26 12:42:08 -04:00
Andrew Kelley
ff737cc648 fix peer type resolution: unreachable, error set, unreachable 2019-06-26 12:31:51 -04:00
Vexu
fa42c99d82 fixed IfTypeExpr parsing 2019-06-26 11:04:34 -04:00
Andrew Kelley
e79e8993e6 Merge pull request #2750 from cartr/thumbv4-aeabi
compiler-rt: Support thumb versions older than armv6
2019-06-26 11:03:42 -04:00
Carter Sande
f9e26d9871 compiler-rt: use more idiomatic switch syntax 2019-06-25 22:56:09 -07:00
Andrew Kelley
b4e40cb59a fix peer type resolution with null 2019-06-26 00:36:24 -04:00
Andrew Kelley
fd4c5f54f0 all compile error tests passing 2019-06-25 19:03:56 -04:00
Andrew Kelley
0a77325916 fix several compile error test regressions 2019-06-25 18:06:03 -04:00
Andrew Kelley
da68aec339 fix infinite loop when error in peer resolution 2019-06-25 16:04:01 -04:00
Andrew Kelley
cb55803a59 fix implicit cast vector to array 2019-06-25 13:57:45 -04:00
Andrew Kelley
c61e0a078c fix union init with void payload
all std lib tests passing now
2019-06-25 11:31:38 -04:00
Marc Tiehuis
f5af349bd6 Merge pull request #2714 from ziglang/fmt-overhaul
Add positional, precision and width support to std.fmt
2019-06-25 20:15:33 +12:00
hryx
8435351581 Escape C string literals 2019-06-24 22:37:19 -07:00
Carter Sande
cd02630da8 compiler-rt: Support thumb versions older than armv6
Add versions of __aeabi_memset and __aeabi_memclr which do not use mov
instructions between low registers, as this is unsupported on thumbv4t
and thumbv5.
2019-06-24 22:32:50 -07:00
Marc Tiehuis
08e8d30dd6 Add parsing of fill and alignment in std.format
These options are now available to use when printing, however nothing
currently makes use of these.
2019-06-25 17:11:18 +12:00
Vexu
f6d83ba918 fixed comment formatting in arrays and fn params 2019-06-25 01:12:28 +03:00
Michael Dusan
de2b0cd722 fix compile error when building zig w/ clang
errors as reported on macOS w/ Xcode 10.1, 10.2 and 11.0:

src/ir.cpp:23285:16: error: variable 'bits' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
    } else if (float_type->id == ZigTypeIdFloat)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23288:13: note: uninitialized use occurs here
    switch (bits) {
            ^~~~
src/ir.cpp:23285:12: note: remove the 'if' if its condition is always true
    } else if (float_type->id == ZigTypeIdFloat)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23281:18: note: initialize the variable 'bits' to silence this warning
    unsigned bits;
2019-06-24 16:25:18 -04:00
Michael Dusan
3021e5ca67 align (vector -> array) store to result location 2019-06-24 14:52:57 -04:00
hryx
f845994839 transBinaryOperator: Add, Sub 2019-06-23 17:17:21 -07:00
hryx
69b90e0681 transStringLiteral 2019-06-23 15:06:16 -07:00
hryx
b2e06c3bf4 Observe translate mode in stage2 2019-06-23 14:32:45 -07:00
Andrew Kelley
24400d5882 Merge branch 'shawnl-simd2' 2019-06-23 17:14:28 -04:00
Andrew Kelley
7f4de2dfdb remove stray abort 2019-06-23 17:14:10 -04:00
Andrew Kelley
b2cbc59e4c Merge branch 'simd2' of https://github.com/shawnl/zig into shawnl-simd2 2019-06-23 17:10:33 -04:00
emekoi
ca3660f6bf increase stack size for mingw 2019-06-23 16:51:12 -04:00
hryx
226a23d977 stage1: always render space after fn like stage2 2019-06-23 12:46:17 -07:00
hryx
c423697c78 Merge branch 'master' into translate-c-userland 2019-06-23 12:31:22 -07:00
hryx
1c86a191da Fix order of tokens; omit 'pub' for fn types 2019-06-23 01:03:28 -07:00
Andrew Kelley
020d5b529e compile error tests only for debug mode 2019-06-23 02:06:57 -04:00
hryx
4c8b460fec Fix recursive self-referential block 2019-06-22 22:30:15 -07:00
Andrew Kelley
036cc48a82 Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-23 01:29:48 -04:00
Andrew Kelley
5e58aa4884 uncomment passing std lib tests
these ones getting skipped need to get fixed before merging the branch
2019-06-23 01:29:18 -04:00
Andrew Kelley
38568318a0 fix some legacy coroutine stuff 2019-06-23 00:41:11 -04:00
Andrew Kelley
9153b17c92 Merge pull request #2733 from emekoi/write-strings
various fixes for mingw
2019-06-22 23:51:21 -04:00
emekoi
f1c57a7f84 supress warnings for format strings on msys64 2019-06-22 20:21:48 -05:00
emekoi
3ac9e3c888 make string literal const on windows 2019-06-22 19:54:11 -05:00
hryx
4ae95d7ffc Translate assignment BinaryOperator statements 2019-06-22 17:29:36 -07:00
hryx
6325ffc3f1 Assign undefined literal (instead of null) when no init value 2019-06-22 17:29:10 -07:00
Andrew Kelley
7e303fa28f fix another crash 2019-06-22 19:02:59 -04:00
Andrew Kelley
2b1695b1b0 fix std.json regression 2019-06-22 18:54:27 -04:00
Andrew Kelley
86f362ce8e elide redundant safety check when switching on tagged unions 2019-06-22 16:18:42 -04:00
Shawn Landden
71e014caec stage1: add @sin @cos @exp @exp2 @ln @log2 @log10 @fabs @floor @ceil @trunc @round
and expand @sqrt

This revealed that the accuracy of ln is not as good as the current algorithm in
musl and glibc, and should be ported again.

v2: actually include tests
v3: fix reversal of in and out arguments on f128M_sqrt()
    add test for @sqrt on comptime_float
    do not include @nearbyInt() until it works on all targets.
2019-06-22 14:34:34 -05:00
Sahnvour
987c209b40 heap: make one global instance of DirectAllocator
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
Andrew Kelley
3c4b255a3c fix implicit cast fn call result to optional in field result 2019-06-22 13:37:13 -04:00
Andrew Kelley
65997f816b Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-22 01:19:06 -04:00
Gray Olson
be51511d29 Update langref.html.in 2019-06-22 01:15:47 -04:00
Andrew Kelley
726674b2bd fix ArenaAllocator 2019-06-22 01:13:10 -04:00
Andrew Kelley
b5f9033d82 uncomment passing std lib tests 2019-06-21 19:29:34 -04:00
Andrew Kelley
727af307c6 fix return result loc and then switch with range...
...implicit casted to error union
2019-06-21 18:21:12 -04:00
Andrew Kelley
ff6d563b04 fix implicit cast to optional to error union to return result loc 2019-06-21 17:49:54 -04:00
Andrew Kelley
5441f77672 fix implicit cast bitcast result to error union by returning 2019-06-21 16:54:46 -04:00
Andrew Kelley
142e77abbb fix extern functions returning byval structs 2019-06-21 14:44:49 -04:00
Andrew Kelley
48ccf427af fix nested orelse and nested catch 2019-06-21 14:06:01 -04:00
Andrew Kelley
4299cd4446 blocks have result location semantics 2019-06-21 13:16:55 -04:00
Shawn Landden
ebde2ff899 stage1: update fn_key_eql() for @mulAdd() on vectors 2019-06-21 08:44:20 -05:00
Marc Tiehuis
948dc7b304 Link formatting workaround to issue 2019-06-21 20:23:53 +12:00
Marc Tiehuis
11526b6e9d breaking: Add positional, precision and width support to std.fmt
This removes the odd width and precision specifiers found and replacing
them with the more consistent api described in #1358.

Take the following example:

    {1:5.9}

This refers to the first argument (0-indexed) in the argument list. It
will be printed with a minimum width of 5 and will have a precision of 9
(if applicable).

Not all types correctly use these parameters just yet. There are still
some missing gaps to fill in. Fill characters and alignment have yet to
be implemented.
2019-06-21 20:11:15 +12:00
Andrew Kelley
4f21dc8a80 fix regression with zero sized array
thanks mikdusan!
2019-06-21 00:58:18 -04:00
Andrew Kelley
708f153288 BRANCH_TODO file moved to the pull request comments 2019-06-20 22:39:13 -04:00
Andrew Kelley
0498bd40d9 fix loops with multiple break statements 2019-06-20 22:38:40 -04:00
Matthew Murray
2cbcf3f38b Fix absFloat 2019-06-20 19:34:22 -04:00
Michael Dusan
60b1cf2a83 fix macOS stack trace regression
f8f054b354 exposes the issue where
macho symbol `__mh_execute_header` is weak exported with an extra
underscore and stack traces fail due to invalid header magic.

related #2700
2019-06-20 19:29:25 -04:00
Andrew Kelley
237233b04b fix coroutines 2019-06-20 18:27:04 -04:00
Andrew Kelley
057b105fad one more test passing 2019-06-20 18:03:55 -04:00
Andrew Kelley
3c541d7be3 fix peer result loc fn call with comptime condition 2019-06-19 23:52:51 -04:00
Andrew Kelley
6217b401f9 fix labeled break inside comptime if inside runtime if 2019-06-19 23:39:49 -04:00
Andrew Kelley
78eeb6e9ae fix double getelementptr of runtime global 2019-06-19 22:29:39 -04:00
Andrew Kelley
04c25efe11 Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-19 19:01:28 -04:00
Andrew Kelley
4ffab5b85f fix optional pointer to size zero struct 2019-06-19 18:47:02 -04:00
Andrew Kelley
c7dc03fcb1 fix try not setting error code on result location 2019-06-19 17:07:05 -04:00
Andrew Kelley
96931228af fix comptime test error for empty error set 2019-06-19 16:29:46 -04:00
Andrew Kelley
974db231a0 fix extraneous nested union field instruction 2019-06-19 16:16:47 -04:00
Andrew Kelley
e36680d3bd fix detection of unable to evaluate constant expression 2019-06-19 15:18:51 -04:00
Andrew Kelley
b588a803bf fix comptime modification of const struct field 2019-06-19 14:35:59 -04:00
Shawn Landden
39ad072a84 test: include muladd.zig in behavior tests 2019-06-19 12:07:02 -05:00
Shawn Landden
fce2d2d18b stage1: add support for @mulAdd fused-multiply-add for floats and vectors of floats
Not all of the softfloat library is being built....

Vector support is very buggy at the moment, but should work when the bugs are fixed.
(as I had the same code working with another vector function, that hasn't been merged yet).
2019-06-19 12:07:02 -05:00
Shawn Landden
bbfb53d524 c: add fma and fmaf 2019-06-19 12:07:02 -05:00
Andrew Kelley
79671efd3a fix inline loop behavior with variable result loc 2019-06-18 17:43:05 -04:00
Andrew Kelley
e27da17ff2 back to many behavioral tests passing 2019-06-18 17:07:27 -04:00
joachimschmidt557
381c6a38b1 Correct the isEmpty function
Integrate isEmpty into the tests for std.atomic.Queue

Fix wrong test

Oops

Simpler checking
2019-06-18 16:31:06 -04:00
Andrew Kelley
77e0c53613 fix problem with inferred error set return result 2019-06-18 15:00:19 -04:00
Andrew Kelley
f90d17cc4d fix bitcast 2019-06-18 14:44:25 -04:00
Andrew Kelley
077f9df15b more miscellaneous fixes
when will it end
2019-06-18 14:30:17 -04:00
Jonathan Marler
c7bcf1a447 Fix windows create process retry/path search 2019-06-18 13:19:06 -04:00
Andrew Kelley
3ca4925709 Merge branch 'kristate-you-are-banned-please-fuck-off'
closes #2701
2019-06-18 11:32:31 -04:00
Andrew Kelley
9050a07540 when resolving slice types, might need to...
...resolve alignment if custom alignment is provided

fixes #2689
2019-06-18 11:31:05 -04:00
Andrew Kelley
8ed88280a6 Revert "fixes resolving aligment of child type in slice"
This reverts commit aa60d2a688.

The copyright ownership of this 10 line patch is under dispute.
See #2701 for details. So I'll revert it and then fix it myself without
looking at this patch.
2019-06-18 11:18:53 -04:00
Andrew Kelley
fdc6e0af05 fix zero length array literal casted to slice 2019-06-18 10:49:21 -04:00
Boris
99112b5d4a fix tiny typo in langref.html.in 2019-06-18 10:01:48 -04:00
Andrew Kelley
e5a0414b05 misc fixes 2019-06-17 21:55:14 -04:00
Andrew Kelley
4e182c7e9e inferred comptime array inits 2019-06-17 17:46:03 -04:00
Andrew Kelley
0568000844 fix function calls 2019-06-17 17:12:06 -04:00
Andrew Kelley
74250e434e inferred comptime union inits 2019-06-17 16:27:45 -04:00
Jonathan Marler
21dff1c4e2 Remove duplicate exe name with zig run 2019-06-17 14:10:10 -04:00
Andrew Kelley
b025193de5 inferred comptime values rather than elided scopes
because of this example:

```zig
export fn entry(b: bool) usize {
    var runtime = [1]i32{3};
    comptime var i: usize = 0;
    inline while (i < 2) : (i += 1) {
        const result = if (i == 0) [1]i32{2} else runtime;
    }
    comptime {
        return i;
    }
}
```

The problem is that the concept of "resetting" a result location,
introduced in the previous commit, cannot handle elision scopes.
This concept is inherently broken with inline loops.
2019-06-17 13:31:19 -04:00
Marc Tiehuis
d5d0942a0d Small cleanup of fmt.zig
Use inferred enum literals and split the large test case up.
2019-06-17 13:00:00 -04:00
Josh Wolfe
50c8a93a5e mem.concat 2019-06-17 01:41:33 -04:00
daurnimator
6ce2a03985 std: add gimli permutation to crypto 2019-06-16 22:55:38 -04:00
Timon Kruiper
72029c2fc8 Added HashInt to function calls AutoHash\nFixes issue 2669 2019-06-16 14:36:23 -04:00
Shawn Landden
4d3356435f stage1: check for null in buf_len and buf_ptr
follow up for f4b8850002
2019-06-16 14:26:38 -04:00
Andrew Kelley
f4b8850002 fix type info crash on extern lib name 2019-06-16 14:14:57 -04:00
Jimmi HC
aa60d2a688 fixes resolving aligment of child type in slice 2019-06-16 00:03:43 -04:00
Andrew Kelley
9564c05cd5 better result location handling of inline loops 2019-06-15 19:19:13 -04:00
Andrew Kelley
6bf193af19 better result location semantics with optionals and return locations
somewhere along this branch, #1901 has been fixed.
2019-06-15 12:28:21 -04:00
Andrew Kelley
60025a3704 Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-15 10:34:04 -04:00
Andrew Kelley
7c5ceb0c4c standard library integrates with knowledge of stripped debug info 2019-06-14 18:45:41 -04:00
Andrew Kelley
362c79140f expose builtin.strip_debug_info
zig code now can be made aware that it will not have any debug
information available at runtime.
2019-06-14 18:18:43 -04:00
Andrew Kelley
f8f054b354 fix @export for arrays not respecting the symbol name
Previously, the symbol name parameter of `@export` would be ignored for
variables, and the variable name would be used for the symbol name.
Now it works as expected.

See #2679
2019-06-14 17:23:24 -04:00
Andrew Kelley
42ea2d0d1c fix @export for arrays and allow sections on extern variables
previously `@export` for an array would panic with a TODO message.
now it will do the export. However, it uses the variable's name
rather than the name passed to `@export`. Issue #2679 remains open
for that problem.
2019-06-14 15:28:52 -04:00
Andrew Kelley
acf16b5fb3 uncomment more passing tests 2019-06-14 13:32:04 -04:00
Andrew Kelley
7c074b8516 fix peer result locs with switch 2019-06-14 11:41:53 -04:00
Andrew Kelley
2ba29a1907 fix peer result location with error code and payload 2019-06-14 11:01:38 -04:00
Andrew Kelley
fdaca1b5f3 fix a couple more test regressions 2019-06-13 20:30:39 -04:00
Andrew Kelley
eaf74f4f96 fix bitcast packed struct to integer and back 2019-06-13 20:24:10 -04:00
Andrew Kelley
57347aacd7 fix atomic builtin functions 2019-06-13 20:01:25 -04:00
Andrew Kelley
24cfa3534f allow comptime array literals casted to slices 2019-06-13 16:51:26 -04:00
Andrew Kelley
3cbe827464 fix behavior for nested array literals
new compile error for trying to cast runtime array literals to slices
2019-06-13 16:25:35 -04:00
Andrew Kelley
efb064449f fix runtime initialize array elem and then implicit cast to slice 2019-06-13 13:31:15 -04:00
Jonathan Marler
9e8db5b750 Remove const on argsAlloc 2019-06-13 11:42:17 -04:00
Josh Wolfe
82ab006e58 HashMap.getValue() 2019-06-13 11:41:34 -04:00
Jonathan Marler
8a2c2da805 Handle putNoClobber errors 2019-06-13 01:56:12 -04:00
Josh Wolfe
80fa871f4a Add HashMap apis that assert the common case
* putNoClobber() for put()
* removeAssertDiscard() for remove()
2019-06-13 00:17:12 -04:00
Andrew Kelley
ca0988e1d0 comment out the behavior tests that are failing 2019-06-12 22:19:56 -04:00
Andrew Kelley
b552e68c14 fix result loc implicit casting optionals and error unions
```zig
pub fn openHandle(handle: i32) File {
    return File{ .handle = handle };
}

pub fn getStdErr() anyerror!File {
    return openHandle(1);
}
```
2019-06-12 22:13:18 -04:00
Andrew Kelley
cdf14baa45 fix double nested peer result locations
```zig
export fn entry(x: bool) i32 {
    return if (x)
        if (x) a else b
    else
        if (x) c else d;
}
```
2019-06-12 21:46:04 -04:00
Andrew Kelley
0d62c92947 fix declref not writing to result loc
```zig
const a: i32 = 0;
const b: i32 = 1;
const c: i32 = 2;
const d: i32 = 3;

export fn entry(x: bool) i32 {
    return if (x)
        if (x)
            a
        else if (x)
            b
        else
            c
    else
        d;
}
```
2019-06-12 19:43:24 -04:00
Andrew Kelley
e6fa2ee706 fix nested peer result locs with no memory loc
```zig
export fn entry2(c: bool) i32 {
    return if (c)
        i32(0)
    else if (c)
        i32(1)
    else
        i32(2);
}
```

```llvm
define i32 @entry2(i1) #2 !dbg !35 {
Entry:
  %c = alloca i1, align 1
  store i1 %0, i1* %c, align 1
  call void @llvm.dbg.declare(metadata i1* %c, metadata !41, metadata !DIExpression()), !dbg !42
  %1 = load i1, i1* %c, align 1, !dbg !43
  br i1 %1, label %Then, label %Else, !dbg !43

Then:                                             ; preds = %Entry
  br label %EndIf3, !dbg !45

Else:                                             ; preds = %Entry
  %2 = load i1, i1* %c, align 1, !dbg !46
  br i1 %2, label %Then1, label %Else2, !dbg !46

Then1:                                            ; preds = %Else
  br label %EndIf, !dbg !47

Else2:                                            ; preds = %Else
  br label %EndIf, !dbg !47

EndIf:                                            ; preds = %Else2, %Then1
  %3 = phi i32 [ 1, %Then1 ], [ 2, %Else2 ], !dbg !47
  br label %EndIf3, !dbg !45

EndIf3:                                           ; preds = %EndIf, %Then
  %4 = phi i32 [ 0, %Then ], [ %3, %EndIf ], !dbg !45
  ret i32 %4, !dbg !48
}
```
2019-06-12 18:08:56 -04:00
Andrew Kelley
1526d89711 fix @bitCast with runtime scalar and dest result loc var 2019-06-12 15:02:46 -04:00
Andrew Kelley
35352e0f48 fix alignment problem with @bitCast result location 2019-06-12 13:49:57 -04:00
Andrew Kelley
278c7a2bc3 fix @bitCast regressions 2019-06-12 13:42:21 -04:00
emekoi
3ed6acd2d2 fixed infinite loop when caching packages 2019-06-11 19:19:44 -05:00
Andrew Kelley
ce5d50e4ed fix runtime if nested inside comptime if 2019-06-11 18:26:01 -04:00
emekoi
e12c7d88b2 made root package available to itself 2019-06-11 16:06:24 -05:00
emekoi
4ea7685a5b made root package available to all other packages 2019-06-11 16:05:56 -05:00
Andrew Kelley
b3a4ec1bd2 fix returning scalar values
```zig
export fn entry1() i32 {
    return bar();
}
```

```llvm
define i32 @entry1() #2 !dbg !35 {
Entry:
  %0 = call fastcc i32 @bar(), !dbg !39
  ret i32 %0, !dbg !41
}
```
2019-06-11 16:04:04 -04:00
Andrew Kelley
e1d14e73b5 fix @bitCast semantics when there is no parent result loc 2019-06-11 15:44:06 -04:00
Andrew Kelley
60c3861805 temporarily simplify test_runner.zig
so that this branch can start passing behavior tests. after the tests
pass, go back and undo the changes in this commit
2019-06-11 14:46:46 -04:00
Nicholas Walton
fcc0728a35 Update langref.html.in
Missing an "it"
2019-06-11 14:37:15 -04:00
Andrew Kelley
0ac566892d fix for loop index variable not in scope 2019-06-11 14:15:58 -04:00
Andrew Kelley
515092210f fix not checking return value of resolving result 2019-06-11 13:48:53 -04:00
Andrew Kelley
1c2e889820 fix struct and array init when result casted to anyerror!?T
previous commit message is incorrect, it was only for
anyerror!T
2019-06-11 13:44:09 -04:00
Andrew Kelley
fc8d881240 fix struct and array init when result casted to anyerror!?T 2019-06-11 13:27:01 -04:00
Andrew Kelley
06f307ff77 fix implicit casting return value struct/arary init to optional 2019-06-11 12:19:57 -04:00
daurnimator
43d52fa4c5 std: add std.http.Headers field
Based on lua-http's data structure
2019-06-11 22:54:40 +10:00
hryx
0f545e5a2b transReturnStmt 2019-06-10 23:06:54 -07:00
Andrew Kelley
a431a73dab fixes for crashes and compile errors 2019-06-11 01:24:55 -04:00
Andrew Kelley
b053a65573 fix comptime variables 2019-06-11 00:36:03 -04:00
Andrew Kelley
7411a88d5f fix comptime function calls 2019-06-11 00:27:10 -04:00
Andrew Kelley
33371ab55c Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-11 00:09:58 -04:00
Andrew Kelley
d504318f2e remove the final legacy stack allocation 2019-06-10 23:54:28 -04:00
Andrew Kelley
f6d4e2565e use result loc for ref instruction 2019-06-10 23:51:43 -04:00
Andrew Kelley
a0427d29e4 fix peer result locations in the face of unreachable
```zig
export fn entry() void {
    var nothing: ?*i32 = null;
    var whatever = if (nothing) |x1| i32(1) else unreachable;
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %nothing = alloca i32*, align 8
  %whatever = alloca i32, align 4
  store i32* null, i32** %nothing, align 8, !dbg !45
  call void @llvm.dbg.declare(metadata i32** %nothing, metadata !39, metadata !DIExpression()), !dbg !45
  %0 = load i32*, i32** %nothing, align 8, !dbg !46
  %1 = icmp ne i32* %0, null, !dbg !46
  br i1 %1, label %OptionalThen, label %OptionalElse, !dbg !46

OptionalThen:                                     ; preds = %Entry
  call void @llvm.dbg.declare(metadata i32** %nothing, metadata !43, metadata !DIExpression()), !dbg !46
  store i32 1, i32* %whatever, align 4, !dbg !47
  br label %OptionalEndIf, !dbg !46

OptionalElse:                                     ; preds = %Entry
  tail call fastcc void @panic(%"[]u8"* @1, %builtin.StackTrace* null), !dbg !48
  unreachable, !dbg !48

OptionalEndIf:                                    ; preds = %OptionalThen
  call void @llvm.dbg.declare(metadata i32* %whatever, metadata !44, metadata !DIExpression()), !dbg !49
  ret void, !dbg !50
}
```
2019-06-10 23:25:43 -04:00
Andrew Kelley
4582ec518f result location semantics for vector to array
```zig
export fn entry() void {
    var x: @Vector(4, i32) = undefined;
    var y: [4]i32 = x;
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %x = alloca <4 x i32>, align 16
  %y = alloca [4 x i32], align 4
  %0 = bitcast <4 x i32>* %x to i8*, !dbg !47
  call void @llvm.memset.p0i8.i64(i8* align 16 %0, i8 -86, i64 16, i1 false), !dbg !47
  call void @llvm.dbg.declare(metadata <4 x i32>* %x, metadata !39, metadata !DIExpression()), !dbg !47
  %1 = load <4 x i32>, <4 x i32>* %x, align 16, !dbg !48
  %2 = bitcast [4 x i32]* %y to <4 x i32>*, !dbg !48
  store <4 x i32> %1, <4 x i32>* %2, align 16, !dbg !48
  call void @llvm.dbg.declare(metadata [4 x i32]* %y, metadata !45, metadata !DIExpression()), !dbg !49
  ret void, !dbg !50
}
```
2019-06-10 19:49:24 -04:00
Andrew Kelley
9a324ecb42 result loc semantics for loading packed struct pointer to packed struct
```zig
export fn entry() void {
    var x = foo();
    var ptr = &x.b;
    var y = ptr.*;
}
const Foo = packed struct {
    a: u24 = 1,
    b: Bar = Bar{},
};

const Bar = packed struct {
    a: u4 = 2,
    b: u4 = 3,
};
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %x = alloca %Foo, align 1
  %ptr = alloca i32*, align 8
  %y = alloca %Bar, align 1
  call fastcc void @foo(%Foo* sret %x), !dbg !55
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !39, metadata !DIExpression()), !dbg !56
  %0 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 0, !dbg !57
  store i32* %0, i32** %ptr, align 8, !dbg !57
  call void @llvm.dbg.declare(metadata i32** %ptr, metadata !51, metadata !DIExpression()), !dbg !58
  %1 = load i32*, i32** %ptr, align 8, !dbg !59
  %2 = load i32, i32* %1, align 1, !dbg !60
  %3 = lshr i32 %2, 24, !dbg !60
  %4 = trunc i32 %3 to i8, !dbg !60
  %5 = bitcast %Bar* %y to i8*, !dbg !60
  store i8 %4, i8* %5, !dbg !60
  call void @llvm.dbg.declare(metadata %Bar* %y, metadata !54, metadata !DIExpression()), !dbg !61
  ret void, !dbg !62
}
```
2019-06-10 19:11:34 -04:00
Andrew Kelley
65f6ea66f4 result loc semantics for @sliceToBytes and @bytesToSlice 2019-06-10 18:34:27 -04:00
Andrew Kelley
ee3f7e20f6 result location semantics for cmpxchg 2019-06-10 17:49:36 -04:00
Andrew Kelley
b9c033ae1a result location semantics for error union wrapping an error 2019-06-10 17:28:25 -04:00
tgschultz
34a22a85ca altered all instances of readInt* in std.io (and std.debug) to consume the minimum byte size required instead of @sizeOf(). 2019-06-10 17:10:35 -04:00
Andrew Kelley
4f085b8d2c result location semantics for error union wrapping a payload 2019-06-10 16:55:07 -04:00
Ryan Liptak
05e92a51aa Use std.math.isPowerOfTwo across std lib 2019-06-10 16:42:39 -04:00
Andrew Kelley
eaa9d8bdac result location semantics for optional wrap 2019-06-10 16:20:13 -04:00
Andrew Kelley
c362895116 result location semantics for slices
```zig
export fn entry() void {
    var buf: [10]u8 = undefined;
    const slice1: []const u8 = &buf;
    const slice2 = buf[0..];
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %buf = alloca [10 x i8], align 1
  %slice1 = alloca %"[]u8", align 8
  %slice2 = alloca %"[]u8", align 8
  %0 = bitcast [10 x i8]* %buf to i8*, !dbg !46
  call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 -86, i64 10, i1 false), !dbg !46
  call void @llvm.dbg.declare(metadata [10 x i8]* %buf, metadata !39, metadata !DIExpression()), !dbg !46
  %1 = getelementptr inbounds %"[]u8", %"[]u8"* %slice1, i32 0, i32 0, !dbg !47
  %2 = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0, !dbg !47
  store i8* %2, i8** %1, align 8, !dbg !47
  %3 = getelementptr inbounds %"[]u8", %"[]u8"* %slice1, i32 0, i32 1, !dbg !47
  store i64 10, i64* %3, align 8, !dbg !47
  call void @llvm.dbg.declare(metadata %"[]u8"* %slice1, metadata !44, metadata !DIExpression()), !dbg !48
  %4 = getelementptr inbounds %"[]u8", %"[]u8"* %slice2, i32 0, i32 0, !dbg !49
  %5 = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 0, !dbg !49
  store i8* %5, i8** %4, align 8, !dbg !49
  %6 = getelementptr inbounds %"[]u8", %"[]u8"* %slice2, i32 0, i32 1, !dbg !49
  store i64 10, i64* %6, align 8, !dbg !49
  call void @llvm.dbg.declare(metadata %"[]u8"* %slice2, metadata !45, metadata !DIExpression()), !dbg !50
  ret void, !dbg !51
}
```
2019-06-10 15:49:45 -04:00
Andrew Kelley
17b1ac5d03 result location semantics for @bitCast
```zig
export fn entry() void {
    var x = @bitCast(f32, foo());
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %x = alloca float, align 4
  %0 = bitcast float* %x to %Foo*, !dbg !42
  call fastcc void @foo(%Foo* sret %0), !dbg !42
  call void @llvm.dbg.declare(metadata float* %x, metadata !39, metadata !DIExpression()), !dbg !43
  ret void, !dbg !44
}
```
2019-06-10 12:24:19 -04:00
Andrew Kelley
1a51bf6304 hook up result locations for union initializations
```zig
export fn entry() void {
    var x = Foo{ .bar = bar() };
}
```

```llvm
define void @entry() #2 !dbg !44 {
Entry:
  %x = alloca %Foo, align 4
  %0 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 1, !dbg !68
  store i1 true, i1* %0, align 1, !dbg !68
  %1 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 0, !dbg !68
  %2 = bitcast { i32, [4 x i8] }* %1 to %Bar*, !dbg !68
  call fastcc void @bar(%Bar* sret %2), !dbg !68
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !48, metadata !DIExpression()), !dbg !69
  ret void, !dbg !70
}
```
2019-06-10 11:15:32 -04:00
Andrew Kelley
12b2950bf2 Merge pull request #2424 from daurnimator/single-linked-list
Add SinglyLinkedList
2019-06-10 09:54:03 -04:00
hryx
84e479d94f (broken) local var decls, integer literals (part) 2019-06-09 23:35:48 -07:00
daurnimator
b0648bfbd3 std.heap.ArenaAllocator: use singly linked list 2019-06-10 15:41:40 +10:00
daurnimator
ddf7942aaa std: Add singly linked list 2019-06-10 15:41:40 +10:00
daurnimator
ed41d10a06 std: existing LinkedList is actually a TailQueue 2019-06-10 15:41:40 +10:00
Andrew Kelley
b7811d3269 whitespace cleanup 2019-06-10 00:45:24 -04:00
Andrew Kelley
9c2ed8d103 Merge pull request #2525 from daurnimator/uring
std: linux uring kernel interfaces
2019-06-10 00:43:47 -04:00
SamTebbs33
6c160b8856 Add check for null body in if, for and while 2019-06-10 00:41:33 -04:00
daurnimator
4565f50efe std: add linux kernel definitions for io_uring 2019-06-10 14:40:54 +10:00
daurnimator
ae604b4464 std: add linux kernel_rwf type and preadv2+pwritev2 2019-06-10 14:40:54 +10:00
daurnimator
a712a5515d std: testing.expectEqual on structs now works 2019-06-10 14:39:44 +10:00
Andrew Kelley
39bc82561a fix array literal syntax 2019-06-10 00:39:40 -04:00
daurnimator
ebedc99ac1 std: add math.isPowerOfTwo 2019-06-10 14:39:40 +10:00
Andrew Kelley
af35b73b99 Merge branch 'sfc64' of https://github.com/Sahnvour/zig into Sahnvour-sfc64 2019-06-10 00:38:58 -04:00
Andrew Kelley
5017a1d895 fix build on macos 2019-06-10 00:35:27 -04:00
Andrew Kelley
4e2b2822f1 inferred array size of array literals works 2019-06-09 19:55:15 -04:00
Andrew Kelley
3a4b749c8a Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-09 19:44:01 -04:00
Andrew Kelley
b735764898 different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
Andrew Kelley
59fe13772f result loc semantics for array initialization
```zig
export fn entry() void {
    var x = [3]Bar{ bar(), bar(), Bar{ .y = 12 } };
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %x = alloca [3 x %Bar], align 4
  %0 = getelementptr inbounds [3 x %Bar], [3 x %Bar]* %x, i64 0, i64 0, !dbg !48
  call fastcc void @bar(%Bar* sret %0), !dbg !48
  %1 = getelementptr inbounds [3 x %Bar], [3 x %Bar]* %x, i64 0, i64 1, !dbg !49
  call fastcc void @bar(%Bar* sret %1), !dbg !49
  %2 = getelementptr inbounds [3 x %Bar], [3 x %Bar]* %x, i64 0, i64 2, !dbg !50
  %3 = bitcast %Bar* %2 to i8*, !dbg !50
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %3, i8* align 4 bitcast (%Bar* @0 to i8*), i64 4, i1 false), !dbg !50
  call void @llvm.dbg.declare(metadata [3 x %Bar]* %x, metadata !39, metadata !DIExpression()), !dbg !51
  ret void, !dbg !52
}
```
2019-06-09 12:03:15 -04:00
Andrew Kelley
3ec766abe3 remove ResultLocField dead code 2019-06-09 10:46:13 -04:00
Sahnvour
69d9f322ee implementation of the Sfc64 RNG from PractRand 2019-06-09 15:25:21 +02:00
Sahnvour
8e0670198b allow comptime_int in math.shl and math.shr 2019-06-09 14:44:41 +02:00
markfirmware
10e33b3536 grammar 2019-06-09 01:34:13 -04:00
Jonathan Pentecost
ad064b4a0b docs: update for else example
Updates: #2614
2019-06-08 22:58:31 -04:00
hryx
586c36dd1d Restore fn decls removed during conflict 2019-06-08 17:02:00 -07:00
hryx
ad0f0562d8 Merge branch 'master' into translate-c-userland 2019-06-08 16:23:27 -07:00
hryx
ed5b8335b5 (broken) translate Paren type 2019-06-08 16:09:25 -07:00
hryx
1692a76d28 transImplictCastExpr: LValueToRValue 2019-06-08 15:57:43 -07:00
hryx
1f82c7ba22 transCStyleCastExpr 2019-06-08 15:54:15 -07:00
Andrew Kelley
771e88951a result location mechanism for struct initialization
```zig
export fn entry() void {
    const static = Foo{
        .x = 9,
        .bar = Bar{ .y = 10 },
    };
    const runtime = foo(true);
}

fn foo(c: bool) Foo {
    return Foo{
        .x = 12,
        .bar = if (c) bar1() else bar2(),
    };
}

fn bar1() Bar {
    return Bar{ .y = 34 };
}

fn bar2() Bar {
    return Bar{ .y = 56 };
}
```

```llvm
@0 = internal unnamed_addr constant %Foo { i32 9, %Bar { i32 10 } }, align 4
@1 = internal unnamed_addr constant %Bar { i32 34 }, align 4
@2 = internal unnamed_addr constant %Bar { i32 56 }, align 4

define void @entry() #2 !dbg !35 {
Entry:
  %runtime = alloca %Foo, align 4
  call void @llvm.dbg.declare(metadata %Foo* @0, metadata !39, metadata !DIExpression()), !dbg !50
  call fastcc void @foo(%Foo* sret %runtime, i1 true), !dbg !51
  call void @llvm.dbg.declare(metadata %Foo* %runtime, metadata !49, metadata !DIExpression()), !dbg !52
  ret void, !dbg !53
}

define internal fastcc void @foo(%Foo* nonnull sret, i1) unnamed_addr #2 !dbg !54 {
Entry:
  %c = alloca i1, align 1
  store i1 %1, i1* %c, align 1
  call void @llvm.dbg.declare(metadata i1* %c, metadata !60, metadata !DIExpression()), !dbg !61
  %2 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 0, !dbg !62
  store i32 12, i32* %2, align 4, !dbg !62
  %3 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 1, !dbg !64
  %4 = load i1, i1* %c, align 1, !dbg !65
  br i1 %4, label %Then, label %Else, !dbg !65

Then:                                             ; preds = %Entry
  call fastcc void @bar1(%Bar* sret %3), !dbg !66
  br label %EndIf, !dbg !64

Else:                                             ; preds = %Entry
  call fastcc void @bar2(%Bar* sret %3), !dbg !67
  br label %EndIf, !dbg !64

EndIf:                                            ; preds = %Else, %Then
  ret void, !dbg !68
}

define internal fastcc void @bar1(%Bar* nonnull sret) unnamed_addr #2 !dbg !69 {
Entry:
  %1 = bitcast %Bar* %0 to i8*, !dbg !73
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @1 to i8*), i64 4, i1 false), !dbg !73
  ret void, !dbg !73
}

define internal fastcc void @bar2(%Bar* nonnull sret) unnamed_addr #2 !dbg !75 {
Entry:
  %1 = bitcast %Bar* %0 to i8*, !dbg !76
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @2 to i8*), i64 4, i1 false), !dbg !76
  ret void, !dbg !76
}

!39 = !DILocalVariable(name: "static", scope: !40, file: !5, line: 2, type: !41)
!49 = !DILocalVariable(name: "runtime", scope: !40, file: !5, line: 6, type: !41)
```
2019-06-08 18:51:31 -04:00
Shawn Landden
720ed74413 add bcmp implementation as LLVM 9 now emits those
The optimizer will now convert calls to memcmp into a calls to bcmp
in some circumstances. Users who are building freestanding code (not
depending on the platform’s libc) without specifying -ffreestanding may
need to either pass -fno-builtin-bcmp, or provide a bcmp function.

http://llvm.org/docs/ReleaseNotes.html#non-comprehensive-list-of-changes-in-this-release
2019-06-08 17:24:30 -04:00
Shritesh Bhattarai
404e4b0268 docs: add comment about for else and break 2019-06-08 16:21:46 -04:00
Andrew Kelley
52eb347188 hook up result locs for try 2019-06-08 01:16:19 -04:00
Andrew Kelley
a2fff2628f hook up peer result locs to orelse keyword 2019-06-08 01:09:19 -04:00
Andrew Kelley
b1efba0c70 hook up peer result locs to catch
```zig
export fn entry() void {
    var x = crap() catch bar();
}
```

```llvm
define void @entry() #2 !dbg !40 {
Entry:
  %0 = alloca { i16, %Foo }, align 4
  %x = alloca %Foo, align 4
  call fastcc void @crap({ i16, %Foo }* sret %0), !dbg !50
  %1 = getelementptr inbounds { i16, %Foo }, { i16, %Foo }* %0, i32 0, i32 0, !dbg !51
  %2 = load i16, i16* %1, align 2, !dbg !51
  %3 = icmp ne i16 %2, 0, !dbg !51
  br i1 %3, label %UnwrapErrError, label %UnwrapErrOk, !dbg !51

UnwrapErrError:                                   ; preds = %Entry
  call fastcc void @bar(%Foo* sret %x), !dbg !52
  br label %UnwrapErrEnd, !dbg !51

UnwrapErrOk:                                      ; preds = %Entry
  %4 = getelementptr inbounds { i16, %Foo }, { i16, %Foo }* %0, i32 0, i32 1, !dbg !51
  %5 = bitcast %Foo* %4 to i8*, !dbg !51
  %6 = bitcast %Foo* %x to i8*, !dbg !51
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %6, i8* align 4 %5, i64 4, i1 false), !dbg !51
  br label %UnwrapErrEnd, !dbg !51

UnwrapErrEnd:                                     ; preds = %UnwrapErrOk, %UnwrapErrError
  ret void, !dbg !53
}
```
2019-06-07 17:37:29 -04:00
Andrew Kelley
2b0a1b7b14 hook up result locs to for loops
```zig
export fn entry() void {
    var buf: [10]u8 = undefined;
    var x = for (buf) |x| break foo() else bar();
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %buf = alloca [10 x i8], align 1
  %i = alloca i64, align 8
  %x = alloca %Foo, align 4
  %0 = bitcast [10 x i8]* %buf to i8*, !dbg !51
  call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 -86, i64 10, i1 false), !dbg !51
  call void @llvm.dbg.declare(metadata [10 x i8]* %buf, metadata !39, metadata !DIExpression()), !dbg !51
  store i64 0, i64* %i, align 8, !dbg !52
  call void @llvm.dbg.declare(metadata i64* %i, metadata !44, metadata !DIExpression()), !dbg !52
  br label %ForCond, !dbg !52

ForCond:                                          ; preds = %Entry
  %1 = load i64, i64* %i, align 8, !dbg !52
  %2 = icmp ult i64 %1, 10, !dbg !52
  br i1 %2, label %ForBody, label %ForElse, !dbg !52

ForBody:                                          ; preds = %ForCond
  %3 = getelementptr inbounds [10 x i8], [10 x i8]* %buf, i64 0, i64 %1, !dbg !52
  call void @llvm.dbg.declare(metadata i8* %3, metadata !45, metadata !DIExpression()), !dbg !53
  call fastcc void @foo(%Foo* sret %x), !dbg !54
  br label %ForEnd, !dbg !55

ForElse:                                          ; preds = %ForCond
  call fastcc void @bar(%Foo* sret %x), !dbg !56
  br label %ForEnd, !dbg !52

ForEnd:                                           ; preds = %ForElse, %ForBody
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !46, metadata !DIExpression()), !dbg !57
  ret void, !dbg !58
}
```
2019-06-07 15:58:18 -04:00
Andrew Kelley
ede3436b08 hook up peer result locs to while bool and optional 2019-06-07 15:48:28 -04:00
Andrew Kelley
ec8d8a9774 hook up while on error unions with result locations
```zig
export fn entry() void {
    var c: anyerror!i32 = 1234;
    var x = while (c) |y| break foo() else |e| bar();
}
```

```llvm
define void @entry() #2 !dbg !39 {
Entry:
  %c = alloca { i16, i32 }, align 4
  %x = alloca %Foo, align 4
  %0 = bitcast { i16, i32 }* %c to i8*, !dbg !56
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !56
  call void @llvm.dbg.declare(metadata { i16, i32 }* %c, metadata !43, metadata !DIExpression()), !dbg !56
  br label %WhileCond, !dbg !57

WhileCond:                                        ; preds = %Entry
  %1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !58
  %2 = load i16, i16* %1, align 2, !dbg !58
  %3 = icmp ne i16 %2, 0, !dbg !58
  br i1 %3, label %WhileElse, label %WhileBody, !dbg !58

WhileBody:                                        ; preds = %WhileCond
  %4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 1, !dbg !57
  call void @llvm.dbg.declare(metadata i32* %4, metadata !50, metadata !DIExpression()), !dbg !57
  call fastcc void @foo(%Foo* sret %x), !dbg !59
  br label %WhileEnd, !dbg !60

WhileElse:                                        ; preds = %WhileCond
  %5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !61
  call void @llvm.dbg.declare(metadata i16* %5, metadata !51, metadata !DIExpression()), !dbg !61
  call fastcc void @bar(%Foo* sret %x), !dbg !61
  br label %WhileEnd, !dbg !57

WhileEnd:                                         ; preds = %WhileElse, %WhileBody
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !52, metadata !DIExpression()), !dbg !62
  ret void, !dbg !63
}
```
2019-06-07 15:22:21 -04:00
Andrew Kelley
0e8b65c537 hook up peer result locs to if optional and if err 2019-06-07 14:49:26 -04:00
Andrew Kelley
ec17f4ebbe fix behavior for peer result locs with one prong unreachable 2019-06-07 14:20:35 -04:00
Andrew Kelley
5784631fab update the default macos version min to 10.14 2019-06-07 12:20:02 -04:00
Andrew Kelley
786f3cdd13 ci: let's try a new build of llvm+clang on 10.14 2019-06-07 12:07:23 -04:00
Andrew Kelley
4c222a482f fix behavior for non sret fn calls 2019-06-07 11:51:50 -04:00
Andrew Kelley
76a3938d69 no-copy semantics for peer result function calls
```zig
export fn entry() void {
    var c = true;
    var x = if (c) foo() else bar();
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %c = alloca i1, align 1
  %x = alloca %Foo, align 4
  store i1 true, i1* %c, align 1, !dbg !47
  call void @llvm.dbg.declare(metadata i1* %c, metadata !39, metadata !DIExpression()), !dbg !48
  %0 = load i1, i1* %c, align 1, !dbg !49
  br i1 %0, label %Then, label %Else, !dbg !49

Then:                                             ; preds = %Entry
  call fastcc void @foo(%Foo* sret %x), !dbg !50
  br label %EndIf, !dbg !51

Else:                                             ; preds = %Entry
  call fastcc void @bar(%Foo* sret %x), !dbg !52
  br label %EndIf, !dbg !51

EndIf:                                            ; preds = %Else, %Then
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !42, metadata !DIExpression()), !dbg !53
  ret void, !dbg !54
}
```
2019-06-07 11:34:47 -04:00
Andrew Kelley
fb5e03b983 Merge pull request #2628 from emekoi/error-unexpected
windows.unexpectedError prints a human friendly string
2019-06-06 12:37:51 -04:00
Andrew Kelley
a682b0acb6 Merge pull request #2630 from squeek502/hashmap-pow2
std.HashMap: optimize by taking advantage of power of two capacity
2019-06-06 12:26:27 -04:00
Ryan Liptak
8f4229a61c std.HashMap: use std.math.ceilPowerOfTwo 2019-06-05 23:36:51 -07:00
Ryan Liptak
656ac43735 std.HashMap: optimize indexing by avoiding modulo operator
x % y can be optimized if y is a power of two by doing x & (y-1) instead. HashMap already enforces power of two capacity, so we can take advantage of this optimization.
2019-06-05 23:26:48 -07:00
emekoi
26613bfa01 switched to fixed-length buffer for error messages 2019-06-05 17:34:58 -05:00
emekoi
0288034c2f fixed mismatched types 2019-06-05 15:30:01 -05:00
emekoi
ddfab40e30 updated std.c.{freebsd, netbsd} to usingnamespace 2019-06-05 16:06:21 -04:00
emekoi
0aabfb09f9 removed duplicate definitions 2019-06-05 14:57:20 -05:00
emekoi
b74bcc9d76 windows.unexpectedError prints a human friendly string 2019-06-05 14:42:36 -05:00
mrkishi
fdddd13106 add cache-control headers to tarballs on ci 2019-06-04 23:25:24 -04:00
Andrew Kelley
ca989a95d3 Merge pull request #2617 from squeek502/ceil-power-of-two
std.math: Add ceilPowerOfTwo and ceilPowerOfTwoPromote
2019-06-04 23:24:34 -04:00
Ryan Liptak
a0d66fa1e6 std.math: Clarify ceilPowerOfTwo inputs and disallow zero as an input 2019-06-04 15:49:27 -07:00
Andrew Kelley
b19b1c1298 no-copy semantics for switch expressions
```zig
export fn entry() void {
    var c: i32 = 1234;
    var x = switch (c) {
        1 => u8(1),
        2...4 => u16(2),
        else => u32(3),
    };
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %c = alloca i32, align 4
  %x = alloca i32, align 4
  store i32 1234, i32* %c, align 4, !dbg !44
  call void @llvm.dbg.declare(metadata i32* %c, metadata !39, metadata !DIExpression()), !dbg !44
  %0 = load i32, i32* %c, align 4, !dbg !45
  %1 = icmp sge i32 %0, 2, !dbg !46
  %2 = icmp sle i32 %0, 4, !dbg !46
  %3 = and i1 %1, %2, !dbg !46
  br i1 %3, label %SwitchRangeYes, label %SwitchRangeNo, !dbg !46

SwitchRangeYes:                                   ; preds = %Entry
  br label %SwitchEnd, !dbg !45

SwitchElse:                                       ; preds = %SwitchRangeNo
  br label %SwitchEnd, !dbg !45

SwitchProng:                                      ; preds = %SwitchRangeNo
  br label %SwitchEnd, !dbg !45

SwitchEnd:                                        ; preds = %SwitchProng, %SwitchElse, %SwitchRangeYes
  %4 = phi i32 [ 2, %SwitchRangeYes ], [ 3, %SwitchElse ], [ 1, %SwitchProng ], !dbg !45
  store i32 %4, i32* %x, align 4, !dbg !45
  call void @llvm.dbg.declare(metadata i32* %x, metadata !42, metadata !DIExpression()), !dbg !47
  ret void, !dbg !48

SwitchRangeNo:                                    ; preds = %Entry
  switch i32 %0, label %SwitchElse [
    i32 1, label %SwitchProng
  ], !dbg !45
}
```
2019-06-04 14:47:01 -04:00
Nick Erdmann
d83b15febf src/ast_render.cpp: fix rendering of character literals <= 0x0f 2019-06-04 13:00:41 -04:00
LemonBoy
291aaee977 Stop the musl builder from skipping necessary files
The code assumed that the architecture-specific bits, found in the arch/
subfolder, were only overrides for the generic .c files.

Changed the logic to always include the whole architecture-specific
implementations and discard the generic ones, this way we won't exclude
files with no .c counterpart.
2019-06-04 12:45:02 -04:00
Timon Kruiper
fd771ea9fb Added LineComment support when MultiLines are used in ArrayInit
also added the corresponding testcase
2019-06-04 12:44:50 -04:00
Andrew Kelley
7eb82b8651 std.os.mmap: update doc comments for previous commits 2019-06-04 12:31:20 -04:00
Andrew Kelley
a608ebaa50 Merge pull request #2581 from LemonBoy/misc-stuff
Miscellaneous stdlib changes
2019-06-04 12:30:38 -04:00
Andrew Kelley
8e109aec6b Merge pull request #2620 from LemonBoy/debug-stuff
Small changes to debug info emitter
2019-06-04 11:58:09 -04:00
LemonBoy
80cd142c96 Propagate DIFlags to LLVM 2019-06-04 09:05:33 +02:00
LemonBoy
ebe921e48f Make void a signed type
Follow the convention set by C so that lldb stops complaining about it.
2019-06-04 09:05:12 +02:00
Andrew Kelley
057b96006b fix the rest of the ir_build_alloca_src callsites
except for switch expressions
2019-06-03 22:21:50 -04:00
Andrew Kelley
a32abcd365 no-copy semantics for if optional and if error union
if expressions no longer introduce a stack allocation.

```zig
export fn entry() void {
    var x: anyerror!i32 = 1234;
    if (x) |i| {} else |e| {}
}
```

```llvm
define void @entry() #2 !dbg !39 {
Entry:
  %x = alloca { i16, i32 }, align 4
  %0 = bitcast { i16, i32 }* %x to i8*, !dbg !52
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !52
  call void @llvm.dbg.declare(metadata { i16, i32 }* %x, metadata !43, metadata !DIExpression()), !dbg !52
  %1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %x, i32 0, i32 0, !dbg !53
  %2 = load i16, i16* %1, align 2, !dbg !53
  %3 = icmp ne i16 %2, 0, !dbg !53
  br i1 %3, label %TryElse, label %TryOk, !dbg !53

TryOk:                                            ; preds = %Entry
  %4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %x, i32 0, i32 1, !dbg !53
  call void @llvm.dbg.declare(metadata i32* %4, metadata !50, metadata !DIExpression()), !dbg !53
  br label %TryEnd, !dbg !53

TryElse:                                          ; preds = %Entry
  %5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %x, i32 0, i32 0, !dbg !53
  call void @llvm.dbg.declare(metadata i16* %5, metadata !51, metadata !DIExpression()), !dbg !53
  br label %TryEnd, !dbg !53

TryEnd:                                           ; preds = %TryElse, %TryOk
  ret void, !dbg !54
}
```
2019-06-03 21:53:32 -04:00
Andrew Kelley
143d6ada8f no-copy semantics for for loops
Note that only the index variable requires a stack allocation, and the
memcpy for the element is gone.

```zig
export fn entry() void {
    var buf: [10]i32 = undefined;
    for (buf) |x| {}
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %buf = alloca [10 x i32], align 4
  %i = alloca i64, align 8
  %0 = bitcast [10 x i32]* %buf to i8*, !dbg !47
  call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 -86, i64 40, i1 false), !dbg !47
  call void @llvm.dbg.declare(metadata [10 x i32]* %buf, metadata !39, metadata !DIExpression()), !dbg !47
  store i64 0, i64* %i, align 8, !dbg !48
  call void @llvm.dbg.declare(metadata i64* %i, metadata !45, metadata !DIExpression()), !dbg !48
  br label %ForCond, !dbg !48

ForCond:                                          ; preds = %ForBody, %Entry
  %1 = load i64, i64* %i, align 8, !dbg !48
  %2 = icmp ult i64 %1, 10, !dbg !48
  br i1 %2, label %ForBody, label %ForEnd, !dbg !48

ForBody:                                          ; preds = %ForCond
  %3 = getelementptr inbounds [10 x i32], [10 x i32]* %buf, i64 0, i64 %1, !dbg !48
  call void @llvm.dbg.declare(metadata i32* %3, metadata !46, metadata !DIExpression()), !dbg !49
  %4 = add nuw i64 %1, 1, !dbg !48
  store i64 %4, i64* %i, align 8, !dbg !48
  br label %ForCond, !dbg !48

ForEnd:                                           ; preds = %ForCond
  ret void, !dbg !50
}
```
2019-06-03 21:40:56 -04:00
Andrew Kelley
d4054e35fe while loops
Note that neither the payload capture variable nor the error capture
variable require a stack allocation.

```zig
export fn entry() void {
    var c: anyerror!i32 = 1234;
    while (c) |hi| {} else |e| {}
}
```

```llvm
define void @entry() #2 !dbg !39 {
Entry:
  %c = alloca { i16, i32 }, align 4
  %0 = bitcast { i16, i32 }* %c to i8*, !dbg !52
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast ({ i16, i32 }* @0 to i8*), i64 8, i1 false), !dbg !52
  call void @llvm.dbg.declare(metadata { i16, i32 }* %c, metadata !43, metadata !DIExpression()), !dbg !52
  br label %WhileCond, !dbg !53

WhileCond:                                        ; preds = %WhileBody, %Entry
  %1 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !54
  %2 = load i16, i16* %1, align 2, !dbg !54
  %3 = icmp ne i16 %2, 0, !dbg !54
  br i1 %3, label %WhileElse, label %WhileBody, !dbg !54

WhileBody:                                        ; preds = %WhileCond
  %4 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 1, !dbg !53
  call void @llvm.dbg.declare(metadata i32* %4, metadata !50, metadata !DIExpression()), !dbg !53
  br label %WhileCond, !dbg !53

WhileElse:                                        ; preds = %WhileCond
  %5 = getelementptr inbounds { i16, i32 }, { i16, i32 }* %c, i32 0, i32 0, !dbg !55
  call void @llvm.dbg.declare(metadata i16* %5, metadata !51, metadata !DIExpression()), !dbg !55
  ret void, !dbg !56
}
```
2019-06-03 20:56:22 -04:00
Andrew Kelley
b6108eed52 fix alignment of consts 2019-06-03 19:11:41 -04:00
Andrew Kelley
eb8a132d23 var types, alignment, and comptime 2019-06-03 17:46:58 -04:00
Andrew Kelley
735543d502 add missing ir_expr_wrap calls 2019-06-03 15:44:53 -04:00
Ryan Liptak
9bed6e1bf9 std.math: Add ceilPowerOfTwo and ceilPowerOfTwoPromote
Closes #2426
2019-06-02 22:09:22 -07:00
tgschultz
3eca5a42e6 fixed Deserializer.alignToByte() and added test coverage 2019-06-01 20:34:10 -04:00
LemonBoy
46cbed621b Move dl_iterate_phdr to os.zig 2019-05-31 11:59:53 +02:00
LemonBoy
4b30e40a91 Remove length restriction in mmap wrapper 2019-05-31 11:48:42 +02:00
Shritesh Bhattarai
6d73e5de05 doc: recommend optional pointers for nullptrs instead of allowzero 2019-05-31 02:26:19 -04:00
Andrew Kelley
ccce3d8526 no-copy semantics for function forwarding
```zig
fn foo() Foo {
    return bar();
}
```

```llvm
define internal fastcc void @foo(%Foo* nonnull sret) unnamed_addr #2 !dbg !48 {
Entry:
  call fastcc void @bar(%Foo* sret %0), !dbg !52
  ret void, !dbg !54
}
```
2019-05-31 01:36:57 -04:00
Andrew Kelley
461382ae94 no-copy semantics for function call init var and literal
```zig
export fn entry() void {
    var x = foo();
}
const Foo = struct {
    x: i32,
};
fn foo() Foo {
    return Foo{
        .x = 1234,
    };
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %x = alloca %Foo, align 4
  call fastcc void @foo(%Foo* sret %x), !dbg !45
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !39, metadata !DIExpression()), !dbg !46
  ret void, !dbg !47
}
define internal fastcc void @foo(%Foo* nonnull sret) unnamed_addr #2 !dbg !48 {
Entry:
  %1 = bitcast %Foo* %0 to i8*, !dbg !52
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Foo* @0 to i8*), i64 4, i1 false), !dbg !52
  ret void, !dbg !52
}
```
2019-05-31 01:08:16 -04:00
Andrew Kelley
8aba0643a5 peer result locations with mixed runtime/comptime
```zig
export fn entry() void {
    var c = true;
    var a = u8(4);
    const x = if (c) a else u32(8);
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %c = alloca i1, align 1
  %a = alloca i8, align 1
  %x = alloca i32, align 4
  store i1 true, i1* %c, align 1, !dbg !45
  call void @llvm.dbg.declare(metadata i1* %c, metadata !39, metadata !DIExpression()), !dbg !46
  store i8 4, i8* %a, align 1, !dbg !47
  call void @llvm.dbg.declare(metadata i8* %a, metadata !42, metadata !DIExpression()), !dbg !48
  %0 = load i1, i1* %c, align 1, !dbg !49
  br i1 %0, label %Then, label %Else, !dbg !49

Then:                                             ; preds = %Entry
  %1 = load i8, i8* %a, align 1, !dbg !50
  %2 = zext i8 %1 to i32, !dbg !50
  br label %EndIf, !dbg !51

Else:                                             ; preds = %Entry
  br label %EndIf, !dbg !51

EndIf:                                            ; preds = %Else, %Then
  %3 = phi i32 [ %2, %Then ], [ 8, %Else ], !dbg !51
  store i32 %3, i32* %x, align 4, !dbg !51
  call void @llvm.dbg.declare(metadata i32* %x, metadata !43, metadata !DIExpression()), !dbg !52
  ret void, !dbg !53
}
```
2019-05-31 00:54:10 -04:00
Andrew Kelley
3702c278e3 local consts with comptime init exprs
```zig
export fn entry() void {
    const x = if (true) u8(4) else u32(8);
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  call void @llvm.dbg.declare(metadata i8* @0, metadata !39, metadata !DIExpression()), !dbg !41
  ret void, !dbg !42
}
```
2019-05-31 00:22:12 -04:00
Andrew Kelley
95d9835898 no-copy semantics for nested if
```zig
export fn entry() void {
    var c = true;
    var x = if (c) u8(4) else if (c) u16(100) else u32(10);
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %c = alloca i1, align 1
  %x = alloca i32, align 4
  store i1 true, i1* %c, align 1, !dbg !44
  call void @llvm.dbg.declare(metadata i1* %c, metadata !39, metadata !DIExpression()), !dbg !45
  %0 = load i1, i1* %c, align 1, !dbg !46
  br i1 %0, label %Then2, label %Else, !dbg !46

Else:                                             ; preds = %Entry
  %1 = load i1, i1* %c, align 1, !dbg !47
  br i1 %1, label %Then, label %Else1, !dbg !47

Then:                                             ; preds = %Else
  br label %EndIf, !dbg !48

Else1:                                            ; preds = %Else
  br label %EndIf, !dbg !48

Then2:                                            ; preds = %Entry
  br label %EndIf3, !dbg !49

EndIf:                                            ; preds = %Else1, %Then
  %2 = phi i32 [ 100, %Then ], [ 10, %Else1 ], !dbg !48
  br label %EndIf3, !dbg !49

EndIf3:                                           ; preds = %EndIf, %Then2
  %3 = phi i32 [ 4, %Then2 ], [ %2, %EndIf ], !dbg !49
  store i32 %3, i32* %x, align 4, !dbg !49
  call void @llvm.dbg.declare(metadata i32* %x, metadata !42, metadata !DIExpression()), !dbg !50
  ret void, !dbg !51
}
```
2019-05-30 23:25:37 -04:00
Andrew Kelley
a4aca78722 no-copy semantics for if expr
```zig
export fn entry() void {
    var c = true;
    var x = if (c) u8(4) else u32(10);
}
```

```llvm
define void @entry() #2 !dbg !35 {
Entry:
  %c = alloca i1, align 1
  %x = alloca i32, align 4
  store i1 true, i1* %c, align 1, !dbg !44
  call void @llvm.dbg.declare(metadata i1* %c, metadata !39, metadata !DIExpression()), !dbg !45
  %0 = load i1, i1* %c, align 1, !dbg !46
  br i1 %0, label %Then, label %Else, !dbg !46

Then:                                             ; preds = %Entry
  br label %EndIf, !dbg !47

Else:                                             ; preds = %Entry
  br label %EndIf, !dbg !47

EndIf:                                            ; preds = %Else, %Then
  %1 = phi i32 [ 4, %Then ], [ 10, %Else ], !dbg !47
  store i32 %1, i32* %x, align 4, !dbg !47
  call void @llvm.dbg.declare(metadata i32* %x, metadata !42, metadata !DIExpression()), !dbg !48
  ret void, !dbg !49
}
```
2019-05-30 23:16:11 -04:00
Andrew Kelley
5e1003bc81 no-copy semantics for basic runtime function call variable init
```zig
export fn entry() void {
    var x: Foo = foo();
}
```

```llvm
define void @entry() #2 !dbg !37 {
Entry:
  %x = alloca %Foo, align 4
  call fastcc void @foo(%Foo* sret %x), !dbg !48
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !41, metadata !DIExpression()), !dbg !49
  ret void, !dbg !50
}
```
2019-05-30 17:11:14 -04:00
Andrew Kelley
0ccd91faea Merge pull request #2593 from LemonBoy/aarch64-stuff
Fix some syscalls on arm64
2019-05-30 15:48:22 -04:00
Andrew Kelley
78f32259da default struct field initialization expressions
closes #485
2019-05-30 15:46:11 -04:00
Andrew Kelley
7878f9660f dep tokenizer: run zig fmt and move exports to canonical location 2019-05-30 12:07:55 -04:00
Andrew Kelley
5954d5235f Merge pull request #2182 from mikdusan/issue.2046
new .d file parser for stage1 compiler
2019-05-30 11:53:08 -04:00
LemonBoy
51fc375b0d Correct flag definitions for arm64 2019-05-30 17:05:39 +02:00
LemonBoy
477ee9c8b9 Fix some syscalls on arm64 2019-05-30 16:28:33 +02:00
Andrew Kelley
8ca294c430 update load dynamic library test for std lib changes 2019-05-30 00:04:11 -04:00
tgschultz
8eaf1387c7 Fix fmt.zig handling of slices of slices
Discovered while calling testing.expectError on an error union with payload [][]const u8. Even though the payload was not going to be printed, the current format handling caused a compile error anyway because it couldn't be casted to []const u8. The new handling treats a []u8 as a string but otherwise treats the slice as a pointer.
2019-05-29 20:46:08 -04:00
tgschultz
f9e7bd2682 std.meta/trait: def/definition => decl/declaration
TypeInfo: defs/Definition => decls/Declarations
2019-05-29 20:43:07 -04:00
Andrew Kelley
01a4897da5 improve the libc of wasm32-freestanding target
* introduce wasm32-freestanding-musl .h files to fix
   conflicts with stddef.h and errno.h
 * fix an issue with zig build system regarding installation of
   webassembly libraries
 * add implementations to zig's libc:
   - strcmp
   - strncmp
   - strerror
   - strlen

See #514
2019-05-29 20:32:27 -04:00
Shawn Landden
4188faeac5 stage1: AstNodes cannot be casted, but are rather accessed via a union.
Unlike IrInstruction[Foo]s, which all start with:
    IrInstruction base;
AstNodes do not work like this, and instead use a pointer to their
specializations. The code assumed otherwise.
2019-05-29 20:21:07 -04:00
Timon Kruiper
4e1f3a9ba3 Correct formatting for multiline string in arrays 2019-05-29 19:56:28 -04:00
Andrew Kelley
7bfae39c5c Merge branch 'NBonaparte-linuxdynlib' 2019-05-29 19:49:10 -04:00
NBonaparte
e716c9ba4b build_examples: reenable load_dynamic_library 2019-05-29 19:48:36 -04:00
NBonaparte
dab1dc79a7 LinuxDynLib: remove MAP_LOCKED flag 2019-05-29 19:48:36 -04:00
Andrew Kelley
345501a72d Merge pull request #2567 from emekoi/fix-dynlib
remove allocator from DynLib
2019-05-29 19:41:16 -04:00
Andrew Kelley
c66a747045 Merge pull request #2546 from LemonBoy/sigaltstack
Add sigaltstack syscall for Linux
2019-05-29 19:38:01 -04:00
Andrew Kelley
bfc86776d5 run zig fmt to update use to usingnamespace 2019-05-29 19:09:58 -04:00
Andrew Kelley
8a4ee5942b zig fmt: fix 2 bugs of mangling source files 2019-05-29 19:09:58 -04:00
Andrew Kelley
b7a82288ad change use to usingnamespace
See #2014

`use` syntax is still accepted for now. `zig fmt` automatically
updates code. After a release cycle the old syntax will be removed.
2019-05-29 19:09:58 -04:00
hryx
3e14f86f9e Implement missing clang functions from last commit 2019-05-29 15:33:44 -07:00
Andrew Kelley
9a7cf73b3b main: set subsystem in zig builtin when explicitly provided 2019-05-29 18:18:18 -04:00
Andrew Kelley
6dbaae4c46 Merge branch 'emekoi-builtin-subsystem' 2019-05-29 17:14:34 -04:00
Andrew Kelley
3819654c39 codegen: initialize subsystem 2019-05-29 16:55:02 -04:00
Andrew Kelley
1ab0ac3ea2 cleanups for windows subsystem in builtin.zig 2019-05-29 16:55:02 -04:00
emekoi
b461e600e2 set subsystem to null if not on windows or uefi 2019-05-29 16:55:01 -04:00
emekoi
6bc5b07e3e try to resolve TargetSubSystemAuto to actual subsystem 2019-05-29 16:55:01 -04:00
emekoi
fb5dc28921 added subsystem to builtin.zig 2019-05-29 16:54:59 -04:00
LemonBoy
b8d1060f0a Add missing sigaltstack definition for darwin 2019-05-29 22:38:14 +02:00
LemonBoy
399e026cc0 Add sigaltstack wrapper in os.zig 2019-05-29 22:38:14 +02:00
Andrew Kelley
7017388e9e Merge branch 'LemonBoy-use-struct-pt2' 2019-05-29 16:32:16 -04:00
Andrew Kelley
1ccbd1fb67 use works on unions and enums in addition to structs 2019-05-29 16:31:49 -04:00
Andrew Kelley
9891c4f30d Merge branch 'use-struct-pt2' of https://github.com/LemonBoy/zig into LemonBoy-use-struct-pt2 2019-05-29 15:48:49 -04:00
Michael Dusan
2975bdc684 add review changes
- use std.heap.c_allocator
- use @panic instead of unreachable
- use extern enum for tokenizer result type
2019-05-29 14:39:13 -04:00
Andrew Kelley
f9ada1cfba Merge pull request #2530 from gonzus/gonzus/improve-clang-zig
Add declarations missing from clang.zig
2019-05-29 10:47:23 -04:00
Andrew Kelley
b66438eb80 no "use of undeclared identifer" in dead comptime branches 2019-05-28 18:19:27 -04:00
LemonBoy
528c151a55 Reject undefined as type
Make analyze_type_expr behave like ir_resolve_type when the user tries
to use `undefined` as a type.

Closes #2436
2019-05-28 18:02:57 -04:00
LemonBoy
a169d844c7 Warn the user if run/test is paired with emit options 2019-05-28 17:50:28 -04:00
LemonBoy
048169cbea Avoid a crash when there are no namespace components
Fixes #2500
2019-05-28 17:49:37 -04:00
Andrew Kelley
9d16839420 fix invalid LLVM IR generated for ?*void const casts
closes #2578
2019-05-28 16:11:36 -04:00
Andrew Kelley
508fdfea72 link to contributing in readme 2019-05-28 14:53:01 -04:00
Andrew Kelley
a37ea5acf3 extract CONTRIBUTING.md from README.md 2019-05-28 14:50:02 -04:00
Andrew Kelley
8a65478801 Create FUNDING.yml 2019-05-28 14:36:03 -04:00
LemonBoy
e2c2263434 Move __zig_fail_unwrap locals on stack 2019-05-28 13:02:45 -04:00
Andrew Kelley
568dc56232 Merge branch 'LemonBoy-guard-pages-in-threads' 2019-05-28 12:47:10 -04:00
Andrew Kelley
c518b7b8bf thread.spawn: bubble up mprotect error.OutOfMemory 2019-05-28 12:46:44 -04:00
LemonBoy
381f845287 Add a guard page for each thread 2019-05-28 18:26:38 +02:00
LemonBoy
594366a482 Fix os.mprotect signature 2019-05-28 18:25:48 +02:00
emekoi
f2b64fd18f updated dynamic libraries to new std 2019-05-28 11:18:30 -05:00
Gonzalo Diethelm
6547468af6 clang.zig cleanup #9: rename arg0 to self 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
8d50d4f3fc clang.zig cleanup #8: add missing consts 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
b639447263 clang.zig cleanup #7: add missing struct 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
f4b4ea402e clang.zig cleanup #6: move block around 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
fd9e63da53 clang.zig cleanup #5: add missing enums 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
7f1dd05fa7 clang.zig cleanup #4: move block around 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
5df2e791c2 clang.zig cleanup #3: move block around 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
abf97cc232 clang.zig cleanup #2: move block around 2019-05-28 18:05:08 +02:00
Gonzalo Diethelm
333c050a1d clang.zig cleanup #1: move block around 2019-05-28 18:05:07 +02:00
Gonzalo Diethelm
775a25b7fd Add declarations missing from clang.zig 2019-05-28 18:05:07 +02:00
emekoi
b8cd4b18b0 remove unneed allocator from DynLib 2019-05-28 10:34:35 -05:00
LemonBoy
bcdbd8d169 Add sigaltstack syscall 2019-05-28 15:22:19 +02:00
hryx
e632c2ade3 (broken) port a bunch of stuff from stage1 translate-c 2019-05-27 23:55:48 -07:00
Andrew Kelley
d1b6f29d22 Merge pull request #2523 from shritesh/wasmdoc
docs: wasm
2019-05-27 22:37:15 -04:00
hryx
b558d0996a expr: DeclRefExpr 2019-05-27 19:20:23 -07:00
emekoi
3f302594b8 respect subsystem flag in all cases 2019-05-27 22:15:33 -04:00
Andrew Kelley
f924fbddcf Merge pull request #2552 from Sahnvour/issue-2543
gen-h: do not output visibility macros when the build is static
2019-05-27 21:51:34 -04:00
hryx
e07888e54c expr: FunctionToPointerDecay & ArrayToPointerDecay for ImplicitCastExpr 2019-05-27 18:18:27 -07:00
Andrew Kelley
2c0280ba08 improve the stack check CLI options
See #2526
2019-05-27 20:59:19 -04:00
hryx
22299869ba Prevent infinite recursion 2019-05-27 17:54:40 -07:00
hryx
e1f3eec9cc Merge branch 'master' into translate-c-userland 2019-05-27 17:24:21 -07:00
Andrew Kelley
3fccc07479 self-hosted translate-c: fix bad memory arena references 2019-05-27 20:22:15 -04:00
Michael Dusan
d4b241c14e new .d file parser for C compilation
- wip for #2046
- clang .d output must be created with `clang -MV` switch
- implemented in Zig
- hybridized for zig stage0 and stage1
- zig test src-self-hosted/dep_tokenizer.zig
2019-05-27 19:47:10 -04:00
Andrew Kelley
f68d8060ec Merge pull request #2526 from LemonBoy/arch-format-osx
Build archives using the K_DARWIN format when targeting osx
2019-05-27 19:25:58 -04:00
Andrew Kelley
6a56091213 Merge pull request #2527 from ziglang/posix-layer
rework the API layers between the standard library and the operating system
2019-05-27 19:21:17 -04:00
hryx
2aa1c5da5d Remove unused local struct type 2019-05-27 15:58:21 -07:00
LemonBoy
d110818cfe Trigger rebuild on sr.ht 2019-05-28 00:12:09 +02:00
hryx
3bbee1ba2e expr: BitCast for ImplicitCastExpr 2019-05-27 14:38:09 -07:00
Andrew Kelley
3640303ce1 freebsd fixes 2019-05-27 17:28:59 -04:00
Andrew Kelley
af4b8eb6c0 windows does not integrate cleanly with libc 2019-05-27 15:55:15 -04:00
Andrew Kelley
86bb7e5984 fixes for windows to build self hosted compiler 2019-05-27 15:55:15 -04:00
Andrew Kelley
5de07ab721 revert hello world examples. macos tests passing 2019-05-27 15:48:31 -04:00
Andrew Kelley
db0a5e7516 darwin: add missing error handling 2019-05-27 15:14:35 -04:00
Andrew Kelley
b3dc1c380d use close$NOCANCEL on darwin 2019-05-27 14:41:13 -04:00
Andrew Kelley
13265cf7c7 std.fs: fix error set regressions on linux 2019-05-27 14:32:12 -04:00
Andrew Kelley
06435535d3 fixes for darwin 2019-05-27 14:12:50 -04:00
Andrew Kelley
f1610f6c1d nanosleep: move windows logic to std.time 2019-05-27 12:16:32 -04:00
Andrew Kelley
abf959a0c9 fix debug builds of WASI 2019-05-27 02:16:05 -04:00
Andrew Kelley
fda7e0bb01 std lib fixes for zig build on windows 2019-05-27 02:00:39 -04:00
Shawn Landden
5a91dbc16c allow const to be passed to @hasField()
Actually include the tests I wrote
2019-05-27 00:38:36 -05:00
Andrew Kelley
129714d077 more fixes for windows and wasi 2019-05-27 01:35:58 -04:00
Andrew Kelley
6be79d79aa fixes for Windows and WASI 2019-05-27 00:48:56 -04:00
Andrew Kelley
0c6ab61b22 tests passing on linux 2019-05-26 23:35:26 -04:00
hryx
9c437f9032 var decl: ImplicitCastExpr 2019-05-26 19:14:50 -07:00
hryx
1a8f8c6262 var decl: init node 2019-05-26 17:36:47 -07:00
hryx
c79b8aeaef var decl: threadlocal 2019-05-26 17:05:49 -07:00
Andrew Kelley
2b42e910bf behavior tests passing on Linux 2019-05-26 19:56:37 -04:00
hryx
99f0b28d39 var decl: mut_token, create child scope 2019-05-26 16:51:25 -07:00
hryx
fceedada5c WIP translate var decl 2019-05-26 15:43:13 -07:00
Andrew Kelley
44a049e01e more cleanup. down to just the @hasDecl builtin 2019-05-26 18:32:45 -04:00
Andrew Kelley
2f040a23c8 clean up references to os 2019-05-26 18:32:44 -04:00
Andrew Kelley
7cb6279ac0 clean up references to posix 2019-05-26 18:32:44 -04:00
Andrew Kelley
ca6debcaf4 starting to fix the regressions 2019-05-26 18:32:44 -04:00
Andrew Kelley
3d61e42282 rename "posix" to "bits" 2019-05-26 18:32:44 -04:00
Andrew Kelley
17b0166e00 do Jay's suggestion with posix/os API naming & layout 2019-05-26 18:32:44 -04:00
Andrew Kelley
2def23063f more progress. moving windows API layer to its own file 2019-05-26 18:32:44 -04:00
Andrew Kelley
daae7e1f5a more progress on posix API layer
see #2380
2019-05-26 18:32:43 -04:00
Andrew Kelley
67726e36b0 extract posix functions from std/os.zig to std/os/posix.zig
See #2380
2019-05-26 18:32:40 -04:00
Andrew Kelley
df7aa9a4f0 allow implicit optional pointer to optional c_void pointer 2019-05-26 17:55:20 -04:00
Andrew Kelley
269a53b6af introduce @hasDecl builtin function
closes #1439
2019-05-26 16:21:03 -04:00
Andrew Kelley
21ed939117 support enum literals implicit casting to tagged unions 2019-05-26 12:59:30 -04:00
Sahnvour
99ee0608f7 gen-h: do not output visibility macros when the build is static 2019-05-25 14:17:59 +02:00
Sahnvour
c89b522233 test: slightly better output for failure of tests based on text comparison 2019-05-25 13:43:52 +02:00
LemonBoy
86b3007b94 Reject slices in use expressions
Co-Authored-By: emekoi <emekankurumeh@outlook.com>
2019-05-24 13:20:44 +02:00
Robert Scott
9b7ad12481 Implement @unionInit 2019-05-24 01:48:45 -07:00
Shritesh Bhattarai
b618a0b866 doc: wasm: embedded->host 2019-05-22 09:37:37 -07:00
Shritesh Bhattarai
9e65a144fa docs: clarify why wasm_allocator should be used 2019-05-22 07:43:17 -07:00
LemonBoy
f67ca20655 Make use work with arbitrary structs 2019-05-21 17:07:40 +02:00
LemonBoy
7987202243 Fix signedness mismatch in comparison 2019-05-20 23:14:49 +02:00
LemonBoy
266b2de150 Remove macos-specific linking hacks 2019-05-20 23:09:25 +02:00
LemonBoy
f5657b5552 Build archives using the K_DARWIN format when targeting osx 2019-05-20 17:04:00 +02:00
Marc Tiehuis
163a8e98bc std.fmt.parse_float: Fix exponent calculation
This was incorrectly translated as a u64. binary_exponent is an
unadjusted value so can be negative. In becomes unconditionally positive
when adding the bias.
2019-05-20 17:28:17 +12:00
Shritesh Bhattarai
3b6fc3fdc7 docs: wasm 2019-05-19 19:32:28 -07:00
emekoi
1c73c08298 ran zig fmt on stdlib 2019-05-19 16:33:31 -04:00
LemonBoy
6672ee9eb3 Fix too eager comptime evaluation of error ptr 2019-05-19 15:53:32 -04:00
LemonBoy
b660134a18 Use the correct scope for use
use expressions outside the top-level scope now work as intended.
2019-05-19 00:32:49 -04:00
Andrew Kelley
860684cc2f Merge pull request #2516 from LemonBoy/32bfix
More 32bit fixes for stdlib
2019-05-19 00:31:16 -04:00
LemonBoy
0a3aec020a Fix load/store of non-integer fields in packed struct 2019-05-18 19:59:47 -04:00
LemonBoy
232bc1bdee Remove more 64bit-centric assumptions from stdlib 2019-05-18 11:08:04 +02:00
LemonBoy
6957927194 Fix some test cases to run on 32bit systems 2019-05-18 10:59:56 +02:00
LemonBoy
51aaa02679 VDSO calls must use the C CC 2019-05-16 22:10:38 -04:00
Andrew Kelley
2eba779af5 stage1 tokenizer: add more missing break statements 2019-05-16 16:50:24 -04:00
SamTebbs33
87901baa28 Add break after digit_value check in TokenizeStateCharCode 2019-05-16 16:49:26 -04:00
Andrew Kelley
e09c05f689 Merge branch 'shawnl-builtins' 2019-05-16 16:38:06 -04:00
Andrew Kelley
80983ca1ca fixups to the previous commit 2019-05-16 16:37:58 -04:00
Shawn Landden
1fdb24827f breaking changes to all bit manipulation intrinsics
* `@clz`, `@ctz`, `@popCount`, `@bswap`, `@bitreverse` now
   have a type parameter
 * rename @bitreverse to @bitReverse
 * rename @bswap to @byteSwap

Closes #2119
Closes #2120
2019-05-16 16:37:58 -04:00
Shritesh Bhattarai
56a905c7d1 docgen: add lib codeblock type and use it for wasm32-freestanding 2019-05-16 14:58:10 -04:00
Andrew Kelley
8468ff0fe1 Merge pull request #2507 from ziglang/wasm-libs
improvements to build-lib use case of WebAssembly
2019-05-16 14:31:54 -04:00
Andrew Kelley
978fab817c the wasm freestanding _start function is return value void 2019-05-16 14:19:13 -04:00
Andrew Kelley
81e960eb74 improvements to build-lib use case of WebAssembly
* build-exe does include the startup code that supplies _start for the
   wasm32-freestanding target. Previously this did not occur because
   of logic excluding "freestanding".
 * build-lib for wasm32-freestanding target gets linked by LLD. To avoid
   infinite recursion, compiler_rt and zig libc are built as objects
   rather than libraries.
   - no "lib" prefix and ".wasm" extension instead of ".a". Rather than
   build-lib foo.zig producing "libfoo.a", now it produces "foo.wasm".
 * go back to using `.o` extension for webassembly objects
 * zig libc only provides _start symbol for wasm when linking libc.
2019-05-16 13:56:56 -04:00
Andrew Kelley
07d0aee11a clang C API wrapper: small progress 2019-05-16 12:55:45 -04:00
daurnimator
e30cd800e2 std: update linux syscalls to 5.1 2019-05-16 12:38:40 -04:00
Andrew Kelley
6b36b756eb fix static builds of zig from requiring c compiler
to be installed when linking libc.

When zig links against libc, it requires a dynamic linker path.
Usually this can be determined based on the architecture and operating
system components of the target. However on some systems this is not
correct; because of this zig checks its own dynamic linker.

When zig is statically linked, this information is not available, and so
it resorts to using cc -print-filename=foo to find the dynamic linker
path.

Before this commit, Zig incorrectly exited with an error if there was
no c compiler installed. Now, Zig falls back to the dynamic linker
determined based on the arch and os when no C compiler can be found.
2019-05-15 21:50:56 -04:00
Shritesh Bhattarai
b64e6cb813 change wasm obj ext to .wasm 2019-05-15 20:41:22 -04:00
Andrew Kelley
14cdb01f35 improvements to zig's implementation of libc and WebAssembly
* rename std/special/builtin.zig to std/special/c.zig
   not to be confused with @import("builtin") which is entirely
   different, this is zig's multi-target libc implementation.
 * WebAssembly: build-exe is for executables which have a main().
   build-lib is for building libraries of functions to use from,
   for example, a web browser environment.
   - for now pass --export-all for libraries when there are any
     C objects because we have no way to detect the list of exports
     when compiling C code.
   - stop passing --no-entry for executables. if you want --no-entry
     then use build-lib.
 * make the "musl" ABI the default ABI for wasm32-freestanding.
 * zig provides libc for wasm32-freestanding-musl.
2019-05-15 20:14:58 -04:00
Andrew Kelley
3aa43dc31c update libclang C API wrapper 2019-05-15 11:57:55 -04:00
LemonBoy
787fd0f1be Fix off-by-one error in LEB128 parsing 2019-05-15 11:11:16 -04:00
Andrew Kelley
057a5d4898 slice types no longer have field access
* fix crash when doing field access of slice types. closes #2486
 * remove the deprecated Child property from slice types
 * add -Dskip-non-native build option to build script
2019-05-14 21:21:59 -04:00
Andrew Kelley
5a57610039 clean up code now that #769 is implemented 2019-05-14 19:23:31 -04:00
Andrew Kelley
e93a05b6e4 switching on error sets makes new error set for capture values
closes #769
2019-05-14 19:11:37 -04:00
Andrew Kelley
c08c222d5e fix regression on switch capture value for multiple cases 2019-05-14 18:25:14 -04:00
Andrew Kelley
df4f77024e else value when switching on error set has
optional capture value which is subset.

see #769
2019-05-14 18:06:57 -04:00
LemonBoy
6536b409df Don't emit DW_TAG_lexical_block for VarDecls 2019-05-14 14:34:49 -04:00
Marc Tiehuis
b64cee2ec2 Merge pull request #2482 from ziglang/linux-elf-read
Mmap debug info on linux
2019-05-14 16:43:21 +12:00
LemonBoy
08d41da916 Fix formatting for multiline asm expressions 2019-05-13 12:20:11 -04:00
Andrew Kelley
66d86eccbe Merge branch 'LemonBoy-asm-cc' 2019-05-13 12:16:17 -04:00
Andrew Kelley
7330a6102f cache_add_dep_file: handle ErrorFileNotFound specially 2019-05-13 12:15:55 -04:00
Andrew Kelley
f3db3b3c13 Merge branch 'asm-cc' of https://github.com/LemonBoy/zig into LemonBoy-asm-cc 2019-05-13 12:10:21 -04:00
LemonBoy
a038ef3570 Assemble asm files using CC
Stuffing all the files together and compiling the resulting blob with
the main program is a terrible idea.

Some files, namely the .S ones, must be run trough the C preprocessor
before assembling them (#2437).

Beside that the aggregate may be mis-compiled due to the presence of
some flags that affect the following code.

For example let's consider two files, a.s and b.s

a.s
```
fn1:
    ret
.data
data1:
    .word 0
```

b.s
```
fn2:
    ret
```

Now, fn1 and fn2 will be both placed in the .text section as intended if
the two files are compiled separately. But if we merge them the `.data`
flag ends up placing fn2 in the wrong section!

This fixes a nasty crash where musl's memset ended up in the
non-executable data segment, leading to too many hours of
head-scratching.
2019-05-13 16:41:07 +02:00
Marc Tiehuis
c4d1597f50 Mmap debug info on linux
Closes #907.
2019-05-13 20:04:25 +12:00
Andrew Kelley
c1793d6106 zig fmt on the standard library 2019-05-12 12:56:01 -04:00
Andrew Kelley
ed5a6d74ad Merge pull request #2405 from hryx/stage2-recursive-parser
Recursive stage2 parser
2019-05-12 12:53:10 -04:00
hryx
173142b16a Undo parse2 import 2019-05-12 03:24:48 -07:00
hryx
0d629421c9 Recursive rewrite of stage2 parser, final sync 2019-05-12 02:10:27 -07:00
hryx
3a3a738478 Recursive rewrite of stage2 parser, part 3 2019-05-12 02:01:45 -07:00
hryx
3787f34286 Merge branch 'master' into rebased 2019-05-12 02:00:49 -07:00
Tyler Philbrick
16aee1f58a Fix memory leak in parser tests
The `arena` instance being used bythe parse tree was valid and
pointed to valid memory, but existed as a local variable inside the
stack frame of the `parse` function (the `const arena`), which was never
stored anywhere before leaving the scope.

This meant that code above the `parse` function saw a valid instance of
an `ArenaAllocator` that pointed to the same backing memory, but didn't
posess any of the local state built up after the call to `parseRoot`,
basically the caller saw an empty arena.

This meant that when `deinit` was called, it saw an Arena with 0
allocations in it's `buffer_list` and wasn't able to destroy any of the
memory.  This caused it to leak and caused FailingAllocator to balk.

The fix is to make sure the parse tree is using the same instance of
ArenaAllocator as is reported up the call stack, the one inside the
`Tree{}` object.  I'm not sure why that field is marked with a comment
to remove it, as it's used by the `std.ast.Tree.deinit()` function, but
this change seems to solve the problem.
2019-05-12 01:54:30 -07:00
hryx
4e28c2571d Recursive rewrite of stage2 parser, part 1 2019-05-12 01:52:16 -07:00
Andrew Kelley
edcc7c72d1 Merge pull request #2459 from LemonBoy/enum-num-um-m
Signed types for enum tags
2019-05-11 20:38:13 -04:00
LemonBoy
d210628c91 Amend the error messages 2019-05-11 21:29:55 +02:00
LemonBoy
b05e8d46ec Change the enum value allocation strategy 2019-05-11 21:29:53 +02:00
LemonBoy
655794f44f amend type_is_valid_extern_enum_tag 2019-05-11 21:29:00 +02:00
LemonBoy
c766f3f9ca Support signed types as enum tags 2019-05-11 21:28:58 +02:00
LemonBoy
917bd4192d Validate enum tag for extern enum
The C specification mandates the enum to be compatible with signed char,
signed int or unsigned int.
2019-05-11 21:27:58 +02:00
Jimmi Holst Christensen
6cf7fb1177 fixes #2235 2019-05-11 20:51:59 +02:00
Jimmi Holst Christensen
ba3d18a80e added grammar rule for enum literal to docs 2019-05-11 20:26:41 +02:00
Jimmi Holst Christensen
e5a0e21a53 Merge branch 'master' of github.com:ziglang/zig 2019-05-11 20:12:08 +02:00
Jimmi Holst Christensen
fb3b943b07 added tests for global variable declaration syntax 2019-05-11 20:11:56 +02:00
Andrew Kelley
32efa68f90 Merge pull request #2449 from Sahnvour/directallocator
Rework of windows' DirectAllocator
2019-05-11 13:04:20 -04:00
Jimmi Holst Christensen
b2a196e01d Merge branch 'master' of github.com:ziglang/zig 2019-05-11 18:49:23 +02:00
Jimmi Holst Christensen
c051904903 Fixed parser for extern threadlocal variables 2019-05-11 18:48:52 +02:00
Andrew Kelley
10e9d47b49 stage2 translate-c: implement functions with no prototype
stage1 translate-c actually has this wrong. When exporting a function,
it's ok to use empty parameters. But for prototypes, "no prototype"
means that it has to be emitted as a function that accepts anything,
e.g. extern fn foo(...) void;

See #1964
2019-05-11 12:09:11 -04:00
Andrew Kelley
2ef2f9d71f Merge pull request #2475 from LemonBoy/linux-wo-vdso
Fix clock_gettime on systems without VDSO
2019-05-11 12:01:52 -04:00
Sahnvour
cd537f822b Use unprotected heap when in single_threaded mode. 2019-05-11 16:41:13 +02:00
Sahnvour
a2d5b0fabe Implement Windows' DirectAllocator on top of VirtualAlloc and VirtualFree. 2019-05-11 16:41:13 +02:00
daurnimator
3d93c89fc5 std: the failing allocator didn't actually count allocations
Add a field '.allocations' to actually track the number of allocations.

Additionally, only increment '.deallocations' when memory is freed
2019-05-11 09:55:41 -04:00
LemonBoy
6756e545f4 Fix more corner cases in LEB128 parsing 2019-05-11 09:54:48 -04:00
LemonBoy
1b23348f30 linux: Minor zig fmt induced reformatting 2019-05-11 10:34:22 +02:00
LemonBoy
715d808f14 linux: Fix clock_gettime on systems w/o VDSO 2019-05-11 10:33:41 +02:00
Andrew Kelley
5f4c3e6557 stage2 translate-c: simple function definitions
See #1964
2019-05-10 23:35:46 -04:00
Andrew Kelley
dbb5da14f4 stage2 translate-c: builtin types and pub
See #1964
2019-05-10 17:56:00 -04:00
Andrew Kelley
82219b1fd5 translate-c: better handling of restore points 2019-05-10 17:44:47 -04:00
Andrew Kelley
2933d6b848 add test case for previous commit
closes #2467
2019-05-10 16:57:37 -04:00
Andrew Kelley
fee0e6c8b9 fix hang for some compile errors
see #2467
2019-05-10 16:39:50 -04:00
Andrew Kelley
a6f7a9ce2b translate-c: we have our first test of self-hosted
See #1964
2019-05-10 16:03:54 -04:00
Michael Dusan
d065f297ab stage1: compile error for loop expr val ignored
closes #2460
2019-05-10 10:05:40 -04:00
Jimmi HC
6b10f03b4a Fixes and simplifications for stage 1 parser 2019-05-10 16:09:58 +02:00
Andrew Kelley
bcf4d20289 Merge pull request #2465 from LemonBoy/builtins-for-wasm
A few builtins for wasm
2019-05-10 08:44:27 -04:00
LemonBoy
1606dae728 Fix erroneous test case
The *Mem variants cannot return EndOfStream and are generally unsafe to
use.
Proper order of checks, try both the variants and make sure they return
the same error/result.
Run the leb128.zig tests.
2019-05-10 08:40:36 -04:00
LemonBoy
7fb55ce2bb compiler-rt: Add __ashrti3 2019-05-10 13:26:33 +02:00
LemonBoy
fbffece1b5 compiler-rt: Add __lshrti3 2019-05-10 13:26:33 +02:00
LemonBoy
7db2aa1c25 compiler-rt: Add __ashlti3 2019-05-10 13:26:33 +02:00
Andrew Kelley
1c0223899c translate-c: progress on self-hosted function prototypes
See #1964
2019-05-10 01:24:00 -04:00
Andrew Kelley
f8b7ea119f Merge pull request #2461 from LemonBoy/dwarf-leb128
Fix minor bug in LEB128 parsing
2019-05-09 20:14:20 -04:00
Andrew Kelley
09cff0d2bd fix translate-c regression
introduced in eb65410b62
2019-05-09 20:11:56 -04:00
LemonBoy
8cc4eaea9f Use matching types when parsing fields 2019-05-10 00:44:24 +02:00
LemonBoy
4d8f96dd88 Fix minor bug in LEB128 parsing 2019-05-10 00:41:05 +02:00
Andrew Kelley
eea2de108d translate-c: progress on self-hosted function prototypes
See #1964
2019-05-09 16:52:30 -04:00
Andrew Kelley
214625587c translate-c: use C API for builtin types
See #1964
2019-05-09 15:46:48 -04:00
Andrew Kelley
010963ce43 stage1: make some asserts print source location 2019-05-09 14:52:06 -04:00
Andrew Kelley
c459edac18 compile error for attempt to cast enum literal to error
closes #2203
2019-05-09 13:18:13 -04:00
Andrew Kelley
72899da44b fix std.os.copyFile
closes #2454
2019-05-09 13:05:06 -04:00
Andrew Kelley
eb65410b62 translate-c: enough C tokenization/parsing to handle shifting in macros
See #2451
2019-05-09 12:48:38 -04:00
Andrew Kelley
62065a9aea translate-c: handle int to ptr and ptr to int casting
See #2451
2019-05-09 12:17:23 -04:00
Andrew Kelley
a7346ea49f fix build on macOS
Sadly due to a workaround for LLD linker limitations on macOS
we cannot put libuserland into an .a file; instead we have to use object
files. Again due to linker limitations, bundling compiler_rt.o into
another relocatable object also doesn't work. So we're left with
disabling stack probing on macOS for the stage1 self-hosted code.

These workarounds could all be removed if the macos support in the LLD
linker improved, or if Zig project had its own linker that did not have
these issues.
2019-05-08 22:45:49 -04:00
Andrew Kelley
4b9e12be50 Merge pull request #2452 from LemonBoy/more-more-builtins
More more builtins
2019-05-08 22:24:12 -04:00
Andrew Kelley
46e1c34fcf self-hosted translate-c progress on function decls
See #1964
2019-05-08 22:05:59 -04:00
Andrew Kelley
9bbd71c9ab add --bundle-compiler-rt function to link options
and use it when building libuserland.a

The self-hosted part of stage1 relies on zig's compiler-rt, and so we
include it in libuserland.a.

This should potentially be the default, but for now it's behind a linker
option.

self-hosted translate-c: small progress on translating functions.
2019-05-08 20:51:49 -04:00
Andrew Kelley
3bd5c16f39 stage1: remove unneeded extern function 2019-05-08 19:33:57 -04:00
Andrew Kelley
e3542196c0 translate-c: NULL pointers translate to null
See #1967
2019-05-08 19:21:54 -04:00
Andrew Kelley
9c12237d2d std.debug: fix stack trace iteration code
Previously, the stack trace iteration code was using the number of
frames collected as the number of frames to print, not recognizing the
fixed size of the buffer. So it would redundantly print items, matching
the total number of frames ever collected.

Now the iteration code is limited to the actual stack trace frame count,
and will not print duplicate frames.

Closes #2447
Closes #2151
2019-05-08 19:11:01 -04:00
Andrew Kelley
a4aee8b24d C pointers support if and orelse
See #1967
2019-05-08 18:47:14 -04:00
LemonBoy
4208fa9ad9 compiler-rt: add __floatsitf 2019-05-09 00:25:50 +02:00
LemonBoy
383b8a032e compiler-rt: Add __aeabi_unwind_cpp_pr{0,1,2} 2019-05-09 00:07:46 +02:00
LemonBoy
2dce137d92 compiler-rt: Add __extendsfdf2
Add AEABI builtin __aeabi_f2d
2019-05-09 00:07:46 +02:00
LemonBoy
2be066d057 compiler-rt: Add __floatdidf
Add AEABI builtin __aeabi_l2d
2019-05-08 23:57:09 +02:00
LemonBoy
d4434dfb67 compiler-rt: Add __floatundidf & __floatunsidf
Add AEABI builtins __aeabi_ul2d, __aeabi_ui2d
2019-05-08 23:57:09 +02:00
LemonBoy
92fd2df054 compiler-rt: Add __truncdfsf2
Add AEABI builtin __aeabi_d2f
2019-05-08 23:57:09 +02:00
Andrew Kelley
0099583bd3 C pointers support .? operator
see #1967
2019-05-08 17:39:00 -04:00
LemonBoy
c00167e91a compiler-rt: More division intrinsics 2019-05-08 22:30:20 +02:00
LemonBoy
917103710e compiler-rt: Add __floatsidf & __floatsisf
Also add their AEABI aliases, __aeabi_i2f & __aeabi_i2d
2019-05-08 22:26:54 +02:00
Andrew Kelley
50bbb34594 C pointers support null
See #1967
2019-05-08 16:06:34 -04:00
LemonBoy
be7cacfbbe Implement stack probes for x86/x86_64
Enabled on non-Windows systems only since it already requires stack
probes.
2019-05-08 12:36:54 -04:00
Sahnvour
d665948dcf Duplicate windows's DirectAllocator as HeapAllocator, which it is in reality. 2019-05-08 18:19:36 +02:00
Marc Tiehuis
24ee765318 Merge pull request #2448 from markfirmware/patch-1
Update README.md
2019-05-08 23:32:49 +12:00
markfirmware
b083ef18e3 Update README.md 2019-05-08 05:11:21 -04:00
Andrew Kelley
9c0596e627 Merge pull request #2427 from LemonBoy/linux-tls
Proper support for TLS on linux
2019-05-07 12:26:26 -04:00
Andrew Kelley
097a62555e Merge pull request #2439 from LemonBoy/fixes-fixes-fixes
A batch of miscellaneous fixes
2019-05-07 12:26:02 -04:00
LemonBoy
043bd71621 Add ARCH_SET_* definitions for x86_64 2019-05-07 13:19:38 +02:00
LemonBoy
b1db696c10 Less error messages
Decrease the overall size of the binary, programming errors are caught
with unreachable.
2019-05-07 13:09:20 +02:00
LemonBoy
2f041239cb Always initialize the TLS 2019-05-07 13:09:20 +02:00
LemonBoy
cfcf02489d std: Implement on-demand TLS allocation 2019-05-07 13:09:19 +02:00
LemonBoy
d8ab301aa8 std: Implement TLS support for Linux
Tested on x86_64, i386, ARM, AARCH64
2019-05-07 13:09:18 +02:00
LemonBoy
4ab7b459df Avoid endless recursion in __extendhfsf2
On some platforms the conversion ended up creating a dangerous recursive
loop that ate all the stack.

The conversion to f16 is also pointless since we're operating on the raw
bits anyway.
2019-05-07 11:47:23 +02:00
LemonBoy
94b504c9e4 Fix float comparison result in __aeabi_{f,d}cmp* 2019-05-07 11:47:23 +02:00
LemonBoy
a3beda27fc Add missing cast to usize 2019-05-07 11:47:23 +02:00
Andrew Kelley
7432fb04d6 Merge pull request #2354 from LemonBoy/iterate_phdr_impl
dl_iterate_phdr implementation
2019-05-06 15:48:37 -04:00
LemonBoy
939ec878a0 Fix edge case in addXf3
The operands may be zero, use the wrapping operators and avoid a
spurious integer-overflow error.
2019-05-06 21:41:08 +02:00
LemonBoy
60242e96df Fix definition of epoll_* struct on non x86_64 arches 2019-05-06 21:39:02 +02:00
Shawn Landden
d1f9b8184d docs for @hasField 2019-05-06 11:58:04 -05:00
Shawn Landden
c19bdc2d37 stage1: add @hasField() built-in
This was quite straight-forward

Closes: #1439
2019-05-06 11:52:47 -05:00
LemonBoy
a095db0df7 Add a test case 2019-05-06 18:30:49 +02:00
Andrew Kelley
7a41af2632 Merge pull request #2422 from tgschultz/stdlib-packed-int-array
Added PackedIntArray, PackedIntSlice to std
2019-05-05 15:25:17 -04:00
LemonBoy
07dfccf967 Review 2019-05-05 13:00:20 +02:00
Andrew Kelley
5d347c01cf Merge pull request #2374 from LemonBoy/fileszoff-reform
Make io offsets/sizes u64 instead of usize
2019-05-04 15:20:42 -04:00
Andrew Kelley
6a34da963b Merge branch 'LemonBoy-stdlib-32b' 2019-05-04 15:19:14 -04:00
Andrew Kelley
09cbcf8841 std lib sleep APIs: add doc comments and no @intCast
The sleep APIs are now documented as having spurious wakeups and no
precision of timing guaranteed. They also cannot fail. This commit makes
the entire range of u64 legal values to pass to std.os.time.sleep and
std.os.time.posixSleep. Values that do not fit in the native system APIs
will cause a sleep for the longest possible duration and then be handled
as a spurious wakeup.
2019-05-04 15:16:39 -04:00
Andrew Kelley
70a9ee3dd6 Merge branch 'stdlib-32b' of https://github.com/LemonBoy/zig into LemonBoy-stdlib-32b 2019-05-04 14:46:35 -04:00
Andrew Kelley
6f0aa801c8 Merge pull request #2404 from squeek502/hash-map-ensure-cap
std.HashMap: add public ensureCapacity fn
2019-05-04 14:13:18 -04:00
Andrew Kelley
21c8d57fca Merge pull request #2326 from daurnimator/sendmmsg
Add sendmmsg syscall wrapper
2019-05-04 14:05:55 -04:00
tgschultz
14a00d3825 zig fmt 2019-05-04 16:19:26 +00:00
tgschultz
8c28b59605 Added ability to specify endianess of PackedInt(Array/Slice) 2019-05-04 16:17:12 +00:00
tgschultz
27ed525e03 zig fmt 2019-05-04 13:31:53 +00:00
LemonBoy
98bc2b73bf Implement failsafe logic for posixSleep
Now we'll sleep for the specified amount of time even though the number
of seconds doesn't fit in a `isize` field.
2019-05-04 09:03:01 +02:00
LemonBoy
b612512bb5 std: Remove some assumptions about the host platform
The stdlib is now 32-bit friendly.
2019-05-04 08:44:26 +02:00
Ryan Liptak
cf8dde2d68 std.HashMap: cleanup ensureCapacity + add test
- Cleaned up some comments
- Removed the "is power of two" check from optimizedCapacity since the * 5 / 3 is unlikely to end up with a power of two, so it's a wasted check the majority of the time
- Made ensureCapacity/ensureCapacityExact increment the modification count if they resize the hash map so that we can catch resizes while iterating, which would likely break the iterator state
2019-05-03 21:15:00 -07:00
tgschultz
4dfd1f54db Ugh. I updated these but forgot to git add. 2019-05-04 03:08:33 +00:00
tgschultz
7dc71cdc4a and again 2019-05-04 02:39:55 +00:00
tgschultz
3e3bdd577c Fixed some comments 2019-05-04 02:38:16 +00:00
tgschultz
e2fd37e75b Added PackedIntArray, PackedIntSlice to std 2019-05-04 00:28:51 +00:00
Shritesh Bhattarai
f4798297de wasi: Implement read and write with err checking 2019-05-03 17:35:42 -04:00
LemonBoy
2f3b461703 compiler-rt: Add __modsi3, __umodsi3 2019-05-03 17:12:33 -04:00
LemonBoy
1be4e87f0b compiler-rt: Add __moddi3, __divdi3 2019-05-03 17:12:33 -04:00
LemonBoy
077216b582 Address the comments of the first review round 2019-05-03 22:42:45 +02:00
Andrew Kelley
584dd2863a Merge pull request #2409 from shritesh/wasi_native
WASI std: implement native os.exit and os.abort
2019-05-03 16:24:00 -04:00
Shritesh Bhattarai
f86b8e4535 WasmAllocator: compileError on non-wasm arch 2019-05-03 16:21:33 -04:00
Shritesh Bhattarai
2f39da7cdd docgen: show -target command line argument 2019-05-03 15:56:33 -04:00
Shritesh Bhattarai
5c04c22bcc docgen: support wasm and wasi 2019-05-03 15:56:33 -04:00
Andrew Kelley
f6937db7d6 remove redundant information from README 2019-05-03 14:48:56 -04:00
Andrew Kelley
bd9c629c4c always respect threadlocal for variables with external linkage
Previously if you had, for example:

extern "c" threadlocal var errno: c_int;

This would turn errno into a normal variable for --single-threaded
builds. However for variables with external linkage, there is an ABI
to uphold.

This is needed to make errno work for DragonFly BSD. See #2381.
2019-05-03 14:39:54 -04:00
Andrew Kelley
8cda4fd73a docs: remove @setGlobalLinkage section
`@setGlobalLinkage` was removed with #462. The not-yet-implemented
proposal for external weak symbols is #1917.
2019-05-03 13:38:24 -04:00
Benjamin Feng
8d58dc715b Switch wasm export-all to only values marked exports 2019-05-03 13:23:02 -04:00
daurnimator
fca3e3a73f std: add std.ArrayList.orderedRemove 2019-05-03 01:54:49 -04:00
Andrew Kelley
3552180143 optimize @memset with undefined
When using `@memset` to set bytes to `undefined`, Zig notices this
case and does a single Valgrind client request rather than N.

Speeds up all allocators in safe modes.

Closes #2388
2019-05-03 01:25:03 -04:00
Ryan Liptak
13a7b8586a std.HashMap: make ensureCapacityExact private 2019-05-02 17:43:51 -07:00
Ryan Liptak
26591d4f22 std.HashMap: add putAssumeCapacity fn 2019-05-02 17:42:38 -07:00
Ryan Liptak
4d42275d03 std.HashMap: make ensureCapacity optimize for the expected count, add ensureCapacityExact 2019-05-02 17:01:30 -07:00
Shritesh Bhattarai
a530a111a5 wasi: remove posix-y exit 2019-05-02 11:33:10 -05:00
Shritesh Bhattarai
84682eb862 wasi: implement os.exit 2019-05-02 11:26:33 -05:00
Shritesh Bhattarai
6fb677c4f6 wasi: native os.abort 2019-05-02 11:25:25 -05:00
Andrew Kelley
f8117a0799 docs: update for shared libraries 2019-05-02 12:00:16 -04:00
Ryan Liptak
0afa2d040a make std.HashMap.ensureCapacity round up to the nearest power of two 2019-05-02 00:58:26 -07:00
Marc Tiehuis
f950ec0c16 Merge pull request #2397 from ziglang/std.math
Review std/math and update documentation
2019-05-02 19:05:26 +12:00
Marc Tiehuis
3370e60dd9 std.math: Correct math.nan usage in cos 2019-05-02 19:03:49 +12:00
Ryan Liptak
8b7c59a414 std.HashMap: add public ensureCapacity fn 2019-05-01 23:46:52 -07:00
Dong-hee Na
c00c18de6a main: change --enable-pic and --disable-pic to -fPIC and -fno-PIC 2019-05-01 16:11:08 -04:00
Andrew Kelley
6e4f69a54a docgen: add exe_build_err tag 2019-05-01 15:34:36 -04:00
Andrew Kelley
54a93e5393 docs: add note to @setRuntimeSafety 2019-05-01 15:09:03 -04:00
Marc Tiehuis
40fe6afdad Don't install zig_cpp lib for stage2 target
Missed in last commit. See #2220.
2019-05-01 21:01:34 +12:00
Marc Tiehuis
89d71a960b std.math: Add documentation for all functions and algorithm sources 2019-05-01 18:37:46 +12:00
Marc Tiehuis
f94964cd05 std.math: Add upstream changes/fixes and simplify go derived code
This also starts the documentation effort for the math/ subdirectory.
The intent is to use this as a somewhat representative test-case for any
work on the documentation generator.
2019-05-01 18:13:33 +12:00
Shritesh Bhattarai
7bbc8eb16c wasi: import all core exports 2019-04-30 23:53:17 -04:00
Shritesh Bhattarai
f53abf4063 wasi: import all constants and their types 2019-04-30 22:58:41 -04:00
Andrew Kelley
bb0c5f7a2f Merge pull request #2392 from shritesh/wasi_clock
wasi: implement timestamp
2019-04-30 21:52:26 -04:00
Shritesh Bhattarai
d395ed2d40 wasi: implement timestamp 2019-04-30 20:43:43 -05:00
Shritesh Bhattarai
0ce05fa621 wasi: import clock and timestamp function/types 2019-04-30 20:06:39 -05:00
Shritesh Bhattarai
1fabd6bbf3 wasi: implement getRandomBytes 2019-04-30 20:50:41 -04:00
Andrew Kelley
79a139ac63 Merge pull request #2390 from shritesh/wasi_env
wasi: add getEnvMap
2019-04-30 19:52:20 -04:00
Shritesh Bhattarai
0a693b70e4 wasi: use mem.separate instead 2019-04-30 18:43:43 -05:00
Shritesh Bhattarai
20458f56d8 wasi: add getEnvMap 2019-04-30 18:18:20 -05:00
Shritesh Bhattarai
8e700bf92a wasi: import environ_get and environ_sizes_get 2019-04-30 16:35:27 -05:00
Andrew Kelley
9dfd24a334 add test case to cover solved bug
closes #2114
2019-04-30 14:17:16 -04:00
Marc Tiehuis
81767a658d Don't install stage2 artifacts
Fixes #2220.
2019-04-30 12:13:41 -04:00
Andrew Kelley
b4f8d68e2e translate-c: fix using wrong enum
closes #2385
2019-04-30 03:14:45 -04:00
daurnimator
fd056752da std: add sendmmsg on linux 2019-04-30 16:47:09 +10:00
Andrew Kelley
a7f99c8ee9 self-hosted translate-c: iterate over top level decls
See #1964
2019-04-30 00:21:45 -04:00
Shritesh Bhattarai
01365be82f WASI: implement argsAlloc and argsFree (#2364)
* wasi: change URL to canon WASI-core.md

* wasi: import args_get and args_sizes_get

* wasi: Implement argsAlloc and argsFree

* test return value for wasi arg syscalls

* wasi: return unexpectedErrorPosix in argsAlloc

* wasi: Add TODO for ArgIterator
2019-04-29 21:54:30 -04:00
LemonBoy
77383f968d translate-c: Emit @ptrCast + @alignPtr sequence
Avoid producing Zig code that doesn't compile due to mismatched
alignments between pointers.

Always emit a @alignOf instead of hardcoding the alignment value
returned by LLVM for portability sake of the generated code.
2019-04-29 21:30:19 -04:00
LemonBoy
b1a61a6d51 compiler-rt: Add __mulodi4 2019-04-29 18:55:20 -04:00
Andrew Kelley
d2328ac71a Merge pull request #2372 from LemonBoy/aeabi_idiv
compiler-rt: Add __divsi3, __aeabi_idiv
2019-04-29 18:54:21 -04:00
Andrew Kelley
75d42ace31 Merge branch 'squeek502-readme-std-lib' 2019-04-29 18:25:49 -04:00
Andrew Kelley
360ab8310b readme: expand Developing Zig section into Contributing section 2019-04-29 18:25:27 -04:00
Andrew Kelley
fe80c15c4b Merge branch 'readme-std-lib' of https://github.com/squeek502/zig into squeek502-readme-std-lib 2019-04-29 17:38:03 -04:00
Matt Stancliff
a4e506510b Fix crash due to command line argument parsing
zig --help -> ok
zig --help --c-source -> ok
zig --c-source --help -> crash [fixed]

'i' was being incremented without regard for the 'argc' limit, so
we were running off the end of 'argv'.
2019-04-29 17:34:23 -04:00
Andrew Kelley
e3452ba21b json tests do not need this prefix anymore 2019-04-29 14:04:31 -04:00
Andrew Kelley
da28811c50 enable more json tests
I think it was a mistake that these weren't getting automatically run by
the test suite.
2019-04-29 14:02:19 -04:00
Andrew Kelley
4b6f350369 DirectAllocator: move if > 0 condition above @memcpy
Minor improvement to 3c13aa17 as noted by daurnimator
2019-04-29 13:48:15 -04:00
Shawn Landden
3c13aa178b std.heap: do not excessively call mmap, and munmap in direct allocator 2019-04-29 13:47:24 -04:00
Andrew Kelley
8afa1e800b fix build (unused function warning)
d3c88a89 needed some #ifdefs shuffled around
2019-04-29 13:18:16 -04:00
LemonBoy
4e241263ff compiler-rt: Add __divmodsi4, __aeabi_idivmod 2019-04-29 19:17:48 +02:00
LemonBoy
738562e990 compiler-rt: Add __divsi3, __aeabi_idiv 2019-04-29 19:17:48 +02:00
Andrew Kelley
d3c88a8949 Merge pull request #2139 from emekoi/lib-on-mingw
implement linking to libc on mingw
2019-04-29 13:16:41 -04:00
LemonBoy
9902b604cb Fix generation of container initializers
The code creates temporary ConstExprValue with global_refs set to
nullptr and that's carried over to the final value. Doing so prevents
the deduplication mechanism to work correctly, causing all sorts of
runtime crashes.

Fixes #1636
Fixes #1608 (Even though it was already fixed by #1991)
2019-04-28 13:13:42 -04:00
LemonBoy
fbcc559cdb Make io offsets/sizes u64 instead of usize
Decouple the concepts of address-space size and file size.

Closes #637
2019-04-28 18:07:40 +02:00
emekoi
6057513cc7 fixed visibility of zig_libc_cc_print_file_name 2019-04-27 16:17:07 -05:00
Ryan Liptak
205e501e42 std.fmt: add max_depth to avoid infinite recursion from self-references 2019-04-27 11:20:10 -04:00
daurnimator
bc1840e18f Revert "std: Add mem.nativeIntToBig and mem.nativeIntToLittle"
This reverts commit 211f0a2226.

The functions `mem.nativeToBig` and `mem.nativeToLittle` already existed.
2019-04-27 11:18:53 -04:00
emekoi
66f3ef06e8 fixed syntax error 2019-04-27 11:16:33 -04:00
daurnimator
ad7927a748 std: add LoggingAllocator prototype 2019-04-27 15:36:53 +10:00
emekoi
dfada0cc77 added static_crt_dir to libc file 2019-04-27 00:24:26 -05:00
Shritesh Bhattarai
d02489fd9a fix missing semicolon 2019-04-26 21:01:20 -04:00
Andrew Kelley
2d6520d5d4 zig fmt is built directly into stage1 rather than child process
Previously, `zig fmt` on the stage1 compiler (which is what we currently
ship) would perform what equates to `zig run std/special/fmt_runner.zig`

Now, `zig fmt` is implemented with the hybrid zig/C++ strategy outlined
by #1964.

This means Zig no longer has to ship some of the stage2 .zig files, and
there is no longer a delay when running `zig fmt` for the first time.
2019-04-26 20:46:28 -04:00
Andrew Kelley
ac3946620c Merge pull request #2357 from squeek502/heap-shrink-large-align
DirectAllocator: reduce the amount of redundant memcpy calls on Windows
2019-04-26 19:34:24 -04:00
Shritesh Bhattarai
efc5122fb6 docgen: properly close tags for skipped execs 2019-04-26 19:33:33 -04:00
Ryan Liptak
6936f0514f readme: Fix filepath to test file when testing std lib changes 2019-04-26 14:14:48 -07:00
Andrew Kelley
28071ac637 self-hosted translate-c emits a hello world AST
Also breaking std lib API change: the return value of
std.zig.parse returns `*ast.Tree` rather than `ast.Tree`.

See #1964
2019-04-26 15:43:36 -04:00
Andrew Kelley
c82acdbb9e clean up test output
After 4df2f3d74f test names have the word "test" in them so the
redundant word is removed from test runner. Also move the prefix/suffix
to where it logically belongs in the fully qualified symbol name.
2019-04-26 15:10:13 -04:00
Andrew Kelley
1d95fdaf6e Fix path canonicalization when $HOME has a trailing slash 2019-04-26 14:37:26 -04:00
LemonBoy
9ec4ccc68f Do not invoke UB in BigInt shr operations
Shifting a value of type T by an amount that's greater or equal to the
size of the type itself is UB.

Spotted by @tgschultz
2019-04-26 14:24:35 -04:00
rylmovuk
4df2f3d74f Change symbol name of tests in codegen
Tests now have the symbol name of the format `test "<name>"` in order
to be more easily distinguished from functions with similar names.
See issue #2267.
2019-04-26 14:23:56 -04:00
Ryan Liptak
afc33f00ee heap: fixup style of realloc memory copies 2019-04-25 13:41:19 -07:00
Ryan Liptak
57f545eed8 std.heap.DirectAllocator: reduce the amount of redundant memcpy calls on Windows
Previously the memory would be copied to a different aligned address in some cases where the old offset could have been used. This fixes it so that it will always try to use the old offset when possible, and only uses a different offset if the old one is truly invalid (not aligned or not enough space to store the alloc at the old offset).
2019-04-25 13:35:45 -07:00
Andrew Kelley
92d9cef071 Merge pull request #2332 from ziglang/translate-c-userland
beginnings of implementing translate-c in userland
2019-04-25 08:35:28 -04:00
Andrew Kelley
17ffe166c2 add preliminary windows support to std.io.COutStream 2019-04-25 00:24:25 -04:00
Andrew Kelley
e1bf74fca3 translate-c: put -x c back in there, it's necessary 2019-04-25 00:06:58 -04:00
Andrew Kelley
535d419590 translate-c: self-hosted implementation can detect C errors
See #1964
2019-04-25 00:06:58 -04:00
Andrew Kelley
712274997e translate-c: unify API for self-hosted and C++ translate-c
See #1964
2019-04-25 00:06:57 -04:00
Andrew Kelley
976080462c translate-c: a little closer to self-hosted implementation 2019-04-25 00:06:54 -04:00
Andrew Kelley
56e07622c6 Merge pull request #2312 from squeek502/heap-shrink-large-align
fix heap allocators when shrinking an object but growing its alignment
2019-04-24 23:44:28 -04:00
Shawn Landden
8ef7f6febb remove Shebang (#!) support
Closes:  #2165
2019-04-24 23:34:19 -04:00
Andrew Kelley
fb2acaff06 @sizeOf returns 0 for comptime types
This defines `@sizeOf` to be the runtime size of a type, which means
that it is zero for types such as comptime_int, type, and (enum
literal).

See #2209
2019-04-24 22:31:53 -04:00
vegecode
733c547a65 compiler-rt: Add missing import of test for comparesf2 2019-04-24 21:16:03 -04:00
vegecode
01168e1577 compiler-rt: add aeabi_dcmp, comparedf2 2019-04-24 21:15:39 -04:00
LemonBoy
e4825dbd77 Other 2019-04-24 20:54:17 +02:00
LemonBoy
12eff09ff4 Expose Elf32_Dyn and Elf64_Dyn 2019-04-24 20:54:05 +02:00
LemonBoy
074ddf1ac6 Implementation of dl_phdr_info 2019-04-24 20:53:46 +02:00
Andrew Kelley
ad994c9642 Merge pull request #2296 from LemonBoy/translate-c-stuff
Handle implicit casts in translate-c
2019-04-24 14:43:46 -04:00
Wink Saville
7bafe2e490 Fix alignment of macro FIND_AND_ADD_CLANG_LIB 2019-04-24 14:42:08 -04:00
hryx
06bf918436 Sync grammar with spec
- Remove rule LabeledExpr
- Add rule CurlySuffixExpr
2019-04-24 14:38:56 -04:00
Michael Dusan
5de934810f add -fvisibility-inlines-hidden
On macOS building with Xcode/clang the linker complains loudly when
symbol visibility is inconsistent. This option syncs visibilty setting
of both LLVM and Zig.
2019-04-24 14:37:14 -04:00
Andrew Kelley
ed41955522 build libuserland in cross compilation mode
Previously libuserland was being built for the native target,
which could depend on native CPU features such as AVX. The
CI infrastructure is intending to create binaries that are
widely compatible and do not make use of specific CPU features.

There could be something to gain from enabling native CPU features
sometimes, by introducing a new cmake configuration option, but
since it's planned to eventually ship self-hosted rather than stage1,
I don't think it really matters.

closes #2348
2019-04-24 14:13:55 -04:00
Jimmi Holst Christensen
e4a86d4653 Merge pull request #2351 from ziglang/fixed-2346
fixes #2346
2019-04-24 18:42:55 +02:00
Jimmi HC
1a2e02e267 fixed #2356
const_ptr_pointee_unchecked did not take into account that if the
pointer is zero sized, then const_val->data.x_ptr.special would be
ConstPtrSpecialInvalid. This commit fixes this by also checking
that the child type of the pointer only have one possible value
and just returns that value.
2019-04-24 15:04:58 +02:00
Jimmi Holst Christensen
e553ade090 Merge pull request #2335 from hryx/no-tag-expr-for-struct
Allow tag expr for enum but not struct
2019-04-24 14:53:54 +02:00
Andrew Kelley
3bc361178c Merge pull request #2344 from LemonBoy/dbg-things
Minor debug things
2019-04-23 10:15:53 -04:00
LemonBoy
374d16793f Go one instruction before the return address
The return address may not point to an area covered by the debug infos
so we hope for the best and decrement the address so that it points to
the caller instruction.
2019-04-23 10:05:46 +02:00
LemonBoy
b095e33667 Fix silly typo 2019-04-23 09:57:57 +02:00
LemonBoy
57ec183c09 Fix reading of signed leb128 values 2019-04-23 09:57:22 +02:00
LemonBoy
70c2e86da3 Add translation from pointer to boolean 2019-04-22 22:23:41 +02:00
LemonBoy
a44ad08954 Add some zig_panic for 80-bit float codepaths 2019-04-22 22:23:41 +02:00
LemonBoy
9ea600b634 Correct rendering of AST Char literals 2019-04-22 22:23:41 +02:00
LemonBoy
8d05330cf7 More precise translation of char literals 2019-04-22 22:23:41 +02:00
LemonBoy
ab424bbb35 translate-c: Add test for implicit casts 2019-04-22 22:23:41 +02:00
LemonBoy
69bc5fd04d translate-c: Pointer to/from integral conversion 2019-04-22 22:16:30 +02:00
LemonBoy
d3dd49c403 translate-c: Support for integer to boolean conversions 2019-04-22 22:16:29 +02:00
Ryan Liptak
8ce130de3c Bump up FixedBufferAllocator test memory to account for new tests 2019-04-22 02:25:57 -07:00
Ryan Liptak
b3598163df std.heap.DirectAllocator: Fix aligned reallocs on Windows 2019-04-22 02:20:01 -07:00
hryx
5765cbd2de Allow tag expr for enum but not struct 2019-04-22 00:14:51 -07:00
Ryan Liptak
af7daae26b readme: Simplify instructions for making changes to the standard library 2019-04-21 21:53:35 -07:00
Ryan Liptak
e64c0dee35 readme: Add instructions for making changes to the standard library
Closes #2324
2019-04-21 15:21:19 -07:00
emekoi
0f8fc3b924 fixed stack protector issues 2019-04-21 14:13:48 -04:00
daurnimator
211f0a2226 std: Add mem.nativeIntToBig and mem.nativeIntToLittle
To be used where `htons`, `htonl`, etc. would be used in C.
It's useful to have a function that returns a number directly for use in initialisers.
2019-04-21 14:04:01 -04:00
daurnimator
217b95da31 std: add msghdr_const
As `iovec_const` is to `iovec`, `msghdr_const` is to `msghdr`
2019-04-21 21:53:24 +10:00
daurnimator
9babcac7a6 std: improve msghdr definition 2019-04-21 21:50:48 +10:00
Ryan Liptak
66020856b2 fix heap allocators when shrinking an object but growing its alignment 2019-04-20 23:56:39 -07:00
vegecode
bb25f212b3 compiler-rt: add aeabi_fcmp, comparesf2 2019-04-21 00:12:21 -04:00
tgschultz
22f5e5fd3e Fixes DirectAllocator Windows implementation to call HeapFree when new_size == 0 2019-04-20 14:04:09 -04:00
Andrew Kelley
b864fe7e23 Merge branch 'LemonBoy-dwarfy' 2019-04-20 13:49:02 -04:00
Andrew Kelley
9b83fe6b4c fixup and zig fmt 2019-04-20 13:48:38 -04:00
Andrew Kelley
907a7068ce Merge branch 'dwarfy' of https://github.com/LemonBoy/zig into LemonBoy-dwarfy 2019-04-20 13:32:59 -04:00
LemonBoy
c2542bb7b7 Recover symbol infos from DWARF sections 2019-04-20 10:35:39 +02:00
Ryan Liptak
1030cc97ca fix DirectAllocator not unmapping unused pages on large alignments
Fixes #2306
2019-04-20 02:21:42 -04:00
emekoi
f4c5fa7ff4 renamed add_gnu_link_args 2019-04-20 00:12:33 -05:00
Raul Leal
d44d2784e6 zig-fmt: allow comptime blocks in containers (#2308)
* zig-fmt: allow comptime blocks in containers
* add test for comptime block in container
2019-04-19 15:27:42 -04:00
LemonBoy
0286be127e Fix parseFormValueConstant
Signed/unsigned confusion made the code fail an assertion sometimes.
2019-04-19 19:59:14 +02:00
LemonBoy
19b8278f91 translate-c: Convert char literals 2019-04-19 11:50:30 +02:00
LemonBoy
6d95c5d15c translate-c: Parse float/double literals 2019-04-19 11:50:30 +02:00
LemonBoy
1fda44cbc8 translate-c: support conversion to/from fp types 2019-04-19 11:50:30 +02:00
Matt Stancliff
3b6a4fe4cd Fix test in langref to assert against modified var 2019-04-18 16:14:30 -04:00
Andrew Kelley
a10a1efc83 ci: fix accidentally shipping zig0.exe 2019-04-17 20:27:13 -04:00
Andrew Kelley
ff3cdbc3a0 stage1 assertions always on, and have stack traces 2019-04-17 15:58:20 -04:00
Andrew Kelley
4ad7d09ba5 build: rename zig1 to zig0 to avoid confusion with stage1 2019-04-17 14:09:18 -04:00
Andrew Kelley
bc2d60c11f Merge pull request #2295 from ziglang/stage1-hybrid
stage1 is now a hybrid of C++ and Zig
2019-04-17 00:24:51 -04:00
Andrew Kelley
da8403bcdd build.zig: libuserland expects to against libc 2019-04-16 19:13:46 -04:00
Andrew Kelley
89763c9a0d stage1 is now a hybrid of C++ and Zig
This modifies the build process of Zig to put all of the source files
into libcompiler.a, except main.cpp and userland.cpp.

Next, the build process links main.cpp, userland.cpp, and libcompiler.a
into zig1. userland.cpp is a shim for functions that will later be
replaced with self-hosted implementations.

Next, the build process uses zig1 to build src-self-hosted/stage1.zig
into libuserland.a, which does not depend on any of the things that
are shimmed in userland.cpp, such as translate-c.

Finally, the build process re-links main.cpp and libcompiler.a, except
with libuserland.a instead of userland.cpp. Now the shims are replaced
with .zig code. This provides all of the Zig standard library to the
stage1 C++ compiler, and enables us to move certain things to userland,
such as translate-c.

As a proof of concept I have made the `zig zen` command use text defined
in userland. I added `zig translate-c-2` which is a work-in-progress
reimplementation of translate-c in userland, which currently calls
`std.debug.panic("unimplemented")` and you can see the stack trace makes
it all the way back into the C++ main() function (Thanks LemonBoy for
improving that!).

This could potentially let us move other things into userland, such as
hashing algorithms, the entire cache system, .d file parsing, pretty
much anything that libuserland.a itself doesn't need to depend on.

This can also let us have `zig fmt` in stage1 without the overhead
of child process execution, and without the initial compilation delay
before it gets cached.

See #1964
2019-04-16 19:12:20 -04:00
Andrew Kelley
4c03746926 Revert "DirectAllocator: on windows, use HeapFree instead of HeapReAlloc to free memory."
This reverts commit 71bb8cd537.

This broke the CI on Windows.
2019-04-16 19:11:37 -04:00
Andrew Kelley
b29241fc08 docs: update intro text 2019-04-16 14:23:58 -04:00
Michael Dusan
611d4bc6a1 stage1: const_values_equal support tagged union 2019-04-16 13:55:23 -04:00
Andrew Kelley
52caf311bb Merge pull request #2286 from shritesh/wasm_alloc
WasmAllocator: WebAssembly Memory Allocator
2019-04-16 13:27:56 -04:00
Shritesh Bhattarai
0c28a18d96 WasmAllocator: cleanup 2019-04-16 12:23:45 -05:00
Sahnvour
71bb8cd537 DirectAllocator: on windows, use HeapFree instead of HeapReAlloc to free memory. 2019-04-16 13:18:21 -04:00
Andrew Kelley
4e2f6ebf39 freestanding target adds -ffrestanding to cc parameters
closes #2287
2019-04-16 12:06:14 -04:00
Andrew Kelley
3226b5315e translate-c: move some code to the C API
See #1964
2019-04-16 04:32:48 -04:00
Andrew Kelley
f488f3fd03 remove workaround for LLD bug
Zig's embedded LLD now has a patch to resolve the deadlock race
condition, and the patch is getting upstreamed too, so this
closes #2283.
2019-04-16 03:58:15 -04:00
Andrew Kelley
c8b60538ed add patch to LLD to fix deadlock race condition in wasm linker
Patch is getting upstreamed here: https://reviews.llvm.org/D60757
And so this patch can be removed with LLVM 9.0.0.
2019-04-16 03:56:46 -04:00
Shritesh Bhattarai
4235982fe6 fmt wasm_allocator 2019-04-16 01:42:11 -05:00
Shritesh Bhattarai
aa3f31ac0a wasm: add WasmAllocator 2019-04-16 01:40:16 -05:00
Shritesh Bhattarai
f2119f9961 wasm: WasmAllocator that uses fixed 64kb pages 2019-04-15 21:21:46 -05:00
Andrew Kelley
0a280b6062 update std.os.page_size for WebAssembly 2019-04-15 21:20:41 -04:00
Andrew Kelley
6692cbbe18 disable threads when linking WebAssembly to work around an LLD bug
See #2283
2019-04-15 20:41:50 -04:00
Andrew Kelley
579dd74114 fix Debug mode when error return tracing is off
Previously the code for generating a panic crash expected
one of the parameters to be the error return trace. Now
it does not expect that parameter when g->have_err_ret_tracing
is false.

Closes #2276
2019-04-15 20:17:06 -04:00
Shritesh Bhattarai
f5d84250a3 wasi: switch to "standard" wasi_unstable module fn 2019-04-15 18:44:33 -04:00
Andrew Kelley
3b8a85c941 Merge pull request #2281 from shritesh/wasm_module
Support wasm module imports
2019-04-15 18:05:46 -04:00
Shritesh Bhattarai
a0d2185199 wasm: add wasm-import-module attr to extern 2019-04-15 17:00:04 -05:00
Shritesh Bhattarai
9465c6d538 link: exemption for wasm instead of wasi 2019-04-15 16:59:34 -05:00
Andrew Kelley
5cb18e9c6f translate-c: move some code to the C API
See #1964
2019-04-15 00:32:27 -04:00
Shritesh Bhattarai
cc8cf94cb2 Update wasm tiers (#2272)
* tier update: wasm32=2, wasm64=4
2019-04-14 11:29:22 -04:00
Andrew Kelley
27253f09b6 organize how the single threaded option is passed around 2019-04-14 11:01:01 -04:00
Andrew Kelley
63a970a548 Merge pull request #2268 from shritesh/wasi
wasm: preliminary WASI OS support
2019-04-14 10:45:30 -04:00
Shritesh Bhattarai
0f1d92e2cf wasm: force single threaded 2019-04-14 10:21:48 -04:00
Shritesh Bhattarai
94e0871603 wasi: don't pass --no-entry to linker 2019-04-14 00:03:32 -05:00
Shritesh Bhattarai
ecd0f89254 wasi: better extern wasi logic 2019-04-13 23:49:02 -05:00
Shritesh Bhattarai
93d43d4529 wasi: add std/os/wasi{,/core}.zig to CMakeLists.txt 2019-04-13 22:51:18 -05:00
Shritesh Bhattarai
22960a5fdf wasi: better comments 2019-04-13 22:45:31 -05:00
Shritesh Bhattarai
a2d8f03092 support extern "wasi" functions 2019-04-13 22:28:58 -05:00
Shritesh Bhattarai
93528be6b1 wasi: sigabrt at panic 2019-04-13 21:54:50 -05:00
Shritesh Bhattarai
fe9cd0b4bc wasi: use __wasi_proc_exit instead of posix.exit 2019-04-13 21:36:53 -05:00
Andrew Kelley
68d7e4a1b6 better handle quota of setEvalBranchQuota
Now that c58b802034 has removed
the "top of the comptime stack" requirement, the branch quota
can be modified somewhere other than the top of the comptime stack.

This means that the quota of a parent IrExecutable has to be
modifiable by an instruction in the child.

Closes #2261
2019-04-13 16:55:59 -04:00
Duncan
a43fd7a550 Add favicon to langref.html 2019-04-13 16:20:33 -04:00
Andrew Kelley
4a2ccd6fb8 Merge pull request #2266 from bnoordhuis/fix-cache-lseek-ebadf
don't close cache manifest file prematurely
2019-04-13 16:17:12 -04:00
Shritesh Bhattarai
72bcd5a4a5 WIP: hello world 2019-04-13 15:15:39 -05:00
Ben Noordhuis
93e89b3b7e don't close cache manifest file prematurely
ErrorInvalidFormat is not a fatal error so don't close the cache
manifest file right away but instead let cache_final() handle it.

Fixes the following (very common) warning when running the test suite:

    Warning: Unable to write cache file [..]: unexpected seek failure

The seek failure is an lseek() system call that failed with EBADF
because the file descriptor had already been closed.
2019-04-13 12:33:29 +02:00
Ben Noordhuis
ea5518f69e make os_file_close poison file handle after close
This helps track down use-after-close bugs.
2019-04-13 12:31:49 +02:00
Andrew Kelley
9d229791c6 translate-c: move some code to the C API
See #1964
2019-04-12 14:39:12 -04:00
Shritesh Bhattarai
63f2e96eea wasm: use .wasm ext for exe 2019-04-12 13:17:59 -04:00
Andrew Kelley
6284a4c534 translate-c: move some code to the C API
See #1964
2019-04-12 03:56:38 -04:00
Andrew Kelley
f860493f23 translate-c: move some code to the C API
See #1964
2019-04-12 03:12:22 -04:00
Andrew Kelley
6f34d08aed translate-c: move some code to the C API
See #1964
2019-04-11 23:38:41 -04:00
Shritesh Bhattarai
5f8dbcac06 wasm: disable error ret tracing 2019-04-11 16:37:40 -04:00
Andrew Kelley
b960f1d922 translate-c: move some code to the C API
See #1964
2019-04-11 15:33:26 -04:00
Andrew Kelley
4172fe986e readme: separate powerpc 32 and 64 bit in the support table 2019-04-11 15:22:15 -04:00
Andrew Kelley
3ce024dd85 A bunch of fixes for the DWARF parser (#2254)
* Correct parsing of DWARF line_info section

* Fix reading of udata/sdata encoded attributes

* Add definition for DW_AT_alignment

Even though it's been standardized in DWARF5 some compilers produce it
anyway for DWARF4 infos too.

* Fix reading of reference attributes

* Distinguish between absolute/relative addresses
2019-04-11 14:34:13 -04:00
Andrew Kelley
a895c59971 delete unused function
missed by 27cd830ec8
2019-04-11 14:33:43 -04:00
Matthew Iannucci
27cd830ec8 Add initial support for iOS targets (#2237)
* Add iOS C int sizes... try to hack in iOS DebugInfo

* Get rid of ios link check for now

* Remove macos linkversion check
2019-04-11 13:15:17 -04:00
LemonBoy
51eb4ebec1 Distinguish between absolute/relative addresses 2019-04-11 15:41:42 +02:00
Marc Tiehuis
b59c65e986 Merge pull request #2102 from ziglang/big.int-additions
Add big.Rational type to std
2019-04-11 22:54:19 +12:00
LemonBoy
38492b2ea4 Fix reading of reference attributes 2019-04-11 10:36:15 +02:00
LemonBoy
29ec409b52 Add definition for DW_AT_alignment
Even though it's been standardized in DWARF5 some compilers produce it
anyway for DWARF4 infos too.
2019-04-11 10:36:15 +02:00
LemonBoy
795b3e9b68 Fix reading of udata/sdata encoded attributes 2019-04-11 10:36:15 +02:00
Andrew Kelley
dff201540f translate-c: move some code to the C API
See #1964
2019-04-11 03:59:12 -04:00
LemonBoy
8f5753ba9f Fix normalization of right-shifted BigInt at CT
The pointer value for the `digits` field was being treated as if it were
a limb.

Fixes #2225
2019-04-11 03:49:15 -04:00
Marc Tiehuis
78af62a19a Pack big.Int sign and length fields
This effectively takes one-bit from the length field and uses it as the
sign bit. It reduces the size of an Int from 40 bits to 32 bits on a
64-bit arch.

This also reduces std.Rational from 80 bits to 64 bits.
2019-04-11 19:36:35 +12:00
Marc Tiehuis
87d8ecda46 Fix math.big.Int divN/gcdLehmer and fuzz-test failures 2019-04-11 19:36:35 +12:00
Marc Tiehuis
30788a98b1 Handle zero-limb trailing div case in big.Int 2019-04-11 19:36:35 +12:00
Marc Tiehuis
d3e1f32362 Small fixes for big.Rational and corrections for gcdLehmer
The int div code still causes some edge cases to fail right now.
2019-04-11 19:36:35 +12:00
Marc Tiehuis
b3ecdfd7bf Fix big.Int toString maybe-null allocator 2019-04-11 19:36:35 +12:00
Marc Tiehuis
5f4fcd5030 Add initial big.Rational type 2019-04-11 19:36:35 +12:00
Marc Tiehuis
ea1d2a2409 Add read-only, non-allocating Int for internal constants
A constant Int is one which has a value of null for its allocator field.
It cannot be resized or have its limbs written. Any attempt made to
write to it will be caught with a runtime panic.
2019-04-11 19:36:35 +12:00
Andrew Kelley
e309ad884a fix outdated/incorrect docs for @truncate
closes #2234
2019-04-10 23:00:53 -04:00
Andrew Kelley
a4c7e4c4eb __muloti4 does not need the ABI workaround on Windows
Fixes 128-bit integer multiplication on Windows.

closes #2250
2019-04-10 22:33:33 -04:00
Shritesh Bhattarai
13798d26c7 pass exec_path to zig run 2019-04-10 20:07:35 -04:00
Shritesh Bhattarai
666e879925 Build compiler_rt for WASM exe 2019-04-10 19:14:19 -04:00
Andrew Kelley
a71bfc249d compiler-rt: better way to do the ABI required on Windows
This removes the compiler_rt.setXmm0 hack. Instead, for
the functions that use i128 or u128 in their parameter and
return types, we use `@Vector(2, u64)` which generates
the LLVM IR `<2 x i64>` type that matches what Clang
generates for `typedef int ti_int __attribute__ ((mode (TI)))`
when targeting Windows x86_64.
2019-04-10 18:47:14 -04:00
LemonBoy
60e2a04322 Correct parsing of DWARF line_info section 2019-04-10 23:30:41 +02:00
Andrew Kelley
52934851f2 compiler_rt: @divTrunc rather than @divFloor in muloti4 2019-04-10 16:29:10 -04:00
vegecode
aff2e47821 compiler-rt: correct use_thumb_1 flag
The flag is for generating correct arm-thumb interwork veneers in the
assembly code __aeabi_{memcpy,memset,etc} functions.

Armv6m only does thumb code generation regardless of whether arm or
thumb is selected and armv6t2 uses the newer thumb 2 set. All other
versions that zig supports pre-armv7 need the veneers and hence the
flag. Armv5 is actually armv5t.

Relevant code from clang/lib/Basic/Targets/Arm.cpp

```c
bool ARMTargetInfo::isThumb() const {
  return ArchISA == llvm::ARM::ISAKind::THUMB;
  }

bool ARMTargetInfo::supportsThumb() const {
  return CPUAttr.count('T') || ArchVersion >= 6;
}

bool ARMTargetInfo::supportsThumb2() const {
  return CPUAttr.equals("6T2") ||
    (ArchVersion >= 7 && !CPUAttr.equals("8M_BASE"));
}
```

Also see

http://www.llvm.org/svn/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td
2019-04-10 12:35:16 -04:00
Andrew Kelley
dea1027f97 doc comments for parameters in std.mem.Allocator 2019-04-09 17:43:49 -04:00
Jay Weisskopf
cca02a4cf8 Update README headline to match website 2019-04-09 00:31:39 -04:00
Jay Weisskopf
98fa065de7 docs: Underline link when hovering over it
In addition to the pointer, this gives some visual feedback to the user
that the element is interactive. This is a very common style pattern
across the web.
2019-04-09 00:31:25 -04:00
Andrew Kelley
bddbbef32b Release 0.4.0 2019-04-08 15:41:41 -04:00
Jimmi Holst Christensen
43e219b0d9 Merge branch 'master' of github.com:ziglang/zig 2019-04-08 05:30:32 +02:00
Jimmi Holst Christensen
f86ea797ba Import 1607.zig to behavior.zig 2019-04-08 05:30:27 +02:00
Ryan Liptak
6a78b315b2 Fix std.HashMap.remove returning incorrect KV
Now returns a copy of the removed kv instead of a pointer to the removed kv. The removed kv gets overwritten when shifting the hash map after the removal, so returning a pointer to it will have another kv's values in it after the return.

This bug had some nasty downstream effects in things like BufSet and BufMap where delete would free a still in-use KV and leave the actually removed KV un-free'd.
2019-04-07 15:47:09 -04:00
Andrew Kelley
6715c54cc6 Merge pull request #2205 from kristate/zig-backport-issue532
stage1: create ir.cpp specific `analyze_type_expr`
2019-04-07 15:32:02 -04:00
kristopher tate
fae0c35195 test/compile_errors.zig: add regression test for ziglang/zig#532 ; 2019-04-07 10:37:43 +09:00
kristopher tate
627b52fe65 src/ir.cpp: don't call-out to analyze_type_expr;
replaces `analyze_type_expr` with `ir_analyze_type_expr`
2019-04-07 10:37:43 +09:00
Jimmi Holst Christensen
7c38651a65 Merge branch 'master' of github.com:ziglang/zig 2019-04-07 03:19:08 +02:00
Jimmi Holst Christensen
6960cd156a Added regression test for #1607. fixes #1607 2019-04-07 03:18:51 +02:00
Andrew Kelley
77c2036159 Merge pull request #2200 from ziglang/fix-1726
fixed #1726
2019-04-06 12:49:00 -04:00
Jimmi Holst Christensen
65cf5a8e44 removed todo comment and added test 2019-04-06 11:04:55 +02:00
Jimmi Holst Christensen
3109c89850 fixed 1726 2019-04-06 10:56:07 +02:00
Andrew Kelley
f00adb47f5 ir: avoid dependency on isnan
there's a simple way to check for nan that does not need this header.
hryx on IRC reported that Linux Mint based on ubuntu 16.04, kernel
4.15.0, x86_64 did not have the isnan function.
2019-04-06 01:03:30 -04:00
Andrew Kelley
974977f12f docgen: add a space between the header and the section symbol 2019-04-05 23:12:25 -04:00
Andrew Kelley
83390bdfdd fix dereferencing a zero bit type
Before only u0 was special cased in handling a dereference;
now all zero bit types are handled the same way. Dereferencing
a pointer to a zero bit type always gives a comptime-known
result.

This previously had been failing on master branch but went unnoticed
because until 846f72b57c the CI server was mistakenly not actually
running the single-threaded tests with --single-threaded.

This fixes the standard library tests with --single-threaded
--release-fast.
2019-04-05 20:18:26 -04:00
Shritesh Bhattarai
3854bb9198 wasm: Pass --allow-undefined and --export-all to the linker 2019-04-05 18:46:11 -04:00
Shritesh Bhattarai
66fab05eba build: usageAndErr clean exit (#2194)
* build: usageAndErr clean exit
2019-04-05 18:38:11 -04:00
Shritesh Bhattarai
895e6eabc2 Fix getCurrentId test for pthreads (#2197)
* Fix getCurrentId test for pthreads
2019-04-05 18:12:46 -04:00
vegecode
d72239d339 Add divdf3 to compiler_rt
Also adds __aeabi_ddiv for arm32 targets
2019-04-05 18:10:19 -04:00
Andrew Kelley
1f9ebf49f8 ci: stop doing the branch redirect thing
Now that we have https://ziglang.org/download/index.json

See #1046
2019-04-05 17:33:58 -04:00
Andrew Kelley
f6be6ace1f docgen: allow urls to have numbers 2019-04-05 17:33:58 -04:00
Andrew Kelley
fd65cdc55a fix incorrect Thread.getCurrentId test
Documentation comments copied here:

On Linux, it is possible that the thread spawned with `spawnThread`
finishes executing entirely before the clone syscall completes. In this
case, `std.os.Thread.handle` will return 0 rather than the
no-longer-existing thread's pid.
2019-04-05 16:06:35 -04:00
Andrew Kelley
c47c2a2f2a stage1: fix debug builds on macOS 2019-04-05 15:39:00 -04:00
Andrew Kelley
846f72b57c zig build: support single-threaded builds
and fix the zig test suite not setting the --single-threaded flag
2019-04-05 14:54:37 -04:00
Andrew Kelley
a5b47bc2c2 docs: update @typeInfo definition and clarify field order 2019-04-05 12:38:15 -04:00
Shritesh Bhattarai
2f236e6efb fmt: support trailing comma after var_args 2019-04-05 12:27:13 -04:00
Shritesh Bhattarai
6cc2d3938e support comptime_int in formatInt{,Value} 2019-04-05 11:11:04 -04:00
Jay Weisskopf
3cce56af99 docs: Use section symbol §, not paragraph symbol ¶
A header may cover more than one paragraph, so a section symbol is more appropriate. 

https://en.wikipedia.org/wiki/Section_sign
2019-04-05 11:09:38 -04:00
vegecode
c24a49a1a7 Fixes to divsf3 (#2186)
* Fixes to divsf3

Embarrassingly failed to notice a section that was unchanged from where
it was copied from mulXf3.zig. The test cases for this function series
div{s,d,t}f3 are very incomplete and don't exercise all code paths.

Remove unnecessary switch from divsf3 left during development from when
I tried to make it generic to support f32, f64, and f128 in one go.

Make runtime safety dependent on whether a test is being run.

* divsf3: switch plus to minus
2019-04-05 11:04:46 -04:00
Shawn Landden
aecbd1892a Simplify math.isnan
We can just rely on the builtin behavior.
2019-04-05 11:03:57 -04:00
Andrew Kelley
1dc6751721 fix NaN comparing equal to itself
This was broken both in comptime code and in runtime code.

closes #1174
2019-04-04 22:07:15 -04:00
emekoi
0bd4901a17 fixed linking of system libraries on mingw 2019-04-04 21:07:02 -05:00
emekoi
6cc443ee45 added code for linking libc on mingw 2019-04-04 19:51:55 -05:00
emekoi
ecd2332bb5 made lld flags on windows consistent 2019-04-04 19:51:55 -05:00
Shritesh Bhattarai
8e6ff8d615 fmt: format multi line only on trailing comma (#2184)
* fmt: format multi line only on trailing comma
2019-04-04 19:33:32 -04:00
Andrew Kelley
5866dfe4d9 Merge pull request #2109 from emekoi/fix-mingw
fixed libc command on mingw
2019-04-04 15:55:40 -04:00
Andrew Kelley
be0f656c21 fix @divFloor returning incorrect value and add __modti3
Closes #2152
See #1290
2019-04-04 15:45:37 -04:00
vegecode
12c4ab3927 Add divsf3 to compiler rt 2019-04-04 15:38:09 -04:00
Andrew Kelley
7dd1e0fc2b docs: add Variables section
closes #1927
2019-04-04 12:26:47 -04:00
Andrew Kelley
c195d645e4 add regression test for #1025
closes #1025
2019-04-04 01:45:18 -04:00
Andrew Kelley
947c87b558 threads: fix using unmapped memory in some cases
as pointed out in #musl IRC, the memory for the fs register address
value needs to be taken into account in the mmap call.
2019-04-04 01:36:01 -04:00
hryx
e827b9661b zig fmt: Prevent for-else on same line when body is interrupted by LF 2019-04-04 01:31:39 -04:00
hryx
cec8c8678a zig fmt: Fix regression in for-else (#2178) 2019-04-04 01:31:39 -04:00
Andrew Kelley
90b6eab05a docs: complete the documentation for extern struct
closes #1522
2019-04-04 01:23:41 -04:00
Andrew Kelley
e4d595a8ba fix thread local variables for non- position independent code
This fixes comes thanks to Rich Felker from the musl libc project,
who gave me this crucial information:

"to satisfy the abi, your init code has to write the same value
to that memory location as the value passed to the [arch_prctl]
syscall"

This commit also changes the rules for when to build statically
by default. When building objects and static libraries, position
independent code is disabled if no libraries will be dynamically
linked and the target does not require position independent code.

closes #2063
2019-04-04 01:08:26 -04:00
Ruslan Prokopchuk
70ae3222b5 handle LibExeObjStep.disable_gen_h
It is sometimes useful to skip generating of the header file (e.g. https://github.com/ziglang/zig/issues/2173), and zig compiler provides an option `--disable-gen-h` to control that behaviour. However, setting `lib.disable_gen_h = true` in a typical `build.zig` didn't append the option to arguments. This commit fixes it and adds a convenient `setDisableGenH` setter.
2019-04-03 18:31:25 -04:00
Andrew Kelley
4795f161e6 Merge pull request #2175 from tgschultz/stdlib-serialization-minor_changes
Minor changes to serializer/deserializer
2019-04-03 18:13:25 -04:00
Andrew Kelley
b60f2d0c9f langref: rework the theming and layout
* Instead of the only color scheme being dark, the language reference
   now has a light theme by default, and respects the user's light/dark
   preference via prefers-color-scheme media query. Most browsers don't
   support this yet, so we just have to wait patiently for the future to
   arrive. closes #2172.

 * Instead of a side bar index, the index is inline with the rest of the
   content. This is simpler and more friendly to all user agents, and means
   we don't need the media query for mobile devices. It also makes
   back-references work, so now headers link to the table of contents
   and the table of contents links to headers.
2019-04-03 17:39:07 -04:00
tgschultz
fe33d8ea14 Changes as suggested by andrewrk 2019-04-03 20:05:24 +00:00
Andrew Kelley
692086f898 ci: add missing cache control headers and update download/index.json 2019-04-03 16:04:24 -04:00
tgschultz
ba774c5697 (De)serializer now uses enum instead of bool to determine packing mode (byte/bit).
Optional is initialized in a more straight-forward way by deserializer.
2019-04-03 15:47:46 +00:00
Andrew Kelley
85edf55b73 Merge pull request #2135 from ziglang/decouple-llvm-types
decouple llvm types from zig types
2019-04-02 23:17:17 -04:00
Andrew Kelley
025a1475c4 emit better debug info for enums
fixes llvm assertion when building for windows
2019-04-02 19:40:33 -04:00
Andrew Kelley
6a7b75b73c fix LLVM assertion failures 2019-04-02 19:09:25 -04:00
Andrew Kelley
15bd4aa54f fix setting union body twice 2019-04-02 18:43:25 -04:00
Andrew Kelley
e9dc504141 avoid tripping assertion for setting struct body twice 2019-04-02 18:31:19 -04:00
Andrew Kelley
d577dde636 passing all tests 2019-04-02 18:31:19 -04:00
Andrew Kelley
9780fd59f0 put the alignment hack in for unions too. fixes std tests 2019-04-02 18:31:19 -04:00
Andrew Kelley
cb0241fe44 behavior tests passing again 2019-04-02 18:31:19 -04:00
Andrew Kelley
4c38a8cce1 more regression fixes. empty test passes again 2019-04-02 18:31:19 -04:00
Andrew Kelley
5aee17e888 regression fixes and fix packed struct abi size 2019-04-02 18:31:19 -04:00
Andrew Kelley
ddb8aa73f5 more regression fixes 2019-04-02 18:31:18 -04:00
Andrew Kelley
30b2fb2fb5 bug fixes 2019-04-02 18:31:18 -04:00
Andrew Kelley
d7bc7635c0 put the hack from master branch back in 2019-04-02 18:31:18 -04:00
Andrew Kelley
d3f2fe2cef remove the lazy value stuff
let's try to keep this branch to solving one problem at a time
2019-04-02 18:31:18 -04:00
Andrew Kelley
3dc8448680 introduce lazy values
but I think it's a bad idea, so I'm going to back out the change
2019-04-02 18:31:18 -04:00
Andrew Kelley
ee5064c053 decouple llvm types from zig types
Not tested yet, but it builds.

This closes #761, and lays the groundwork for fixing the remaining
false positive "foo depends on itself" bugs, such as #624.

It also lays the groundwork for implementing ability to specify
alignment of fields (#1512).
2019-04-02 18:31:17 -04:00
Andrew Kelley
2f96c55095 fix cache hash regression
fixes "warning: unexpected seek failure"

fix regression introduced by 27e31f0475

the fd should be closed only if returning with an error
2019-04-02 15:29:16 -04:00
Andrew Kelley
0cccba71d4 better error message when os_file_overwrite fails 2019-04-02 15:21:08 -04:00
Shawn Landden
27e31f0475 fix fd leak in stage1 cacheing code 2019-04-02 12:27:14 -04:00
Andrew Kelley
3c27d9c25a Merge pull request #2147 from emekoi/fix1940
added error for implicit cast from *const T to *[1]T.
2019-04-01 11:35:03 -04:00
Andrew Kelley
3199792ade Merge pull request #2150 from vegecode/armv7m-compiler-rt
Armv7m compiler rt
2019-04-01 11:31:57 -04:00
hryx
c76d51de97 zig fmt: Allow one-line for loops 2019-04-01 11:31:00 -04:00
Shritesh Bhattarai
d645500883 fmt: fix first line comment indent in struct init 2019-03-31 22:33:32 -04:00
vegecode
bfbfb7b3b0 Remove inline keywords in addXf3.zig pending #2154 2019-03-31 21:00:36 -05:00
hryx
0563e8e1d4 Always write a multiline struct literal if a field expr is multiline 2019-03-31 21:09:56 -04:00
emekoi
b7aa289ae4 fixed broken casts in std 2019-03-31 16:47:34 -05:00
emekoi
4a64f26627 added error for implicit cast from *const T to *[1]T. credit: @kristate 2019-03-31 16:47:34 -05:00
Michael Dusan
aa794eb621 fix zig run to accept executable args
The `--` double-hyphen is now used to end further `zig` processing
of command line options. All arguments after `--` will be passed
on to the executable. eg. `--help` will be passed on.

`zig run foo.zig -- --help`

closes #2148
2019-03-31 17:01:11 -04:00
vegecode
937ff0cb6a Add all __aeabi functions (C versions) who alias currently existing functions to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
779137be41 Add __aeabi_{f,d}neg and __neg{s,d,X}f2 to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
38c2093500 Add __aeabi_{f,d}{add,sub} and __{add,sub}{s,d}f3 to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
310f91fb4f Add __aeabi_mem{cmp,clr,set,cpy,move} to compiler-rt 2019-03-31 15:54:02 -05:00
vegecode
e89b704293 Add memcmp to builtins 2019-03-31 15:54:02 -05:00
hryx
a4afacd182 Veritcally align array literal columns 2019-03-31 14:27:10 -04:00
Andrew Kelley
25ac2fe8cd fix anon enum literal used with switch on union(enum)
closes #2141
closes #2142
2019-03-31 12:43:21 -04:00
MateuszOkulus
62af701804 Remove binary and octal float literals from documentation.
Part of #2093
2019-03-31 10:49:55 -04:00
Andrew Kelley
90a78866db Merge pull request #2112 from shritesh/param_decl_doc_comments
Add doc_comments to param decl
2019-03-30 19:22:28 -04:00
Shritesh Bhattarai
b0d89cfe3f fmt: Fix param decl test 2019-03-30 14:58:18 -05:00
Shritesh Bhattarai
efa751c339 Add doc_comments to param decl 2019-03-30 14:50:08 -05:00
emekoi
8fdf8b6972 fixed libc command on mingw 2019-03-29 23:16:17 -05:00
Rohlem
5703ab1d0c fix std.ascii type error and inverted logic
previously:
```
...\lib\zig\std\ascii.zig:203:20: error: unable to perform binary not operation on type 'comptime_int'
        return c | ~0b00100000;
                   ^
```
2019-03-29 12:18:42 -04:00
Rohlem
a824a8c687 add std.ascii to std.std test "std" 2019-03-29 12:18:42 -04:00
Shawn Landden
d494a5f4cf fix tests for math.mulWide 2019-03-29 12:17:48 -04:00
Shawn Landden
66f13ba807 stage1: better error message when comparing against null
Closes: #2104
2019-03-28 15:54:44 -04:00
Shawn Landden
85d1885375 std.mulWide() whose return is twice as wide 2019-03-28 15:51:10 -04:00
Andrew Kelley
64b2cf776c implement target_c_type_size_in_bits for WASI 2019-03-27 16:08:45 -04:00
Andrew Kelley
fbe9233aa7 Merge pull request #2107 from shawnl/arm64
fix build on arm64
2019-03-27 13:11:01 -04:00
emekoi
cf4e9a27c5 removed static build flags on mingw 2019-03-27 12:49:26 -04:00
Shawn Landden
084724c689 use __ARM_EABI__, not __arm__
This is sort of pedantic and old OABI systems are unlikely to ever run zig.
2019-03-27 01:18:58 +00:00
Shawn Landden
65e234adfd fix build on arm64 2019-03-27 01:14:29 +00:00
Shritesh Bhattarai
85575704a4 Use linux.exit_group if not single threaded 2019-03-26 17:49:20 -04:00
Shritesh Bhattarai
5942797000 fmt: check for extra newline at end of file
`anything_changed` checks if `source_index` == `source.len`
Fixes #2074
2019-03-26 13:26:00 -04:00
Shawn Landden
51be449a57 std.ascii: respond to review
This won't generate as much mode in debug mode, as it doesn't check for overflow.
2019-03-26 12:00:55 -04:00
Andrew Kelley
1d09cdaa6a munmap allows address 0
fixes test suite regression on macOS from previous commit
2019-03-25 16:04:25 -04:00
Andrew Kelley
5eaead6a56 implement allowzero pointer attribute
closes #1953

only needed for freestanding targets.

also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley
3306e43984 add compile error test for invalid enum literal implicit cast
See #683
2019-03-24 18:51:24 -04:00
Andrew Kelley
da9d8a6ecf implement peer type resolution for enum literals
See #683
2019-03-24 18:47:36 -04:00
Andrew Kelley
aff7b38838 make switch expressions allow enum literal types
See #683
2019-03-24 01:15:21 -04:00
Andrew Kelley
a736dfe6a1 implement implicit cast from enum literal to enum
See #683
2019-03-24 00:55:55 -04:00
Andrew Kelley
d0551db5cd introduce the enum literal type
see #683
2019-03-24 00:44:18 -04:00
Andrew Kelley
64dddd7afe add compile error for ignoring error
closes #772
2019-03-23 19:33:00 -04:00
Andrew Kelley
6a9c32f759 add regression tests for a bug fixed by an older commit
closes #1914
2019-03-23 19:01:51 -04:00
Andrew Kelley
4d50bc3f8d add peer type resolution for *const T and ?*T
closes #1298
2019-03-23 18:48:12 -04:00
Andrew Kelley
89953ec83d character literals: allow unicode escapes
also make the documentation for character literals more clear.
closes #2089

see #2097
2019-03-23 17:35:21 -04:00
Andrew Kelley
55cb9ef138 docs: clarify NaN, inf, -inf
closes #2089
2019-03-23 15:25:38 -04:00
Andrew Kelley
3e9697bb35 remove octal and hex floats from the language
closes #2093

This is technically a breaking change but I would be
surprised if anyone was actually using this feature.
2019-03-23 14:04:52 -04:00
Andrew Kelley
14d416f83b parse_f128.c: fix whitespace 2019-03-23 13:46:50 -04:00
Andrew Kelley
d83836825f add mulXf3 to compiler-rt
this adds the following functions to compiler-rt:

 * `__mulsf3`
 * `__muldf3`
 * `__multf3`

See #1290
2019-03-22 17:46:49 -04:00
Andrew Kelley
324cbb9864 stage1: implement get_dynamic_linker for riscv 2019-03-22 17:12:41 -04:00
Andrew Kelley
e9f066acae fix macos build instructions in readme and fix warning 2019-03-22 16:57:41 -04:00
Shawn Landden
b76398c993 std: add ascii with C ASCII character classes
Does NOT look at the locale the way the C functions do.

       int isalnum(int c);
       int isalpha(int c);
       int iscntrl(int c);
       int isdigit(int c);
       int isgraph(int c);
       int islower(int c);
       int isprint(int c);
       int ispunct(int c);
       int isspace(int c);
       int isupper(int c);
       int isxdigit(int c);

       int isascii(int c);
       int isblank(int c);

       int toupper(int c);
       int tolower(int c);

Tested to match glibc (when using C locale) with this program:

const c = @cImport({
    // See https://github.com/ziglang/zig/issues/515
    @cDefine("_NO_CRT_STDIO_INLINE", "1");
    @cInclude("stdio.h");
    @cInclude("string.h");
    @cInclude("ctype.h");
});

const std = @import("std");
const ascii = std.ascii;
const abort = std.os.abort;

export fn main(argc: c_int, argv: **u8) c_int {
    var i: u8 = undefined;
    i = 0;
    while (true) {
        if (ascii.isAlNum(i) != (c.isalnum(i) > 0)) { abort(); }
        if (ascii.isAlpha(i) != (c.isalpha(i) > 0)) { abort(); }
        if (ascii.isCtrl(i) != (c.iscntrl(i) > 0)) { abort(); }
        if (ascii.isDigit(i) != (c.isdigit(i) > 0)) { abort(); }
        if (ascii.isGraph(i) != (c.isgraph(i) > 0)) { abort(); }
        if (ascii.isLower(i) != (c.islower(i) > 0)) { abort(); }
        if (ascii.isPrint(i) != (c.isprint(i) > 0)) { abort(); }
        if (ascii.isPunct(i) != (c.ispunct(i) > 0)) { abort(); }
        if (ascii.isSpace(i) != (c.isspace(i) > 0)) { abort(); }
        if (ascii.isUpper(i) != (c.isupper(i) > 0)) { abort(); }
        if (ascii.isXDigit(i) != (c.isxdigit(i) > 0)) { abort(); }
        if (i == 255) { break; }
        i += 1;
    }

    _ = c.printf(c"Success!\n");
    return 0;
}
2019-03-22 16:25:56 -04:00
Andrew Kelley
6272847917 Merge pull request #2094 from ziglang/f128-decimal-literal
float literals now parse using musl's 128 bit float code
2019-03-22 16:21:56 -04:00
Andrew Kelley
02767690e0 get rid of restrict; it's not supported by MSVC 2019-03-22 16:08:19 -04:00
Andrew Kelley
71c78cc9cf avoid quad float literal syntax for MSVC 2019-03-22 16:06:18 -04:00
Andrew Kelley
4615ed5ea0 float literals now parse using musl's 128 bit float code
fixes float literals not having 128 bit precision
2019-03-22 14:56:03 -04:00
Matt Stancliff
1ca78e39e4 Fix typos around pointer usage 2019-03-22 14:10:17 -04:00
Andrew Kelley
127bb124a0 Merge pull request #2091 from ziglang/bigint-print-fix
Fix bigint_append_buf
2019-03-22 10:23:18 -04:00
Andrew Kelley
3560f61c16 Merge pull request #2087 from ziglang/float-parsing
fix some hex literal parsing bugs
2019-03-22 10:16:46 -04:00
Marc Tiehuis
a3f42a5fe1 Fix compile-error test case for large integer type 2019-03-23 00:20:03 +13:00
Marc Tiehuis
6f90d2c209 Fix bigint_append_buf
All current usages use base 10 and have a limb length of 1, hence why
we weren't hitting this error in practice.
2019-03-22 22:10:51 +13:00
Jimmi Holst Christensen
23af502d04 Updated langref to newest grammar 2019-03-22 09:01:30 +01:00
Marc Tiehuis
e3b70fe4ba Simplify hex-float parsing code 2019-03-22 17:11:57 +13:00
Andrew Kelley
d04a1456df hex float parsing: solve another case
this works now: 0x1.edcb34a235253948765432134674fp-1
2019-03-21 16:35:18 -04:00
Andrew Kelley
af509c68b0 fix parsing of large hex float literals
closes #2083
2019-03-21 16:17:29 -04:00
Andrew Kelley
b5cc92f163 ci: more quoting 2019-03-21 10:05:14 -04:00
Andrew Kelley
246304125a add documentation for zig test
closes #1518
2019-03-20 23:50:22 -04:00
Andrew Kelley
bf4701562c ci: add FreeBSD to download page 2019-03-20 23:19:18 -04:00
Andrew Kelley
b7fb63d696 ci: apt-get update before install as a workaround 2019-03-20 19:05:47 -04:00
Andrew Kelley
15c316b0d8 add docs for assembly and fix global assembly parsing
Previously, global assembly was parsed expecting it to have
the template syntax. However global assembly has no inputs,
outputs, or clobbers, and thus does not have template syntax.
This is now fixed.

This commit also adds a compile error for using volatile
on global assembly, since it is meaningless.

closes #1515
2019-03-20 19:00:23 -04:00
Andrew Kelley
3c7555cb67 Merge remote-tracking branch 'origin/llvm8' 2019-03-20 13:34:07 -04:00
Andrew Kelley
2fdf69bc40 Merge pull request #2079 from Sahnvour/issue-2050
Fixes c_ABI tests on windows
2019-03-20 00:11:11 -04:00
Sahnvour
d669db7673 c_abi: activate tests on windows 2019-03-19 22:41:27 +01:00
Sahnvour
27d5e1f36c c_abi: add some tests for int and float parameter passing potentially using both registers and stack 2019-03-19 22:09:12 +01:00
Andrew Kelley
ac34841270 build.zig: allow run() on non-native target artifacts 2019-03-19 17:08:50 -04:00
Sahnvour
c17b1635ca c_abi: when compiling for x86_64, differenciate between system V and windows ABI 2019-03-19 22:08:19 +01:00
Andrew Kelley
9801a1df6a disable all C warnings when building musl 2019-03-19 15:04:39 -04:00
Andrew Kelley
3c36929603 zig targets prints the available libcs 2019-03-19 15:04:29 -04:00
Andrew Kelley
af9ac0d548 better buffer length for formatIntUnsigned
see #1358
2019-03-19 10:11:28 -04:00
Jimmi Holst Christensen
e508b85746 Updated parser to newest grammar 2019-03-19 10:36:37 +01:00
Andrew Kelley
1b25dcde96 freebsd ci: disable not working stuff 2019-03-19 00:53:36 -04:00
Andrew Kelley
fd2993578d ci: freebsd tests docs 2019-03-19 00:05:59 -04:00
Andrew Kelley
b44ff4ca8e freebsd ci: install wget and set -x -e 2019-03-18 23:44:29 -04:00
Andrew Kelley
0c6e687436 start producing freebsd binaries 2019-03-18 23:37:48 -04:00
Andrew Kelley
567175f833 add documentation for Memory
closes #1904
2019-03-18 21:40:24 -04:00
Andrew Kelley
fca83876d8 workaround for Ubuntu/Debian bug
see #2076
2019-03-18 20:56:46 -04:00
Andrew Kelley
85256521ba fix translate-c regression 2019-03-18 20:09:27 -04:00
Andrew Kelley
a581f4f0e2 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-18 20:03:23 -04:00
Andrew Kelley
db0e188f0e update macos static build for llvm8 2019-03-18 18:36:35 -04:00
Andrew Kelley
1b801bdbae pass explicit frame pointer args when compiling C code 2019-03-18 16:59:48 -04:00
Andrew Kelley
a17bf219c6 Merge pull request #2069 from ziglang/glibc-assert-translation
Implemented enough of translate-c to translate assert
2019-03-18 14:43:17 -04:00
Andrew Kelley
7dfbeca13e libc: separate linux headers from musl/glibc 2019-03-18 13:47:59 -04:00
Jimmi Holst Christensen
9171e7a7c1 More work on ignoring values correctly 2019-03-18 14:55:57 +01:00
Andrew Kelley
6acabd6b57 when linking msvcrt, also link ntdll.lib
See #2073
2019-03-17 14:14:05 -04:00
Andrew Kelley
c8453454e1 add missing std lib file rb.zig to cmakelists.txt 2019-03-17 13:52:45 -04:00
Sahnvour
ae9b90cf6e print a message instead of returning an error when debug info comes from a source file not found (for example compiled on another computer) 2019-03-16 15:34:14 +01:00
Sahnvour
704dfaaabf avoid reading LineBlockFragmentHeader at all if the address is not in range, thus simplifying code and improving speed of execution 2019-03-16 15:34:14 +01:00
Sahnvour
094d40fb1a allow pdb modules to have no C13 data, this happens if the module is stripped 2019-03-16 15:34:14 +01:00
Sahnvour
0d4a5c40bc correct padding handling between std.pdb.ModInfo entries in DbiStream 2019-03-16 15:34:14 +01:00
Andrew Kelley
6abe6dbfe4 enable issue_339 test on macos
closes #1126
2019-03-16 01:18:46 -04:00
Andrew Kelley
6d6195424d add regression test for invalid multiple dereferences
closes #1042
2019-03-16 00:23:18 -04:00
Andrew Kelley
c40448eb9a add compile error for wrong type with use
closes #1557
2019-03-16 00:18:10 -04:00
Andrew Kelley
4a5cd0b895 fix while continue block not checking for ignored expression
closes #957
2019-03-15 23:52:11 -04:00
Andrew Kelley
01fb421031 fix regressions on Windows from previous commit 2019-03-15 18:57:07 -04:00
Andrew Kelley
9c13e9b7ed breaking changes to std.mem.Allocator interface API
Before, allocator implementations had to provide `allocFn`,
`reallocFn`, and `freeFn`.

Now, they must provide only `reallocFn` and `shrinkFn`.
Reallocating from a zero length slice is allocation, and
shrinking to a zero length slice is freeing.

When the new memory size is less than or equal to the
previous allocation size, `reallocFn` now has the option
to return `error.OutOfMemory` to indicate that the allocator
would not be able to take advantage of the new size.

For more details see #1306. This commit closes #1306.

This commit paves the way to solving #2009.

This commit also introduces a memory leak to all coroutines.
There is an issue where a coroutine calls the function and it
frees its own stack frame, but then the return value of `shrinkFn`
is a slice, which is implemented as an sret struct. Writing to
the return pointer causes invalid memory write. We could work
around it by having a global helper function which has a void
return type and calling that instead. But instead this hack will
suffice until I rework coroutines to be non-allocating. Basically
coroutines are not supported right now until they are reworked as
in #1194.
2019-03-15 17:57:21 -04:00
Jimmi HC
5ae400fb39 fixed void cast and added the last tests 2019-03-15 19:11:46 +01:00
Andrew Kelley
4090fe81f6 Merge pull request #2068 from ziglang/workaround-for-2043
workaround for #2043
2019-03-15 11:19:21 -04:00
Jimmi Holst Christensen
a77b2a0810 Implemented enough of translate-c to translate assert
This required the following
* __extention__
* ({})
* Fixing if (0) ; else ;
2019-03-15 16:12:41 +01:00
Jimmi Holst Christensen
3ef9b899e4 workaround for #2043 2019-03-15 11:17:21 +01:00
Akuli
b1c8c79733 Add /lib/x86_64-linux-gnu or similar to default system library search paths
this makes compiling with libraries like zlib and ncurses easier
2019-03-14 14:51:24 -04:00
Andrew Kelley
080dd27157 breaking: fix @typeInfo handling of global error set type
`builtin.TypeInfo.ErrorSet` is now `?[]Error`
instead of `struct{errors:[]Error}`.

closes #1936
2019-03-14 11:57:56 -04:00
Andrew Kelley
e861da03f9 macho linking: always -dynamic for non-static-libs 2019-03-14 00:07:05 -04:00
Andrew Kelley
862ac42a6e ignore -lm on darwin because it's handled by libSystem 2019-03-13 23:44:38 -04:00
Andrew Kelley
927efe5f42 force windows to link against dynamic msvcrt
See #2064
2019-03-13 23:35:58 -04:00
Andrew Kelley
20c36949e1 fix target_requires_pic and reloc_mode
disable failing thread local variable test.
see #2063
2019-03-13 23:15:34 -04:00
Andrew Kelley
5d2edac12d breaking: remove --static; add -dynamic
`--static` is no longer an option. Instead, Zig makes things as static
as possible by default. `-dynamic` can be used to choose a dynamic
library rather than a static one.

`--enable-pic` is a new option. Usually it will be enabled
automatically, but in the case of build-exe with no dynamic libraries
on Linux or freestanding, Zig chooses off by default.

closes #1703
closes #1828
2019-03-13 19:50:41 -04:00
Andrew Kelley
85d0f0d45b fix @setRuntimeSafety not able to override release modes 2019-03-13 14:46:53 -04:00
Andrew Kelley
d213708333 this empty import workaround no longer necessary 2019-03-13 14:13:09 -04:00
Andrew Kelley
284f6baf1c remove nios2 from list of libc targets 2019-03-13 13:33:00 -04:00
Andrew Kelley
0588fed15f add documentation for pub
closes #1727
2019-03-13 13:05:23 -04:00
Andrew Kelley
54edbc6815 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-13 12:56:58 -04:00
Andrew Kelley
d495dcc3c9 zig test respects --output-dir parameter 2019-03-13 12:35:10 -04:00
Andrew Kelley
4e40bd8633 add documentation for @"" syntax
closes #1614
2019-03-13 12:01:32 -04:00
LemonBoy
49838a9f3e Fix generation of comptime slices
By erasing the global_refs field we'd trip any codepath using
const_values_equal_ptr to figure if two slices were different.
2019-03-13 11:35:05 -04:00
emekoi
1ed38a682e added z3 and fixed dynamic linker on mingw 2019-03-13 10:37:53 -04:00
Andrew Kelley
26b0d34361 Merge pull request #2055 from ziglang/musl
support musl for all compatible targets
2019-03-13 01:01:26 -04:00
Andrew Kelley
c73cd05468 musl: remove files that have case conflicts 2019-03-13 01:00:12 -04:00
Andrew Kelley
235ded6265 fix gitattributes 2019-03-12 18:40:31 -04:00
Andrew Kelley
cf699ee068 don't resolve dynamic linker for static executables 2019-03-12 18:28:32 -04:00
Andrew Kelley
9741b2aab4 avoid a string that is too long for msvc 2019-03-12 18:09:40 -04:00
Andrew Kelley
5570bc986b remove accidental swap file 2019-03-12 17:44:03 -04:00
Andrew Kelley
62486c35a4 ability to build musl from source
bundles musl 1.1.21

See #514
2019-03-12 17:32:32 -04:00
Andrew Kelley
5734b7a37a building musl start files from source 2019-03-12 13:18:52 -04:00
Andrew Kelley
b7c331eb61 add musl headers 2019-03-12 10:30:12 -04:00
Andrew Kelley
761356209b add test cases to cover switching on u0 values
closes #1563
2019-03-11 19:42:07 -04:00
Andrew Kelley
1a94dec50e docs: finish initial documentation for implicit casts
closes #1514
2019-03-11 19:34:58 -04:00
Sahnvour
9b99356551 translate-c: additional test case for integer suffixes on 0 2019-03-11 16:36:27 -04:00
Andrew Kelley
f2ca2ace09 zig build: do a better job of detecting system paths
See #2041
2019-03-11 15:22:05 -04:00
Andrew Kelley
a909efae9f Merge branch 'daurnimator-valgrind' 2019-03-11 13:42:54 -04:00
Andrew Kelley
d633dcd07a remove the valgrind integration with std.mem.Allocator
See #1837
2019-03-11 13:34:51 -04:00
Andrew Kelley
5362ca204f Merge branch 'valgrind' of https://github.com/daurnimator/zig into daurnimator-valgrind 2019-03-11 13:27:04 -04:00
Andrew Kelley
80e5af2be2 Merge pull request #2049 from ziglang/problematic-mtime-detection
stage1 caching system: detect problematic mtimes
2019-03-11 12:47:55 -04:00
Andrew Kelley
9efa18f687 enable C ABI tests on macOS 2019-03-11 12:21:30 -04:00
Andrew Kelley
e1fbb24d64 add test for spawning child process with empty environment
thanks to BenoitJGirard for pointing out the child process
implementation needs 3 extra null bytes in #2031
2019-03-11 11:56:08 -04:00
Andrew Kelley
b4e6e301e1 Merge branch 'fix-1600'
closes #2036
2019-03-11 11:09:55 -04:00
Andrew Kelley
1d5e349a52 ir: fix handling of OnePossibleValueInvalid
this is the poison value which means a compile error has
already been reported
2019-03-11 11:09:15 -04:00
Jimmi HC
bcbb2650c5 check for type_has_one_possible_value and added correct caching to TypeInfo 2019-03-11 10:55:43 -04:00
Jimmi Holst Christensen
357813b193 added tests 2019-03-11 10:55:43 -04:00
Jimmi Holst Christensen
2d7f0ca387 fixed enum to union code 2019-03-11 10:55:10 -04:00
Jimmi Holst Christensen
5a52613caf use cached const_void_val 2019-03-11 10:55:10 -04:00
Jimmi Holst Christensen
29accac74c removed wild tab 2019-03-11 10:55:10 -04:00
Jimmi Holst Christensen
8eedec4f93 fixed #1600 2019-03-11 10:55:04 -04:00
Andrew Kelley
3ff0e8bd96 Revert "docgen: --cache off for tests"
This reverts commit 0a8a7a57e7.

This workaround is no longer necessary.
2019-03-11 10:35:42 -04:00
Andrew Kelley
6a5c2b249d Revert "use unique test source names for test-gen-h"
This reverts commit 264b03d570.

This workaround is no longer necessary.
2019-03-11 10:35:39 -04:00
Andrew Kelley
895fab156a fix build on windows 2019-03-11 10:35:04 -04:00
Andrew Kelley
3a6f19de48 stage1 caching system: detect problematic mtimes
closes #2045
2019-03-11 10:26:08 -04:00
Marc Tiehuis
83b79522d2 Mark third-party dependencies as vendored 2019-03-11 08:16:50 -04:00
Andrew Kelley
4cb55d3af6 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 18:07:28 -04:00
Andrew Kelley
fec4555476 fix inconsistent type information of optional C pointers
solves an assertion failure in LLVM
2019-03-10 18:02:59 -04:00
Andrew Kelley
918dbd4551 std.zig: this is no longer a keyword 2019-03-10 15:55:54 -04:00
Matt Whiteside
b63b3dc756 Add elf riscv32 and elf riscv64 as options in getLDMOption during construction of link job. 2019-03-10 15:06:17 -04:00
Sahnvour
fa9fcab620 translate-c: add support for integer suffixes on 0 (zero) litteral inside macro definitions 2019-03-10 14:56:35 -04:00
Andrew Kelley
3cdd2c0bdd Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 13:48:06 -04:00
Andrew Kelley
0a8a7a57e7 docgen: --cache off for tests 2019-03-09 11:29:15 -05:00
Andrew Kelley
264b03d570 use unique test source names for test-gen-h 2019-03-09 09:52:33 -05:00
Andrew Kelley
8369ddb09c glibc: add missing linux header 2019-03-09 01:24:30 -05:00
Andrew Kelley
8624379c71 Merge pull request #2038 from ziglang/caching
breaking changes to zig build API and improved caching
2019-03-09 01:17:36 -05:00
Andrew Kelley
a45807db22 disable flaky event test until post coroutine rewrite 2019-03-09 01:15:18 -05:00
Andrew Kelley
94e52dba85 fix docgen and fix unnecessarily adding .root suffix to objects 2019-03-09 01:00:45 -05:00
Andrew Kelley
5046aa9403 fix running things with zig build on Windows
Windows doesn't have rpaths for DLLs so we instead add
search paths to Path environment variable when running
an executable that depends on DLLs built with zig build.
2019-03-09 00:42:14 -05:00
Andrew Kelley
85d23e68ee fix .d file parsing and string literal ast rendering 2019-03-08 23:40:39 -05:00
Andrew Kelley
91955dee58 breaking changes to zig build API and improved caching
* in Zig build scripts, getOutputPath() is no longer a valid function
   to call, unless setOutputDir() was used, or within a custom make()
   function. Instead there is more convenient API to use which takes
   advantage of the caching system. Search this commit diff for
   `exe.run()` for an example.
 * Zig build by default enables caching. All build artifacts will go
   into zig-cache. If you want to access build artifacts in a convenient
   location, it is recommended to add an `install` step. Otherwise
   you can use the `run()` API mentioned above to execute programs
   directly from their location in the cache. Closes #330.
   `addSystemCommand` is available for programs not built with Zig
   build.
 * Please note that Zig does no cache evicting yet. You may have to
   manually delete zig-cache directories periodically to keep disk
   usage down. It's planned for this to be a simple Least Recently
   Used eviction system eventually.
 * `--output`, `--output-lib`, and `--output-h` are removed. Instead,
   use `--output-dir` which defaults to the current working directory.
   Or take advantage of `--cache on`, which will print the main output
   path to stdout, and the other artifacts will be in the same directory
   with predictable file names. `--disable-gen-h` is available when
   one wants to prevent .h file generation.
 * `@cImport` is always independently cached now. Closes #2015.
   It always writes the generated Zig code to disk which makes debug
   info and compile errors better. No more "TODO: remember C source
   location to display here"
 * Fix .d file parsing. (Fixes the MacOS CI failure)
 * Zig no longer creates "temporary files" other than inside a
   zig-cache directory.

This breaks the CLI API that Godbolt uses. The suggested new invocation
can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-08 23:23:11 -05:00
John Schmidt
dd34c21779 PriorityQueue: add bulk insertion methods 2019-03-08 14:23:05 -05:00
Jay Weisskopf
cddc77dd97 Remove glibc compat shim with restrictive license
Unlike the other glibc source code checked into the repo, `csu/init.c`
did not have a license clause that allowed linking without restrictions.

`_IO_stdin_used` is the only symbol in the file and appears to be a 20
year old compatibility shim for the glibc 2.0 ABI. Obsolete in 2.1.
2019-03-08 08:46:06 -05:00
Andrew Kelley
1e634a384c Merge branch 'glibc'
See #514
2019-03-07 16:55:31 -05:00
Andrew Kelley
2bb6825baa fix passing invalid argument -NDEBUG 2019-03-07 16:53:44 -05:00
Andrew Kelley
3d2c48e4c9 disable some tests until coroutine rewrite is finished 2019-03-07 16:11:00 -05:00
Andrew Kelley
46242c4d38 fix -mllvm command line option regression 2019-03-07 16:08:25 -05:00
Andrew Kelley
bbbcf16ef9 fix linking glibc: caching static libs and
handle linking pthread, rt, dl, m better
2019-03-07 15:50:49 -05:00
Andrew Kelley
2caf39c961 fix .d file processing and use -MV to quote spaces 2019-03-07 14:30:50 -05:00
Andrew Kelley
431b3b2459 fix windows build 2019-03-07 13:32:43 -05:00
Andrew Kelley
197311d7dd windows and uefi don't have dynamic linkers 2019-03-07 13:25:17 -05:00
Andrew Kelley
4d8467fafc better behavior when cache dir unavailable
and choose different manifest dir for local cache to avoid
conflict with zig build
2019-03-07 13:16:52 -05:00
Andrew Kelley
e2ce00f272 fix regressions on macos 2019-03-07 13:04:10 -05:00
Andrew Kelley
ffaa4f0a87 dynamic_linker_path can be null on some targets 2019-03-07 12:21:27 -05:00
Andrew Kelley
ce76de35f1 multi-arch glibc headers 2019-03-07 12:16:10 -05:00
Andrew Kelley
189fba4390 process headers tool 2019-03-07 09:15:43 -05:00
Sahnvour
5469e3e3c1 missed change when switching TypeInfo to use comptime_int
fixes #2030
2019-03-06 15:27:56 -05:00
Andrew Kelley
ccdef8c0fb cross compile glibc startup files 2019-03-06 13:22:36 -05:00
Andrew Kelley
697b1233f0 support other architectures for glibc startup files 2019-03-06 12:10:03 -05:00
Andrew Kelley
b554f6294f add popcountdi2 to compiler_rt 2019-03-05 23:09:00 -05:00
Andrew Kelley
ba144b366c build libunwind.a from source and link it 2019-03-05 22:45:41 -05:00
Andrew Kelley
5cecb5e479 libcxx headers 8.0.0rc3 2019-03-05 22:42:35 -05:00
Andrew Kelley
bc8c4ec608 libunwind 8.0.0rc3 2019-03-05 22:42:14 -05:00
Andrew Kelley
e2f4df6065 std.os.changeCurDir no longer needs an allocator 2019-03-05 18:43:39 -05:00
Andrew Kelley
4c386436ea support glibc dl, m, pthread, rt 2019-03-05 18:17:22 -05:00
Andrew Kelley
e06da10838 fix translate-c 2019-03-05 16:12:19 -05:00
Andrew Kelley
55a0016221 dynamic linker path is independent from libc installation 2019-03-05 16:00:28 -05:00
Andrew Kelley
0d10ab0680 stop linking against gcc files 2019-03-05 14:37:32 -05:00
Andrew Kelley
dd263eccb7 support crtbegin.o and crtend.o when using explicit libc 2019-03-05 14:12:46 -05:00
Andrew Kelley
c5fdea59d3 building glibc from source 2019-03-05 13:26:59 -05:00
Andrew Kelley
aeb16010f3 initial glibc support 2019-03-04 22:15:53 -05:00
Andrew Kelley
0714e19598 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-04 08:24:56 -05:00
Andrew Kelley
9c5852aa86 fix slice of C pointer
closes #2002
2019-03-03 13:04:04 -05:00
Andrew Kelley
e3b275fa47 fix build.zig not respecting --static
closes #2027
2019-03-03 12:35:09 -05:00
Andrew Kelley
d0d615d819 fix const initialization of optional C pointer to null 2019-03-03 10:47:06 -05:00
sjdh02
74c123cd0a fix check for 64-bit arm platforms with new targets 2019-03-03 10:04:08 -05:00
Andrew Kelley
e402455704 rename std lib files to new convention 2019-03-02 16:46:04 -05:00
Andrew Kelley
f7835000b6 @returnAddress and @frameAddress return usize now 2019-03-02 15:34:58 -05:00
Andrew Kelley
ea5cedced1 fix @typeName on slices
closes #2026
2019-03-02 14:31:27 -05:00
Sahnvour
4bac22e888 all integers returned by @typeInfo are now comptime_int 2019-03-02 14:27:37 -05:00
Andrew Kelley
67b4de33d2 compile error for import outside package path
closes #2024

there's a new cli option `--main-pkg-path` which you can use to choose
a different root package directory besides the one inferred from the
root source file

and a corresponding build.zig API:
foo.setMainPkgPath(path)
2019-03-02 10:38:27 -05:00
Andrew Kelley
99b6429a89 disable tests which are tripping an llvm assertion
See #2019
2019-03-02 08:44:18 -05:00
Andrew Kelley
764205ac13 better error message for -target windows CLI
closes #1169
2019-03-01 18:42:09 -05:00
Andrew Kelley
bed81089e1 Merge pull request #2020 from ziglang/kill-namespace-type
remove the (namespace) type and make every file an empty struct
2019-03-01 18:07:46 -05:00
Andrew Kelley
9c47bf68fa gen-h: respect @export 2019-03-01 17:52:17 -05:00
Andrew Kelley
fc17b8ee8b remove unused function 2019-03-01 17:36:43 -05:00
Andrew Kelley
26128396f3 gen-h: use the bare type names for now 2019-03-01 17:36:08 -05:00
Andrew Kelley
e8dad62441 fix docs typo 2019-03-01 17:23:27 -05:00
Andrew Kelley
5f7d9c5845 @typeInfo for structs and opaque types is the bare name 2019-03-01 17:15:58 -05:00
Andrew Kelley
a7ddcabb50 fix type names 2019-03-01 15:49:52 -05:00
Andrew Kelley
582fdc2869 fix dependency loops, pub, tests, use decls, root source
* fix dependency loop detection
   - closes #679
   - closes #1500
 * fix `pub`
 * fix tests
 * fix use decls
 * main package file gets a special "" namespace path
2019-03-01 15:35:29 -05:00
Marc Tiehuis
c4887d7f54 Use bitwise-and instead of modulo in __zig_return_error
Avoids emitting compiler-rt div calls on some targets.
2019-03-01 08:23:11 -05:00
Andrew Kelley
76b4e49178 add mprotect syscall 2019-02-28 20:11:36 -05:00
Andrew Kelley
faf76032f1 fix "use" decls 2019-02-28 15:54:09 -05:00
Andrew Kelley
02f3a834b0 struct types get fully qualified names
and function symbol names become fully qualified
2019-02-28 15:40:57 -05:00
Andrew Kelley
382a155191 web assembly is a tier 3 target now
avr should be listed as tier 4. it's not a default target of LLVM
2019-02-28 14:18:55 -05:00
Andrew Kelley
0fd64e6c69 stage2: update for changes regarding sub-architecture 2019-02-28 14:10:45 -05:00
Andrew Kelley
fa3d89674a update clang C headers to 8.0.0rc3 2019-02-28 13:52:17 -05:00
Andrew Kelley
182cd0e4c0 LLD patch: workaround for buggy MACH-O code
This reapplies 00902ff9b0
to the embedded LLD.
2019-02-28 12:54:11 -05:00
Andrew Kelley
5768fcb085 update embedded LLD to 8.0.0rc3 2019-02-28 12:53:08 -05:00
Andrew Kelley
5424b4320d remove namespace type; files are empty structs
closes #1047
2019-02-28 10:11:32 -05:00
Andrew Kelley
6bc19b437c updates to build with llvm 8.0.0rc3 2019-02-28 09:55:27 -05:00
Andrew Kelley
ea73b8e2b8 update clang driver code to 8.0.0rc3 2019-02-28 09:27:07 -05:00
Andrew Kelley
2dcf1a2392 Merge remote-tracking branch 'origin/master' into llvm8 2019-02-28 09:19:18 -05:00
Andrew Kelley
9753e87545 fix incorrect use of printf in previous commit 2019-02-27 20:09:07 -05:00
Andrew Kelley
3bfacf071e print the command that failed when C source code fails to build
also respect the --color arg when building C code
2019-02-27 16:02:07 -05:00
Andrew Kelley
14ca0fd493 uefi os: better auto detection of subsystem 2019-02-27 09:30:48 -05:00
Andrew Kelley
d093f51f16 stage1: fix unused function error on freebsd and netbsd
closes #2012
closes #2013
2019-02-27 08:40:54 -05:00
Andrew Kelley
c59ce046a0 windows returns EINVAL for fopen when there is an asterisk in the name
closes #508
2019-02-26 23:02:57 -05:00
Andrew Kelley
22dd0db9bf improve docs for unions and switching on tagged unions
closes #1943
2019-02-26 22:57:01 -05:00
Andrew Kelley
0d48011f5e fix stage1 zig fmt on macos 2019-02-26 21:33:46 -05:00
Andrew Kelley
557983e502 fix handling when there are multiple externs and
an export in the same object

closes #529
2019-02-26 19:43:12 -05:00
Andrew Kelley
763357c9c3 add test coverage for type used as switch case
closes #996
2019-02-26 19:41:36 -05:00
Andrew Kelley
d5fc826437 add test coverage for binary OR on error sets
closes #1074
2019-02-26 19:34:22 -05:00
Andrew Kelley
1d7e5479b0 fix .gitignore file and add commit missing std lib file 2019-02-26 18:33:27 -05:00
Andrew Kelley
4563f6b424 add builder.addFmt API and use it to test stage1 zig fmt
closes #1968
2019-02-26 18:10:40 -05:00
Andrew Kelley
6365f5a9f3 introduce sys_include_dir for when sys/* files are not with stdlib.h 2019-02-26 17:26:34 -05:00
Andrew Kelley
33174f11ef fix regressions on Windows 2019-02-26 16:24:32 -05:00
Andrew Kelley
ade10387a5 breaking changes to the way targets work in zig
* CLI: `-target [name]` instead of `--target-*` args.
   This matches clang's API.
 * `builtin.Environ` renamed to `builtin.Abi`
   - likewise `builtin.environ` renamed to `builtin.abi`
 * stop hiding the concept of sub-arch. closes #1526
 * `zig targets` only shows available targets. closes #438
 * include all targets in readme, even those that don't
   print with `zig targets` but note they are Tier 4
 * refactor target.cpp and make the naming conventions
   more consistent
 * introduce the concept of a "default C ABI" for a given
   OS/Arch combo. As a rule of thumb, if the system compiler
   is clang or gcc then the default C ABI is the gnu ABI.
2019-02-26 15:58:10 -05:00
Andrew Kelley
1ec1097bd3 use -nostdinc and sometimes -nolibc when compiling C code 2019-02-26 14:59:36 -05:00
John Schmidt
0eed72d687 Add priority queue 2019-02-26 13:21:11 -05:00
Andrew Kelley
6fd2816431 use -nostdinc++ when compiling C code 2019-02-26 10:15:48 -05:00
Andrew Kelley
3932b6474e use -nobuiltininc when compiling c code 2019-02-26 08:16:03 -05:00
Andrew Kelley
82fafca375 fix the libc compile error tests to only run on linux 2019-02-25 21:46:32 -05:00
Andrew Kelley
7571db05de fix incorrectly trying to memset at comptime
closes #718
2019-02-25 20:33:40 -05:00
Andrew Kelley
4b7e285b76 add a regression test for #704
closes #704
2019-02-25 20:18:35 -05:00
Andrew Kelley
152db27146 better error message when forgetting to link against libc
closes #1698
2019-02-25 20:09:18 -05:00
Andrew Kelley
3ca861c7dd add a compile error note when C import fails and not linking libc
closes #558
2019-02-25 19:31:30 -05:00
Andrew Kelley
0f54728cf0 fix not finding libgcc_s when looking for native libc
closes #2011
2019-02-25 19:10:48 -05:00
Andrew Kelley
aab8e13529 add docs for zero bit types and pointers to zero bit types
closes #1561
2019-02-25 18:31:37 -05:00
Andrew Kelley
39605a7965 delete incorrect TODO comment
The code path is tested by behavior tests.

Thanks to various contributors, but mostly Marc Tiehuis,
bigint.cpp now has full coverage.

closes #405
2019-02-25 16:36:18 -05:00
Andrew Kelley
7b8c5578c6 fix infinite recursion in type_has_one_possible_value
closes #2006
2019-02-25 16:28:23 -05:00
Andrew Kelley
33cbb29def zig build: 2 improvements
* `linkLibrary` will make the target depend on libc if the source does
 * when building C source file(s), don't try to generate .h files
2019-02-25 14:27:03 -05:00
Andrew Kelley
6003b1ea70 Merge pull request #2005 from ziglang/c-source
first class support for compiling C code
2019-02-25 14:11:54 -05:00
Andrew Kelley
0d4db8828a @cImport works with --cache on
We pass -MD -MF args to clang when doing `@cImport`, which
gives us a complete list of files that the C code read from.
Then we add these to the cache. So even when using `@cImport`
Zig's caching system remains perfect. This is a proof of concept
for the mechanism that the self-hosted compiler will use to
watch and rebuild files.
2019-02-25 14:03:36 -05:00
Andrew Kelley
525c2eaf5d building DLLs on Windows works better 2019-02-25 13:34:25 -05:00
Andrew Kelley
e76ce2c1d0 first class support for compiling C code
New CLI parameter: --c-source [options] [file]

It even works with `--cache on` when there are transitive dependencies.

Instead of `builder.addCExecutable`, use `builder.addExecutable` and pass
`null` for the root source file. Then use `builder.addCSourceFile`,
which takes the path to the C code, and a list of C compiler args.
Be sure to linkSystemLibrary("c") if you want libc headers to be
available.

Merge TestStep into LibExeObjStep. That was long overdue.
2019-02-25 11:45:00 -05:00
Andrew Kelley
e5d4862e14 Merge pull request #2003 from ziglang/zig-cc
add `zig cc` command to act like a C compiler
2019-02-24 16:28:49 -05:00
Andrew Kelley
8c2c6368f9 zig cc: work around clang calling GetCommandLine on Windows 2019-02-24 15:31:02 -05:00
Andrew Kelley
bcca76b3c4 zig cc: remove "polly" which was an undefined symbol on macos 2019-02-24 13:37:41 -05:00
Andrew Kelley
a77a17e2c2 add zig cc command to act like a C compiler
closes #490
2019-02-24 12:53:28 -05:00
Andrew Kelley
98869edb8b fix zig fmt arg0 handled incorrectly 2019-02-23 20:25:33 -05:00
Andrew Kelley
00d8f4a1bb introduce std.debug.captureStackTrace
and fix the implementation of writeStackTrace
it was printing the first frame in the wrong place
2019-02-23 13:19:06 -05:00
Andrew Kelley
6fd8d455bc better libc detection (#1996)
* better libc detection

This introduces a new command `zig libc` which prints
the various paths of libc files. It outputs them to stdout
in a simple text file format that it is capable of parsing.
You can use `zig libc libc.txt` to validate a file.

These arguments are gone:
--libc-lib-dir [path]        directory where libc crt1.o resides
--libc-static-lib-dir [path] directory where libc crtbegin.o resides
--msvc-lib-dir [path]        (windows) directory where vcruntime.lib resides
--kernel32-lib-dir [path]    (windows) directory where kernel32.lib resides

Instead we have this argument:
--libc [file]                Provide a file which specifies libc paths

This is used to pass a libc text file (which can be generated with
`zig libc`). So it is easier to manage multiple cross compilation
environments.

`--cache on` now works when linking against libc.

`ZigTarget` now has a bool field `is_native`

Better error messaging when you try to link against libc or use
`@cImport` but the various paths cannot be found. It should also be
faster.

* save native_libc.txt in zig-cache

This avoids having to detect libc at runtime on every invocation.
2019-02-23 09:35:56 -05:00
Andrew Kelley
52bb71867d implement vector negation
also fix vector behavior tests, they weren't actually testing
runtime vectors, but now they are.

See #903
2019-02-22 13:28:57 -05:00
Andrew Kelley
2fe8a0831f add regression test for bitcast to array
closes #421
2019-02-22 11:09:17 -05:00
Andrew Kelley
d0c39895aa docs for packed structs
closes #1513
2019-02-22 10:56:49 -05:00
Andrew Kelley
0c5f897904 fix @bitCast when src/dest types have mismatched handle_is_ptr
* separate BitCast and BitCastGen instructions
 * closes #991
 * closes #1934
 * unrelated: fix typo in docs (thanks gamester for pointing it out)
2019-02-22 08:49:27 -05:00
Andrew Kelley
cbce61a209 better field access of types which have one possible value
* When you do field access of a type which only has one possible
   value, the result is comptime-known.
 * StorePtr instructions which operate on pointers to types which
   only have one possible value, the result is a comptime no-op.

closes #1554
2019-02-21 16:09:14 -05:00
Andrew Kelley
1066004b79 better handling of arrays in packed structs
* Separate LoadPtr IR instructions into pass1 and pass2 variants.
 * Define `type_size_bits` for extern structs to be the same as
   their `@sizeOf(T) * 8` and allow them in packed structs.
 * More helpful error messages when trying to use types in
   packed structs that are not allowed.
 * Support arrays in packed structs even when they are not
   byte-aligned.
 * Add compile error for using arrays in packed structs when the
   padding bits would be problematic. This is necessary since
   we do not have packed arrays.

closes #677
2019-02-21 14:44:14 -05:00
Andrew Kelley
2bb795dc45 @sliceToBytes works at comptime
closes #262
2019-02-21 10:07:11 -05:00
Andrew Kelley
db31c2524d extern structs support comptime bitcasting 2019-02-21 08:46:43 -05:00
Andrew Kelley
3ee9d06cbd packed structs support comptime bitcasting
* `type_size_store` is no longer a thing. loading and storing a pointer
   to a value may dereference up to `@sizeOf(T)` bytes, even for
   integers such as `u24`.
 * fix `types_have_same_zig_comptime_repr` to not think that the
   same `ZigTypeId` means the `ConstExprValue` neccesarily has the
   same representation.
 * implement `buf_write_value_bytes` and `buf_read_value_bytes` for
   `ContainerLayoutPacked`

closes #1120
2019-02-20 22:40:41 -05:00
daurnimator
7bbccfc7f3 Use valgrind marks from Allocator 2019-02-21 11:43:09 +11:00
Andrew Kelley
079728752e deduplicate compile errors for undeclared identifiers
closes #111
2019-02-20 08:04:46 -05:00
daurnimator
d68ae35c11 std: when a FixedBufferAllocator is initialised, set the buffer to undefined 2019-02-20 16:52:23 +11:00
daurnimator
da7880b4cf std: Add valgrind module 2019-02-20 16:52:20 +11:00
Andrew Kelley
067968c57f Merge branch 'matthew-mcallister-slice-deref-failure' 2019-02-19 15:35:00 -05:00
Andrew Kelley
c8ce351ec9 pull request fixups 2019-02-19 15:34:44 -05:00
Andrew Kelley
1034af40f9 Merge branch 'slice-deref-failure' of https://github.com/matthew-mcallister/zig into matthew-mcallister-slice-deref-failure 2019-02-19 15:27:10 -05:00
LemonBoy
400006bbe7 Prevent crash in tagged enums rendering (#1986)
* Prevent crash in tagged enums rendering

* Add a test case
2019-02-19 15:18:57 -05:00
Andrew Kelley
db74832e40 valgrind client requests for undefined values
with this change, when you assign undefined, zig emits a few
assembly instructions to tell valgrind that the memory is undefined

it's on by default for debug builds, and disabled otherwise. only
support for linux, darwin, solaris, mingw on x86_64 is currently
implemented.

--disable-valgrind turns it off even in debug mode.
--enable-valgrind turns it on even in release modes.

It's always disabled for compiler_rt.a and builtin.a.

Adds `@import("builtin").valgrind_support` which lets code know
at comptime whether valgrind client requests are enabled.

See #1989
2019-02-19 12:07:56 -05:00
Andrew Kelley
c9fb5240d6 remove --no-rosegment workaround now that valgrind bug is fixed
See #896

Zig 0.3.0+ and Valgrind 3.14+ do not need the workaround.
2019-02-19 08:39:36 -05:00
Andrew Kelley
007a260cda Merge branch 'kristate-zig-backport-issue1944' 2019-02-18 18:12:02 -05:00
Andrew Kelley
ea3d9d5c53 add test for 74bdc1d1f8 2019-02-18 18:11:30 -05:00
Andrew Kelley
b0ceea1831 zig fmt: fix infix operator before multiline string literal 2019-02-18 18:11:12 -05:00
kristopher tate
74bdc1d1f8 src/analyze.cpp: default to using param_node upon callconv error; 2019-02-18 17:57:24 -05:00
John Schmidt
99adda9df5 Some function doc tweaks (#1961)
* Add docs for the inline function attribute

* Remove outdated comment

Seems like a leftover from when implicit returns were around.

* Consistent terminology
2019-02-18 17:53:41 -05:00
Andrew Kelley
043090020f docs: shadowing
closes #1245
2019-02-18 17:49:26 -05:00
Andrew Kelley
8922008dec docs: note top level declarations are order-independent
closes #1244
2019-02-18 17:41:55 -05:00
Andrew Kelley
28bf768883 export _mh_execute_header with weak linkage
* also fix extern variables with initialiaztion values to generate runtime code
 * remove the workaround in example/shared_library/mathtest.zig
 * introduce the ability for global variables to have Weak and LinkOnce
   linkage
 * fix `@export` to work for non-functions. this code needs to be
   audited though.
 * fix comptime ptrcast not keeping bigger alignment
 * fix linker warnings when targeting darwin

closes #1903
2019-02-18 16:47:30 -05:00
Andrew Kelley
74a335c4cc Merge branch 'emekoi-fix-1711' 2019-02-18 13:12:03 -05:00
Andrew Kelley
7a84fe79b9 pull request fixups 2019-02-18 13:05:26 -05:00
emekoi
9b3013d2f6 make @enumToInt work on union(enum)
closes #1711
2019-02-18 11:43:45 -05:00
Jimmi HC
d2fb95af88 Fixed std.testing.expectEqual 2019-02-18 17:22:14 +01:00
LemonBoy
e280dce30f Translate parameterless C functions (#1978)
Both FunctionNoProto and FunctionProto are subclasses of FunctionType,
the only difference is that the former is parameterless.
2019-02-18 10:26:45 -05:00
LemonBoy
7d762648a4 Add align attribute for params pointers 2019-02-18 09:52:18 -05:00
Andrew Kelley
74d9593d85 README: add NetBSD to support table 2019-02-18 00:13:18 -05:00
Andrew Kelley
3e586264e5 Merge pull request #1972 from coypoop/netbsd
Add NetBSD support
2019-02-18 00:10:31 -05:00
Andrew Kelley
39207fa1d4 Merge pull request #1963 from matthew-mcallister/dedup-compile-log-warning
Deduplicate compile log statement warnings
2019-02-17 23:53:43 -05:00
Quetzal Bradley
7e54954052 fix openWriteNoClobber and add test 2019-02-17 23:21:45 -05:00
Matthew McAllister
c70ee9177e Check for duped error messages in compile tests 2019-02-17 15:33:28 -08:00
Matthew McAllister
51783510b9 Deduplicate compile log statement warnings 2019-02-17 14:02:37 -08:00
Maya Rashish
b93405c24b Don't provide a bogus definition of EVFILT_USER 2019-02-17 23:50:30 +02:00
Andrew Kelley
de18ece294 Merge pull request #1975 from BenoitJGirard/master
Fix std.math.powi so powi(x, +-0) = 1 for any x.
2019-02-17 15:00:17 -05:00
Benoit Jauvin-Girard
fcf65f06c4 Fix std.math.powi so powi(x, +-0) = 1 for any x. 2019-02-17 14:52:40 -05:00
LemonBoy
6cf38369d2 Silence gcc8 class-memaccess warnings
Use an explicit cast to tell gcc we know what we're doing.
2019-02-17 14:40:01 -05:00
BenoitJGirard
6daa041932 Merge pull request #2 from ziglang/master
Refreshing fork.
2019-02-17 14:38:55 -05:00
Maya Rashish
2878efee86 Undo local, unneeded patch 2019-02-17 14:14:17 +02:00
Maya Rashish
8d2a902945 freebsd: fix pointer cast in mmap 2019-02-17 02:25:37 -05:00
Maya Rashish
bc10382ec1 Add NetBSD support
Mostly picking the same paths as FreeBSD.
We need a little special handling for crt files, as netbsd uses its
own (and not GCC's) for those, with slightly different names.
2019-02-17 09:17:34 +02:00
Andrew Kelley
db9c1b0528 Merge branch 'sjdh02-master' 2019-02-17 00:33:43 -05:00
Andrew Kelley
4a0bb62584 fixups 2019-02-17 00:29:58 -05:00
sjdh02
fd61a084e4 fix BufferedInStream not reading delayed input 2019-02-16 21:19:49 -06:00
Matthew McAllister
91989e70ba Fix lvalue dereference type checking
Previously, if a dereference instruction was an lvalue, it would fail to
typecheck that the value being dereferenced was indeed a pointer.
Although a little clunky, this change obviates the need for redundant
type checks scattered about the analysis.
2019-02-16 17:37:47 -08:00
Andrew Kelley
c3c92ca8b1 translate-c: 4 more functions using C decls
See #1964
2019-02-16 19:48:39 -05:00
Andrew Kelley
2dfa76a1a7 fix regressions from previous commit when building with clang 2019-02-16 16:17:30 -05:00
Andrew Kelley
356cfa08f4 translate-c: proof of concept for transitioning to userland
See #1964
2019-02-16 15:26:44 -05:00
Andrew Kelley
bd52d81dc3 README: direct link to Download & Documentation at the top 2019-02-16 14:36:52 -05:00
Andrew Kelley
f4c5bcfea5 refactor translate-c - no more using namespace clang
this is in preparation for #1964
2019-02-16 14:09:00 -05:00
Andrew Kelley
f57182456d Merge pull request #1898 from Sahnvour/translate-c-arrays
Translate c arrays
2019-02-16 14:07:41 -05:00
Andrew Kelley
a97362e677 fmt_runner: remove redundant check 2019-02-16 12:24:02 -05:00
Andrew Kelley
ba56f365c8 bring zig fmt to stage1 2019-02-16 00:53:32 -05:00
Marc Tiehuis
77a4e7b374 Merge pull request #1958 from ziglang/parse-float
Add float parsing support to std
2019-02-16 15:04:37 +13:00
emekoi
5736a9c6a9 removed hidden union tag in release modes 2019-02-15 20:02:09 -05:00
Andrew Kelley
a05e224150 typecheck the panic function
this adds the prototype of panic to @import("builtin")
and then uses it to do an implicit cast of the panic
function to this prototype, rather than redoing all the
implicit cast logic.

closes #1894
closes #1895
2019-02-15 19:19:28 -05:00
Andrew Kelley
7293e012d7 breaking: fix @sizeOf to be alloc size rather than store size
* Fixes breaches of the guarantee that `@sizeOf(T) >= @alignOf(T)`
 * Fixes std.mem.secureZero for integers where this guarantee previously
   was breached
 * Fixes std.mem.Allocator for integers where this guarantee previously
   was breached

Closes #1851
Closes #1864
2019-02-15 18:05:50 -05:00
Andrew Kelley
567c9b688e Merge pull request #1965 from ziglang/c-pointer-type
implement C pointers
2019-02-15 02:20:42 -05:00
Andrew Kelley
ee5e196f88 add test for truncate on comptime integers
closes #703
2019-02-15 02:02:19 -05:00
Andrew Kelley
99b19adeb3 stage2: fix windows regressions 2019-02-14 23:46:53 -05:00
Andrew Kelley
71d7100aa8 darwin: fix pointer cast in mmap 2019-02-14 23:38:14 -05:00
Marc Tiehuis
170ec504ec Use official llvm mirror for compiler-rt commit ref 2019-02-15 17:37:55 +13:00
Marc Tiehuis
18ad50970f Make parseFloat stricter in what it accepts as input 2019-02-15 17:32:13 +13:00
Andrew Kelley
e025c70166 stage2: fix llvm.zig with opaque types back to single-item pointer 2019-02-14 23:17:11 -05:00
Andrew Kelley
d6e0d82c32 translate-c: back to *c_void for opaque types
See #1059
2019-02-14 23:09:31 -05:00
Andrew Kelley
d5bbd74871 allow C pointers to have alignment
clang/gcc support pointer alignment attribute:
https://clang.llvm.org/docs/AttributeReference.html#align-value
2019-02-14 20:04:13 -05:00
Andrew Kelley
cc7060d0d9 compile error for C pointer with align attribute
See #1059
2019-02-14 20:02:29 -05:00
Andrew Kelley
973a93d43b add docs for C pointers 2019-02-14 19:03:04 -05:00
Andrew Kelley
df87044fd6 omit nonnull attribute for C pointers
See #1059
2019-02-14 16:10:12 -05:00
Andrew Kelley
6769183a9d fix implicit cast error unions with non-optional to optional pointer
and update self hosted compiler for C pointers

See #1059
2019-02-14 15:48:28 -05:00
Andrew Kelley
52c03de5c2 add missing compile error for OpaqueType inside structs/unions
closes #1862
2019-02-14 13:07:51 -05:00
Andrew Kelley
e03c770145 compile error tests for implicit C pointer casting
See #1059
2019-02-14 12:28:50 -05:00
Andrew Kelley
c58b802034 remove the "top of the comptime stack" compile error
It's still best practice to put `@setEvalBranchQuota` at the top of
the comptime stack, but as Jimmi notes in #1949, when a function
can be called at comptime and also can be the top of the comptime stack,
this compile error is fundamentally unsound.

So now it's gone.

closes #1949
2019-02-14 10:51:59 -05:00
Andrew Kelley
a4e32d9fb1 ci: freebsd: remove '.git' from URL as per upstream suggestion
https://todo.sr.ht/~sircmpwn/dispatch.sr.ht/24#comment-1465
2019-02-14 09:46:08 -05:00
Andrew Kelley
59de24817e runtime safety check for casting null to pointer
see #1059
2019-02-14 01:09:33 -05:00
Andrew Kelley
d4d2718bca comptime detection of casting null to pointer
See #1059
2019-02-14 00:40:39 -05:00
Jimmi Holst Christensen
2911eb34de Added error for nesting vectors 2019-02-13 12:19:08 +01:00
Marc Tiehuis
de7c55145a Add parseFloat support to json.zig 2019-02-14 00:12:00 +13:00
Marc Tiehuis
c34ce6878e Add parseFloat to std.fmt
This is not intended to be the long-term implementation as it doesn't
provide various properties that we eventually will want (e.g.
round-tripping, denormal support). It also uses f64 internally so the
wider f128 will be inaccurate.
2019-02-14 00:07:51 +13:00
Jimmi Holst Christensen
53297a1bd0 We already support vector bit operators, so let's test it 2019-02-13 11:40:32 +01:00
Jimmi Holst Christensen
c7b9ab985c Merge branch 'master' of github.com:ziglang/zig 2019-02-13 11:31:20 +01:00
Jimmi Holst Christensen
c221b29c9d We already support vector on floats, so let's test it 2019-02-13 11:31:13 +01:00
Marc Tiehuis
cf007e37b9 Add f128 support for fabs, isinf, isnan, inf and nan functions 2019-02-13 23:27:23 +13:00
Marc Tiehuis
be861a85c8 compiler-rt: Add __addtf3, __subtf3 and __truncdfhf2
Allows addition/subtraction of f128 and narrowing casts to f16 from
larger float types.
2019-02-13 23:24:52 +13:00
Matthew McAllister
0b3db784f1 Enable compileLog to display slices 2019-02-13 02:00:02 -05:00
Andrew Kelley
5699ab5e77 C pointers: errors for nested pointer casting regarding null
See #1059
2019-02-12 18:20:00 -05:00
Andrew Kelley
270933b1e9 compile error test for casting integer to c pointer
when the int has more bits than pointers

See #1059
2019-02-12 10:25:21 -05:00
Andrew Kelley
6f05e8d1be implicit casting between C pointer and optional non-C pointer
See #1059
2019-02-12 01:38:11 -05:00
Andrew Kelley
285e2f62ba disallow C pointers to non-C-ABI-compatible element types
See #1059
2019-02-12 00:51:06 -05:00
Andrew Kelley
0abe6d668e C pointers: delete dead code in ir_num_lit_fits_in_other_type 2019-02-12 00:39:08 -05:00
Andrew Kelley
069fc1a269 peer type resolution with C pointers
See #1059
2019-02-11 19:21:59 -05:00
Andrew Kelley
57a7ab0d33 comptime support for pointer arithmetic with hard coded addresses 2019-02-11 19:12:01 -05:00
Andrew Kelley
90b8cd4a45 add C pointer type to @typeInfo
See #1059
2019-02-11 16:07:40 -05:00
Andrew Kelley
342bca7f46 C pointer comparison and arithmetic
See #1059
2019-02-11 15:31:09 -05:00
Andrew Kelley
d9e01be973 translate-c: use C pointer type everywhere
See #1059
2019-02-11 14:56:59 -05:00
Andrew Kelley
4a1b910e03 zig fmt: support C pointers
See #1059
2019-02-11 14:07:19 -05:00
Andrew Kelley
43df49cb35 README: move i386-macosx to Tier 4
See #1930
2019-02-11 12:59:33 -05:00
Andrew Kelley
661fc79fba langref: update grammar with c pointers
See #1059
2019-02-10 12:02:56 -05:00
Andrew Kelley
7a8f391b0f avoid needlessly creating global constants
This deletes some legacy cruft, and produces leaner object files.
Example:

```
var x: i32 = 1234;

export fn entry() i32 {
    return x;
}
```

This produces:

```
@x = internal unnamed_addr global i32 1234, align 4
@0 = internal unnamed_addr constant i32* @x, align 8
```

and @0 is never even used. After this commit, @0 is not produced.

This fixes a bug: Zig was creating invalid LLVM IR when one of these
globals that shouldn't exist takes the address of a thread local
variable. In LLVM 8.0.0rc2, it would produce a linker error. But
probably after my bug report is solved it will be caught by the IR
verifier.

https://bugs.llvm.org/show_bug.cgi?id=40652
2019-02-10 11:07:00 -05:00
Andrew Kelley
bcbcb2e9ff Merge remote-tracking branch 'origin/master' into llvm8 2019-02-10 11:03:17 -05:00
Andrew Kelley
8e68d43ad3 avoid needlessly creating global constants
This deletes some legacy cruft, and produces leaner object files.
Example:

```
var x: i32 = 1234;

export fn entry() i32 {
    return x;
}
```

This produces:

```
@x = internal unnamed_addr global i32 1234, align 4
@0 = internal unnamed_addr constant i32* @x, align 8
```

and @0 is never even used. After this commit, @0 is not produced.

This fixes a bug: Zig was creating invalid LLVM IR when one of these
globals that shouldn't exist takes the address of a thread local
variable. In LLVM 8.0.0rc2, it would produce a linker error. But
probably after my bug report is solved it will be caught by the IR
verifier.

https://bugs.llvm.org/show_bug.cgi?id=40652
2019-02-10 10:58:00 -05:00
Jimmi HC
2f9fedabf0 testing.expectEqual use expected type as the type of actual
This allows for impl casts
2019-02-10 12:43:49 +01:00
Andrew Kelley
73e8e46257 casting between C pointers and normal pointers
See #1059
2019-02-10 01:11:40 -05:00
Andrew Kelley
b8cbe3872e added C pointer type and implicit int-to-ptr for this type
See #1059
2019-02-10 00:14:30 -05:00
Andrew Kelley
caf672c495 @truncate: comptime 0 when target type is 0 bits
also if the dest type is a comptime_int, then treat it
as an implicit cast.

also compile error for attempting to truncate undefined

closes #1568
2019-02-09 21:38:34 -05:00
Andrew Kelley
31be1ddf09 docs: add threadlocal keyword to grammar 2019-02-09 20:57:45 -05:00
Andrew Kelley
34eb9f18ac fix not updating debug info type of optional error sets
There's an unfortunate footgun in the current design of error sets.
The debug info type for every error set is the same as the debug info
type of the global error set, which is essentially an enum forward
declaration. The problem is that when we "replace" the forward
declaration with the final value, once we know all the possible errors,
we have to update the pointers of every error set.

So the footgun is that if you ever copy the debug info type of the
global error set, you have to add the address of the pointer to a list
of pointers that need to be updated once we "replace" the forward
declaration. I activated the footgun when I introduced the optimization
that `?anyerror` types are the same size as `anyerror` types (using 0 as
the null value), because I introduced a pointer copy of the global error
set debug info type, but forgot to add it to the list.

I'm sure that there is a better way to code this, which does not have
the footgun, but this commit contains only a fix, not a reworking of the
logic.

closes #1937
2019-02-09 20:41:26 -05:00
Andrew Kelley
1864acd326 Merge remote-tracking branch 'origin/master' into llvm8 2019-02-09 18:57:39 -05:00
Andrew Kelley
ca8580ece1 Merge branch 'vector-int-add-safety' 2019-02-09 16:24:41 -05:00
Andrew Kelley
373e21bb56 implement vector math safety with ext and trunc 2019-02-09 16:24:29 -05:00
Andrew Kelley
0a7bdc0077 implement vector addition with safety checking
this would work if @llvm.sadd.with.overflow supported
vectors, which it does in trunk. but it does not support
them in llvm 7 or even in llvm 8 release branch.

so the next commit after this will have to do a different
strategy, but when llvm 9 comes out it may be worth coming
back to this one.
2019-02-09 14:44:33 -05:00
Andrew Kelley
a8a63feba7 docgen: update for threadlocal keyword 2019-02-09 00:28:12 -05:00
Andrew Kelley
052800e952 zig fmt: support threadlocal 2019-02-09 00:19:24 -05:00
Andrew Kelley
d6f2af378a fix docs
broken by c2db077574
2019-02-08 19:38:16 -05:00
Andrew Kelley
46ddd5f5f4 fix compiler assertion failure when returning value from test
closes #1935
2019-02-08 19:23:46 -05:00
Andrew Kelley
c2db077574 std.debug.assert: remove special case for test builds
Previously, std.debug.assert would `@panic` in test builds,
if the assertion failed. Now, it's always `unreachable`.

This makes release mode test builds more accurately test
the actual code that will be run.

However this requires tests to call `std.testing.expect`
rather than `std.debug.assert` to make sure output is correct.

Here is the explanation of when to use either one, copied from
the assert doc comments:

Inside a test block, it is best to use the `std.testing` module
rather than assert, because assert may not detect a test failure
in ReleaseFast and ReleaseSafe mode. Outside of a test block, assert
is the correct function to use.

closes #1304
2019-02-08 18:23:38 -05:00
John Schmidt
be6d022257 Make ThreadSafeFixedBufferAllocator alias FixedBufferAllocator when --single-threaded
Fixes #1910
2019-02-07 23:21:37 -05:00
Andrew Kelley
48c1e235cb update clang headers to 8.0.0rc2 2019-02-07 18:49:42 -05:00
Andrew Kelley
00902ff9b0 LLD patch: workaround for buggy MACH-O code
This reapplies 1a1414fc42
to the embedded LLD.
2019-02-07 17:08:25 -05:00
Andrew Kelley
3e08b3a4f8 update embedded LLD to 8.0.0rc2 2019-02-07 17:07:18 -05:00
Andrew Kelley
f330eebe4b fix using the result of @intCast to u0
closes #1817
2019-02-07 16:02:45 -05:00
Andrew Kelley
91baa574a5 build: update Findllvm.cmake for llvm 8 2019-02-07 12:24:55 -05:00
Andrew Kelley
f8ba50f5ed build: make sure LLVM is exactly correct
* check the version to be the correct major version
 * ensure that it has all the default targets enabled
2019-02-07 12:22:04 -05:00
Andrew Kelley
a94304d3e4 Merge remote-tracking branch 'origin/master' into llvm8 2019-02-07 12:21:20 -05:00
Andrew Kelley
7843c96df8 build: make sure LLVM is exactly correct
* check the version to be the correct major version
 * ensure that it has all the default targets enabled
2019-02-07 12:18:01 -05:00
Andrew Kelley
2b2bf53a49 better error message when LLVM does not understand a triple 2019-02-07 11:40:56 -05:00
Andrew Kelley
a0590bda29 Merge branch 'kristate-zig-backport-std.mem.join' 2019-02-07 10:56:30 -05:00
Andrew Kelley
38a7716194 fixups 2019-02-07 10:55:23 -05:00
Andrew Kelley
130f422742 Merge branch 'zig-backport-std.mem.join' of https://github.com/kristate/zig into kristate-zig-backport-std.mem.join 2019-02-07 10:43:14 -05:00
Andrew Kelley
7fc99c33bd Merge branch 'kristate-zig-backport-std.os.path' 2019-02-07 00:49:06 -05:00
Andrew Kelley
36bade5c56 fixups, and modify std.mem.join and std.os.path.resolve API
* zig fmt
 * std.mem.join takes a slice of slices instead of var args
 * std.mem.join takes a separator slice rather than byte,
   and always inserts it. Previously it would not insert the separator
   if there already was one, violating the documented behavior.
 * std.mem.join calculates exactly the correct amount to allocate
   and has no call to allocator.shrink()
 * bring back joinWindows and joinPosix and the corresponding tests.
   it is intended to be able to call these functions from any OS.
 * rename std.os.path.resolveSlice to resolve (now resolve takes
   a slice of slices instead of var args)
2019-02-07 00:42:41 -05:00
Andrew Kelley
c804ae2d6b Merge branch 'zig-backport-std.os.path' of https://github.com/kristate/zig into kristate-zig-backport-std.os.path 2019-02-06 22:53:34 -05:00
Andrew Kelley
8a5d3e2eaf Merge pull request #1924 from ziglang/tls
Implement Thread Local Variables
2019-02-06 20:21:13 -05:00
Andrew Kelley
89ffb58197 implement Thread Local Storage on Windows 2019-02-06 18:32:41 -05:00
Andrew Kelley
d2602b442e require running std lib tests coherently
this should actually improve CI times a bit too

See the description at the top of std/os/startup.zig (deleted in this
commit) for a more detailed understanding of what this commit does.
2019-02-06 14:32:20 -05:00
Andrew Kelley
b1775ca168 thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
Andrew Kelley
3abf293a84 doc/targets.md has moved to the github wiki
https://github.com/ziglang/zig/wiki/How-to-Add-Support-For-More-Targets
2019-02-06 11:53:09 -05:00
tgschultz
20e2d8da61 Fixed Serializer and BitOutStream when used with streams that have empty error sets. 2019-02-06 00:06:27 -05:00
Andrew Kelley
fd28b9d501 Merge pull request #1919 from Sahnvour/windows-childprocess
Better behaviour of ChildProcess under windows.
2019-02-05 21:03:33 -05:00
Sahnvour
6860db66fe Typo: use the joined path to try executables available from PATH. 2019-02-05 23:13:17 +01:00
Sahnvour
a9faace8b4 Notify failure to create a process when the executable is not found even in PATH. 2019-02-05 23:12:54 +01:00
Sahnvour
075fda3c73 translate-c: add tests. Commented for now as the output is currently empty until #646 is fixed. 2019-02-05 20:36:57 +01:00
Andrew Kelley
ac4e38226b docs: clarify passing aggregate types as parameters 2019-02-05 10:28:56 -05:00
Jimmi Holst Christensen
4010f6a11d Added support for vector wrapping mult and sub
* I also merged the code that generates ir for add, sub, and mult
2019-02-05 09:57:11 -05:00
Andrew Kelley
06be65a602 fix vector debug info tripping LLVM assertion 2019-02-04 22:16:16 -05:00
Andrew Kelley
d974afde1d fix vector debug info tripping LLVM assertion 2019-02-04 22:14:35 -05:00
Andrew Kelley
f32f7a937f Merge remote-tracking branch 'origin/master' into llvm8 2019-02-04 21:26:50 -05:00
Andrew Kelley
8c6fa982cd SIMD: array to vector, vector to array, wrapping int add
also vectors and arrays now use the same ConstExprVal representation

See #903
2019-02-04 20:30:00 -05:00
Andrew Kelley
2828a9695f Merge branch 'kristate-zig-backport-std.mem.separate' 2019-02-04 15:27:44 -05:00
Andrew Kelley
67bd45f0cf adjustments to std.mem split / separate
* rename std.mem.split to std.mem.tokenize
 * add future deprecation notice to docs
 * (unrelated) add note to std.os.path.resolve docs
 * std.mem.separate - assert delimiter.len not zero
 * fix implementation of std.mem.separate to respect the delimiter
 * separate the two iterators to different structs
2019-02-04 15:24:06 -05:00
Andrew Kelley
f44ce7836a Merge branch 'zig-backport-std.mem.separate' of https://github.com/kristate/zig into kristate-zig-backport-std.mem.separate 2019-02-04 13:29:17 -05:00
Andrew Kelley
dfbc063f79 std.mem.Allocator.create replaced with better API
`std.mem.Allocator.createOne` is renamed to `std.mem.Allocator.create`.

The problem with the previous API is that even after copy elision,
the initalization value passed as a parameter would always be a copy.
With the new API, once copy elision is done, initialization
functions can directly initialize allocated memory in place.

Related:
 * #1872
 * #1873
2019-02-03 16:13:28 -05:00
Matthew McAllister
c90c256868 Fix slice concatenation
This was causing an underflow error
2019-02-02 22:22:00 -05:00
Andrew Kelley
9b8e23934b introduce --single-threaded build option
closes #1764

This adds another boolean to the test matrix; hopefully it does not
inflate the time too much.

std.event.Loop does not work with this option yet. See #1908
2019-02-01 18:05:54 -05:00
Matthew McAllister
8bedb10939 Fix runtime assignment to comptime aggregate field
This was causing a segfault
2019-02-01 17:14:12 -05:00
Andrew Kelley
ae1ebe09b7 add compile errror for @bitCast when bit counts mismatch
fixes invalid LLVM IR from previous commit
2019-02-01 14:06:51 -05:00
Andrew Kelley
bbe857be96 Merge pull request #1775 from tgschultz/stdlib-serialization
Added serialization, bitstreams, traits for int sign, TagPayloadType, some fixes to std
2019-02-01 13:05:34 -05:00
Andrew Kelley
8d32d25619 Merge branch 'emekoi-windows-mutex' 2019-02-01 12:22:55 -05:00
Andrew Kelley
bfc1772d8e fixups 2019-02-01 12:22:21 -05:00
Andrew Kelley
8d3eb25e92 Merge branch 'windows-mutex' of https://github.com/emekoi/zig into emekoi-windows-mutex 2019-02-01 10:21:16 -05:00
Andrew Kelley
7a4ed10981 darwin: fix incorrect timeval struct type
closes #1648

I also added some more extern functions for darwin time functions,
although nothing depends on them currently.
2019-01-31 18:57:53 -05:00
Andrew Kelley
28873e7622 os.cpp: fix regression on Windows from 59c050e7 2019-01-31 16:52:59 -05:00
Andrew Kelley
545064c1d9 introduce vector type for SIMD
See #903

 * create with `@Vector(len, ElemType)`
 * only wrapping addition is implemented

This feature is far from complete; this is only the beginning.
2019-01-30 23:39:25 -05:00
Andrew Kelley
169a789b34 fix test after merging ad8381e0d2
this test slipped through due to branching
2019-01-30 16:12:30 -05:00
Andrew Kelley
59c050e7ff collapse os_file_mtime into os_file_open_r and check for directory
This is a manual merge of kristate's pull request #1754, due to
conflicts + a couple fixups.

closes #1754
2019-01-30 16:06:18 -05:00
Matthew McAllister
ad8381e0d2 Move tokenizer error location to offending char
Previously, it pointed to the start of the current token, but this made
it difficult to tell where the error occurred when it was, say, in the
middle of a string.
2019-01-30 14:02:01 -05:00
Andrew Kelley
ecb0cb661a darwin time code: don't cast to int until the end
See #1648
2019-01-30 02:53:59 -05:00
Andrew Kelley
9ca94bbba5 fix freebsd ci from previous commit 2019-01-30 02:53:50 -05:00
Andrew Kelley
581edd643f backport copy elision changes
This commit contains everything from the copy-elision-2
branch that does not have to do with copy elision directly,
but is generally useful for master branch.

 * All const values know their parents, when applicable, not
   just structs and unions.
 * Null pointers in const values are represented explicitly,
   rather than as a HardCodedAddr value of 0.
 * Rename "maybe" to "optional" in various code locations.
 * Separate DeclVarSrc and DeclVarGen
 * Separate PtrCastSrc and PtrCastGen
 * Separate CmpxchgSrc and CmpxchgGen
 * Represent optional error set as an integer, using the 0 value.
   In a const value, it uses nullptr.
 * Introduce type_has_one_possible_value and use it where applicable.
 * Fix debug builds not setting memory to 0xaa when storing
   undefined.
 * Separate the type of a variable from the const value of a variable.
 * Use copy_const_val where appropriate.
 * Rearrange structs to pack data more efficiently.
 * Move test/cases/* to test/behavior/*
 * Use `std.debug.assertOrPanic` in behavior tests instead of
   `std.debug.assert`.
 * Fix outdated slice syntax in docs.
2019-01-29 22:30:30 -05:00
Andrew Kelley
9c328b4291 simpler implementation of && and || hints
This accomplishes the same goal, but with less changes, so that
I can backport copy elision stuff easier.
2019-01-29 22:29:56 -05:00
Sahnvour
f0d35d78b6 translate-c: avoid array concatenation if the init node is empty, for clarity. 2019-01-26 16:47:11 +01:00
Sahnvour
584cb1fcfe translate-c: only detect ints as negative if they are signed. 2019-01-26 15:53:19 +01:00
Sahnvour
b2662e443d translate-c: correct array concatenation for incomplete C array initializers. 2019-01-26 15:41:23 +01:00
Sahnvour
dd5450e7b9 translate-c: get real child type of array type for incomplete initializers and/or multi-dimensional arrays. 2019-01-26 15:39:38 +01:00
kristopher tate
5bf9ffdc5b Hint at use of and/or when &&/|| is improperly used (#1886) 2019-01-25 21:10:40 +01:00
Andrew Kelley
1411df4e27 update to llvm8 trunk. all tests passing 2019-01-24 09:31:00 -05:00
Andrew Kelley
87f5bed11f Merge remote-tracking branch 'origin/master' into llvm8 2019-01-22 20:10:34 -05:00
tharvik
3bec3b9f9b llvm-config sanity check 2019-01-21 15:58:54 -05:00
Andrew Kelley
aee973829d Merge branch 'kristate-zig-backport-issue1883' 2019-01-20 14:09:46 -05:00
Andrew Kelley
1357bc7430 add test case for previous commit 2019-01-20 14:09:17 -05:00
kristopher tate
0d1ce1fb5f src/analyze.cpp: return type entry for ZigTypeIdPointer if it points to ZigTypeIdOpaque
ref: ziglang/zig#1883
2019-01-20 17:08:35 +09:00
Andrew Kelley
c968d8756c Merge pull request #1885 from Sahnvour/master
Fixed source lines printing of stack traces on windows.
2019-01-18 13:32:01 -05:00
Sahnvour
a60ecdc681 Hopefully fixed #1503 (at least improved) line accuracy of stack traces on windows. 2019-01-18 10:35:00 +01:00
Sahnvour
5ab8db7b3e removed unnecessary cast 2019-01-18 10:35:00 +01:00
Andrew Kelley
404c87b06a fix incorrect parameter names for std.math.atan2 2019-01-14 18:11:17 -05:00
emekoi
3ff9ab332c fixed type signature 2019-01-11 09:56:37 -06:00
emekoi
51fff9fa82 fixed initializer and typos 2019-01-11 09:56:36 -06:00
emekoi
35d93d22db removed nullables 2019-01-11 09:56:36 -06:00
emekoi
9385127052 changed pointer types 2019-01-11 09:56:35 -06:00
emekoi
bb31695fbf fixed mutex on windows 2019-01-11 09:56:35 -06:00
emekoi
207fa3849c moved to InitializeCriticalSection to init 2019-01-11 09:56:34 -06:00
emekoi
25d7f5b654 switching back to EnterCriticalSection 2019-01-11 09:56:34 -06:00
emekoi
aaae2f5705 switching from EnterCriticalSection to TryEnterCriticalSection 2019-01-11 09:56:33 -06:00
emekoi
99f44219bc updated structs 2019-01-11 09:56:33 -06:00
emekoi
b61bce254c added mutex for windows 2019-01-11 09:56:32 -06:00
Andrew Kelley
3b2eeb839b Merge remote-tracking branch 'origin/master' into llvm8 2019-01-09 10:44:57 -05:00
Andrew Kelley
5864d92b40 when rendering llvm const values, ensure the types align
the representation of the const expr val in zig, and the
type that we tell LLVM it is.
2019-01-09 10:43:48 -05:00
Andrew Kelley
027a0c46ae Merge remote-tracking branch 'origin/master' into llvm8 2019-01-08 16:50:16 -05:00
Andrew Kelley
1ca983dbd7 translate-c: update to llvm8 2019-01-08 16:49:52 -05:00
Andrew Kelley
4d5d0d3ada @typeInfo: more correct return type info 2019-01-08 14:40:56 -05:00
Andrew Kelley
aa65b94671 fix debug info for function pointers
found when testing against LLVM 8

see https://bugs.llvm.org/show_bug.cgi?id=40198
2019-01-08 11:53:51 -05:00
Andrew Kelley
013c7b24d2 Merge pull request #1874 from ziglang/issue-1866
Fix #1866
2019-01-06 14:00:34 -05:00
Jimmi HC
da08525bb3 Removed oops comments 2019-01-06 18:02:00 +01:00
Jimmi HC
97702988d1 Added test case 2019-01-06 17:58:00 +01:00
Jimmi HC
55e95daf54 Fixed issue where TypeInfo would use types from a prev CodeGen instance
When doing multible codegen passes (such as building
compiler_rt and then something else) the TypeInfo cache code would point
to types from the prev code gen (such as the prev 'bool' type), giving
us errors like "expected type 'bool', but found type 'bool'"
This disabling of caching might have a performance hit, but correctness is better than
speed, so let's have this for now, until someone optimizes this
correctly (probably in stage2)
2019-01-06 17:53:34 +01:00
Jimmi HC
e410b1f915 Implemented buf_read_value_bytes for ZigTypeIdArray
* Only for x_array.special == ConstArraySpecialNone
2019-01-06 17:49:24 +01:00
Jimmi HC
db92891587 Respect the type system instead of ConstExprValue when getting field 2019-01-06 17:48:31 +01:00
Marcio
5f26d1dddb freebsd: fix wrong call to clock_getres (#1871)
Reported-by: daurnimator
2019-01-05 13:34:47 -05:00
vegecode
1f08be4d7f Mark comptime int hardcoded address pointee as a run time variable #1171 (#1868)
* Mark comptime int hardcoded address as a run time variable #1171

* test case for dereferencing hardcoded address intToPtr
2019-01-04 17:34:21 -05:00
Marcio Giaxa
5c2a1055a0 freebsd: add sockaddr structs 2019-01-04 16:31:57 -05:00
Marcio Giaxa
4d9547ff2e freebsd: implement clock related functions
- clock_gettime
 - clock_getres
2019-01-04 16:31:57 -05:00
Marcio Giaxa
1e781a30f6 freebsd: add clock const definitions 2019-01-04 16:31:57 -05:00
vegecode
f6cd68386d @bitreverse intrinsic, part of #767 (#1865)
* bitreverse - give bswap behavior

* bitreverse, comptime_ints, negative values still not working?

* bitreverse working for negative comptime ints

* Finished bitreverse test cases

* Undo exporting a bigint function. @bitreverse test name includes ampersand

* added docs entry for @bitreverse
2019-01-02 16:47:47 -05:00
Andrew Kelley
036a49e97d Merge remote-tracking branch 'origin/master' into llvm8 2019-01-01 18:36:12 -05:00
alexander
6df8e4bca7 Add DIFlagStaticMember flag to functions.
Prevents LLVM from generating debug info for
struct member functions with a pointer as the
first parameter as though the first parameter
were the implicit "this" pointer from C++.
2018-12-30 12:57:49 -05:00
Andrew Kelley
d8b6fa9134 Merge pull request #1859 from mgxm/fbsd2
Progress towards tier 1 support for FreeBSD x86_64
2018-12-29 12:49:23 -05:00
Marcio Giaxa
2e08bd6be4 ci: update freebsd manifest 2018-12-28 15:36:43 -02:00
Marcio Giaxa
4ff23b668a tests: remove freebsd from the test matrix
- Manually add all the native tests to CI manifest.
2018-12-28 11:38:58 -02:00
Andrew Kelley
c464ecf3bf Merge pull request #1857 from vegecode/boolean-switch
Switching on bools with duplicate and missing value detection: Issue …
2018-12-27 18:14:33 -05:00
alexander
64061cc1bf Test cases for compiler error and working behavior for switching on booleans 2018-12-27 13:46:32 -06:00
Andrew Kelley
aaef6259c3 allow not having libc include paths and doing @cImport 2018-12-26 20:44:06 -05:00
Marcio Giaxa
c29cae76b0 tests: add FreeBSD to the test matrix 2018-12-26 22:44:13 -02:00
Andrew Kelley
2b7e29f791 Merge branch 'nebulaeonline-nebulaeonline'
Zig gains the UEFI OS target
2018-12-26 15:26:53 -05:00
Andrew Kelley
a918ce26b8 fixups 2018-12-26 15:25:54 -05:00
alexander
4a1f0e1418 Switching on bools with duplicate and missing value detection: Issue 1768 2018-12-26 10:44:25 -06:00
nebulaeonline
f49b45b00f tabs to space fix. thanks visual studio. 2018-12-24 14:01:35 -05:00
Marcio Giaxa
52be7d7404 freebsd: fix flags for opening files
Prior to this fix, the compare-outputs test suite was showing a strange
behavior, the tests always stopped between tests 6-8 and had a stack track
similar to each other.

```
Test 8/68 compare-output multiple files with private function (ReleaseSmall)...OK
/usr/home/mgxm/dev/zig/zig-cache/source.zig:7:2: error: invalid token: '&'
}&(getStdOut() catch unreachable).outStream().stream;
 ^
The following command exited with error code 1:

```

With the wrong O_* flags, the source code was being written in append mode which
resulted in an invalid file

```zig
use @import("foo.zig");
use @import("bar.zig");

pub fn main() void {
	foo_function();
	bar_function();
}&(getStdOut() catch unreachable).outStream().stream;
	stdout.print("OK 2\n") catch unreachable;
}

fn privateFunction() void {
	printText();
}
```
2018-12-24 11:45:55 -02:00
nebulaeonline
28cd337d1f fixed formatting in options display 2018-12-24 07:49:15 -05:00
Marcio Giaxa
de473d4423 freebsd: implement std.os.time.sleep 2018-12-24 10:27:08 -02:00
nebulaeonline
7dcee99510 fixed stricmp/strcasecmp between windows/posix 2018-12-23 23:59:59 -05:00
nebulaeonline
51baea184b Yet another git user error remnant fixed 2018-12-23 23:46:45 -05:00
nebulaeonline
480061d2c9 git user error fix 2018-12-23 23:09:07 -05:00
nebulaeonline
e0af3d7b50 Merge branch 'nebulaeonline' of https://github.com/nebulaeonline/zig into nebulaeonline 2018-12-23 22:56:20 -05:00
nebulaeonline
fdea12b2d9 msvc subsystem option handling; added uefi os type 2018-12-23 22:44:02 -05:00
nebulaeonline
39d32ee40a Altered SUBSYSTEM option handling when linking in msvc mode; Added preliminary UEFI support. 2018-12-23 22:21:32 -05:00
Marcio Giaxa
682815f6e9 freebsd: remove syscall and use libc
Use libc interface for:
 - getdents
 - kill
 - openat
 - setgid
 - setuid
2018-12-23 23:30:31 -02:00
Marcio Giaxa
773bf80133 Merge branch 'master' into fbsd2 2018-12-23 23:21:59 -02:00
Andrew Kelley
c0e391e94a self-hosted: add hurd os to switch 2018-12-23 18:30:13 -05:00
Andrew Kelley
75d142c3c7 llvm8: fix ZigLLVMCreateFunction 2018-12-23 18:22:30 -05:00
Andrew Kelley
280187031a tests: make type info tests not depend on builtin.Os enum 2018-12-23 18:03:22 -05:00
Andrew Kelley
94424e3fa6 test: remove type info test dependency on builtin.Os enum 2018-12-23 17:40:38 -05:00
Andrew Kelley
16b8467a5e llvm8: fix build errors 2018-12-23 17:36:41 -05:00
Andrew Kelley
c00216701c Merge remote-tracking branch 'origin/master' into llvm8 2018-12-23 17:04:26 -05:00
Andrew Kelley
45081c1e9c hello world example can use const instead of var 2018-12-23 13:57:37 -05:00
Andrew Kelley
218a4d4b30 comptime: ability to @ptrCast to an extern struct and read fields 2018-12-22 23:06:30 -05:00
Andrew Kelley
f301474531 self-hosted: add DeviceBusy as a BuildError 2018-12-21 23:01:21 -05:00
Andrew Kelley
0eba5b6744 I observed open() return EBUSY on linux
when trying to open for writing a tty fd that is already opened with
screen
2018-12-21 19:50:21 -05:00
Marcio Giaxa
c26f543970 freebsd: fix Stat mode type 2018-12-21 15:04:55 -02:00
Andrew Kelley
56fedbb524 translate-c: --verbose-cimport prints clang command 2018-12-20 19:56:24 -05:00
Marcio Giaxa
c156d51d55 freebsd: remove system linker hack 2018-12-20 21:44:18 -02:00
Marcio Giaxa
a6f33e3dc5 freebsd: add realpath to freebsd/index.zig 2018-12-20 21:05:31 -02:00
Marcio Giaxa
46a0f60e4c freebsd: use realpath() to resolve symbolic links 2018-12-20 20:57:58 -02:00
Marcio
ac1b2a3c73 Merge pull request #1 from myfreeweb/fbsd2
Fix dirent/stat, add preadv
2018-12-20 22:55:14 +00:00
Greg V
76efc462e7 Add preadv/pwritev on FreeBSD 2018-12-20 23:55:44 +03:00
Greg V
054c7ab18a Fix stat/timespec definitions for FreeBSD 2018-12-20 23:54:09 +03:00
myfreeweb
fa6c7c1303 Use Ninja in .builds/freebsd.yml
It's faster and doesn't require manually getting the number of CPUs
2018-12-20 15:15:25 -05:00
tgschultz
f35ba34a88 Removed allocator from Linux version DynLib. Added dynamic_library.zig to std test list. 2018-12-20 14:49:34 -05:00
Andrew Kelley
8cf3543c80 Merge branch 'mgxm-srtht_fbsd' 2018-12-20 14:18:22 -05:00
Andrew Kelley
2a776ed8a8 ci: only run the debug behavior tests for FreeBSD 2018-12-20 14:18:02 -05:00
Marcio Giaxa
4840600988 ci: add sr.ht build manifest for FreeBSD 2018-12-20 12:40:05 -05:00
Andrew Kelley
459045aa40 Merge branch 'kristate-zig-backport-issue1832' 2018-12-20 12:36:30 -05:00
Andrew Kelley
0f54194e6a fixups 2018-12-20 12:36:15 -05:00
kristopher tate
fb81b1978b tests: re: 79db394;
ref: ziglang/zig#1832
2018-12-20 22:53:54 +09:00
kristopher tate
39567e8b50 src/analyze.cpp: support alignOf(struct T) aligned member inside struct T;
ref: ziglang/zig#1832
2018-12-20 22:53:54 +09:00
Andrew Kelley
8768816d69 std.io: call the idiomatic std.mem.readInt functions
I originally called the Slice variants to work around
comptime code not supporting `@ptrCast`, but I fixed that
in 757d0665 so now the workaround is no longer needed.
2018-12-19 17:48:21 -05:00
Marcio Giaxa
e5b4748101 freebsd: initial stack trace
Stack trace is partially working, with only a few symbols missing. Uses
the same functions that we use in Linux to get the necessary debug info.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
9900f94afe freebsd: use sysctl to get the current executable path
FreeBSD doesn't mount procfs as default on the base system, so we can't
depend on it to get the current path, In this case, we use sysctl(3) to
retrieves the system information and get the same information.

 - CTL_KERN: High kernel limits

 - KERN_PROC: Return selected information about specific running
   processes.

 - KERN_PROC_PATHNAME: The path of the process

 - Process ID: a process ID of -1 implies the current process.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
1811e7e6c9 freebsd: remove getrandom dependency from libc
The system call getrandom(2) just landed on FreeBSD 12, so if we want to
support some earlier version or at least FreeBSD 11, we can't depend on
the system call.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
11ced4f99d freebsd: use libc interface instead system calls
Remove all syscalls references

 * dup2()
 * chdir()
 * execve()
 * fork()
 * getcwd()
 * isatty()
 * readlink()
 * mkdir()
 * mmap()
 * munmap()
 * read()
 * rmdir()
 * symlink()
 * pread()
 * write()
 * pwrite()
 * rename()
 * open()
 * close()
 * lseek()
 * exit()
 * unlink()
 * waitpid()
 * nanosleep()
 * setreuid()
 * setregid()
 * raise()
 * fstat()
 * pipe()
 * added pipe2() extern c fn
2018-12-19 18:42:00 -02:00
Marcio Giaxa
6cfcdbde2b freebsd: link against libc++
All supported versions of FreeBSD have libc++ in the base system.
2018-12-19 18:42:00 -02:00
Marcio Giaxa
1fc56b82ad freebsd: link against libc
Since the stable kernel ABI is through libc #1759
2018-12-19 18:42:00 -02:00
Marcio Giaxa
0273fbf710 freebsd: add access 2018-12-19 18:42:00 -02:00
Marcio Giaxa
5ea37f6e8c freebsd: add getdirentries 2018-12-19 18:41:59 -02:00
Marcio Giaxa
666b153144 freebsd: remove syscall files 2018-12-19 18:41:40 -02:00
Jimmi Holst Christensen
a7670e80a4 Added formatting of function pointers (#1843) 2018-12-19 10:07:35 -05:00
Jimmi Holst Christensen
45e72c0b39 Fixed intToPtr to fn type when the address is hardcoded (#1842)
* Fixed intToPtr to fn type

* Added test

* Import inttoptr.zig in behavior.zig
2018-12-19 09:39:18 -05:00
Jimmi Holst Christensen
260c3d9cc0 formatType can now format comptime_int 2018-12-19 11:50:29 +01:00
Andrew Kelley
f6a02a427f README: clarify self-hosted status 2018-12-18 15:55:00 -05:00
Andrew Kelley
e077a44656 ir: delete dead code 2018-12-18 15:48:26 -05:00
Andrew Kelley
f75262b79f fix comptime pointer reinterpretation array index offset
closes #1835
2018-12-17 11:05:50 -05:00
Andrew Kelley
5a68c60023 ci: update msys packages before installing 2018-12-16 12:32:20 -05:00
Andrew Kelley
757d0665ae implement comptime pointer cast
closes #955
closes #1835
2018-12-16 12:08:14 -05:00
Josh Wolfe
7533d1b14c mem foreign functions call the native ones
this reduces the amount of implementation to change for #1835
2018-12-16 11:59:29 -05:00
Andrew Kelley
624c74af6f ci: install openssl on windows 2018-12-16 11:22:33 -05:00
Andrew Kelley
82bf1eb7a1 docs: fix alphabetical sorting of builtin functions 2018-12-14 20:21:23 -05:00
Andrew Kelley
0afb868684 Merge branch 'suirad-windows-wide-imports' 2018-12-13 18:50:11 -05:00
Andrew Kelley
fff6e47125 fixups 2018-12-13 17:13:10 -05:00
Andrew Kelley
457f03e37d Merge branch 'windows-wide-imports' of https://github.com/suirad/zig into suirad-windows-wide-imports 2018-12-13 15:57:24 -05:00
Andrew Kelley
e98ba5fc40 add mem.readVarInt, fix InStream.readVarInt, fix stack traces
fixes a regression from b883bc8
2018-12-13 06:38:14 -05:00
Andrew Kelley
6395cf8d6b fix mistakes introduced in b883bc8 2018-12-13 06:07:39 -05:00
Andrew Kelley
7417f2e4b3 freebsd: fix issues with syscalls 2018-12-13 00:33:13 -05:00
Andrew Kelley
d770333827 freebsd: fix os_self_exe_path function and update std lib 2018-12-12 22:28:15 -05:00
Andrew Kelley
b883bc873d breaking API changes to all readInt/writeInt functions & more
* add `@bswap` builtin function. See #767
 * comptime evaluation facilities are improved to be able to
   handle a `@ptrCast` with a backing array.
 * `@truncate` allows "truncating" a u0 value to any integer
   type, and the result is always comptime known to be `0`.
 * when specifying pointer alignment in a type expression,
   the alignment value of pointers which do not have addresses
   at runtime is ignored, and always has the default/ABI alignment
 * threw in a fix to freebsd/x86_64.zig to update syntax from
   language changes
 * some improvements are pending #863

closes #638
closes #1733

std lib API changes
 * io.InStream().readIntNe renamed to readIntNative
 * io.InStream().readIntLe renamed to readIntLittle
 * io.InStream().readIntBe renamed to readIntBig
 * introduced io.InStream().readIntForeign
 * io.InStream().readInt has parameter order changed
 * io.InStream().readVarInt has parameter order changed
 * io.InStream().writeIntNe renamed to writeIntNative
 * introduced io.InStream().writeIntForeign
 * io.InStream().writeIntLe renamed to writeIntLittle
 * io.InStream().writeIntBe renamed to writeIntBig
 * io.InStream().writeInt has parameter order changed
 * mem.readInt has different parameters and semantics
 * introduced mem.readIntNative
 * introduced mem.readIntForeign
 * mem.readIntBE renamed to mem.readIntBig and different API
 * mem.readIntLE renamed to mem.readIntLittle and different API
 * introduced mem.readIntSliceNative
 * introduced mem.readIntSliceForeign
 * introduced mem.readIntSliceLittle
 * introduced mem.readIntSliceBig
 * introduced mem.readIntSlice
 * mem.writeInt has different parameters and semantics
 * introduced mem.writeIntNative
 * introduced mem.writeIntForeign
 * mem.writeIntBE renamed to mem.readIntBig and different semantics
 * mem.writeIntLE renamed to mem.readIntLittle and different semantics
 * introduced mem.writeIntSliceForeign
 * introduced mem.writeIntSliceNative
 * introduced mem.writeIntSliceBig
 * introduced mem.writeIntSliceLittle
 * introduced mem.writeIntSlice
 * removed mem.endianSwapIfLe
 * removed mem.endianSwapIfBe
 * removed mem.endianSwapIf
 * added mem.littleToNative
 * added mem.bigToNative
 * added mem.toNative
 * added mem.nativeTo
 * added mem.nativeToLittle
 * added mem.nativeToBig
2018-12-12 20:35:04 -05:00
Wink Saville
634d11ab28 Add add compiler_rt routines for float to signed integer conversion
And add std.math.f128_* constants.

The routines are:

  __fixdfdi, __fixdfsi, __fixdfti,
  __fixsfdi, __fixsfsi, __fixsfti,
  __fixtfdi, __fixtfsi, __fixtfti.

These all call fixint which is a generic zig function that does the
conversion:

  pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t

There are also a set tests:

  __fixdfdi_test, __fixdfsi_test, __fixdfti_test,
  __fixsfdi_test, __fixsfsi_test, __fixsfti_test,
  __fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-12 00:21:42 -05:00
BenoitJGirard
f0ec308e26 Merge pull request #1 from ziglang/master
Refresh from original.
2018-12-11 20:06:13 -05:00
Jay Weisskopf
5f5364ad73 font-family fallbacks for unsupported system-ui 2018-12-11 01:44:48 -05:00
Jay Weisskopf
57113bab2f docs: Prefer system-ui font-family
system-ui is a new generic font-family for matching the font used in the operating system's native user interface. E.g. Roboto on Android, San Francisco on macOS, Segoe UI on Windows, etc.

https://caniuse.com/#search=system-ui
2018-12-11 01:44:48 -05:00
Henry Nelson
68b0fce62f Document explicitly ignoring expression values 2018-12-11 01:42:54 -05:00
tgschultz
1a8570403f Minor doc-comment fix. 2018-12-09 20:59:51 -06:00
tgschultz
1188da926f Minor change to custom (de)serializer to allow them to be defined outside of the struct and aliased inside it. This will enable alternate generic serializers (i.e. one that follows pointers) on a struct-by-struct basis. 2018-12-09 20:52:16 -06:00
Andrew Kelley
1b0f4d5976 implement compile error note for function parameter type mismatch 2018-12-05 15:32:25 -05:00
Jimmi Holst Christensen
518ff33e64 Allow packages in TestStep 2018-12-05 14:10:09 +01:00
Andrew Kelley
9ac838c8e3 LLD patch: allow non-allocated sections to go into allocated sections
Patch submitted upstream: https://reviews.llvm.org/D55276
2018-12-04 11:42:22 -05:00
Andrew Kelley
3a1612a0f5 std.debug: fix some issues with freestanding debug info 2018-12-02 23:46:45 -05:00
Andrew Kelley
5c3b8cb365 expose std.debug.DwarfInfo and delete unused function 2018-12-02 20:08:06 -05:00
Andrew Kelley
a436d2ab8c std.debug.printSourceAtAddressDwarf
which works in freestanding mode
2018-12-02 19:34:11 -05:00
Andrew Kelley
4292ed9571 std.debug.StackIterator 2018-12-02 18:54:04 -05:00
Andrew Kelley
a40d160a5c introduce std.io.SeekableStream
Relevant #764

dwarf debug info is modified to use this instead of std.os.File
directly to make it easier for bare metal projects to take advantage
of debug info parsing
2018-12-02 18:36:18 -05:00
Andrew Kelley
6f5e7ee09c make std.unicode.Utf8Iterator public 2018-12-01 02:14:17 -05:00
Andrew Kelley
a9eab69b58 zig build: addStaticExecutable 2018-12-01 01:21:59 -05:00
tgschultz
8423bd423b Added explicit test for #1810 issue to io_test.zig. 2018-11-30 15:02:10 -06:00
tgschultz
5936bdf8a4 Fixed readBits to cast errors to the correct errorset. See #1810 for why this wasn't caught earlier. 2018-11-30 14:50:17 -06:00
tgschultz
b6489ff90a Increased range of bitwidths tested by "serialize/deserialize Int" tests. Added tests for float inf and NaN. 2018-11-30 14:50:17 -06:00
tgschultz
1ab66f3b55 Added serialization, bitstreams, traits for integer sign, TagPayloadType 2018-11-30 14:50:17 -06:00
Suirad
cf266ff80a Update tests 2018-11-30 02:15:33 -06:00
Suirad
e8e6ae57d4 Find CI env variables 2018-11-30 02:08:34 -06:00
Suirad
1fa2217c10 Simplify implementation 2018-11-30 02:08:34 -06:00
Suirad
24592d0216 Add more padding to parse buffer 2018-11-30 02:08:34 -06:00
Suirad
0abd5520bd Platform specific tests 2018-11-30 02:08:34 -06:00
Suirad
5dfca87a65 Update windows imports 2018-11-30 02:08:33 -06:00
Jimmi Holst Christensen
823969a5a4 Implemented new more flexible readLineFrom (#1801) 2018-11-29 22:38:39 +01:00
Andrew Kelley
b29769532b ci: workaround azure quirk for windows too 2018-11-29 14:54:23 -05:00
kristopher tate
1e60ca4b75 stage2: update std.os.path.join method signature;
stage2: take 2;
2018-11-30 03:52:28 +09:00
kristopher tate
2b78a90424 std.os.path: remove dependance on std.mem.join;
std/os/child_process.zig: windows

test/cli.zig: godbolt;

doc/docgen.zig
2018-11-30 03:52:27 +09:00
kristopher tate
ff1b2889f3 std.mem: split: test for multiple seperator bytes; 2018-11-30 02:17:15 +09:00
Andrew Kelley
bbdc12891b ci: workaround azure quirk with set -x 2018-11-29 11:05:56 -05:00
kristopher tate
6a1a2898b1 std.mem: remove varargs on join to stop excessive inlined code;
join was preducing inline code for every unique call causing code bloat
2018-11-30 00:53:52 +09:00
dbandstra
53766e7a3a make parseUnsigned handle types <8 bits wide 2018-11-29 09:53:43 -05:00
daurnimator
4ecb3ceafb Add std.LinkedList.concat 2018-11-29 09:44:24 -05:00
Andrew Kelley
7005ec5efe Revert "Add math min/max for Float and Value"
This reverts commit 078a0a6999.

On closer inspection, I'm not sure these values for float min/max
make sense. Why is it max instead of true_max? Why isn't it positive
and negative infinity?

Let's discuss further before committing to these changes.
2018-11-29 09:33:47 -05:00
Jimmi Holst Christensen
f74320d56d Implemented getOrPutValue which wraps getOrPut 2018-11-29 09:10:15 +01:00
Wink Saville
078a0a6999 Add math min/max for Float and Value 2018-11-28 23:13:12 -05:00
Andrew Kelley
c54fe0d3ae work around to support debian's fork of llvm 7.0.1
it has a patch that adds an OS type, breaking the public API
this commit avoids depending on the last os type enum item,
but retains the safety assertion checks.

closes #1788
2018-11-28 22:58:52 -05:00
Josh Wolfe
11e8afb37c fix child_process piped streams not getting closed 2018-11-28 18:33:55 -05:00
Andrew Kelley
57f44eb2bd Merge branch 'freebsd2'
Tier 2 support for FreeBSD
2018-11-27 21:06:35 -05:00
Andrew Kelley
dd2450b1b2 tier 2 support for freebsd 2018-11-27 20:56:43 -05:00
Andrew Kelley
e3bf40742d Merge branch 'master' into freebsd2 2018-11-27 20:36:44 -05:00
Sahnvour
1fb15be05f stack traces: fix for windows 2018-11-27 20:34:55 -05:00
Andrew Kelley
3c4965a616 readme: update support table 2018-11-27 11:27:45 -05:00
daurnimator
2baf0e2ffc add std.math.IntFittingRange 2018-11-27 10:19:06 -05:00
Andrew Kelley
6bbe4cf9f7 Merge branch 'winksaville-Fix-pushToParent-to-work-for-arrays-of-Objects' 2018-11-27 00:53:09 -05:00
Andrew Kelley
a5b79017a3 fix regression from d5648d26
thanks Wink Saville for the test case.
2018-11-27 00:52:32 -05:00
Andrew Kelley
7818550edc Merge branch 'Fix-pushToParent-to-work-for-arrays-of-Objects' of https://github.com/winksaville/zig into winksaville-Fix-pushToParent-to-work-for-arrays-of-Objects 2018-11-27 00:45:46 -05:00
Andrew Kelley
0860be03b1 Merge branch 'kristate-zig-backport-os_file_read-EISDIR' 2018-11-26 20:07:19 -05:00
Andrew Kelley
67a39a4c99 stage1: better file path handling
* better message printed when cache hash fails
 * better handling of '/' as root source file
 * os_path_split parses '/' and '/a' correctly

closes #1693
closes #1746
2018-11-26 20:04:35 -05:00
Andrew Kelley
d2ed4d3dd3 Merge branch 'zig-backport-os_file_read-EISDIR' of https://github.com/kristate/zig into kristate-zig-backport-os_file_read-EISDIR 2018-11-26 19:59:58 -05:00
kristopher tate
0f7de58b64 std.mem: add new separate method and rework SplitIterator; 2018-11-26 02:02:17 +09:00
daurnimator
f6cd02be65 add std.meta.stringToEnum 2018-11-25 11:48:11 -05:00
Andrew Kelley
a07490a4bc Merge pull request #1783 from ziglang/rand-range
Use better rand range implementations
2018-11-25 11:44:08 -05:00
Josh Wolfe
9ae5200bd2 factor out and expose biased range limiting function 2018-11-24 22:25:21 -05:00
Josh Wolfe
eed7b48fe3 test lots of types 2018-11-24 22:25:21 -05:00
Josh Wolfe
49b49618d2 add biased random range api 2018-11-24 22:25:21 -05:00
Josh Wolfe
1924ffa67d better debiased random range implementation 2018-11-24 22:25:21 -05:00
Andrew Kelley
4d747d452f update zen os std lib for latest zig changes 2018-11-24 16:51:52 -05:00
Andrew Kelley
3d2752cc36 refactor type_requires_comptime to have possible error
fixes a compiler crash when building
https://github.com/AndreaOrru/zen
2018-11-24 16:15:58 -05:00
Andrew Kelley
56a8f2b018 fix @intCast not catching negative numbers to unsigned 2018-11-24 14:36:16 -05:00
Andrew Kelley
b953e322a8 std.os.path.realC: make overflow more clearly impossible 2018-11-21 13:41:10 -05:00
Andrew Kelley
bb3ac177a8 fix incorrect buf len 2018-11-20 12:37:42 -05:00
kristopher tate
a69695a28c std/mem: writeIntLE: buf.* to buf; 2018-11-20 11:11:07 -05:00
Wink Saville
a05716bd20 Allow json tests to be easily filtered 2018-11-19 18:08:38 -05:00
Andrew Kelley
4dafdc00d5 zig fmt 2018-11-19 17:28:18 -05:00
Andrew Kelley
9493738e54 Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2 2018-11-19 17:24:41 -05:00
Sahnvour
703c6684d1 Crash fixes and small improvements to inline asm. (#1756)
* codegen: LLVMConstInlineAsm is deprecated.

* codegen: replace commas in asm constraint strings by pipes as required by LLVM.

* ir: enforce usage of '=' constraint modifier for inline assembly outputs.

Others are not currently supported and this was just asserted alter in `ir_render_asm`.

* asm: forbid comptime_int/floats as inputs in favor of explicitely sized constants.

Fixes a crash due to comptime_int/floats having no type_ref.

* asm: handle inputs with integers of <8 or non power of 2 bitsize.

We widen them to the next highest power of two.
2018-11-19 16:22:21 -05:00
Andrew Kelley
89e82281be fix incorrect --help text 2018-11-19 13:26:35 -05:00
Andrew Kelley
b1a676b279 docs: fix some incorrect error documentation 2018-11-19 13:20:39 -05:00
Andrew Kelley
2f5d1ec500 improve error message when wrong type returned
closes #1650
2018-11-19 11:22:57 -05:00
Wink Saville
81d9403dce Add SegmentedList.shrink
I was exploring std.zig.Tokenizer and wanted to compare performance of
arrays, SegmentedList and ArrayList and needed SegmentedList.shrink
to make the comparison "fair".
2018-11-19 10:53:25 -05:00
Marc Tiehuis
4c0163b69b std/rand: fix ziggurat next_f64 call 2018-11-19 21:56:45 +13:00
Andrew Kelley
921d9c9bcb add std.meta.intToEnum 2018-11-18 20:18:24 -05:00
Andrew Kelley
3829e200ec fix assertion failure related to @intToEnum 2018-11-18 20:04:16 -05:00
Josh Wolfe
3c05ad4012 atomic.Int.set 2018-11-18 19:43:13 -05:00
Andrew Kelley
f8a782fb2e all numbers with comptime known values implicitly cast
to all number types. If the value does not fit,
a compile error is emitted.

closes #422
closes #1712
2018-11-18 19:37:59 -05:00
Wink Saville
8d54cbb834 Fix pushToParent to work for arrays of Objects
The reference `*array` is a copy of the value on the stack. Instead use
a reference to top of stack. This is the same technique used above for
`var object` in `Value.String`.

Added two simple tests.
2018-11-18 10:14:37 -08:00
Duncan
e9b47d960b Fix setsockopt syscall on linux 2018-11-18 10:45:38 -05:00
kristopher tate
947cdafd91 src/os.cpp: os_file_read: return ErrorIsDir on case EISDIR; 2018-11-18 15:30:24 +09:00
Andrew Kelley
085d049a08 aarch64 improvements
* support C ABI for all return types
 * don't include __aeabi_uldivmod & co on aarch64 since
   it's 64 bit
2018-11-17 11:21:00 -05:00
Jimmi HC
2a580278c4 Updated comments in parser.cpp 2018-11-17 14:42:47 +01:00
Jimmi HC
f1fd8d2b1f Updated docs to newest grammar 2018-11-17 14:36:36 +01:00
Andrew Kelley
c21884e1d6 Merge remote-tracking branch 'origin/master' into llvm8 2018-11-17 02:18:56 -05:00
Andrew Kelley
704374e512 rename section keyword to linksection
add zig fmt support for this syntax

closes #1152
2018-11-17 01:38:35 -05:00
Andrew Kelley
3862962881 delete rogue file 2018-11-16 14:26:53 -05:00
Vallentin
398914eb71 Fixed typos 2018-11-16 14:03:39 -05:00
Matthew O'Connor
fbd6a66ae7 camelCase std.rb.set_child to std.rb.setChild 2018-11-16 13:03:13 -05:00
kristopher tate
e198417687 std/fmt/index.zig: support printing hex bytes on slices; 2018-11-16 10:22:33 -05:00
Jimmi Holst Christensen
be9bb0a857 Fixed #1663 and removed IrInstructionArrayLen 2018-11-16 10:15:13 -05:00
Andrew Kelley
332fdf33ee update readme 2018-11-16 10:05:52 -05:00
Matthew O'Connor
007783753e Change rb functions to use snakeCase. 2018-11-16 09:21:48 -05:00
Andrew Kelley
ba361f31c6 more fixes related to readStruct API 2018-11-15 16:16:08 -05:00
Jimmi HC
3090f83800 Fixed failure using readStruct and gave async readStruct the same sig 2018-11-15 21:59:17 +01:00
Jimmi HC
f4606842d2 Have readStruct in stream return a value instead of taking a pointer 2018-11-15 21:03:27 +01:00
Jimmi Holst Christensen
2a9843de95 Added NullOutStream and CountingOutStream (#1722) 2018-11-15 09:37:39 -08:00
Andrew Kelley
b8b36f3cce disable windows test until coroutines rewrite lands
See #1363
2018-11-15 10:02:12 -05:00
Andrew Kelley
0c3bd0c3d1 zig fmt: add --check flag
closes #1558
closes #1555
2018-11-15 00:26:43 -05:00
Josh Wolfe
65cddc5a19 test for readIntBE/LE 2018-11-14 21:40:53 -05:00
Josh Wolfe
8008ae470e io read/write int be/le optimizations 2018-11-14 20:57:51 -05:00
Josh Wolfe
772876b2f0 implement mem.writeIntLE, mem.writeIntBE 2018-11-14 20:57:46 -05:00
Josh Wolfe
8d8836c2d1 address port getter 2018-11-14 20:28:19 -05:00
Andrew Kelley
3666fbd9f9 ** and ++ operators force comptime on operands
closes #1707
2018-11-14 12:23:40 -05:00
Jimmi Holst Christensen
14308db923 Manual update to new grammar.
TODO: Figure out how we can auto update this, when the grammar changes in
the zig-spec repo
2018-11-14 08:56:26 +01:00
Jimmi Holst Christensen
5b3f7a8e1f Fixed error where we didn't expect the return type of a function 2018-11-13 14:43:08 +01:00
Jimmi Holst Christensen
8139c5a516 New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Andrew Kelley
67fbb0434f ir: remove redundant casting code 2018-11-11 12:48:55 -05:00
Andrew Kelley
ef5d7ce463 array type syntax implies comptime 2018-11-09 19:26:54 -05:00
emekoi
8e69a18d8c made colored output more consistent (#1706)
* made colored output more consistent
* added os.supportsAnsiEscapeCodes
2018-11-08 00:36:36 -05:00
Andrew Kelley
ac8898e681 std.build.Builder: mutable env_map 2018-11-07 21:23:09 -05:00
Andrew Kelley
d9fe38789b macos: use the same code as linux to determine libc include path
this fixes .h file locating on macos 10.14
2018-11-06 17:59:44 -05:00
Andrew Kelley
63f636e7b7 limit integer types to maximum bit width of 65535
closes #1541
2018-11-06 11:09:14 -05:00
Andrew Kelley
a08b65720b README: update CI badges 2018-11-06 09:55:54 -05:00
Andrew Kelley
2928b01afc fix broken cli test and translate-c: support no-op cast 2018-11-05 20:03:16 -05:00
Andrew Kelley
eba90cdc41 ci: remove accidental .lib files from windows zip 2018-11-05 16:55:16 -05:00
Andrew Kelley
86e3b51565 ci: 7-zip instead of info-zip for windows
I'm guessing this is why 0.3.0 is 21.5MiB while
master is 27.6MiB
2018-11-05 13:26:46 -05:00
kristopher tate
3ec58b8e0b ci/azure: set wget to non-verbose mode to make logs easier to read;
Over 5000 lines of wget download process updates are stored to the logs: `2018-11-05T15:12:23.7724039Z 296000K .......... .......... .......... .......... .......... 99% 83.9M 0s`
2018-11-05 12:59:35 -05:00
Andrew Kelley
0a495aa563 update type info behavior test
it depends on the OS struct, which is probably not necessary
to accomplish the test's goal.
2018-11-05 11:37:48 -05:00
Andrew Kelley
c19bc7ecb4 update self-hosted compiler for new targets 2018-11-05 11:32:02 -05:00
Andrew Kelley
5b96cc236c update to build against llvm trunk 2018-11-05 11:17:35 -05:00
Andrew Kelley
197ffe0092 update ci scripts for llvm 8 2018-11-05 10:58:53 -05:00
Andrew Kelley
f8d6f5daff Merge remote-tracking branch 'origin/master' into llvm8 2018-11-05 10:56:42 -05:00
Andrew Kelley
973e0abe79 ci: full test suite 2018-11-05 10:10:27 -05:00
Andrew Kelley
e64e8d62dd ci: display environment variables 2018-11-05 09:46:31 -05:00
Andrew Kelley
9b0fb8a912 ci: fix paths 2018-11-05 01:51:28 -05:00
Andrew Kelley
dc2dfef0a2 ci: upload a src tarball too 2018-11-05 01:32:21 -05:00
Andrew Kelley
caf1ec9474 ci: fix shasum commands 2018-11-04 23:26:23 -05:00
Andrew Kelley
eb1c769404 ci: add missing steps field 2018-11-04 22:38:23 -05:00
Andrew Kelley
c2df9236c4 ci: use azure for all CI
* appveyor and travis are removed
 * add a job to update the download page when all
   targets pass. closes #1046
2018-11-04 22:32:59 -05:00
kristopher tate
5d014d4b37 os.crypto: support for HmacBlake2s256 variety; 2018-11-03 15:03:48 -04:00
Andrew Kelley
c7b79284ef azure: build static macos 2018-11-02 00:54:34 -04:00
Andrew Kelley
1554dd9697 support building static self hosted compiler on macos
* add a --system-linker-hack command line parameter to work around
   poor LLD macho code. See #1535
 * build.zig correctly handles static as well as dynamic dependencies
   when building the self hosted compiler.
   - no more unnecessary libxml2 dependency
   - a static build on macos produces a completely static self-hosted
     compiler for macos (except for libSystem as intended).
2018-11-02 00:54:34 -04:00
Andrew Kelley
5c97aff627 readme: MSVC 2017 is the supported one now
also add note about pre-built master branch
2018-11-01 15:21:41 -04:00
Andrew Kelley
5b1b072d8d Merge branch 'winksaville-add-test-for-atomic-Queue-dump' 2018-10-31 10:44:25 -04:00
Andrew Kelley
0f3e7387bf cleanups 2018-10-31 10:44:05 -04:00
Andrew Kelley
b04c6cee60 Merge branch 'add-test-for-atomic-Queue-dump' of https://github.com/winksaville/zig into winksaville-add-test-for-atomic-Queue-dump 2018-10-31 10:29:49 -04:00
Andrew Kelley
4e12f909df simplify logic of pass1 ir for while on error unions 2018-10-31 10:00:51 -04:00
Andrew Kelley
7405bc7618 remove implicit cast from number literal to enum
I missed this code when removing explicit cast syntax.
2018-10-30 17:28:03 -04:00
Andrew Kelley
ca71373da1 remove another implicit cast to const pointer
* remove implicit cast from *T to ?*const T
 * remove implicit cast from T to ?*const T when T is a struct/union
2018-10-29 16:41:30 -04:00
Andrew Kelley
0921a93c1c Merge pull request #1686 from emekoi/comment-fix
fixed comments
2018-10-27 14:07:08 -04:00
emekoi
c7799ff2b2 fixed comments 2018-10-27 12:58:40 -05:00
emekoi
395f3d946a fixed mingw compilation 2018-10-27 11:35:01 -04:00
Andrew Kelley
2b395d4ede remove @minValue,@maxValue; add std.math.minInt,maxInt
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Andrew Kelley
40b7652a6d fix stack pointer register name on i386 2018-10-25 18:25:53 -04:00
Andrew Kelley
eb0b1d38ff remove 3 more implicit casts to const pointers
see #1465
2018-10-25 12:52:12 -04:00
Ryan Saunderson
73ab0afadd Bug fixes in WinSDK detection (#1665)
* fixed detecting the latest installed version of the windows sdk & related tests
2018-10-24 16:14:16 -04:00
tgschultz
63f9769e80 fix "std" not found error in meta/trait 2018-10-24 01:47:52 -04:00
tgschultz
65b9fae4f8 fix error where "std" isn't found in meta/trait 2018-10-24 01:47:52 -04:00
Andrew Kelley
b4801186b7 langref: dark style. easier on the eyes 2018-10-23 22:11:31 -04:00
emekoi
d7cec5b37c fixes #1667 2018-10-23 21:29:04 -04:00
Andrew Kelley
96923edc53 travis: don't use newer cli args of s3cmd 2018-10-23 18:48:34 -04:00
Andrew Kelley
08c5f7d059 travis: add missing http headers for docs 2018-10-23 17:06:37 -04:00
Josh Wolfe
6fe7dd93cb that's not a keyword 2018-10-22 20:44:59 -04:00
Jimmi Holst Christensen
65b7d85524 Fixed code still using old ptr syntax 2018-10-20 17:59:06 +02:00
tgschultz
58610a4427 Add std.meta to deployment (#1670) 2018-10-20 11:40:26 -04:00
Greg V
f3bc1c38bf Specify 16-byte stack alignment in _start on FreeBSD 2018-10-20 15:21:35 +03:00
Greg V
6a8fb06006 Split at zero byte in SplitIterator
To avoid extra zeros in buffers
2018-10-20 15:21:35 +03:00
Greg V
e5627f8e63 Support more of std on FreeBSD 2018-10-20 15:21:35 +03:00
Greg V
831bb66895 Set up libc/rtld paths for FreeBSD 2018-10-20 15:21:35 +03:00
Greg V
a983a0a59b Add /usr/local/lib path for libxml2 and link libc++ on FreeBSD 2018-10-20 15:21:32 +03:00
Greg V
d6cab0d4b6 Various fcntl flags are also machine-independent on FreeBSD 2018-10-20 15:15:01 +03:00
Greg V
afe26bbcbd System call numbers on FreeBSD are machine-independent
But e.g. sbrk is only removed in new architectures (aarch64, riscv),
so keep it in x86_64
2018-10-20 15:15:01 +03:00
Greg V
7a3f0a55d9 Add freebsd to more things 2018-10-20 15:15:01 +03:00
Greg V
1829c09303 Fix os/freebsd files 2018-10-20 15:15:01 +03:00
Marc Tiehuis
19659c3bd3 freebsd: Fix argc resolution in _start
FreeBSD appears to use rdi instead of rsp as in other posix systems.
According to some loose documentation, x86 passes values on the stack,
so amd64 freebsd may be the only exception.
2018-10-20 15:15:01 +03:00
Marc Tiehuis
102cb61e40 Get freebsd std compiling again 2018-10-20 15:15:01 +03:00
Marc Tiehuis
264dd2eb57 Set FreeBSD ELF OS/ABI when targeting
Closes #553.
2018-10-20 15:15:01 +03:00
Marc Tiehuis
e2b9c153bd Add initial freebsd stdlib functionality
Trivial program now compiles with now warnings.
2018-10-20 15:15:01 +03:00
Greg V
9a541c1214 Add FreeBSD support to os.cpp 2018-10-20 15:15:01 +03:00
Greg V
24e54799fd Fix CMake finding LLVM/clang/lld on FreeBSD 2018-10-20 15:15:01 +03:00
Jimmi Holst Christensen
db3b768eab Ran fmt on last PR 2018-10-19 23:27:16 +02:00
tgschultz
2a3fdd52ce Add std.meta (#1662)
Implement std.meta
2018-10-19 17:19:22 -04:00
Andrew Kelley
b9a53c261a travis: upload langref on successful test run 2018-10-17 18:10:07 -04:00
Andrew Kelley
eeb4f376a3 std.io: fix compile error when InStream has empty error set 2018-10-16 12:48:38 -04:00
Andrew Kelley
49bc33efe1 fix windows 2018-10-15 21:38:01 -04:00
Andrew Kelley
d5648d2640 remove implicit cast from T to *const T
closes #1465
2018-10-15 18:23:47 -04:00
Jimmi Holst Christensen
378d3e4403 Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Andrew Kelley
822d4fa216 fix compiler crash 2018-10-13 16:35:38 -04:00
Andrew Kelley
3e72411db0 C ABI and compiler rt improvements for ARM
* add __multi3 compiler rt function. See #1290
* compiler rt includes ARM functions for thumb and aarch64 and
  other sub-arches left out. See #1526
* support C ABI for returning structs on ARM. see #1481
2018-10-13 15:18:00 -04:00
Marc Tiehuis
67fb4d1359 Improve time.sleep api 2018-10-11 11:57:59 -04:00
emekoi
a22d9daaec added math.pow support for integer types. resolves #1637 (#1642)
added math.powi for integers; pow now handles ints
2018-10-10 10:50:23 -04:00
Andrew Kelley
9e38a81230 Merge pull request #1647 from ziglang/static-libs
Support building static libraries
2018-10-09 13:20:27 -04:00
Andrew Kelley
81c6f08724 add workaround for bad LLD macos code 2018-10-09 13:16:51 -04:00
Andrew Kelley
05e608a0c7 stage1 os: workaround for macos not having environ variable 2018-10-09 13:16:51 -04:00
Andrew Kelley
e29a3b1d2a stage1 link: compiler_rt and builtin libs know ...
...whether they will be linked with libc
2018-10-09 13:16:51 -04:00
Andrew Kelley
e0a94db65e fix error limit linker arg on windows 2018-10-09 13:16:51 -04:00
Andrew Kelley
84690ee05e std/special/bootstrap: inline some functions to improve stack traces 2018-10-09 13:16:50 -04:00
Andrew Kelley
6b93495792 more efficient builtin library code generation
* introduce --disable-pic option which can generally be allowed to be
   the default. compiler_rt.a and builtin.a get this option when you
   build a static executable.
 * compiler_rt and builtin libraries are not built for build-lib
   --static
 * posix_spawn instead of fork/execv
 * disable the error limit on LLD. Fixes the blank lines printed
2018-10-09 13:16:50 -04:00
Andrew Kelley
5a3c02137e support building static libraries
closes #1493
closes #54
2018-10-09 13:15:14 -04:00
Andrew Kelley
d40c4e7c89 Merge pull request #1429 from shawnl/arm64
initial arm64 support
2018-10-06 00:11:39 -04:00
Andrew Kelley
5b84192f07 build: try to find llvm-config-7 before llvm-config 2018-10-06 00:10:16 -04:00
Andrew Kelley
b7dda772a8 disable C ABI tests on macos due to LLD deficiency
See #1535

we'll have a better macos linker someday
2018-10-06 00:06:36 -04:00
Shawn Landden
2d27341724 arm64: respond to code review 2018-10-06 03:31:52 +00:00
Andrew Kelley
4640853d1b on linux, link statically if not linking any shared libs 2018-10-05 18:34:37 -04:00
Andrew Kelley
8700f4d2b1 docs: add comment about operator overloading 2018-10-05 18:25:20 -04:00
Andrew Kelley
c81a4b3e3d docs: fix double escaping html entities 2018-10-05 10:21:08 -04:00
Andrew Kelley
8d6601d7ce improve pointer documentation
closes #1630
2018-10-04 22:51:36 -04:00
Andrew Kelley
d07413f9b7 fix missing .h files
closes #1634
2018-10-04 18:14:57 -04:00
Andrew Kelley
23b07ad8d2 refactor ir.cpp
Analysis functions no longer return `ZigType *`. Instead they
return `IrInstruction *`.
2018-10-04 14:33:52 -04:00
emekoi
31469daca3 removed unneeded dll extension 2018-10-04 11:43:53 -04:00
Andrew Kelley
3f13a59cbc better mutex implementation
based on Ulrich Drepper's "Futexes are tricky" paper, Mutex, Take 3

also includes tests
2018-10-03 14:55:12 -04:00
Andrew Kelley
66cb75d114 std.Mutex: implement blocking mutexes on linux
closes #1463

Thanks to Shawn Landden for the original pull request.
This commit is based on that code.
2018-10-03 13:19:10 -04:00
Andrew Kelley
acefcdbca5 add std.os.linux.vfork and std.os.linux.exit_group 2018-10-02 14:08:32 -04:00
Andrew Kelley
364bc66924 Merge pull request #1619 from bnoordhuis/fix1570
fix build-exe for --target-arch wasm32 (#1570)
2018-10-02 09:02:14 -04:00
Ben Noordhuis
24bbade217 fix build-exe for --target-arch wasm32 (#1570)
Pass --no-entry instead of --relocatable to lld. Both stop a reference
to the _start() entry point from being emitted but --relocatable also
prevents public symbols from being exported when creating an executable.
2018-10-02 12:31:21 +02:00
Wink Saville
cd211bcc20 Add doc comment for tokenLocationPtr (#1618)
The algorithm seemed unusual and I had spent some effort understanding
it, so I thought I'd add a comment.
2018-10-02 00:51:53 -04:00
Jimmi Holst Christensen
bc3e99c5e5 Fixed StackTrace not being resolved when panic is invalid (#1615) 2018-10-01 20:30:34 +02:00
Andrew Kelley
d4d22df1d9 increase stack size on windows for all executables
fixes test failures

See #157
2018-10-01 14:10:18 -04:00
Andrew Kelley
af229c1fdc std lib (breaking): posixRead can return less than buffer size
closes #1414

std.io.InStream.read now can return less than buffer size
introduce std.io.InStream.readFull for previous behavior

add std.os.File.openWriteNoClobberC
rename std.os.deleteFileWindows to std.os.deleteFileW
remove std.os.deleteFilePosix
add std.os.deleteFileC

std.os.copyFile no longer takes an allocator
std.os.copyFileMode no longer takes an allocator
std.os.AtomicFile no longer takes an allocator

add std.os.renameW
add windows support for std.os.renameC

add a test for std.os.AtomicFile
2018-10-01 13:50:55 -04:00
Andrew Kelley
d1ec8377d1 std lib: flesh out the async I/O streaming API a bit 2018-10-01 10:53:39 -04:00
Andrew Kelley
9d4eaf1e07 update std lib API for I/O
std.io.FileInStream -> std.os.File.InStream
std.io.FileInStream.init(file) -> file.inStream()
std.io.FileOutStream -> std.os.File.OutStream
std.io.FileOutStream.init(file) -> file.outStream()

remove a lot of error code possibilities from os functions

std.event.net.socketRead -> std.event.net.read
std.event.net.socketWrite -> std.event.net.write
add std.event.net.readv
add std.event.net.writev
add std.event.net.readvPosix
add std.event.net.writevPosix
add std.event.net.OutStream
add std.event.net.InStream

add std.event.io.InStream
add std.event.io.OutStream
2018-09-30 17:28:35 -04:00
Sahnvour
ba78ae0ae7 Fixes --emit asm on windows and makes C header file generation explicit. (#1612)
* build: only do codegen_link when emitting an actual binary. Fixes #1371

* build: only output C header file when explicitely asked to
2018-09-30 16:59:45 -04:00
Andrew Kelley
418b2e7d47 build: omit finding libxml2, zlib since no direct dependency 2018-09-30 16:56:06 -04:00
Andrew Kelley
57c4d38c55 rename std.event.tcp to std.event.net 2018-09-30 10:37:58 -04:00
Andrew Kelley
a42a213e35 Merge pull request #1594 from emekoi/master
added dynamic library loading for windows
2018-09-30 09:31:24 -04:00
emekoi
e6446dfc86 fixed native target detection 2018-09-30 09:27:53 -04:00
emekoi
623f5085f1 merged windows dll apis 2018-09-30 01:05:13 -05:00
emekoi
42ba206c5d fixed compilation on mingw 2018-09-30 01:05:13 -05:00
emekoi
d3bf267136 added dynamic library loading for windows 2018-09-30 01:05:13 -05:00
Jimmi Holst Christensen
1428ef3b07 Expose failing_allocator as *Allocator instead of const FailingAllocator 2018-09-30 01:23:05 +02:00
Andrew Kelley
40da2c6098 Merge pull request #1599 from ziglang/zig-build-arg0
zig build: use os_self_exe_path to determine exe path not arg0
2018-09-28 18:45:50 -04:00
Andrew Kelley
779881b978 zig build: use os_self_exe_path to determine exe path not arg0 2018-09-28 16:41:23 -04:00
Andrew Kelley
ce912e2964 add HermitCore target 2018-09-19 17:52:37 -04:00
Andrew Kelley
a4d61b5d72 update to llvm 8 2018-09-19 17:34:52 -04:00
Wink Saville
d9ed3d186d Add test for Queue.dump
To make dump testable added dumpToSteam which takes a stream as input
and added the stream as a paraemter to dumpRecursive.

Added test "std.atomic.Queue dump"

And to make the test more robust SliceOutStream.pos is now public. This
allows the user of SliceOutStream to know the length of the data captured.
2018-09-14 14:14:58 -07:00
Shawn Landden
17cb69cebc fix elf auxv handling
Auxillery vectors are not guaranteed to be in any order, this
just happens to work on x86_64.
2018-09-08 14:47:21 +00:00
Shawn Landden
7d6d1d1f60 NaNs do not have signedness.
From IEEE-754 standard:

Conversion of a quiet NaN in a supported format to an external character sequence
shall produce a language-defined one of “nan” or a sequence that is equivalent except
for case (e.g., “NaN”), with an optional preceding sign. (This standard does not interpret
the sign of a NaN.)
2018-09-08 03:52:28 +00:00
Shawn Landden
fdeb8765f0 use vfork in stage1 compiler to avoid OOM 2018-09-08 03:52:28 +00:00
Shawn Landden
cba0d76fbc clone() on arm64 2018-09-08 03:52:28 +00:00
Shawn Landden
f8808edff4 simplify f64_min to equivilent value
arm64 complains about the old value (I added a test)
2018-09-08 03:52:28 +00:00
Shawn Landden
342cff28f5 initial arm64 support 2018-09-08 03:52:28 +00:00
Shawn Landden
4a8c992ef1 os: use less syscalls
these don't exist on new platforms (such as arm64)

also switch from the deprecated dirent to dirent64
2018-09-08 03:52:28 +00:00
Shawn Landden
d956d30167 this is not arch-specific 2018-09-08 03:52:28 +00:00
10721 changed files with 2449054 additions and 220825 deletions

11
.builds/freebsd.yml Normal file
View File

@@ -0,0 +1,11 @@
image: freebsd/latest
packages:
- cmake
- py27-s3cmd
- wget
secrets:
- 6c60aaee-92e7-4e7d-812c-114817689b4d
sources:
- https://github.com/ziglang/zig
tasks:
- build: cd zig && ./ci/srht/freebsd_script

7
.gitattributes vendored
View File

@@ -1,2 +1,9 @@
*.zig text eol=lf
*.txt text eol=lf
langref.html.in text eol=lf
deps/* linguist-vendored
lib/include/* linguist-vendored
lib/libc/* linguist-vendored
lib/libcxx/* linguist-vendored
lib/libunwind/* linguist-vendored

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
github: [andrewrk]

6
.gitignore vendored
View File

@@ -10,6 +10,6 @@
# -andrewrk
zig-cache/
build/
build-*/
docgen_tmp/
/build/
/build-*/
/docgen_tmp/

View File

@@ -1,22 +0,0 @@
sudo: required
services:
- docker
os:
- linux
- osx
dist: trusty
osx_image: xcode8.3
language: cpp
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ci/travis_linux_before_install; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ci/travis_osx_before_install; fi
install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ci/travis_linux_install; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ci/travis_osx_install; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ci/travis_linux_script; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ci/travis_osx_script; fi
env:
global:
- secure: QmJ+eLOxj3Irl5SHxt6lQvrj7++1AIz8bYri6RScAQGHQPIztkmbpBjAkpFgYaWPkZ04ROtamFXdS7oHtJHSECesgPoqM/CHIychQkgpDq30+TsFyYbBpDGHY+N6r2WnQTvg+9EuAp6P365us6qFS0D5zQ3P40c56uMbazFu3J4W1HZP+pLWlLjEXaN88ePhHWqNZyvwGMkLpYl3ghcrE9H4vGZQ7jenRW4UmskLEkuhUPJbQiow3Td8arJiRmLVISzWqneqNraLUpGyUVr4F3Rbjzacfoo3r9ZZynhY0mFsEye82x6TMGgH2xsNGkd91zpQuckWUT+pQv/G6FXpnEnjIJSO2Z5WAxXrx6xB1k2HZ17/4NWLF3fJVhdQJm3mS6odeGzUjgGrl1A42evxU+7VbcofEJq1aMiLgU1jUT2pt+pefCwmKJYLpEsSzuyrVxgvskQz0QpC053TAYSNf2Jj6Qhg9YDWyOeemYmDgffTqErF7AYhc6NKH0s0XKkIiNFSxorkEsfG/Ck1o+15slHNmWZXlmXToxDqFkLDoPvfGKg7koU5YTGvci/F9ZKb1juhGLxZbwap/18zN40BqA+Ip2yDBJAKxsIiwSjSIguy6g/Z1I50s0xNGOr36urfRRQX5H+rqr/xCZ63B6WSe6qBcZboWAQMDn8HLS9Xiwc=
- secure: dnb7r5guUeMOX9e7XlPUSZzmga8VW3G9Q1aa7LxEKiTjSnWhu5KpPDe8o1X3Rj6nc5iXDqmBH/C/7eNXPDyXJJWPvpE2YRpGymyUkRaakul0QBKJEaMvwy2SuAfS69CWC+TSzfGRvtSYkdpBhhLvs0h5S819S5jYbCNSCmOKfFucaP5NsHNIZ/I19oIeTPTa0/UnVm7DLFZXZjvbS+czkdyH1DhbT85sLj+XqNTzLePImE68efrjaHnlSy/CzBVJzj55UgD5i9fxNCQWzGWim/SD5xZ0zKtLycSOf6wQN2lCo0lkjw9rDlYz69mM5L9ikfYL9oHDPZnh84oXKglQ5miOHCgqs/qs4439I05lIu8i/EfbFA55YG4NyO3rL9YVOOt5gwiwvJYhDcnkVVzSl0o5bsoZgQfYvPWaIQKNkl3C53zfDQjgqS54CeDzlZpFrQTDQ1RrH8oeVC1gfYAeMabMDadox5rfZmLIN5JTf/F8iD/QdxGcoUvkEENcQgfP9PnubExtexgHGsEmqbm6ORSZ1MkEh2m3fo0f8KE6TbN1UigmcQ8nTkWBHsSmfHnB8HwJQp8mwQmDamXA+Hl3e3w4LOdYkJVlNW1/TTyJJOOvjMQCjF8SJmPHuh+QpqKbSaT9XM/vBhxbIZEufH8kawJKCBBcCNspGMNjhXfNjM0=

View File

@@ -6,7 +6,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE STRING
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE STRING
"Directory to install zig to" FORCE)
endif()
@@ -15,7 +15,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(ZIG_VERSION_MAJOR 0)
set(ZIG_VERSION_MINOR 3)
set(ZIG_VERSION_MINOR 5)
set(ZIG_VERSION_PATCH 0)
set(ZIG_VERSION "${ZIG_VERSION_MAJOR}.${ZIG_VERSION_MINOR}.${ZIG_VERSION_PATCH}")
@@ -23,19 +23,29 @@ find_program(GIT_EXE NAMES git)
if(GIT_EXE)
execute_process(
COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} name-rev HEAD --tags --name-only --no-undefined --always
RESULT_VARIABLE EXIT_STATUS
OUTPUT_VARIABLE ZIG_GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(ZIG_GIT_REV MATCHES "\\^0$")
if(NOT("${ZIG_GIT_REV}" STREQUAL "${ZIG_VERSION}^0"))
message("WARNING: Tag does not match configured Zig version")
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(EXIT_STATUS EQUAL "0")
if(ZIG_GIT_REV MATCHES "\\^0$")
if(NOT("${ZIG_GIT_REV}" STREQUAL "${ZIG_VERSION}^0"))
message("WARNING: Tag does not match configured Zig version")
endif()
else()
set(ZIG_VERSION "${ZIG_VERSION}+${ZIG_GIT_REV}")
endif()
else()
set(ZIG_VERSION "${ZIG_VERSION}+${ZIG_GIT_REV}")
endif()
endif()
message("Configuring zig version ${ZIG_VERSION}")
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL "Disable copying lib/ files to install prefix")
if(ZIG_STATIC)
set(ZIG_STATIC_LLVM "on")
endif()
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_LIB_DIR_ESCAPED "${ZIG_LIBC_LIB_DIR}")
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_STATIC_LIB_DIR_ESCAPED "${ZIG_LIBC_STATIC_LIB_DIR}")
@@ -50,35 +60,24 @@ option(ZIG_FORCE_EXTERNAL_LLD "If your system has the LLD patches use it instead
find_package(llvm)
find_package(clang)
# TODO fix https://github.com/ziglang/docker-zig/issues/7
list(REMOVE_ITEM LLVM_LIBRARIES "-l/deps/local/lib/libxml2.a")
if(NOT MSVC)
find_library(LIBXML2 NAMES xml2 libxml2)
if(${LIBXML2} STREQUAL "LIBXML2-NOTFOUND")
message(FATAL_ERROR "Could not find libxml2")
else()
message("${LIBXML2} found")
endif()
if(APPLE AND ZIG_STATIC)
list(REMOVE_ITEM LLVM_LIBRARIES "-lz")
find_library(ZLIB NAMES z zlib libz)
if(${ZLIB} STREQUAL "ZLIB-NOTFOUND")
message(FATAL_ERROR "Could not find zlib")
else()
message("${ZLIB} found")
endif()
if(APPLE AND ZIG_STATIC)
list(REMOVE_ITEM LLVM_LIBRARIES "-lz")
list(REMOVE_ITEM LLVM_LIBRARIES "-lxml2")
list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
find_library(LIBNCURSES NAMES libncurses.a)
list(APPEND LLVM_LIBRARIES "${LIBNCURSES}" "${LIBXML2}" "${ZLIB}")
endif()
list(APPEND LLVM_LIBRARIES "${ZLIB}")
endif()
set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zig_cpp")
# Handle multi-config builds and place each into a common lib. The VS generator
# for example will append a Debug folder by default if not explicitly specified.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ZIG_CPP_LIB_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ZIG_CPP_LIB_DIR})
foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${CONFIG_TYPE} CONFIG_TYPE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_TYPE} ${ZIG_CPP_LIB_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_TYPE} ${ZIG_CPP_LIB_DIR})
endforeach(CONFIG_TYPE CMAKE_CONFIGURATION_TYPES)
if(ZIG_FORCE_EXTERNAL_LLD)
find_package(lld)
include_directories(${LLVM_INCLUDE_DIRS})
@@ -94,6 +93,7 @@ else()
set(EMBEDDED_LLD_LIB_SOURCES
"${CMAKE_SOURCE_DIR}/deps/lld/Common/Args.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/Common/ErrorHandler.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/Common/Filesystem.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/Common/Memory.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/Common/Reproduce.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/Common/Strings.cpp"
@@ -132,6 +132,7 @@ else()
"${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/MachO/WriterMachO.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp"
)
set(EMBEDDED_LLD_ELF_SOURCES
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/AArch64ErrataFix.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/AArch64.cpp"
@@ -139,19 +140,20 @@ else()
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/ARM.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/AVR.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/Hexagon.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/MSP430.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/Mips.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/MipsArchTree.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/PPC.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/PPC64.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/RISCV.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/SPARCV9.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/X86.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Arch/X86_64.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/CallGraphSort.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/DWARF.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Driver.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/DriverUtils.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/EhFrame.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/Filesystem.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/GdbIndex.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/ICF.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/InputFiles.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/ELF/InputSection.cpp"
@@ -174,6 +176,7 @@ else()
set(EMBEDDED_LLD_COFF_SOURCES
"${CMAKE_SOURCE_DIR}/deps/lld/COFF/Chunks.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/COFF/DLL.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/COFF/DebugTypes.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/COFF/Driver.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/COFF/DriverUtils.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/COFF/ICF.cpp"
@@ -197,20 +200,25 @@ else()
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/LTO.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/MarkLive.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/OutputSections.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/Relocations.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/SymbolTable.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/Symbols.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/SyntheticSections.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/Writer.cpp"
"${CMAKE_SOURCE_DIR}/deps/lld/wasm/WriterUtils.cpp"
)
add_library(embedded_lld_lib ${EMBEDDED_LLD_LIB_SOURCES})
add_library(embedded_lld_elf ${EMBEDDED_LLD_ELF_SOURCES})
add_library(embedded_lld_coff ${EMBEDDED_LLD_COFF_SOURCES})
add_library(embedded_lld_mingw ${EMBEDDED_LLD_MINGW_SOURCES})
add_library(embedded_lld_wasm ${EMBEDDED_LLD_WASM_SOURCES})
add_library(embedded_lld_lib STATIC ${EMBEDDED_LLD_LIB_SOURCES})
add_library(embedded_lld_elf STATIC ${EMBEDDED_LLD_ELF_SOURCES})
add_library(embedded_lld_coff STATIC ${EMBEDDED_LLD_COFF_SOURCES})
add_library(embedded_lld_mingw STATIC ${EMBEDDED_LLD_MINGW_SOURCES})
add_library(embedded_lld_wasm STATIC ${EMBEDDED_LLD_WASM_SOURCES})
if(MSVC)
set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -D_CRT_SECURE_NO_WARNINGS /w")
else()
set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -fno-exceptions -fno-rtti -Wno-comment")
set(ZIG_LLD_COMPILE_FLAGS "-std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Wno-comment")
if(MINGW)
set(ZIG_LLD_COMPILE_FLAGS "${ZIG_LLD_COMPILE_FLAGS} -D__STDC_FORMAT_MACROS -D__USE_MINGW_ANSI_STDIO")
endif()
endif()
set_target_properties(embedded_lld_lib PROPERTIES
COMPILE_FLAGS ${ZIG_LLD_COMPILE_FLAGS}
@@ -268,7 +276,6 @@ else()
embedded_lld_wasm
embedded_lld_lib
)
install(TARGETS embedded_lld_elf embedded_lld_coff embedded_lld_mingw embedded_lld_wasm embedded_lld_lib DESTINATION "${ZIG_CPP_LIB_DIR}")
endif()
# No patches have been applied to SoftFloat-3e
@@ -313,6 +320,7 @@ set(EMBEDDED_SOFTFLOAT_SOURCES
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_add.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_div.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_eq.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_isSignalingNaN.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_lt.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_mul.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_rem.c"
@@ -324,6 +332,7 @@ set(EMBEDDED_SOFTFLOAT_SOURCES
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f32_to_f128M.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f64_to_f128M.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f64_to_f16.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/i32_to_f128M.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/s_add256M.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/s_addCarryM.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/s_addComplCarryM.c"
@@ -393,11 +402,13 @@ set(EMBEDDED_SOFTFLOAT_SOURCES
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/s_subMagsF32.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/s_subMagsF64.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/s_tryPropagateNaNF128M.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f16_mulAdd.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/f128M_mulAdd.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/softfloat_state.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/ui32_to_f128M.c"
"${CMAKE_SOURCE_DIR}/deps/SoftFloat-3e/source/ui64_to_f128M.c"
)
add_library(embedded_softfloat ${EMBEDDED_SOFTFLOAT_SOURCES})
add_library(embedded_softfloat STATIC ${EMBEDDED_SOFTFLOAT_SOURCES})
if(MSVC)
set_target_properties(embedded_softfloat PROPERTIES
COMPILE_FLAGS "-std=c99 /w"
@@ -416,6 +427,12 @@ set(SOFTFLOAT_LIBRARIES embedded_softfloat)
find_package(Threads)
# CMake doesn't let us create an empty executable, so we hang on to this one separately.
set(ZIG_MAIN_SRC "${CMAKE_SOURCE_DIR}/src/main.cpp")
# This is our shim which will be replaced by libuserland written in Zig.
set(ZIG0_SHIM_SRC "${CMAKE_SOURCE_DIR}/src/userland.cpp")
set(ZIG_SOURCES
"${CMAKE_SOURCE_DIR}/src/analyze.cpp"
"${CMAKE_SOURCE_DIR}/src/ast_render.cpp"
@@ -428,352 +445,36 @@ set(ZIG_SOURCES
"${CMAKE_SOURCE_DIR}/src/compiler.cpp"
"${CMAKE_SOURCE_DIR}/src/errmsg.cpp"
"${CMAKE_SOURCE_DIR}/src/error.cpp"
"${CMAKE_SOURCE_DIR}/src/glibc.cpp"
"${CMAKE_SOURCE_DIR}/src/ir.cpp"
"${CMAKE_SOURCE_DIR}/src/ir_print.cpp"
"${CMAKE_SOURCE_DIR}/src/libc_installation.cpp"
"${CMAKE_SOURCE_DIR}/src/link.cpp"
"${CMAKE_SOURCE_DIR}/src/main.cpp"
"${CMAKE_SOURCE_DIR}/src/os.cpp"
"${CMAKE_SOURCE_DIR}/src/parser.cpp"
"${CMAKE_SOURCE_DIR}/src/range_set.cpp"
"${CMAKE_SOURCE_DIR}/src/stack_report.cpp"
"${CMAKE_SOURCE_DIR}/src/target.cpp"
"${CMAKE_SOURCE_DIR}/src/tokenizer.cpp"
"${CMAKE_SOURCE_DIR}/src/util.cpp"
"${CMAKE_SOURCE_DIR}/src/translate_c.cpp"
"${CMAKE_SOURCE_DIR}/src/util.cpp"
)
set(BLAKE_SOURCES
set(OPTIMIZED_C_SOURCES
"${CMAKE_SOURCE_DIR}/src/blake2b.c"
"${CMAKE_SOURCE_DIR}/src/parse_f128.c"
)
set(ZIG_CPP_SOURCES
"${CMAKE_SOURCE_DIR}/src/zig_llvm.cpp"
"${CMAKE_SOURCE_DIR}/src/zig_clang.cpp"
"${CMAKE_SOURCE_DIR}/src/zig_clang_driver.cpp"
"${CMAKE_SOURCE_DIR}/src/zig_clang_cc1_main.cpp"
"${CMAKE_SOURCE_DIR}/src/zig_clang_cc1as_main.cpp"
"${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp"
)
set(ZIG_STD_FILES
"array_list.zig"
"atomic/index.zig"
"atomic/int.zig"
"atomic/queue.zig"
"atomic/stack.zig"
"base64.zig"
"buf_map.zig"
"buf_set.zig"
"buffer.zig"
"build.zig"
"c/darwin.zig"
"c/index.zig"
"c/linux.zig"
"c/windows.zig"
"coff.zig"
"crypto/blake2.zig"
"crypto/chacha20.zig"
"crypto/hmac.zig"
"crypto/index.zig"
"crypto/md5.zig"
"crypto/sha1.zig"
"crypto/sha2.zig"
"crypto/sha3.zig"
"crypto/poly1305.zig"
"crypto/x25519.zig"
"cstr.zig"
"debug/failing_allocator.zig"
"debug/index.zig"
"dwarf.zig"
"dynamic_library.zig"
"elf.zig"
"empty.zig"
"event.zig"
"event/channel.zig"
"event/fs.zig"
"event/future.zig"
"event/group.zig"
"event/lock.zig"
"event/locked.zig"
"event/loop.zig"
"event/rwlock.zig"
"event/rwlocked.zig"
"event/tcp.zig"
"fmt/errol/enum3.zig"
"fmt/errol/index.zig"
"fmt/errol/lookup.zig"
"fmt/index.zig"
"hash/adler.zig"
"hash/crc.zig"
"hash/fnv.zig"
"hash/index.zig"
"hash/siphash.zig"
"hash_map.zig"
"heap.zig"
"index.zig"
"io.zig"
"json.zig"
"lazy_init.zig"
"linked_list.zig"
"macho.zig"
"math/acos.zig"
"math/acosh.zig"
"math/asin.zig"
"math/asinh.zig"
"math/atan.zig"
"math/atan2.zig"
"math/atanh.zig"
"math/big/index.zig"
"math/big/int.zig"
"math/cbrt.zig"
"math/ceil.zig"
"math/complex/abs.zig"
"math/complex/acos.zig"
"math/complex/acosh.zig"
"math/complex/arg.zig"
"math/complex/asin.zig"
"math/complex/asinh.zig"
"math/complex/atan.zig"
"math/complex/atanh.zig"
"math/complex/conj.zig"
"math/complex/cos.zig"
"math/complex/cosh.zig"
"math/complex/exp.zig"
"math/complex/index.zig"
"math/complex/ldexp.zig"
"math/complex/log.zig"
"math/complex/pow.zig"
"math/complex/proj.zig"
"math/complex/sin.zig"
"math/complex/sinh.zig"
"math/complex/sqrt.zig"
"math/complex/tan.zig"
"math/complex/tanh.zig"
"math/copysign.zig"
"math/cos.zig"
"math/cosh.zig"
"math/exp.zig"
"math/exp2.zig"
"math/expm1.zig"
"math/expo2.zig"
"math/fabs.zig"
"math/floor.zig"
"math/fma.zig"
"math/frexp.zig"
"math/hypot.zig"
"math/ilogb.zig"
"math/index.zig"
"math/inf.zig"
"math/isfinite.zig"
"math/isinf.zig"
"math/isnan.zig"
"math/isnormal.zig"
"math/ln.zig"
"math/log.zig"
"math/log10.zig"
"math/log1p.zig"
"math/log2.zig"
"math/modf.zig"
"math/nan.zig"
"math/pow.zig"
"math/round.zig"
"math/scalbn.zig"
"math/signbit.zig"
"math/sin.zig"
"math/sinh.zig"
"math/sqrt.zig"
"math/tan.zig"
"math/tanh.zig"
"math/trunc.zig"
"mem.zig"
"mutex.zig"
"net.zig"
"os/child_process.zig"
"os/darwin.zig"
"os/darwin/errno.zig"
"os/epoch.zig"
"os/file.zig"
"os/get_app_data_dir.zig"
"os/get_user_id.zig"
"os/index.zig"
"os/linux/errno.zig"
"os/linux/index.zig"
"os/linux/vdso.zig"
"os/linux/x86_64.zig"
"os/path.zig"
"os/time.zig"
"os/windows/advapi32.zig"
"os/windows/error.zig"
"os/windows/index.zig"
"os/windows/kernel32.zig"
"os/windows/ntdll.zig"
"os/windows/ole32.zig"
"os/windows/shell32.zig"
"os/windows/util.zig"
"os/zen.zig"
"pdb.zig"
"rand/index.zig"
"rand/ziggurat.zig"
"segmented_list.zig"
"sort.zig"
"special/bootstrap.zig"
"special/bootstrap_lib.zig"
"special/build_runner.zig"
"special/builtin.zig"
"special/compiler_rt/aulldiv.zig"
"special/compiler_rt/aullrem.zig"
"special/compiler_rt/comparetf2.zig"
"special/compiler_rt/divti3.zig"
"special/compiler_rt/extendXfYf2.zig"
"special/compiler_rt/fixuint.zig"
"special/compiler_rt/fixunsdfdi.zig"
"special/compiler_rt/fixunsdfsi.zig"
"special/compiler_rt/fixunsdfti.zig"
"special/compiler_rt/fixunssfdi.zig"
"special/compiler_rt/fixunssfsi.zig"
"special/compiler_rt/fixunssfti.zig"
"special/compiler_rt/fixunstfdi.zig"
"special/compiler_rt/fixunstfsi.zig"
"special/compiler_rt/fixunstfti.zig"
"special/compiler_rt/floattidf.zig"
"special/compiler_rt/floattisf.zig"
"special/compiler_rt/floattitf.zig"
"special/compiler_rt/floatunditf.zig"
"special/compiler_rt/floatunsitf.zig"
"special/compiler_rt/floatuntidf.zig"
"special/compiler_rt/floatuntisf.zig"
"special/compiler_rt/floatuntitf.zig"
"special/compiler_rt/index.zig"
"special/compiler_rt/muloti4.zig"
"special/compiler_rt/truncXfYf2.zig"
"special/compiler_rt/udivmod.zig"
"special/compiler_rt/udivmoddi4.zig"
"special/compiler_rt/udivmodti4.zig"
"special/compiler_rt/udivti3.zig"
"special/compiler_rt/umodti3.zig"
"special/init-exe/build.zig"
"special/init-exe/src/main.zig"
"special/init-lib/build.zig"
"special/init-lib/src/main.zig"
"special/panic.zig"
"special/test_runner.zig"
"unicode.zig"
"zig/ast.zig"
"zig/index.zig"
"zig/parse.zig"
"zig/parse_string_literal.zig"
"zig/render.zig"
"zig/tokenizer.zig"
)
set(ZIG_C_HEADER_FILES
"__clang_cuda_builtin_vars.h"
"__clang_cuda_cmath.h"
"__clang_cuda_complex_builtins.h"
"__clang_cuda_intrinsics.h"
"__clang_cuda_math_forward_declares.h"
"__clang_cuda_runtime_wrapper.h"
"__stddef_max_align_t.h"
"__wmmintrin_aes.h"
"__wmmintrin_pclmul.h"
"adxintrin.h"
"altivec.h"
"ammintrin.h"
"arm64intr.h"
"arm_acle.h"
"arm_neon.h"
"armintr.h"
"avx2intrin.h"
"avx512bitalgintrin.h"
"avx512bwintrin.h"
"avx512cdintrin.h"
"avx512dqintrin.h"
"avx512erintrin.h"
"avx512fintrin.h"
"avx512ifmaintrin.h"
"avx512ifmavlintrin.h"
"avx512pfintrin.h"
"avx512vbmi2intrin.h"
"avx512vbmiintrin.h"
"avx512vbmivlintrin.h"
"avx512vlbitalgintrin.h"
"avx512vlbwintrin.h"
"avx512vlcdintrin.h"
"avx512vldqintrin.h"
"avx512vlintrin.h"
"avx512vlvbmi2intrin.h"
"avx512vlvnniintrin.h"
"avx512vnniintrin.h"
"avx512vpopcntdqintrin.h"
"avx512vpopcntdqvlintrin.h"
"avxintrin.h"
"bmi2intrin.h"
"bmiintrin.h"
"cetintrin.h"
"clflushoptintrin.h"
"clwbintrin.h"
"clzerointrin.h"
"cpuid.h"
"cuda_wrappers/algorithm"
"cuda_wrappers/complex"
"cuda_wrappers/new"
"emmintrin.h"
"f16cintrin.h"
"float.h"
"fma4intrin.h"
"fmaintrin.h"
"fxsrintrin.h"
"gfniintrin.h"
"htmintrin.h"
"htmxlintrin.h"
"ia32intrin.h"
"immintrin.h"
"intrin.h"
"inttypes.h"
"iso646.h"
"limits.h"
"lwpintrin.h"
"lzcntintrin.h"
"mm3dnow.h"
"mm_malloc.h"
"mmintrin.h"
"module.modulemap"
"msa.h"
"mwaitxintrin.h"
"nmmintrin.h"
"opencl-c.h"
"pkuintrin.h"
"pmmintrin.h"
"popcntintrin.h"
"prfchwintrin.h"
"rdseedintrin.h"
"rtmintrin.h"
"s390intrin.h"
"shaintrin.h"
"smmintrin.h"
"stdalign.h"
"stdarg.h"
"stdatomic.h"
"stdbool.h"
"stddef.h"
"stdint.h"
"stdnoreturn.h"
"tbmintrin.h"
"tgmath.h"
"tmmintrin.h"
"unwind.h"
"vadefs.h"
"vaesintrin.h"
"varargs.h"
"vecintrin.h"
"vpclmulqdqintrin.h"
"wmmintrin.h"
"x86intrin.h"
"xmmintrin.h"
"xopintrin.h"
"xsavecintrin.h"
"xsaveintrin.h"
"xsaveoptintrin.h"
"xsavesintrin.h"
"xtestintrin.h"
)
if(MSVC)
set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
if(IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
set(ZIG_DIA_GUIDS_LIB "${MSVC_DIA_SDK_DIR}/lib/amd64/diaguids.lib")
string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_DIA_GUIDS_LIB_ESCAPED "${ZIG_DIA_GUIDS_LIB}")
endif()
@@ -781,11 +482,13 @@ endif()
set(ZIG_LIB_DIR "lib/zig")
set(C_HEADERS_DEST "${ZIG_LIB_DIR}/include")
set(LIBC_FILES_DEST "${ZIG_LIB_DIR}/libc")
set(LIBUNWIND_FILES_DEST "${ZIG_LIB_DIR}/libunwind")
set(LIBCXX_FILES_DEST "${ZIG_LIB_DIR}/libcxx")
set(ZIG_STD_DEST "${ZIG_LIB_DIR}/std")
set(CONFIGURE_OUT_FILE "${CMAKE_BINARY_DIR}/config.h")
configure_file (
"${CMAKE_SOURCE_DIR}/src/config.h.in"
${CONFIGURE_OUT_FILE}
"${CMAKE_BINARY_DIR}/config.h"
)
include_directories(
@@ -799,38 +502,46 @@ set(EXE_CFLAGS "-std=c++11")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if(MSVC)
set(EXE_CFLAGS "${EXE_CFLAGS} /w")
elseif(MINGW)
set(EXE_CFLAGS "${EXE_CFLAGS} -Wall -Werror -Wno-error=format= -Wno-error=format -Wno-error=format-extra-args")
else()
set(EXE_CFLAGS "${EXE_CFLAGS} -Werror -Wall")
endif()
endif()
if(MSVC)
set(EXE_CFLAGS "${EXE_CFLAGS}")
set(EXE_CFLAGS "${EXE_CFLAGS}")
else()
set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fno-exceptions -fno-rtti -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces")
if(MINGW)
set(EXE_CFLAGS "${EXE_CFLAGS} -D__USE_MINGW_ANSI_STDIO -Wno-pedantic-ms-format")
endif()
set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces")
if(MINGW)
set(EXE_CFLAGS "${EXE_CFLAGS} -Wno-format")
endif()
endif()
set(BLAKE_CFLAGS "-std=c99")
set(OPTIMIZED_C_FLAGS "-std=c99 -O3")
set(EXE_LDFLAGS " ")
if(MINGW)
set(EXE_LDFLAGS "-static -static-libgcc -static-libstdc++")
elseif(MSVC)
set(EXE_LDFLAGS "/STACK:16777216")
elseif(ZIG_STATIC)
if(MSVC)
set(EXE_LDFLAGS "${EXE_LDFLAGS} /STACK:16777216")
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
set(EXE_LDFLAGS "${EXE_LDFLAGS} /debug:fastlink")
endif()
elseif(MINGW)
set(EXE_LDFLAGS "${EXE_LDFLAGS} -Wl,--stack,16777216")
endif()
if(ZIG_STATIC)
if(APPLE)
set(EXE_LDFLAGS "-static-libgcc -static-libstdc++")
else()
set(EXE_LDFLAGS "-static")
set(EXE_LDFLAGS "${EXE_LDFLAGS} -static-libgcc -static-libstdc++")
elseif(MINGW)
set(EXE_LDFLAGS "${EXE_LDFLAGS} -static-libgcc -static-libstdc++ -Wl,-Bstatic, -lwinpthread -lz3 -lz -lgomp")
elseif(NOT MSVC)
set(EXE_LDFLAGS "${EXE_LDFLAGS} -static")
endif()
else()
set(EXE_LDFLAGS " ")
if(MINGW)
set(EXE_LDFLAGS "${EXE_LDFLAGS} -lz3")
endif()
endif()
if(ZIG_TEST_COVERAGE)
set(EXE_CFLAGS "${EXE_CFLAGS} -fprofile-arcs -ftest-coverage")
set(EXE_LDFLAGS "${EXE_LDFLAGS} -fprofile-arcs -ftest-coverage")
@@ -841,20 +552,19 @@ set_target_properties(zig_cpp PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS}
)
add_library(embedded_blake STATIC ${BLAKE_SOURCES})
set_target_properties(embedded_blake PROPERTIES
COMPILE_FLAGS "${BLAKE_CFLAGS} -O3"
add_library(opt_c_util STATIC ${OPTIMIZED_C_SOURCES})
set_target_properties(opt_c_util PROPERTIES
COMPILE_FLAGS "${OPTIMIZED_C_FLAGS}"
)
add_executable(zig ${ZIG_SOURCES})
set_target_properties(zig PROPERTIES
add_library(compiler STATIC ${ZIG_SOURCES})
set_target_properties(compiler PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS}
LINK_FLAGS ${EXE_LDFLAGS}
)
target_link_libraries(zig LINK_PUBLIC
target_link_libraries(compiler LINK_PUBLIC
zig_cpp
embedded_blake
opt_c_util
${SOFTFLOAT_LIBRARIES}
${CLANG_LIBRARIES}
${LLD_LIBRARIES}
@@ -862,24 +572,57 @@ target_link_libraries(zig LINK_PUBLIC
${CMAKE_THREAD_LIBS_INIT}
)
if(NOT MSVC)
target_link_libraries(zig LINK_PUBLIC ${LIBXML2})
target_link_libraries(compiler LINK_PUBLIC ${LIBXML2})
endif()
if(ZIG_DIA_GUIDS_LIB)
target_link_libraries(zig LINK_PUBLIC ${ZIG_DIA_GUIDS_LIB})
target_link_libraries(compiler LINK_PUBLIC ${ZIG_DIA_GUIDS_LIB})
endif()
if(MSVC OR MINGW)
target_link_libraries(zig LINK_PUBLIC version)
target_link_libraries(compiler LINK_PUBLIC version)
endif()
add_executable(zig0 "${ZIG_MAIN_SRC}" "${ZIG0_SHIM_SRC}")
set_target_properties(zig0 PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS}
LINK_FLAGS ${EXE_LDFLAGS}
)
target_link_libraries(zig0 compiler)
if(MSVC)
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/userland.lib")
else()
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(LIBUSERLAND_RELEASE_MODE "false")
else()
set(LIBUSERLAND_RELEASE_MODE "true")
endif()
if(ZIG_SKIP_INSTALL_LIB_FILES)
set(ZIG_BUILD_INSTALL_STEP "")
else()
set(ZIG_BUILD_INSTALL_STEP "install")
endif()
add_custom_target(zig_build_libuserland ALL
COMMAND zig0 build
--override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
libuserland ${ZIG_BUILD_INSTALL_STEP}
"-Doutput-dir=${CMAKE_BINARY_DIR}"
"-Drelease=${LIBUSERLAND_RELEASE_MODE}"
"-Dlib-files-only"
--prefix "${CMAKE_INSTALL_PREFIX}"
DEPENDS zig0
BYPRODUCTS "${LIBUSERLAND}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_executable(zig "${ZIG_MAIN_SRC}")
set_target_properties(zig PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS}
LINK_FLAGS ${EXE_LDFLAGS}
)
target_link_libraries(zig compiler "${LIBUSERLAND}")
add_dependencies(zig zig_build_libuserland)
install(TARGETS zig DESTINATION bin)
install(TARGETS zig_cpp DESTINATION "${ZIG_CPP_LIB_DIR}")
foreach(file ${ZIG_C_HEADER_FILES})
get_filename_component(file_dir "${C_HEADERS_DEST}/${file}" DIRECTORY)
install(FILES "${CMAKE_SOURCE_DIR}/c_headers/${file}" DESTINATION "${file_dir}")
endforeach()
foreach(file ${ZIG_STD_FILES})
get_filename_component(file_dir "${ZIG_STD_DEST}/${file}" DIRECTORY)
install(FILES "${CMAKE_SOURCE_DIR}/std/${file}" DESTINATION "${file_dir}")
endforeach()

125
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,125 @@
## Contributing
### Start a Project Using Zig
One of the best ways you can contribute to Zig is to start using it for a
personal project. Here are some great examples:
* [Oxid](https://github.com/dbandstra/oxid) - arcade style game
* [TM35-Metronome](https://github.com/TM35-Metronome) - tools for modifying and randomizing Pokémon games
* [trOS](https://github.com/sjdh02/trOS) - tiny aarch64 baremetal OS thingy
Without fail, these projects lead to discovering bugs and helping flesh out use
cases, which lead to further design iterations of Zig. Importantly, each issue
found this way comes with real world motivations, so it is easy to explain
your reasoning behind proposals and feature requests.
Ideally, such a project will help you to learn new skills and add something
to your personal portfolio at the same time.
### Spread the Word
Another way to contribute is to write about Zig, or speak about Zig at a
conference, or do either of those things for your project which uses Zig.
Here are some examples:
* [Iterative Replacement of C with Zig](http://tiehuis.github.io/blog/zig1.html)
* [The Right Tool for the Right Job: Redis Modules & Zig](https://www.youtube.com/watch?v=eCHM8-_poZY)
* [Writing a small ray tracer in Rust and Zig](https://nelari.us/post/raytracer_with_rust_and_zig/)
Zig is a brand new language, with no advertising budget. Word of mouth is the
only way people find out about the project, and the more people hear about it,
the more people will use it, and the better chance we have to take over the
world.
### Finding Contributor Friendly Issues
Please note that issues labeled
[Proposal](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aproposal)
but do not also have the
[Accepted](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aaccepted)
label are still under consideration, and efforts to implement such a proposal
have a high risk of being wasted. If you are interested in a proposal which is
still under consideration, please express your interest in the issue tracker,
providing extra insights and considerations that others have not yet expressed.
The most highly regarded argument in such a discussion is a real world use case.
The issue label
[Contributor Friendly](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3A%22contributor+friendly%22)
exists to help you find issues that are **limited in scope and/or
knowledge of Zig internals.**
### Editing Source Code
First, build the Stage 1 compiler as described in [the Building section](#building).
One modification you may want to make is adding `-DZIG_SKIP_INSTALL_LIB_FILES=ON`
to the cmake line. If you use the build directory as a working directory to run
tests with, zig will find the lib files in the source directory, and they will not
be "installed" every time you run `make`. This will allow you to make modifications
directly to the standard library, for example, and have them effective immediately.
Note that if you already ran `make` or `make install` with the default cmake
settings, there will already be a `lib/` directory in your build directory. When
executed from the build directory, zig will find this instead of the source lib/
directory. Remove the unwanted directory so that the desired one can be found.
To test changes, do the following from the build directory:
1. Run `make install` (on POSIX) or
`msbuild -p:Configuration=Release INSTALL.vcxproj` (on Windows).
2. `bin/zig build test` (on POSIX) or `bin\zig.exe build test` (on Windows).
That runs the whole test suite, which does a lot of extra testing that you
likely won't always need, and can take upwards of 1 hour. This is what the
CI server runs when you make a pull request. (Note: actually it runs a few
more tests; keep reading.)
To save time, you can add the `--help` option to the `zig build` command and
see what options are available. One of the most helpful ones is
`-Dskip-release`. Adding this option to the command in step 2 above will take
the time down from around 2 hours to about 6 minutes, and this is a good
enough amount of testing before making a pull request.
Another example is choosing a different set of things to test. For example,
`test-std` instead of `test` will only run the standard library tests, and
not the other ones. Combining this suggestion with the previous one, you could
do this:
`bin/zig build test-std -Dskip-release` (on POSIX) or
`bin\zig.exe build test-std -Dskip-release` (on Windows).
This will run only the standard library tests, in debug mode only, for all
targets (it will cross-compile the tests for non-native targets but not run
them).
When making changes to the compiler source code, the most helpful test step to
run is `test-behavior`. When editing documentation it is `docs`. You can find
this information and more in the `--help` menu.
#### Testing Non-Native Architectures with QEMU
The Linux CI server additionally has qemu installed and sets `-Denable-qemu`.
This provides test coverage for, e.g. aarch64 even on x86_64 machines. It's
recommended for Linux users to install qemu and enable this testing option
when editing the standard library or anything related to a non-native
architecture.
##### glibc
Testing foreign architectures with dynamically linked glibc is one step trickier.
This requires enabling `-Denable-foreign-glibc=/path/to/glibc/multi/install/glibcs`.
This path is obtained by building glibc for multiple architectures. This
process for me took an entire day to complete and takes up 65 GiB on my hard
drive. The CI server does not provide this test coverage. Instructions for
producing this path can be found
[on the wiki](https://github.com/ziglang/zig/wiki/Updating-libc#glibc).
Just the part with `build-many-glibcs.py`.
It's understood that most contributors will not have these tests enabled.
#### Testing Windows from a Linux Machine with Wine
When developing on Linux, another option is available to you: `-Denable-wine`.
This will enable running behavior tests and std lib tests with Wine. It's
recommended for Linux users to install Wine and enable this testing option
when editing the standard library or anything Windows-related.

124
README.md
View File

@@ -1,83 +1,23 @@
![ZIG](https://ziglang.org/zig-logo.svg)
A programming language designed for robustness, optimality, and
clarity.
A general-purpose programming language designed for **robustness**,
**optimality**, and **maintainability**.
[ziglang.org](https://ziglang.org)
## Resources
## Feature Highlights
* [Introduction](https://ziglang.org/#Introduction)
* [Download & Documentation](https://ziglang.org/download)
* [Community](https://github.com/ziglang/zig/wiki/Community)
* [Contributing](https://github.com/ziglang/zig/blob/master/CONTRIBUTING.md)
* [Frequently Asked Questions](https://github.com/ziglang/zig/wiki/FAQ)
* [Community Projects](https://github.com/ziglang/zig/wiki/Community-Projects)
* Small, simple language. Focus on debugging your application rather than
debugging knowledge of your programming language.
* Ships with a build system that obviates the need for a configure script
or a makefile. In fact, existing C and C++ projects may choose to depend on
Zig instead of e.g. cmake.
* A fresh take on error handling which makes writing correct code easier than
writing buggy code.
* Debug mode optimizes for fast compilation time and crashing with a stack trace
when undefined behavior *would* happen.
* ReleaseFast mode produces heavily optimized code. What other projects call
"Link Time Optimization" Zig does automatically.
* Compatible with C libraries with no wrapper necessary. Directly include
C .h files and get access to the functions and symbols therein.
* Provides standard library which competes with the C standard library and is
always compiled against statically in source form. Zig binaries do not
depend on libc unless explicitly linked.
* Optional type instead of null pointers.
* Safe unions, tagged unions, and C ABI compatible unions.
* Generics so that one can write efficient data structures that work for any
data type.
* No header files required. Top level declarations are entirely
order-independent.
* Compile-time code execution. Compile-time reflection.
* Partial compile-time function evaluation which eliminates the need for
a preprocessor or macros.
* The binaries produced by Zig have complete debugging information so you can,
for example, use GDB, MSVC, or LLDB to debug your software.
* Built-in unit tests with `zig test`.
* Friendly toward package maintainers. Reproducible build, bootstrapping
process carefully documented. Issues filed by package maintainers are
considered especially important.
* Cross-compiling is a primary use case.
* In addition to creating executables, creating a C library is a primary use
case. You can export an auto-generated .h file.
## Building from Source
### Support Table
[![Build Status](https://dev.azure.com/ziglang/zig/_apis/build/status/ziglang.zig?branchName=master)](https://dev.azure.com/ziglang/zig/_build/latest?definitionId=1&branchName=master)
Freestanding means that you do not directly interact with the OS
or you are writing your own OS.
Note that if you use libc or other libraries to interact with the OS,
that counts as "freestanding" for the purposes of this table.
| | freestanding | linux | macosx | windows | other |
|-------------|--------------|---------|---------|---------|---------|
|i386 | OK | planned | OK | planned | planned |
|x86_64 | OK | OK | OK | OK | planned |
|arm | OK | planned | planned | N/A | planned |
|aarch64 | OK | planned | N/A | planned | planned |
|bpf | OK | planned | N/A | N/A | planned |
|hexagon | OK | planned | N/A | N/A | planned |
|mips | OK | planned | N/A | N/A | planned |
|powerpc | OK | planned | N/A | N/A | planned |
|r600 | OK | planned | N/A | N/A | planned |
|amdgcn | OK | planned | N/A | N/A | planned |
|sparc | OK | planned | N/A | N/A | planned |
|s390x | OK | planned | N/A | N/A | planned |
|thumb | OK | planned | N/A | N/A | planned |
|spir | OK | planned | N/A | N/A | planned |
|lanai | OK | planned | N/A | N/A | planned |
## Community
* IRC: `#zig` on Freenode ([Channel Logs](https://irclog.whitequark.org/zig/)).
* Reddit: [/r/zig](https://www.reddit.com/r/zig)
* Email list: [ziglang@googlegroups.com](https://groups.google.com/forum/#!forum/ziglang)
## Building
[![Build Status](https://travis-ci.org/ziglang/zig.svg?branch=master)](https://travis-ci.org/ziglang/zig)
[![Build status](https://ci.appveyor.com/api/projects/status/4t80mk2dmucrc38i/branch/master?svg=true)](https://ci.appveyor.com/project/andrewrk/zig-d3l86/branch/master)
Note that you can
[download a binary of master branch](https://ziglang.org/download/#release-master).
### Stage 1: Build Zig from C++ Source Code
@@ -87,14 +27,18 @@ that counts as "freestanding" for the purposes of this table.
* cmake >= 2.8.5
* gcc >= 5.0.0 or clang >= 3.6.0
* LLVM, Clang, LLD development libraries == 7.x, compiled with the same gcc or clang version above
- These depend on zlib and libxml2.
* LLVM, Clang, LLD development libraries == 9.x, compiled with the same gcc or clang version above
- Use the system package manager, or [build from source](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#posix).
##### Windows
* cmake >= 2.8.5
* Microsoft Visual Studio 2015
* LLVM, Clang, LLD development libraries == 7.x, compiled with the same MSVC version above
* cmake >= 3.15.3
* Microsoft Visual Studio. Supported versions:
- 2015 (version 14)
- 2017 (version 15.8)
- 2019 (version 16)
* LLVM, Clang, LLD development libraries == 9.x
- Use the [pre-built binaries](https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows) or [build from source](https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#windows).
#### Instructions
@@ -104,21 +48,18 @@ that counts as "freestanding" for the purposes of this table.
mkdir build
cd build
cmake ..
make
make install
bin/zig build --build-file ../build.zig test
```
##### MacOS
```
brew install cmake llvm@7
brew outdated llvm@7 || brew upgrade llvm@7
brew install cmake llvm@9
brew outdated llvm@9 || brew upgrade llvm@9
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm@7/
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm)
make install
bin/zig build --build-file ../build.zig test
```
##### Windows
@@ -130,10 +71,11 @@ See https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows
*Note: Stage 2 compiler is not complete. Beta users of Zig should use the
Stage 1 compiler for now.*
Dependencies are the same as Stage 1, except now you have a working zig compiler.
Dependencies are the same as Stage 1, except now you can use stage 1 to compile
Zig code.
```
bin/zig build --build-file ../build.zig --prefix $(pwd)/stage2 install
bin/zig build --prefix $(pwd)/stage2
```
This produces `./stage2/bin/zig` which can be used for testing and development.
@@ -142,19 +84,21 @@ binary.
### Stage 3: Rebuild Self-Hosted Zig Using the Self-Hosted Compiler
This is the actual compiler binary that we will install to the system.
*Note: Stage 2 compiler is not yet able to build Stage 3. Building Stage 3 is
not yet supported.*
Once the self-hosted compiler can build itself, this will be the actual
compiler binary that we will install to the system. Until then, users should
use stage 1.
#### Debug / Development Build
```
./stage2/bin/zig build --build-file ../build.zig --prefix $(pwd)/stage3 install
./stage2/bin/zig build --prefix $(pwd)/stage3
```
#### Release / Install Build
```
./stage2/bin/zig build --build-file ../build.zig install -Drelease-fast
./stage2/bin/zig build install -Drelease
```

262
build.zig
View File

@@ -2,25 +2,30 @@ const builtin = @import("builtin");
const std = @import("std");
const Builder = std.build.Builder;
const tests = @import("test/tests.zig");
const os = std.os;
const BufMap = std.BufMap;
const warn = std.debug.warn;
const mem = std.mem;
const ArrayList = std.ArrayList;
const Buffer = std.Buffer;
const io = std.io;
const fs = std.fs;
const InstallDirectoryOptions = std.build.InstallDirectoryOptions;
pub fn build(b: *Builder) !void {
b.setPreferredReleaseMode(.ReleaseFast);
const mode = b.standardReleaseOptions();
var docgen_exe = b.addExecutable("docgen", "doc/docgen.zig");
const rel_zig_exe = try os.path.relative(b.allocator, b.build_root, b.zig_exe);
const langref_out_path = os.path.join(b.allocator, b.cache_root, "langref.html") catch unreachable;
var docgen_cmd = b.addCommand(null, b.env_map, [][]const u8{
docgen_exe.getOutputPath(),
const rel_zig_exe = try fs.path.relative(b.allocator, b.build_root, b.zig_exe);
const langref_out_path = fs.path.join(
b.allocator,
[_][]const u8{ b.cache_root, "langref.html" },
) catch unreachable;
var docgen_cmd = docgen_exe.run();
docgen_cmd.addArgs([_][]const u8{
rel_zig_exe,
"doc" ++ os.path.sep_str ++ "langref.html.in",
"doc" ++ fs.path.sep_str ++ "langref.html.in",
langref_out_path,
});
docgen_cmd.step.dependOn(&docgen_exe.step);
@@ -31,7 +36,7 @@ pub fn build(b: *Builder) !void {
const test_step = b.step("test", "Run all the tests");
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
const build_info = try b.exec([][]const u8{
const build_info = try b.exec([_][]const u8{
b.zig_exe,
"BUILD_INFO",
});
@@ -42,42 +47,55 @@ pub fn build(b: *Builder) !void {
.llvm_config_exe = nextValue(&index, build_info),
.lld_include_dir = nextValue(&index, build_info),
.lld_libraries = nextValue(&index, build_info),
.std_files = nextValue(&index, build_info),
.c_header_files = nextValue(&index, build_info),
.dia_guids_lib = nextValue(&index, build_info),
.llvm = undefined,
.no_rosegment = b.option(bool, "no-rosegment", "Workaround to enable valgrind builds") orelse false,
};
ctx.llvm = try findLLVM(b, ctx.llvm_config_exe);
var test_stage2 = b.addTest("src-self-hosted/test.zig");
test_stage2.setBuildMode(builtin.Mode.Debug);
const fmt_build_zig = b.addFmt([_][]const u8{"build.zig"});
var exe = b.addExecutable("zig", "src-self-hosted/main.zig");
exe.setBuildMode(mode);
try configureStage2(b, test_stage2, ctx);
try configureStage2(b, exe, ctx);
b.default_step.dependOn(&exe.step);
addLibUserlandStep(b, mode);
const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release;
const skip_release_fast = b.option(bool, "skip-release-fast", "Main test suite skips release-fast builds") orelse skip_release;
const skip_release_safe = b.option(bool, "skip-release-safe", "Main test suite skips release-safe builds") orelse skip_release;
const skip_non_native = b.option(bool, "skip-non-native", "Main test suite skips non-native builds") orelse false;
const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false;
const skip_self_hosted = b.option(bool, "skip-self-hosted", "Main test suite skips building self hosted compiler") orelse false;
if (!skip_self_hosted) {
test_step.dependOn(&exe.step);
// TODO re-enable this after https://github.com/ziglang/zig/issues/2377
//test_step.dependOn(&exe.step);
}
const verbose_link_exe = b.option(bool, "verbose-link", "Print link command for self hosted compiler") orelse false;
exe.setVerboseLink(verbose_link_exe);
b.installArtifact(exe);
installStdLib(b, ctx.std_files);
installCHeaders(b, ctx.c_header_files);
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
if (!only_install_lib_files) {
b.default_step.dependOn(&exe.step);
exe.install();
}
b.installDirectory(InstallDirectoryOptions{
.source_dir = "lib",
.install_dir = .Lib,
.install_subdir = "zig",
.exclude_extensions = [_][]const u8{ "test.zig", "README.md" },
});
const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
const is_wine_enabled = b.option(bool, "enable-wine", "Use Wine to run cross compiled Windows tests") orelse false;
const is_qemu_enabled = b.option(bool, "enable-qemu", "Use QEMU to run cross compiled foreign architecture tests") orelse false;
const glibc_multi_dir = b.option([]const u8, "enable-foreign-glibc", "Provide directory with glibc installations to run cross compiled tests that link glibc");
const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests");
test_stage2_step.dependOn(&test_stage2.step);
@@ -104,29 +122,52 @@ pub fn build(b: *Builder) !void {
}
const modes = chosen_modes[0..chosen_mode_index];
test_step.dependOn(tests.addPkgTests(b, test_filter, "test/behavior.zig", "behavior", "Run the behavior tests", modes));
// run stage1 `zig fmt` on this build.zig file just to make sure it works
test_step.dependOn(&fmt_build_zig.step);
const fmt_step = b.step("test-fmt", "Run zig fmt against build.zig to make sure it works");
fmt_step.dependOn(&fmt_build_zig.step);
test_step.dependOn(tests.addPkgTests(b, test_filter, "std/index.zig", "std", "Run the standard library tests", modes));
test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt/index.zig", "compiler-rt", "Run the compiler_rt tests", modes));
test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
test_step.dependOn(tests.addBuildExampleTests(b, test_filter, modes));
test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));
test_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
test_step.dependOn(tests.addCliTests(b, test_filter, modes));
test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes));
test_step.dependOn(tests.addTranslateCTests(b, test_filter));
test_step.dependOn(tests.addGenHTests(b, test_filter));
test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));
test_step.dependOn(docs_step);
}
fn dependOnLib(lib_exe_obj: var, dep: *const LibraryDep) void {
fn dependOnLib(b: *Builder, lib_exe_obj: var, dep: LibraryDep) void {
for (dep.libdirs.toSliceConst()) |lib_dir| {
lib_exe_obj.addLibPath(lib_dir);
}
const lib_dir = fs.path.join(
b.allocator,
[_][]const u8{ dep.prefix, "lib" },
) catch unreachable;
for (dep.system_libs.toSliceConst()) |lib| {
lib_exe_obj.linkSystemLibrary(lib);
const static_bare_name = if (mem.eql(u8, lib, "curses"))
([]const u8)("libncurses.a")
else
b.fmt("lib{}.a", lib);
const static_lib_name = fs.path.join(
b.allocator,
[_][]const u8{ lib_dir, static_bare_name },
) catch unreachable;
const have_static = fileExists(static_lib_name) catch unreachable;
if (have_static) {
lib_exe_obj.addObjectFile(static_lib_name);
} else {
lib_exe_obj.linkSystemLibrary(lib);
}
}
for (dep.libs.toSliceConst()) |lib| {
lib_exe_obj.addObjectFile(lib);
@@ -136,12 +177,24 @@ fn dependOnLib(lib_exe_obj: var, dep: *const LibraryDep) void {
}
}
fn fileExists(filename: []const u8) !bool {
fs.File.access(filename) catch |err| switch (err) {
error.FileNotFound => return false,
else => return err,
};
return true;
}
fn addCppLib(b: *Builder, lib_exe_obj: var, cmake_binary_dir: []const u8, lib_name: []const u8) void {
const lib_prefix = if (lib_exe_obj.target.isWindows()) "" else "lib";
lib_exe_obj.addObjectFile(os.path.join(b.allocator, cmake_binary_dir, "zig_cpp", b.fmt("{}{}{}", lib_prefix, lib_name, lib_exe_obj.target.libFileExt())) catch unreachable);
lib_exe_obj.addObjectFile(fs.path.join(b.allocator, [_][]const u8{
cmake_binary_dir,
"zig_cpp",
b.fmt("{}{}{}", lib_exe_obj.target.libPrefix(), lib_name, lib_exe_obj.target.staticLibSuffix()),
}) catch unreachable);
}
const LibraryDep = struct {
prefix: []const u8,
libdirs: ArrayList([]const u8),
libs: ArrayList([]const u8),
system_libs: ArrayList([]const u8),
@@ -149,33 +202,37 @@ const LibraryDep = struct {
};
fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
const libs_output = try b.exec([][]const u8{
llvm_config_exe,
"--libs",
"--system-libs",
});
const includes_output = try b.exec([][]const u8{
llvm_config_exe,
"--includedir",
});
const libdir_output = try b.exec([][]const u8{
llvm_config_exe,
"--libdir",
});
const shared_mode = try b.exec([_][]const u8{ llvm_config_exe, "--shared-mode" });
const is_static = mem.startsWith(u8, shared_mode, "static");
const libs_output = if (is_static)
try b.exec([_][]const u8{
llvm_config_exe,
"--libfiles",
"--system-libs",
})
else
try b.exec([_][]const u8{
llvm_config_exe,
"--libs",
});
const includes_output = try b.exec([_][]const u8{ llvm_config_exe, "--includedir" });
const libdir_output = try b.exec([_][]const u8{ llvm_config_exe, "--libdir" });
const prefix_output = try b.exec([_][]const u8{ llvm_config_exe, "--prefix" });
var result = LibraryDep{
.prefix = mem.tokenize(prefix_output, " \r\n").next().?,
.libs = ArrayList([]const u8).init(b.allocator),
.system_libs = ArrayList([]const u8).init(b.allocator),
.includes = ArrayList([]const u8).init(b.allocator),
.libdirs = ArrayList([]const u8).init(b.allocator),
};
{
var it = mem.split(libs_output, " \r\n");
var it = mem.tokenize(libs_output, " \r\n");
while (it.next()) |lib_arg| {
if (mem.startsWith(u8, lib_arg, "-l")) {
try result.system_libs.append(lib_arg[2..]);
} else {
if (os.path.isAbsolute(lib_arg)) {
if (fs.path.isAbsolute(lib_arg)) {
try result.libs.append(lib_arg);
} else {
try result.system_libs.append(lib_arg);
@@ -184,7 +241,7 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
}
}
{
var it = mem.split(includes_output, " \r\n");
var it = mem.tokenize(includes_output, " \r\n");
while (it.next()) |include_arg| {
if (mem.startsWith(u8, include_arg, "-I")) {
try result.includes.append(include_arg[2..]);
@@ -194,7 +251,7 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
}
}
{
var it = mem.split(libdir_output, " \r\n");
var it = mem.tokenize(libdir_output, " \r\n");
while (it.next()) |libdir| {
if (mem.startsWith(u8, libdir, "-L")) {
try result.libdirs.append(libdir[2..]);
@@ -206,24 +263,6 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
return result;
}
pub fn installStdLib(b: *Builder, stdlib_files: []const u8) void {
var it = mem.split(stdlib_files, ";");
while (it.next()) |stdlib_file| {
const src_path = os.path.join(b.allocator, "std", stdlib_file) catch unreachable;
const dest_path = os.path.join(b.allocator, "lib", "zig", "std", stdlib_file) catch unreachable;
b.installFile(src_path, dest_path);
}
}
pub fn installCHeaders(b: *Builder, c_header_files: []const u8) void {
var it = mem.split(c_header_files, ";");
while (it.next()) |c_header_file| {
const src_path = os.path.join(b.allocator, "c_headers", c_header_file) catch unreachable;
const dest_path = os.path.join(b.allocator, "lib", "zig", "include", c_header_file) catch unreachable;
b.installFile(src_path, dest_path);
}
}
fn nextValue(index: *usize, build_info: []const u8) []const u8 {
const start = index.*;
while (true) : (index.* += 1) {
@@ -244,18 +283,12 @@ fn nextValue(index: *usize, build_info: []const u8) []const u8 {
}
fn configureStage2(b: *Builder, exe: var, ctx: Context) !void {
// This is for finding /lib/libz.a on alpine linux.
// TODO turn this into -Dextra-lib-path=/lib option
exe.addLibPath("/lib");
exe.setNoRoSegment(ctx.no_rosegment);
exe.addIncludeDir("src");
exe.addIncludeDir(ctx.cmake_binary_dir);
addCppLib(b, exe, ctx.cmake_binary_dir, "zig_cpp");
if (ctx.lld_include_dir.len != 0) {
exe.addIncludeDir(ctx.lld_include_dir);
var it = mem.split(ctx.lld_libraries, ";");
var it = mem.tokenize(ctx.lld_libraries, ";");
while (it.next()) |lib| {
exe.addObjectFile(lib);
}
@@ -265,48 +298,95 @@ fn configureStage2(b: *Builder, exe: var, ctx: Context) !void {
addCppLib(b, exe, ctx.cmake_binary_dir, "embedded_lld_coff");
addCppLib(b, exe, ctx.cmake_binary_dir, "embedded_lld_lib");
}
dependOnLib(exe, ctx.llvm);
dependOnLib(b, exe, ctx.llvm);
if (exe.target.getOs() == builtin.Os.linux) {
const libstdcxx_path_padded = try b.exec([][]const u8{
ctx.cxx_compiler,
"-print-file-name=libstdc++.a",
});
const libstdcxx_path = mem.split(libstdcxx_path_padded, "\r\n").next().?;
if (mem.eql(u8, libstdcxx_path, "libstdc++.a")) {
warn(
\\Unable to determine path to libstdc++.a
\\On Fedora, install libstdc++-static and try again.
\\
);
return error.RequiredLibraryNotFound;
}
exe.addObjectFile(libstdcxx_path);
if (exe.target.getOs() == .linux) {
try addCxxKnownPath(b, ctx, exe, "libstdc++.a",
\\Unable to determine path to libstdc++.a
\\On Fedora, install libstdc++-static and try again.
);
exe.linkSystemLibrary("pthread");
} else if (exe.target.isFreeBSD()) {
try addCxxKnownPath(b, ctx, exe, "libc++.a", null);
exe.linkSystemLibrary("pthread");
} else if (exe.target.isDarwin()) {
exe.linkSystemLibrary("c++");
if (addCxxKnownPath(b, ctx, exe, "libgcc_eh.a", "")) {
// Compiler is GCC.
try addCxxKnownPath(b, ctx, exe, "libstdc++.a", null);
exe.linkSystemLibrary("pthread");
// TODO LLD cannot perform this link.
// See https://github.com/ziglang/zig/issues/1535
exe.enableSystemLinkerHack();
} else |err| switch (err) {
error.RequiredLibraryNotFound => {
// System compiler, not gcc.
exe.linkSystemLibrary("c++");
},
else => return err,
}
}
if (ctx.dia_guids_lib.len != 0) {
exe.addObjectFile(ctx.dia_guids_lib);
}
if (exe.target.getOs() != builtin.Os.windows) {
exe.linkSystemLibrary("xml2");
}
exe.linkSystemLibrary("c");
}
fn addCxxKnownPath(
b: *Builder,
ctx: Context,
exe: var,
objname: []const u8,
errtxt: ?[]const u8,
) !void {
const path_padded = try b.exec([_][]const u8{
ctx.cxx_compiler,
b.fmt("-print-file-name={}", objname),
});
const path_unpadded = mem.tokenize(path_padded, "\r\n").next().?;
if (mem.eql(u8, path_unpadded, objname)) {
if (errtxt) |msg| {
warn("{}", msg);
} else {
warn("Unable to determine path to {}\n", objname);
}
return error.RequiredLibraryNotFound;
}
exe.addObjectFile(path_unpadded);
}
const Context = struct {
cmake_binary_dir: []const u8,
cxx_compiler: []const u8,
llvm_config_exe: []const u8,
lld_include_dir: []const u8,
lld_libraries: []const u8,
std_files: []const u8,
c_header_files: []const u8,
dia_guids_lib: []const u8,
llvm: LibraryDep,
no_rosegment: bool,
};
fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void {
const artifact = b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");
artifact.disable_gen_h = true;
artifact.bundle_compiler_rt = true;
artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
artifact.setBuildMode(mode);
if (mode != .Debug) {
artifact.strip = true;
}
artifact.linkSystemLibrary("c");
if (builtin.os == .windows) {
artifact.linkSystemLibrary("ntdll");
}
const libuserland_step = b.step("libuserland", "Build the userland compiler library for use in stage1");
libuserland_step.dependOn(&artifact.step);
const output_dir = b.option(
[]const u8,
"output-dir",
"For libuserland step, where to put the output",
) orelse return;
artifact.setOutputDir(output_dir);
}

View File

@@ -1,466 +0,0 @@
/*===-- __clang_cuda_libdevice_declares.h - decls for libdevice functions --===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __CLANG_CUDA_LIBDEVICE_DECLARES_H__
#define __CLANG_CUDA_LIBDEVICE_DECLARES_H__
extern "C" {
__device__ int __nv_abs(int __a);
__device__ double __nv_acos(double __a);
__device__ float __nv_acosf(float __a);
__device__ double __nv_acosh(double __a);
__device__ float __nv_acoshf(float __a);
__device__ double __nv_asin(double __a);
__device__ float __nv_asinf(float __a);
__device__ double __nv_asinh(double __a);
__device__ float __nv_asinhf(float __a);
__device__ double __nv_atan2(double __a, double __b);
__device__ float __nv_atan2f(float __a, float __b);
__device__ double __nv_atan(double __a);
__device__ float __nv_atanf(float __a);
__device__ double __nv_atanh(double __a);
__device__ float __nv_atanhf(float __a);
__device__ int __nv_brev(int __a);
__device__ long long __nv_brevll(long long __a);
__device__ int __nv_byte_perm(int __a, int __b, int __c);
__device__ double __nv_cbrt(double __a);
__device__ float __nv_cbrtf(float __a);
__device__ double __nv_ceil(double __a);
__device__ float __nv_ceilf(float __a);
__device__ int __nv_clz(int __a);
__device__ int __nv_clzll(long long __a);
__device__ double __nv_copysign(double __a, double __b);
__device__ float __nv_copysignf(float __a, float __b);
__device__ double __nv_cos(double __a);
__device__ float __nv_cosf(float __a);
__device__ double __nv_cosh(double __a);
__device__ float __nv_coshf(float __a);
__device__ double __nv_cospi(double __a);
__device__ float __nv_cospif(float __a);
__device__ double __nv_cyl_bessel_i0(double __a);
__device__ float __nv_cyl_bessel_i0f(float __a);
__device__ double __nv_cyl_bessel_i1(double __a);
__device__ float __nv_cyl_bessel_i1f(float __a);
__device__ double __nv_dadd_rd(double __a, double __b);
__device__ double __nv_dadd_rn(double __a, double __b);
__device__ double __nv_dadd_ru(double __a, double __b);
__device__ double __nv_dadd_rz(double __a, double __b);
__device__ double __nv_ddiv_rd(double __a, double __b);
__device__ double __nv_ddiv_rn(double __a, double __b);
__device__ double __nv_ddiv_ru(double __a, double __b);
__device__ double __nv_ddiv_rz(double __a, double __b);
__device__ double __nv_dmul_rd(double __a, double __b);
__device__ double __nv_dmul_rn(double __a, double __b);
__device__ double __nv_dmul_ru(double __a, double __b);
__device__ double __nv_dmul_rz(double __a, double __b);
__device__ float __nv_double2float_rd(double __a);
__device__ float __nv_double2float_rn(double __a);
__device__ float __nv_double2float_ru(double __a);
__device__ float __nv_double2float_rz(double __a);
__device__ int __nv_double2hiint(double __a);
__device__ int __nv_double2int_rd(double __a);
__device__ int __nv_double2int_rn(double __a);
__device__ int __nv_double2int_ru(double __a);
__device__ int __nv_double2int_rz(double __a);
__device__ long long __nv_double2ll_rd(double __a);
__device__ long long __nv_double2ll_rn(double __a);
__device__ long long __nv_double2ll_ru(double __a);
__device__ long long __nv_double2ll_rz(double __a);
__device__ int __nv_double2loint(double __a);
__device__ unsigned int __nv_double2uint_rd(double __a);
__device__ unsigned int __nv_double2uint_rn(double __a);
__device__ unsigned int __nv_double2uint_ru(double __a);
__device__ unsigned int __nv_double2uint_rz(double __a);
__device__ unsigned long long __nv_double2ull_rd(double __a);
__device__ unsigned long long __nv_double2ull_rn(double __a);
__device__ unsigned long long __nv_double2ull_ru(double __a);
__device__ unsigned long long __nv_double2ull_rz(double __a);
__device__ unsigned long long __nv_double_as_longlong(double __a);
__device__ double __nv_drcp_rd(double __a);
__device__ double __nv_drcp_rn(double __a);
__device__ double __nv_drcp_ru(double __a);
__device__ double __nv_drcp_rz(double __a);
__device__ double __nv_dsqrt_rd(double __a);
__device__ double __nv_dsqrt_rn(double __a);
__device__ double __nv_dsqrt_ru(double __a);
__device__ double __nv_dsqrt_rz(double __a);
__device__ double __nv_dsub_rd(double __a, double __b);
__device__ double __nv_dsub_rn(double __a, double __b);
__device__ double __nv_dsub_ru(double __a, double __b);
__device__ double __nv_dsub_rz(double __a, double __b);
__device__ double __nv_erfc(double __a);
__device__ float __nv_erfcf(float __a);
__device__ double __nv_erfcinv(double __a);
__device__ float __nv_erfcinvf(float __a);
__device__ double __nv_erfcx(double __a);
__device__ float __nv_erfcxf(float __a);
__device__ double __nv_erf(double __a);
__device__ float __nv_erff(float __a);
__device__ double __nv_erfinv(double __a);
__device__ float __nv_erfinvf(float __a);
__device__ double __nv_exp10(double __a);
__device__ float __nv_exp10f(float __a);
__device__ double __nv_exp2(double __a);
__device__ float __nv_exp2f(float __a);
__device__ double __nv_exp(double __a);
__device__ float __nv_expf(float __a);
__device__ double __nv_expm1(double __a);
__device__ float __nv_expm1f(float __a);
__device__ double __nv_fabs(double __a);
__device__ float __nv_fabsf(float __a);
__device__ float __nv_fadd_rd(float __a, float __b);
__device__ float __nv_fadd_rn(float __a, float __b);
__device__ float __nv_fadd_ru(float __a, float __b);
__device__ float __nv_fadd_rz(float __a, float __b);
__device__ float __nv_fast_cosf(float __a);
__device__ float __nv_fast_exp10f(float __a);
__device__ float __nv_fast_expf(float __a);
__device__ float __nv_fast_fdividef(float __a, float __b);
__device__ float __nv_fast_log10f(float __a);
__device__ float __nv_fast_log2f(float __a);
__device__ float __nv_fast_logf(float __a);
__device__ float __nv_fast_powf(float __a, float __b);
__device__ void __nv_fast_sincosf(float __a, float *__sptr, float *__cptr);
__device__ float __nv_fast_sinf(float __a);
__device__ float __nv_fast_tanf(float __a);
__device__ double __nv_fdim(double __a, double __b);
__device__ float __nv_fdimf(float __a, float __b);
__device__ float __nv_fdiv_rd(float __a, float __b);
__device__ float __nv_fdiv_rn(float __a, float __b);
__device__ float __nv_fdiv_ru(float __a, float __b);
__device__ float __nv_fdiv_rz(float __a, float __b);
__device__ int __nv_ffs(int __a);
__device__ int __nv_ffsll(long long __a);
__device__ int __nv_finitef(float __a);
__device__ unsigned short __nv_float2half_rn(float __a);
__device__ int __nv_float2int_rd(float __a);
__device__ int __nv_float2int_rn(float __a);
__device__ int __nv_float2int_ru(float __a);
__device__ int __nv_float2int_rz(float __a);
__device__ long long __nv_float2ll_rd(float __a);
__device__ long long __nv_float2ll_rn(float __a);
__device__ long long __nv_float2ll_ru(float __a);
__device__ long long __nv_float2ll_rz(float __a);
__device__ unsigned int __nv_float2uint_rd(float __a);
__device__ unsigned int __nv_float2uint_rn(float __a);
__device__ unsigned int __nv_float2uint_ru(float __a);
__device__ unsigned int __nv_float2uint_rz(float __a);
__device__ unsigned long long __nv_float2ull_rd(float __a);
__device__ unsigned long long __nv_float2ull_rn(float __a);
__device__ unsigned long long __nv_float2ull_ru(float __a);
__device__ unsigned long long __nv_float2ull_rz(float __a);
__device__ int __nv_float_as_int(float __a);
__device__ unsigned int __nv_float_as_uint(float __a);
__device__ double __nv_floor(double __a);
__device__ float __nv_floorf(float __a);
__device__ double __nv_fma(double __a, double __b, double __c);
__device__ float __nv_fmaf(float __a, float __b, float __c);
__device__ float __nv_fmaf_ieee_rd(float __a, float __b, float __c);
__device__ float __nv_fmaf_ieee_rn(float __a, float __b, float __c);
__device__ float __nv_fmaf_ieee_ru(float __a, float __b, float __c);
__device__ float __nv_fmaf_ieee_rz(float __a, float __b, float __c);
__device__ float __nv_fmaf_rd(float __a, float __b, float __c);
__device__ float __nv_fmaf_rn(float __a, float __b, float __c);
__device__ float __nv_fmaf_ru(float __a, float __b, float __c);
__device__ float __nv_fmaf_rz(float __a, float __b, float __c);
__device__ double __nv_fma_rd(double __a, double __b, double __c);
__device__ double __nv_fma_rn(double __a, double __b, double __c);
__device__ double __nv_fma_ru(double __a, double __b, double __c);
__device__ double __nv_fma_rz(double __a, double __b, double __c);
__device__ double __nv_fmax(double __a, double __b);
__device__ float __nv_fmaxf(float __a, float __b);
__device__ double __nv_fmin(double __a, double __b);
__device__ float __nv_fminf(float __a, float __b);
__device__ double __nv_fmod(double __a, double __b);
__device__ float __nv_fmodf(float __a, float __b);
__device__ float __nv_fmul_rd(float __a, float __b);
__device__ float __nv_fmul_rn(float __a, float __b);
__device__ float __nv_fmul_ru(float __a, float __b);
__device__ float __nv_fmul_rz(float __a, float __b);
__device__ float __nv_frcp_rd(float __a);
__device__ float __nv_frcp_rn(float __a);
__device__ float __nv_frcp_ru(float __a);
__device__ float __nv_frcp_rz(float __a);
__device__ double __nv_frexp(double __a, int *__b);
__device__ float __nv_frexpf(float __a, int *__b);
__device__ float __nv_frsqrt_rn(float __a);
__device__ float __nv_fsqrt_rd(float __a);
__device__ float __nv_fsqrt_rn(float __a);
__device__ float __nv_fsqrt_ru(float __a);
__device__ float __nv_fsqrt_rz(float __a);
__device__ float __nv_fsub_rd(float __a, float __b);
__device__ float __nv_fsub_rn(float __a, float __b);
__device__ float __nv_fsub_ru(float __a, float __b);
__device__ float __nv_fsub_rz(float __a, float __b);
__device__ int __nv_hadd(int __a, int __b);
__device__ float __nv_half2float(unsigned short __h);
__device__ double __nv_hiloint2double(int __a, int __b);
__device__ double __nv_hypot(double __a, double __b);
__device__ float __nv_hypotf(float __a, float __b);
__device__ int __nv_ilogb(double __a);
__device__ int __nv_ilogbf(float __a);
__device__ double __nv_int2double_rn(int __a);
__device__ float __nv_int2float_rd(int __a);
__device__ float __nv_int2float_rn(int __a);
__device__ float __nv_int2float_ru(int __a);
__device__ float __nv_int2float_rz(int __a);
__device__ float __nv_int_as_float(int __a);
__device__ int __nv_isfinited(double __a);
__device__ int __nv_isinfd(double __a);
__device__ int __nv_isinff(float __a);
__device__ int __nv_isnand(double __a);
__device__ int __nv_isnanf(float __a);
__device__ double __nv_j0(double __a);
__device__ float __nv_j0f(float __a);
__device__ double __nv_j1(double __a);
__device__ float __nv_j1f(float __a);
__device__ float __nv_jnf(int __a, float __b);
__device__ double __nv_jn(int __a, double __b);
__device__ double __nv_ldexp(double __a, int __b);
__device__ float __nv_ldexpf(float __a, int __b);
__device__ double __nv_lgamma(double __a);
__device__ float __nv_lgammaf(float __a);
__device__ double __nv_ll2double_rd(long long __a);
__device__ double __nv_ll2double_rn(long long __a);
__device__ double __nv_ll2double_ru(long long __a);
__device__ double __nv_ll2double_rz(long long __a);
__device__ float __nv_ll2float_rd(long long __a);
__device__ float __nv_ll2float_rn(long long __a);
__device__ float __nv_ll2float_ru(long long __a);
__device__ float __nv_ll2float_rz(long long __a);
__device__ long long __nv_llabs(long long __a);
__device__ long long __nv_llmax(long long __a, long long __b);
__device__ long long __nv_llmin(long long __a, long long __b);
__device__ long long __nv_llrint(double __a);
__device__ long long __nv_llrintf(float __a);
__device__ long long __nv_llround(double __a);
__device__ long long __nv_llroundf(float __a);
__device__ double __nv_log10(double __a);
__device__ float __nv_log10f(float __a);
__device__ double __nv_log1p(double __a);
__device__ float __nv_log1pf(float __a);
__device__ double __nv_log2(double __a);
__device__ float __nv_log2f(float __a);
__device__ double __nv_logb(double __a);
__device__ float __nv_logbf(float __a);
__device__ double __nv_log(double __a);
__device__ float __nv_logf(float __a);
__device__ double __nv_longlong_as_double(long long __a);
__device__ int __nv_max(int __a, int __b);
__device__ int __nv_min(int __a, int __b);
__device__ double __nv_modf(double __a, double *__b);
__device__ float __nv_modff(float __a, float *__b);
__device__ int __nv_mul24(int __a, int __b);
__device__ long long __nv_mul64hi(long long __a, long long __b);
__device__ int __nv_mulhi(int __a, int __b);
__device__ double __nv_nan(const signed char *__a);
__device__ float __nv_nanf(const signed char *__a);
__device__ double __nv_nearbyint(double __a);
__device__ float __nv_nearbyintf(float __a);
__device__ double __nv_nextafter(double __a, double __b);
__device__ float __nv_nextafterf(float __a, float __b);
__device__ double __nv_norm3d(double __a, double __b, double __c);
__device__ float __nv_norm3df(float __a, float __b, float __c);
__device__ double __nv_norm4d(double __a, double __b, double __c, double __d);
__device__ float __nv_norm4df(float __a, float __b, float __c, float __d);
__device__ double __nv_normcdf(double __a);
__device__ float __nv_normcdff(float __a);
__device__ double __nv_normcdfinv(double __a);
__device__ float __nv_normcdfinvf(float __a);
__device__ float __nv_normf(int __a, const float *__b);
__device__ double __nv_norm(int __a, const double *__b);
__device__ int __nv_popc(int __a);
__device__ int __nv_popcll(long long __a);
__device__ double __nv_pow(double __a, double __b);
__device__ float __nv_powf(float __a, float __b);
__device__ double __nv_powi(double __a, int __b);
__device__ float __nv_powif(float __a, int __b);
__device__ double __nv_rcbrt(double __a);
__device__ float __nv_rcbrtf(float __a);
__device__ double __nv_rcp64h(double __a);
__device__ double __nv_remainder(double __a, double __b);
__device__ float __nv_remainderf(float __a, float __b);
__device__ double __nv_remquo(double __a, double __b, int *__c);
__device__ float __nv_remquof(float __a, float __b, int *__c);
__device__ int __nv_rhadd(int __a, int __b);
__device__ double __nv_rhypot(double __a, double __b);
__device__ float __nv_rhypotf(float __a, float __b);
__device__ double __nv_rint(double __a);
__device__ float __nv_rintf(float __a);
__device__ double __nv_rnorm3d(double __a, double __b, double __c);
__device__ float __nv_rnorm3df(float __a, float __b, float __c);
__device__ double __nv_rnorm4d(double __a, double __b, double __c, double __d);
__device__ float __nv_rnorm4df(float __a, float __b, float __c, float __d);
__device__ float __nv_rnormf(int __a, const float *__b);
__device__ double __nv_rnorm(int __a, const double *__b);
__device__ double __nv_round(double __a);
__device__ float __nv_roundf(float __a);
__device__ double __nv_rsqrt(double __a);
__device__ float __nv_rsqrtf(float __a);
__device__ int __nv_sad(int __a, int __b, int __c);
__device__ float __nv_saturatef(float __a);
__device__ double __nv_scalbn(double __a, int __b);
__device__ float __nv_scalbnf(float __a, int __b);
__device__ int __nv_signbitd(double __a);
__device__ int __nv_signbitf(float __a);
__device__ void __nv_sincos(double __a, double *__b, double *__c);
__device__ void __nv_sincosf(float __a, float *__b, float *__c);
__device__ void __nv_sincospi(double __a, double *__b, double *__c);
__device__ void __nv_sincospif(float __a, float *__b, float *__c);
__device__ double __nv_sin(double __a);
__device__ float __nv_sinf(float __a);
__device__ double __nv_sinh(double __a);
__device__ float __nv_sinhf(float __a);
__device__ double __nv_sinpi(double __a);
__device__ float __nv_sinpif(float __a);
__device__ double __nv_sqrt(double __a);
__device__ float __nv_sqrtf(float __a);
__device__ double __nv_tan(double __a);
__device__ float __nv_tanf(float __a);
__device__ double __nv_tanh(double __a);
__device__ float __nv_tanhf(float __a);
__device__ double __nv_tgamma(double __a);
__device__ float __nv_tgammaf(float __a);
__device__ double __nv_trunc(double __a);
__device__ float __nv_truncf(float __a);
__device__ int __nv_uhadd(unsigned int __a, unsigned int __b);
__device__ double __nv_uint2double_rn(unsigned int __i);
__device__ float __nv_uint2float_rd(unsigned int __a);
__device__ float __nv_uint2float_rn(unsigned int __a);
__device__ float __nv_uint2float_ru(unsigned int __a);
__device__ float __nv_uint2float_rz(unsigned int __a);
__device__ float __nv_uint_as_float(unsigned int __a);
__device__ double __nv_ull2double_rd(unsigned long long __a);
__device__ double __nv_ull2double_rn(unsigned long long __a);
__device__ double __nv_ull2double_ru(unsigned long long __a);
__device__ double __nv_ull2double_rz(unsigned long long __a);
__device__ float __nv_ull2float_rd(unsigned long long __a);
__device__ float __nv_ull2float_rn(unsigned long long __a);
__device__ float __nv_ull2float_ru(unsigned long long __a);
__device__ float __nv_ull2float_rz(unsigned long long __a);
__device__ unsigned long long __nv_ullmax(unsigned long long __a,
unsigned long long __b);
__device__ unsigned long long __nv_ullmin(unsigned long long __a,
unsigned long long __b);
__device__ unsigned int __nv_umax(unsigned int __a, unsigned int __b);
__device__ unsigned int __nv_umin(unsigned int __a, unsigned int __b);
__device__ unsigned int __nv_umul24(unsigned int __a, unsigned int __b);
__device__ unsigned long long __nv_umul64hi(unsigned long long __a,
unsigned long long __b);
__device__ unsigned int __nv_umulhi(unsigned int __a, unsigned int __b);
__device__ unsigned int __nv_urhadd(unsigned int __a, unsigned int __b);
__device__ unsigned int __nv_usad(unsigned int __a, unsigned int __b,
unsigned int __c);
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 9020
__device__ int __nv_vabs2(int __a);
__device__ int __nv_vabs4(int __a);
__device__ int __nv_vabsdiffs2(int __a, int __b);
__device__ int __nv_vabsdiffs4(int __a, int __b);
__device__ int __nv_vabsdiffu2(int __a, int __b);
__device__ int __nv_vabsdiffu4(int __a, int __b);
__device__ int __nv_vabsss2(int __a);
__device__ int __nv_vabsss4(int __a);
__device__ int __nv_vadd2(int __a, int __b);
__device__ int __nv_vadd4(int __a, int __b);
__device__ int __nv_vaddss2(int __a, int __b);
__device__ int __nv_vaddss4(int __a, int __b);
__device__ int __nv_vaddus2(int __a, int __b);
__device__ int __nv_vaddus4(int __a, int __b);
__device__ int __nv_vavgs2(int __a, int __b);
__device__ int __nv_vavgs4(int __a, int __b);
__device__ int __nv_vavgu2(int __a, int __b);
__device__ int __nv_vavgu4(int __a, int __b);
__device__ int __nv_vcmpeq2(int __a, int __b);
__device__ int __nv_vcmpeq4(int __a, int __b);
__device__ int __nv_vcmpges2(int __a, int __b);
__device__ int __nv_vcmpges4(int __a, int __b);
__device__ int __nv_vcmpgeu2(int __a, int __b);
__device__ int __nv_vcmpgeu4(int __a, int __b);
__device__ int __nv_vcmpgts2(int __a, int __b);
__device__ int __nv_vcmpgts4(int __a, int __b);
__device__ int __nv_vcmpgtu2(int __a, int __b);
__device__ int __nv_vcmpgtu4(int __a, int __b);
__device__ int __nv_vcmples2(int __a, int __b);
__device__ int __nv_vcmples4(int __a, int __b);
__device__ int __nv_vcmpleu2(int __a, int __b);
__device__ int __nv_vcmpleu4(int __a, int __b);
__device__ int __nv_vcmplts2(int __a, int __b);
__device__ int __nv_vcmplts4(int __a, int __b);
__device__ int __nv_vcmpltu2(int __a, int __b);
__device__ int __nv_vcmpltu4(int __a, int __b);
__device__ int __nv_vcmpne2(int __a, int __b);
__device__ int __nv_vcmpne4(int __a, int __b);
__device__ int __nv_vhaddu2(int __a, int __b);
__device__ int __nv_vhaddu4(int __a, int __b);
__device__ int __nv_vmaxs2(int __a, int __b);
__device__ int __nv_vmaxs4(int __a, int __b);
__device__ int __nv_vmaxu2(int __a, int __b);
__device__ int __nv_vmaxu4(int __a, int __b);
__device__ int __nv_vmins2(int __a, int __b);
__device__ int __nv_vmins4(int __a, int __b);
__device__ int __nv_vminu2(int __a, int __b);
__device__ int __nv_vminu4(int __a, int __b);
__device__ int __nv_vneg2(int __a);
__device__ int __nv_vneg4(int __a);
__device__ int __nv_vnegss2(int __a);
__device__ int __nv_vnegss4(int __a);
__device__ int __nv_vsads2(int __a, int __b);
__device__ int __nv_vsads4(int __a, int __b);
__device__ int __nv_vsadu2(int __a, int __b);
__device__ int __nv_vsadu4(int __a, int __b);
__device__ int __nv_vseteq2(int __a, int __b);
__device__ int __nv_vseteq4(int __a, int __b);
__device__ int __nv_vsetges2(int __a, int __b);
__device__ int __nv_vsetges4(int __a, int __b);
__device__ int __nv_vsetgeu2(int __a, int __b);
__device__ int __nv_vsetgeu4(int __a, int __b);
__device__ int __nv_vsetgts2(int __a, int __b);
__device__ int __nv_vsetgts4(int __a, int __b);
__device__ int __nv_vsetgtu2(int __a, int __b);
__device__ int __nv_vsetgtu4(int __a, int __b);
__device__ int __nv_vsetles2(int __a, int __b);
__device__ int __nv_vsetles4(int __a, int __b);
__device__ int __nv_vsetleu2(int __a, int __b);
__device__ int __nv_vsetleu4(int __a, int __b);
__device__ int __nv_vsetlts2(int __a, int __b);
__device__ int __nv_vsetlts4(int __a, int __b);
__device__ int __nv_vsetltu2(int __a, int __b);
__device__ int __nv_vsetltu4(int __a, int __b);
__device__ int __nv_vsetne2(int __a, int __b);
__device__ int __nv_vsetne4(int __a, int __b);
__device__ int __nv_vsub2(int __a, int __b);
__device__ int __nv_vsub4(int __a, int __b);
__device__ int __nv_vsubss2(int __a, int __b);
__device__ int __nv_vsubss4(int __a, int __b);
__device__ int __nv_vsubus2(int __a, int __b);
__device__ int __nv_vsubus4(int __a, int __b);
#endif // CUDA_VERSION
__device__ double __nv_y0(double __a);
__device__ float __nv_y0f(float __a);
__device__ double __nv_y1(double __a);
__device__ float __nv_y1f(float __a);
__device__ float __nv_ynf(int __a, float __b);
__device__ double __nv_yn(int __a, double __b);
} // extern "C"
#endif // __CLANG_CUDA_LIBDEVICE_DECLARES_H__

View File

@@ -1,43 +0,0 @@
/*===---- __stddef_max_align_t.h - Definition of max_align_t for modules ---===
*
* Copyright (c) 2014 Chandler Carruth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __CLANG_MAX_ALIGN_T_DEFINED
#define __CLANG_MAX_ALIGN_T_DEFINED
#if defined(_MSC_VER)
typedef double max_align_t;
#elif defined(__APPLE__)
typedef long double max_align_t;
#else
// Define 'max_align_t' to match the GCC definition.
typedef struct {
long long __clang_max_align_nonce1
__attribute__((__aligned__(__alignof__(long long))));
long double __clang_max_align_nonce2
__attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
#endif
#endif

View File

@@ -1,62 +0,0 @@
/*===---- __wmmintrin_pclmul.h - PCMUL intrinsics ---------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __WMMINTRIN_H
#error "Never use <__wmmintrin_pclmul.h> directly; include <wmmintrin.h> instead."
#endif
#ifndef __WMMINTRIN_PCLMUL_H
#define __WMMINTRIN_PCLMUL_H
/// Multiplies two 64-bit integer values, which are selected from source
/// operands using the immediate-value operand. The multiplication is a
/// carry-less multiplication, and the 128-bit integer product is stored in
/// the destination.
///
/// \headerfile <x86intrin.h>
///
/// \code
/// __m128i _mm_clmulepi64_si128(__m128i __X, __m128i __Y, const int __I);
/// \endcode
///
/// This intrinsic corresponds to the <c> VPCLMULQDQ </c> instruction.
///
/// \param __X
/// A 128-bit vector of [2 x i64] containing one of the source operands.
/// \param __Y
/// A 128-bit vector of [2 x i64] containing one of the source operands.
/// \param __I
/// An immediate value specifying which 64-bit values to select from the
/// operands. Bit 0 is used to select a value from operand \a __X, and bit
/// 4 is used to select a value from operand \a __Y: \n
/// Bit[0]=0 indicates that bits[63:0] of operand \a __X are used. \n
/// Bit[0]=1 indicates that bits[127:64] of operand \a __X are used. \n
/// Bit[4]=0 indicates that bits[63:0] of operand \a __Y are used. \n
/// Bit[4]=1 indicates that bits[127:64] of operand \a __Y are used.
/// \returns The 128-bit integer vector containing the result of the carry-less
/// multiplication of the selected 64-bit values.
#define _mm_clmulepi64_si128(X, Y, I) \
((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \
(__v2di)(__m128i)(Y), (char)(I)))
#endif /* __WMMINTRIN_PCLMUL_H */

View File

@@ -1,86 +0,0 @@
/*===---- adxintrin.h - ADX intrinsics -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __ADXINTRIN_H
#define __ADXINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* Intrinsics that are available only if __ADX__ defined */
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
unsigned int *__p)
{
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
}
#ifdef __x86_64__
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
_addcarryx_u64(unsigned char __cf, unsigned long long __x,
unsigned long long __y, unsigned long long *__p)
{
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
}
#endif
/* Intrinsics that are also available if __ADX__ undefined */
static __inline unsigned char __DEFAULT_FN_ATTRS
_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
unsigned int *__p)
{
return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
}
#ifdef __x86_64__
static __inline unsigned char __DEFAULT_FN_ATTRS
_addcarry_u64(unsigned char __cf, unsigned long long __x,
unsigned long long __y, unsigned long long *__p)
{
return __builtin_ia32_addcarry_u64(__cf, __x, __y, __p);
}
#endif
static __inline unsigned char __DEFAULT_FN_ATTRS
_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
unsigned int *__p)
{
return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
}
#ifdef __x86_64__
static __inline unsigned char __DEFAULT_FN_ATTRS
_subborrow_u64(unsigned char __cf, unsigned long long __x,
unsigned long long __y, unsigned long long *__p)
{
return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif /* __ADXINTRIN_H */

View File

@@ -1,49 +0,0 @@
/*===---- arm64intr.h - ARM64 Windows intrinsics -------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
/* Only include this if we're compiling for the windows platform. */
#ifndef _MSC_VER
#include_next <arm64intr.h>
#else
#ifndef __ARM64INTR_H
#define __ARM64INTR_H
typedef enum
{
_ARM64_BARRIER_SY = 0xF,
_ARM64_BARRIER_ST = 0xE,
_ARM64_BARRIER_LD = 0xD,
_ARM64_BARRIER_ISH = 0xB,
_ARM64_BARRIER_ISHST = 0xA,
_ARM64_BARRIER_ISHLD = 0x9,
_ARM64_BARRIER_NSH = 0x7,
_ARM64_BARRIER_NSHST = 0x6,
_ARM64_BARRIER_NSHLD = 0x5,
_ARM64_BARRIER_OSH = 0x3,
_ARM64_BARRIER_OSHST = 0x2,
_ARM64_BARRIER_OSHLD = 0x1
} _ARM64INTR_BARRIER_TYPE;
#endif /* __ARM64INTR_H */
#endif /* _MSC_VER */

View File

@@ -1,45 +0,0 @@
/*===---- armintr.h - ARM Windows intrinsics -------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
/* Only include this if we're compiling for the windows platform. */
#ifndef _MSC_VER
#include_next <armintr.h>
#else
#ifndef __ARMINTR_H
#define __ARMINTR_H
typedef enum
{
_ARM_BARRIER_SY = 0xF,
_ARM_BARRIER_ST = 0xE,
_ARM_BARRIER_ISH = 0xB,
_ARM_BARRIER_ISHST = 0xA,
_ARM_BARRIER_NSH = 0x7,
_ARM_BARRIER_NSHST = 0x6,
_ARM_BARRIER_OSH = 0x3,
_ARM_BARRIER_OSHST = 0x2
} _ARMINTR_BARRIER_TYPE;
#endif /* __ARMINTR_H */
#endif /* _MSC_VER */

View File

@@ -1,97 +0,0 @@
/*===------------- avx512bitalgintrin.h - BITALG intrinsics ------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512bitalgintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512BITALGINTRIN_H
#define __AVX512BITALGINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512bitalg"), __min_vector_width__(512)))
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_popcnt_epi16(__m512i __A)
{
return (__m512i) __builtin_ia32_vpopcntw_512((__v32hi) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B)
{
return (__m512i) __builtin_ia32_selectw_512((__mmask32) __U,
(__v32hi) _mm512_popcnt_epi16(__B),
(__v32hi) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B)
{
return _mm512_mask_popcnt_epi16((__m512i) _mm512_setzero_si512(),
__U,
__B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_popcnt_epi8(__m512i __A)
{
return (__m512i) __builtin_ia32_vpopcntb_512((__v64qi) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B)
{
return (__m512i) __builtin_ia32_selectb_512((__mmask64) __U,
(__v64qi) _mm512_popcnt_epi8(__B),
(__v64qi) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B)
{
return _mm512_mask_popcnt_epi8((__m512i) _mm512_setzero_si512(),
__U,
__B);
}
static __inline__ __mmask64 __DEFAULT_FN_ATTRS
_mm512_mask_bitshuffle_epi64_mask(__mmask64 __U, __m512i __A, __m512i __B)
{
return (__mmask64) __builtin_ia32_vpshufbitqmb512_mask((__v64qi) __A,
(__v64qi) __B,
__U);
}
static __inline__ __mmask64 __DEFAULT_FN_ATTRS
_mm512_bitshuffle_epi64_mask(__m512i __A, __m512i __B)
{
return _mm512_mask_bitshuffle_epi64_mask((__mmask64) -1,
__A,
__B);
}
#undef __DEFAULT_FN_ATTRS
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,141 +0,0 @@
/*===------------- avx512cdintrin.h - AVX512CD intrinsics ------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512cdintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512CDINTRIN_H
#define __AVX512CDINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512cd"), __min_vector_width__(512)))
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_conflict_epi64 (__m512i __A)
{
return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
(__v8di) _mm512_setzero_si512 (),
(__mmask8) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
{
return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
(__v8di) __W,
(__mmask8) __U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A)
{
return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
(__v8di) _mm512_setzero_si512 (),
(__mmask8) __U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_conflict_epi32 (__m512i __A)
{
return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
(__v16si) _mm512_setzero_si512 (),
(__mmask16) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
{
return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
(__v16si) __W,
(__mmask16) __U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A)
{
return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
(__v16si) _mm512_setzero_si512 (),
(__mmask16) __U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_lzcnt_epi32 (__m512i __A)
{
return (__m512i) __builtin_ia32_vplzcntd_512 ((__v16si) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
{
return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
(__v16si)_mm512_lzcnt_epi32(__A),
(__v16si)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A)
{
return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
(__v16si)_mm512_lzcnt_epi32(__A),
(__v16si)_mm512_setzero_si512());
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_lzcnt_epi64 (__m512i __A)
{
return (__m512i) __builtin_ia32_vplzcntq_512 ((__v8di) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
{
return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
(__v8di)_mm512_lzcnt_epi64(__A),
(__v8di)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A)
{
return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
(__v8di)_mm512_lzcnt_epi64(__A),
(__v8di)_mm512_setzero_si512());
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_broadcastmb_epi64 (__mmask8 __A)
{
return (__m512i) _mm512_set1_epi64((long long) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_broadcastmw_epi32 (__mmask16 __A)
{
return (__m512i) _mm512_set1_epi32((int) __A);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,82 +0,0 @@
/*===------------- avx512ifmaintrin.h - IFMA intrinsics ------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512ifmaintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __IFMAINTRIN_H
#define __IFMAINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma"), __min_vector_width__(512)))
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_madd52hi_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
{
return (__m512i)__builtin_ia32_vpmadd52huq512((__v8di) __X, (__v8di) __Y,
(__v8di) __Z);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_madd52hi_epu64 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
{
return (__m512i)__builtin_ia32_selectq_512(__M,
(__v8di)_mm512_madd52hi_epu64(__W, __X, __Y),
(__v8di)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_madd52hi_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
{
return (__m512i)__builtin_ia32_selectq_512(__M,
(__v8di)_mm512_madd52hi_epu64(__X, __Y, __Z),
(__v8di)_mm512_setzero_si512());
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_madd52lo_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
{
return (__m512i)__builtin_ia32_vpmadd52luq512((__v8di) __X, (__v8di) __Y,
(__v8di) __Z);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_madd52lo_epu64 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
{
return (__m512i)__builtin_ia32_selectq_512(__M,
(__v8di)_mm512_madd52lo_epu64(__W, __X, __Y),
(__v8di)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_madd52lo_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
{
return (__m512i)__builtin_ia32_selectq_512(__M,
(__v8di)_mm512_madd52lo_epu64(__X, __Y, __Z),
(__v8di)_mm512_setzero_si512());
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,111 +0,0 @@
/*===------------- avx512pfintrin.h - PF intrinsics ------------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512pfintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512PFINTRIN_H
#define __AVX512PFINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512pf")))
#define _mm512_mask_prefetch_i32gather_pd(index, mask, addr, scale, hint) \
__builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
(long long const *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_prefetch_i32gather_pd(index, addr, scale, hint) \
__builtin_ia32_gatherpfdpd((__mmask8) -1, (__v8si)(__m256i)(index), \
(long long const *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) \
__builtin_ia32_gatherpfdps((__mmask16)(mask), \
(__v16si)(__m512i)(index), (int const *)(addr), \
(int)(scale), (int)(hint))
#define _mm512_prefetch_i32gather_ps(index, addr, scale, hint) \
__builtin_ia32_gatherpfdps((__mmask16) -1, \
(__v16si)(__m512i)(index), (int const *)(addr), \
(int)(scale), (int)(hint))
#define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) \
__builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
(long long const *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_prefetch_i64gather_pd(index, addr, scale, hint) \
__builtin_ia32_gatherpfqpd((__mmask8) -1, (__v8di)(__m512i)(index), \
(long long const *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) \
__builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
(int const *)(addr), (int)(scale), (int)(hint))
#define _mm512_prefetch_i64gather_ps(index, addr, scale, hint) \
__builtin_ia32_gatherpfqps((__mmask8) -1, (__v8di)(__m512i)(index), \
(int const *)(addr), (int)(scale), (int)(hint))
#define _mm512_prefetch_i32scatter_pd(addr, index, scale, hint) \
__builtin_ia32_scatterpfdpd((__mmask8)-1, (__v8si)(__m256i)(index), \
(long long *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, scale, hint) \
__builtin_ia32_scatterpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
(long long *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_prefetch_i32scatter_ps(addr, index, scale, hint) \
__builtin_ia32_scatterpfdps((__mmask16)-1, (__v16si)(__m512i)(index), \
(int *)(addr), (int)(scale), (int)(hint))
#define _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, scale, hint) \
__builtin_ia32_scatterpfdps((__mmask16)(mask), \
(__v16si)(__m512i)(index), (int *)(addr), \
(int)(scale), (int)(hint))
#define _mm512_prefetch_i64scatter_pd(addr, index, scale, hint) \
__builtin_ia32_scatterpfqpd((__mmask8)-1, (__v8di)(__m512i)(index), \
(long long *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_mask_prefetch_i64scatter_pd(addr, mask, index, scale, hint) \
__builtin_ia32_scatterpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
(long long *)(addr), (int)(scale), \
(int)(hint))
#define _mm512_prefetch_i64scatter_ps(addr, index, scale, hint) \
__builtin_ia32_scatterpfqps((__mmask8)-1, (__v8di)(__m512i)(index), \
(int *)(addr), (int)(scale), (int)(hint))
#define _mm512_mask_prefetch_i64scatter_ps(addr, mask, index, scale, hint) \
__builtin_ia32_scatterpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
(int *)(addr), (int)(scale), (int)(hint))
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,397 +0,0 @@
/*===------------- avx512vbmi2intrin.h - VBMI2 intrinsics ------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512vbmi2intrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512VBMI2INTRIN_H
#define __AVX512VBMI2INTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi2"), __min_vector_width__(512)))
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_compress_epi16(__m512i __S, __mmask32 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_compresshi512_mask ((__v32hi) __D,
(__v32hi) __S,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_compress_epi16(__mmask32 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_compresshi512_mask ((__v32hi) __D,
(__v32hi) _mm512_setzero_si512(),
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_compress_epi8(__m512i __S, __mmask64 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_compressqi512_mask ((__v64qi) __D,
(__v64qi) __S,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_compress_epi8(__mmask64 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_compressqi512_mask ((__v64qi) __D,
(__v64qi) _mm512_setzero_si512(),
__U);
}
static __inline__ void __DEFAULT_FN_ATTRS
_mm512_mask_compressstoreu_epi16(void *__P, __mmask32 __U, __m512i __D)
{
__builtin_ia32_compressstorehi512_mask ((__v32hi *) __P, (__v32hi) __D,
__U);
}
static __inline__ void __DEFAULT_FN_ATTRS
_mm512_mask_compressstoreu_epi8(void *__P, __mmask64 __U, __m512i __D)
{
__builtin_ia32_compressstoreqi512_mask ((__v64qi *) __P, (__v64qi) __D,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_expand_epi16(__m512i __S, __mmask32 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_expandhi512_mask ((__v32hi) __D,
(__v32hi) __S,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_expand_epi16(__mmask32 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_expandhi512_mask ((__v32hi) __D,
(__v32hi) _mm512_setzero_si512(),
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_expand_epi8(__m512i __S, __mmask64 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_expandqi512_mask ((__v64qi) __D,
(__v64qi) __S,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_expand_epi8(__mmask64 __U, __m512i __D)
{
return (__m512i) __builtin_ia32_expandqi512_mask ((__v64qi) __D,
(__v64qi) _mm512_setzero_si512(),
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_expandloadu_epi16(__m512i __S, __mmask32 __U, void const *__P)
{
return (__m512i) __builtin_ia32_expandloadhi512_mask ((const __v32hi *)__P,
(__v32hi) __S,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_expandloadu_epi16(__mmask32 __U, void const *__P)
{
return (__m512i) __builtin_ia32_expandloadhi512_mask ((const __v32hi *)__P,
(__v32hi) _mm512_setzero_si512(),
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_expandloadu_epi8(__m512i __S, __mmask64 __U, void const *__P)
{
return (__m512i) __builtin_ia32_expandloadqi512_mask ((const __v64qi *)__P,
(__v64qi) __S,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_expandloadu_epi8(__mmask64 __U, void const *__P)
{
return (__m512i) __builtin_ia32_expandloadqi512_mask ((const __v64qi *)__P,
(__v64qi) _mm512_setzero_si512(),
__U);
}
#define _mm512_shldi_epi64(A, B, I) \
(__m512i)__builtin_ia32_vpshldq512((__v8di)(__m512i)(A), \
(__v8di)(__m512i)(B), (int)(I))
#define _mm512_mask_shldi_epi64(S, U, A, B, I) \
(__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
(__v8di)_mm512_shldi_epi64((A), (B), (I)), \
(__v8di)(__m512i)(S))
#define _mm512_maskz_shldi_epi64(U, A, B, I) \
(__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
(__v8di)_mm512_shldi_epi64((A), (B), (I)), \
(__v8di)_mm512_setzero_si512())
#define _mm512_shldi_epi32(A, B, I) \
(__m512i)__builtin_ia32_vpshldd512((__v16si)(__m512i)(A), \
(__v16si)(__m512i)(B), (int)(I))
#define _mm512_mask_shldi_epi32(S, U, A, B, I) \
(__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
(__v16si)_mm512_shldi_epi32((A), (B), (I)), \
(__v16si)(__m512i)(S))
#define _mm512_maskz_shldi_epi32(U, A, B, I) \
(__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
(__v16si)_mm512_shldi_epi32((A), (B), (I)), \
(__v16si)_mm512_setzero_si512())
#define _mm512_shldi_epi16(A, B, I) \
(__m512i)__builtin_ia32_vpshldw512((__v32hi)(__m512i)(A), \
(__v32hi)(__m512i)(B), (int)(I))
#define _mm512_mask_shldi_epi16(S, U, A, B, I) \
(__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
(__v32hi)_mm512_shldi_epi16((A), (B), (I)), \
(__v32hi)(__m512i)(S))
#define _mm512_maskz_shldi_epi16(U, A, B, I) \
(__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
(__v32hi)_mm512_shldi_epi16((A), (B), (I)), \
(__v32hi)_mm512_setzero_si512())
#define _mm512_shrdi_epi64(A, B, I) \
(__m512i)__builtin_ia32_vpshrdq512((__v8di)(__m512i)(A), \
(__v8di)(__m512i)(B), (int)(I))
#define _mm512_mask_shrdi_epi64(S, U, A, B, I) \
(__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
(__v8di)_mm512_shrdi_epi64((A), (B), (I)), \
(__v8di)(__m512i)(S))
#define _mm512_maskz_shrdi_epi64(U, A, B, I) \
(__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
(__v8di)_mm512_shrdi_epi64((A), (B), (I)), \
(__v8di)_mm512_setzero_si512())
#define _mm512_shrdi_epi32(A, B, I) \
(__m512i)__builtin_ia32_vpshrdd512((__v16si)(__m512i)(A), \
(__v16si)(__m512i)(B), (int)(I))
#define _mm512_mask_shrdi_epi32(S, U, A, B, I) \
(__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
(__v16si)_mm512_shrdi_epi32((A), (B), (I)), \
(__v16si)(__m512i)(S))
#define _mm512_maskz_shrdi_epi32(U, A, B, I) \
(__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
(__v16si)_mm512_shrdi_epi32((A), (B), (I)), \
(__v16si)_mm512_setzero_si512())
#define _mm512_shrdi_epi16(A, B, I) \
(__m512i)__builtin_ia32_vpshrdw512((__v32hi)(__m512i)(A), \
(__v32hi)(__m512i)(B), (int)(I))
#define _mm512_mask_shrdi_epi16(S, U, A, B, I) \
(__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
(__v32hi)_mm512_shrdi_epi16((A), (B), (I)), \
(__v32hi)(__m512i)(S))
#define _mm512_maskz_shrdi_epi16(U, A, B, I) \
(__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
(__v32hi)_mm512_shrdi_epi16((A), (B), (I)), \
(__v32hi)_mm512_setzero_si512())
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_shldv_epi64(__m512i __S, __mmask8 __U, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvq512_mask ((__v8di) __S,
(__v8di) __A,
(__v8di) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_shldv_epi64(__mmask8 __U, __m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvq512_maskz ((__v8di) __S,
(__v8di) __A,
(__v8di) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_shldv_epi64(__m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvq512_mask ((__v8di) __S,
(__v8di) __A,
(__v8di) __B,
(__mmask8) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_shldv_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvd512_mask ((__v16si) __S,
(__v16si) __A,
(__v16si) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_shldv_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvd512_maskz ((__v16si) __S,
(__v16si) __A,
(__v16si) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_shldv_epi32(__m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvd512_mask ((__v16si) __S,
(__v16si) __A,
(__v16si) __B,
(__mmask16) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_shldv_epi16(__m512i __S, __mmask32 __U, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvw512_mask ((__v32hi) __S,
(__v32hi) __A,
(__v32hi) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_shldv_epi16(__mmask32 __U, __m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvw512_maskz ((__v32hi) __S,
(__v32hi) __A,
(__v32hi) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_shldv_epi16(__m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshldvw512_mask ((__v32hi) __S,
(__v32hi) __A,
(__v32hi) __B,
(__mmask32) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_shrdv_epi64(__m512i __S, __mmask8 __U, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvq512_mask ((__v8di) __S,
(__v8di) __A,
(__v8di) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_shrdv_epi64(__mmask8 __U, __m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvq512_maskz ((__v8di) __S,
(__v8di) __A,
(__v8di) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_shrdv_epi64(__m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvq512_mask ((__v8di) __S,
(__v8di) __A,
(__v8di) __B,
(__mmask8) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_shrdv_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvd512_mask ((__v16si) __S,
(__v16si) __A,
(__v16si) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_shrdv_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvd512_maskz ((__v16si) __S,
(__v16si) __A,
(__v16si) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_shrdv_epi32(__m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvd512_mask ((__v16si) __S,
(__v16si) __A,
(__v16si) __B,
(__mmask16) -1);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_shrdv_epi16(__m512i __S, __mmask32 __U, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvw512_mask ((__v32hi) __S,
(__v32hi) __A,
(__v32hi) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_shrdv_epi16(__mmask32 __U, __m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvw512_maskz ((__v32hi) __S,
(__v32hi) __A,
(__v32hi) __B,
__U);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_shrdv_epi16(__m512i __S, __m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_vpshrdvw512_mask ((__v32hi) __S,
(__v32hi) __A,
(__v32hi) __B,
(__mmask32) -1);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,123 +0,0 @@
/*===------------- avx512vbmiintrin.h - VBMI intrinsics ------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512vbmiintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __VBMIINTRIN_H
#define __VBMIINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi"), __min_vector_width__(512)))
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_permutex2var_epi8(__m512i __A, __m512i __I, __m512i __B)
{
return (__m512i)__builtin_ia32_vpermi2varqi512((__v64qi)__A, (__v64qi)__I,
(__v64qi) __B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_permutex2var_epi8(__m512i __A, __mmask64 __U, __m512i __I,
__m512i __B)
{
return (__m512i)__builtin_ia32_selectb_512(__U,
(__v64qi)_mm512_permutex2var_epi8(__A, __I, __B),
(__v64qi)__A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask2_permutex2var_epi8(__m512i __A, __m512i __I, __mmask64 __U,
__m512i __B)
{
return (__m512i)__builtin_ia32_selectb_512(__U,
(__v64qi)_mm512_permutex2var_epi8(__A, __I, __B),
(__v64qi)__I);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_permutex2var_epi8(__mmask64 __U, __m512i __A, __m512i __I,
__m512i __B)
{
return (__m512i)__builtin_ia32_selectb_512(__U,
(__v64qi)_mm512_permutex2var_epi8(__A, __I, __B),
(__v64qi)_mm512_setzero_si512());
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_permutexvar_epi8 (__m512i __A, __m512i __B)
{
return (__m512i)__builtin_ia32_permvarqi512((__v64qi) __B, (__v64qi) __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_permutexvar_epi8 (__mmask64 __M, __m512i __A,
__m512i __B)
{
return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
(__v64qi)_mm512_permutexvar_epi8(__A, __B),
(__v64qi)_mm512_setzero_si512());
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_permutexvar_epi8 (__m512i __W, __mmask64 __M, __m512i __A,
__m512i __B)
{
return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
(__v64qi)_mm512_permutexvar_epi8(__A, __B),
(__v64qi)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_multishift_epi64_epi8 (__m512i __W, __mmask64 __M, __m512i __X, __m512i __Y)
{
return (__m512i) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi) __X,
(__v64qi) __Y,
(__v64qi) __W,
(__mmask64) __M);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_multishift_epi64_epi8 (__mmask64 __M, __m512i __X, __m512i __Y)
{
return (__m512i) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi) __X,
(__v64qi) __Y,
(__v64qi) _mm512_setzero_si512 (),
(__mmask64) __M);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_multishift_epi64_epi8 (__m512i __X, __m512i __Y)
{
return (__m512i) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi) __X,
(__v64qi) __Y,
(__v64qi) _mm512_undefined_epi32 (),
(__mmask64) -1);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,214 +0,0 @@
/*===------------- avx512vbmivlintrin.h - VBMI intrinsics ------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512vbmivlintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __VBMIVLINTRIN_H
#define __VBMIVLINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi,avx512vl"), __min_vector_width__(128)))
#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi,avx512vl"), __min_vector_width__(256)))
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_permutex2var_epi8(__m128i __A, __m128i __I, __m128i __B)
{
return (__m128i)__builtin_ia32_vpermi2varqi128((__v16qi)__A,
(__v16qi)__I,
(__v16qi)__B);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_permutex2var_epi8(__m128i __A, __mmask16 __U, __m128i __I,
__m128i __B)
{
return (__m128i)__builtin_ia32_selectb_128(__U,
(__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
(__v16qi)__A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask2_permutex2var_epi8(__m128i __A, __m128i __I, __mmask16 __U,
__m128i __B)
{
return (__m128i)__builtin_ia32_selectb_128(__U,
(__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
(__v16qi)__I);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_permutex2var_epi8(__mmask16 __U, __m128i __A, __m128i __I,
__m128i __B)
{
return (__m128i)__builtin_ia32_selectb_128(__U,
(__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
(__v16qi)_mm_setzero_si128());
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_permutex2var_epi8(__m256i __A, __m256i __I, __m256i __B)
{
return (__m256i)__builtin_ia32_vpermi2varqi256((__v32qi)__A, (__v32qi)__I,
(__v32qi)__B);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_permutex2var_epi8(__m256i __A, __mmask32 __U, __m256i __I,
__m256i __B)
{
return (__m256i)__builtin_ia32_selectb_256(__U,
(__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
(__v32qi)__A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask2_permutex2var_epi8(__m256i __A, __m256i __I, __mmask32 __U,
__m256i __B)
{
return (__m256i)__builtin_ia32_selectb_256(__U,
(__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
(__v32qi)__I);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_permutex2var_epi8(__mmask32 __U, __m256i __A, __m256i __I,
__m256i __B)
{
return (__m256i)__builtin_ia32_selectb_256(__U,
(__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
(__v32qi)_mm256_setzero_si256());
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_permutexvar_epi8 (__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_permvarqi128((__v16qi)__B, (__v16qi)__A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_permutexvar_epi8 (__mmask16 __M, __m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
(__v16qi)_mm_permutexvar_epi8(__A, __B),
(__v16qi)_mm_setzero_si128());
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_permutexvar_epi8 (__m128i __W, __mmask16 __M, __m128i __A,
__m128i __B)
{
return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
(__v16qi)_mm_permutexvar_epi8(__A, __B),
(__v16qi)__W);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_permutexvar_epi8 (__m256i __A, __m256i __B)
{
return (__m256i)__builtin_ia32_permvarqi256((__v32qi) __B, (__v32qi) __A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_permutexvar_epi8 (__mmask32 __M, __m256i __A,
__m256i __B)
{
return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
(__v32qi)_mm256_permutexvar_epi8(__A, __B),
(__v32qi)_mm256_setzero_si256());
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_permutexvar_epi8 (__m256i __W, __mmask32 __M, __m256i __A,
__m256i __B)
{
return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
(__v32qi)_mm256_permutexvar_epi8(__A, __B),
(__v32qi)__W);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_multishift_epi64_epi8 (__m128i __W, __mmask16 __M, __m128i __X, __m128i __Y)
{
return (__m128i) __builtin_ia32_vpmultishiftqb128_mask ((__v16qi) __X,
(__v16qi) __Y,
(__v16qi) __W,
(__mmask16) __M);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_multishift_epi64_epi8 (__mmask16 __M, __m128i __X, __m128i __Y)
{
return (__m128i) __builtin_ia32_vpmultishiftqb128_mask ((__v16qi) __X,
(__v16qi) __Y,
(__v16qi)
_mm_setzero_si128 (),
(__mmask16) __M);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_multishift_epi64_epi8 (__m128i __X, __m128i __Y)
{
return (__m128i) __builtin_ia32_vpmultishiftqb128_mask ((__v16qi) __X,
(__v16qi) __Y,
(__v16qi)
_mm_undefined_si128 (),
(__mmask16) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_multishift_epi64_epi8 (__m256i __W, __mmask32 __M, __m256i __X, __m256i __Y)
{
return (__m256i) __builtin_ia32_vpmultishiftqb256_mask ((__v32qi) __X,
(__v32qi) __Y,
(__v32qi) __W,
(__mmask32) __M);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_multishift_epi64_epi8 (__mmask32 __M, __m256i __X, __m256i __Y)
{
return (__m256i) __builtin_ia32_vpmultishiftqb256_mask ((__v32qi) __X,
(__v32qi) __Y,
(__v32qi)
_mm256_setzero_si256 (),
(__mmask32) __M);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_multishift_epi64_epi8 (__m256i __X, __m256i __Y)
{
return (__m256i) __builtin_ia32_vpmultishiftqb256_mask ((__v32qi) __X,
(__v32qi) __Y,
(__v32qi)
_mm256_undefined_si256 (),
(__mmask32) -1);
}
#undef __DEFAULT_FN_ATTRS128
#undef __DEFAULT_FN_ATTRS256
#endif

View File

@@ -1,249 +0,0 @@
/*===---- avx512vlcdintrin.h - AVX512VL and AVX512CD intrinsics ------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512vlcdintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512VLCDINTRIN_H
#define __AVX512VLCDINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512cd"), __min_vector_width__(128)))
#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512cd"), __min_vector_width__(256)))
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_broadcastmb_epi64 (__mmask8 __A)
{
return (__m128i) _mm_set1_epi64x((long long) __A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_broadcastmb_epi64 (__mmask8 __A)
{
return (__m256i) _mm256_set1_epi64x((long long)__A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_broadcastmw_epi32 (__mmask16 __A)
{
return (__m128i) _mm_set1_epi32((int)__A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_broadcastmw_epi32 (__mmask16 __A)
{
return (__m256i) _mm256_set1_epi32((int)__A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_conflict_epi64 (__m128i __A)
{
return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A,
(__v2di) _mm_undefined_si128 (),
(__mmask8) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_conflict_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
{
return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A,
(__v2di) __W,
(__mmask8) __U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_conflict_epi64 (__mmask8 __U, __m128i __A)
{
return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A,
(__v2di)
_mm_setzero_si128 (),
(__mmask8) __U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_conflict_epi64 (__m256i __A)
{
return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A,
(__v4di) _mm256_undefined_si256 (),
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_conflict_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
{
return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A,
(__v4di) __W,
(__mmask8) __U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_conflict_epi64 (__mmask8 __U, __m256i __A)
{
return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A,
(__v4di) _mm256_setzero_si256 (),
(__mmask8) __U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_conflict_epi32 (__m128i __A)
{
return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A,
(__v4si) _mm_undefined_si128 (),
(__mmask8) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_conflict_epi32 (__m128i __W, __mmask8 __U, __m128i __A)
{
return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A,
(__v4si) __W,
(__mmask8) __U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_conflict_epi32 (__mmask8 __U, __m128i __A)
{
return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A,
(__v4si) _mm_setzero_si128 (),
(__mmask8) __U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_conflict_epi32 (__m256i __A)
{
return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A,
(__v8si) _mm256_undefined_si256 (),
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_conflict_epi32 (__m256i __W, __mmask8 __U, __m256i __A)
{
return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A,
(__v8si) __W,
(__mmask8) __U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_conflict_epi32 (__mmask8 __U, __m256i __A)
{
return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A,
(__v8si)
_mm256_setzero_si256 (),
(__mmask8) __U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_lzcnt_epi32 (__m128i __A)
{
return (__m128i) __builtin_ia32_vplzcntd_128 ((__v4si) __A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_lzcnt_epi32 (__m128i __W, __mmask8 __U, __m128i __A)
{
return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
(__v4si)_mm_lzcnt_epi32(__A),
(__v4si)__W);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_lzcnt_epi32 (__mmask8 __U, __m128i __A)
{
return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U,
(__v4si)_mm_lzcnt_epi32(__A),
(__v4si)_mm_setzero_si128());
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_lzcnt_epi32 (__m256i __A)
{
return (__m256i) __builtin_ia32_vplzcntd_256 ((__v8si) __A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_lzcnt_epi32 (__m256i __W, __mmask8 __U, __m256i __A)
{
return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
(__v8si)_mm256_lzcnt_epi32(__A),
(__v8si)__W);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_lzcnt_epi32 (__mmask8 __U, __m256i __A)
{
return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U,
(__v8si)_mm256_lzcnt_epi32(__A),
(__v8si)_mm256_setzero_si256());
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_lzcnt_epi64 (__m128i __A)
{
return (__m128i) __builtin_ia32_vplzcntq_128 ((__v2di) __A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_lzcnt_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
{
return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
(__v2di)_mm_lzcnt_epi64(__A),
(__v2di)__W);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_lzcnt_epi64 (__mmask8 __U, __m128i __A)
{
return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U,
(__v2di)_mm_lzcnt_epi64(__A),
(__v2di)_mm_setzero_si128());
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_lzcnt_epi64 (__m256i __A)
{
return (__m256i) __builtin_ia32_vplzcntq_256 ((__v4di) __A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_lzcnt_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
{
return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
(__v4di)_mm256_lzcnt_epi64(__A),
(__v4di)__W);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_lzcnt_epi64 (__mmask8 __U, __m256i __A)
{
return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U,
(__v4di)_mm256_lzcnt_epi64(__A),
(__v4di)_mm256_setzero_si256());
}
#undef __DEFAULT_FN_ATTRS128
#undef __DEFAULT_FN_ATTRS256
#endif /* __AVX512VLCDINTRIN_H */

View File

@@ -1,751 +0,0 @@
/*===------------- avx512vlvbmi2intrin.h - VBMI2 intrinsics -----------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <avx512vlvbmi2intrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512VLVBMI2INTRIN_H
#define __AVX512VLVBMI2INTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512vbmi2"), __min_vector_width__(128)))
#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512vbmi2"), __min_vector_width__(256)))
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_compress_epi16(__m128i __S, __mmask8 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_compresshi128_mask ((__v8hi) __D,
(__v8hi) __S,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_compress_epi16(__mmask8 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_compresshi128_mask ((__v8hi) __D,
(__v8hi) _mm_setzero_si128(),
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_compress_epi8(__m128i __S, __mmask16 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_compressqi128_mask ((__v16qi) __D,
(__v16qi) __S,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_compress_epi8(__mmask16 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_compressqi128_mask ((__v16qi) __D,
(__v16qi) _mm_setzero_si128(),
__U);
}
static __inline__ void __DEFAULT_FN_ATTRS128
_mm_mask_compressstoreu_epi16(void *__P, __mmask8 __U, __m128i __D)
{
__builtin_ia32_compressstorehi128_mask ((__v8hi *) __P, (__v8hi) __D,
__U);
}
static __inline__ void __DEFAULT_FN_ATTRS128
_mm_mask_compressstoreu_epi8(void *__P, __mmask16 __U, __m128i __D)
{
__builtin_ia32_compressstoreqi128_mask ((__v16qi *) __P, (__v16qi) __D,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_expand_epi16(__m128i __S, __mmask8 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_expandhi128_mask ((__v8hi) __D,
(__v8hi) __S,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_expand_epi16(__mmask8 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_expandhi128_mask ((__v8hi) __D,
(__v8hi) _mm_setzero_si128(),
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_expand_epi8(__m128i __S, __mmask16 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_expandqi128_mask ((__v16qi) __D,
(__v16qi) __S,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_expand_epi8(__mmask16 __U, __m128i __D)
{
return (__m128i) __builtin_ia32_expandqi128_mask ((__v16qi) __D,
(__v16qi) _mm_setzero_si128(),
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_expandloadu_epi16(__m128i __S, __mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_expandloadhi128_mask ((const __v8hi *)__P,
(__v8hi) __S,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_expandloadu_epi16(__mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_expandloadhi128_mask ((const __v8hi *)__P,
(__v8hi) _mm_setzero_si128(),
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_expandloadu_epi8(__m128i __S, __mmask16 __U, void const *__P)
{
return (__m128i) __builtin_ia32_expandloadqi128_mask ((const __v16qi *)__P,
(__v16qi) __S,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_expandloadu_epi8(__mmask16 __U, void const *__P)
{
return (__m128i) __builtin_ia32_expandloadqi128_mask ((const __v16qi *)__P,
(__v16qi) _mm_setzero_si128(),
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_compress_epi16(__m256i __S, __mmask16 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_compresshi256_mask ((__v16hi) __D,
(__v16hi) __S,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_compress_epi16(__mmask16 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_compresshi256_mask ((__v16hi) __D,
(__v16hi) _mm256_setzero_si256(),
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_compress_epi8(__m256i __S, __mmask32 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_compressqi256_mask ((__v32qi) __D,
(__v32qi) __S,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_compress_epi8(__mmask32 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_compressqi256_mask ((__v32qi) __D,
(__v32qi) _mm256_setzero_si256(),
__U);
}
static __inline__ void __DEFAULT_FN_ATTRS256
_mm256_mask_compressstoreu_epi16(void *__P, __mmask16 __U, __m256i __D)
{
__builtin_ia32_compressstorehi256_mask ((__v16hi *) __P, (__v16hi) __D,
__U);
}
static __inline__ void __DEFAULT_FN_ATTRS256
_mm256_mask_compressstoreu_epi8(void *__P, __mmask32 __U, __m256i __D)
{
__builtin_ia32_compressstoreqi256_mask ((__v32qi *) __P, (__v32qi) __D,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_expand_epi16(__m256i __S, __mmask16 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_expandhi256_mask ((__v16hi) __D,
(__v16hi) __S,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_expand_epi16(__mmask16 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_expandhi256_mask ((__v16hi) __D,
(__v16hi) _mm256_setzero_si256(),
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_expand_epi8(__m256i __S, __mmask32 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_expandqi256_mask ((__v32qi) __D,
(__v32qi) __S,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_expand_epi8(__mmask32 __U, __m256i __D)
{
return (__m256i) __builtin_ia32_expandqi256_mask ((__v32qi) __D,
(__v32qi) _mm256_setzero_si256(),
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_expandloadu_epi16(__m256i __S, __mmask16 __U, void const *__P)
{
return (__m256i) __builtin_ia32_expandloadhi256_mask ((const __v16hi *)__P,
(__v16hi) __S,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_expandloadu_epi16(__mmask16 __U, void const *__P)
{
return (__m256i) __builtin_ia32_expandloadhi256_mask ((const __v16hi *)__P,
(__v16hi) _mm256_setzero_si256(),
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_expandloadu_epi8(__m256i __S, __mmask32 __U, void const *__P)
{
return (__m256i) __builtin_ia32_expandloadqi256_mask ((const __v32qi *)__P,
(__v32qi) __S,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_expandloadu_epi8(__mmask32 __U, void const *__P)
{
return (__m256i) __builtin_ia32_expandloadqi256_mask ((const __v32qi *)__P,
(__v32qi) _mm256_setzero_si256(),
__U);
}
#define _mm256_shldi_epi64(A, B, I) \
(__m256i)__builtin_ia32_vpshldq256((__v4di)(__m256i)(A), \
(__v4di)(__m256i)(B), (int)(I))
#define _mm256_mask_shldi_epi64(S, U, A, B, I) \
(__m256i)__builtin_ia32_selectq_256((__mmask8)(U), \
(__v4di)_mm256_shldi_epi64((A), (B), (I)), \
(__v4di)(__m256i)(S))
#define _mm256_maskz_shldi_epi64(U, A, B, I) \
(__m256i)__builtin_ia32_selectq_256((__mmask8)(U), \
(__v4di)_mm256_shldi_epi64((A), (B), (I)), \
(__v4di)_mm256_setzero_si256())
#define _mm_shldi_epi64(A, B, I) \
(__m128i)__builtin_ia32_vpshldq128((__v2di)(__m128i)(A), \
(__v2di)(__m128i)(B), (int)(I))
#define _mm_mask_shldi_epi64(S, U, A, B, I) \
(__m128i)__builtin_ia32_selectq_128((__mmask8)(U), \
(__v2di)_mm_shldi_epi64((A), (B), (I)), \
(__v2di)(__m128i)(S))
#define _mm_maskz_shldi_epi64(U, A, B, I) \
(__m128i)__builtin_ia32_selectq_128((__mmask8)(U), \
(__v2di)_mm_shldi_epi64((A), (B), (I)), \
(__v2di)_mm_setzero_si128())
#define _mm256_shldi_epi32(A, B, I) \
(__m256i)__builtin_ia32_vpshldd256((__v8si)(__m256i)(A), \
(__v8si)(__m256i)(B), (int)(I))
#define _mm256_mask_shldi_epi32(S, U, A, B, I) \
(__m256i)__builtin_ia32_selectd_256((__mmask8)(U), \
(__v8si)_mm256_shldi_epi32((A), (B), (I)), \
(__v8si)(__m256i)(S))
#define _mm256_maskz_shldi_epi32(U, A, B, I) \
(__m256i)__builtin_ia32_selectd_256((__mmask8)(U), \
(__v8si)_mm256_shldi_epi32((A), (B), (I)), \
(__v8si)_mm256_setzero_si256())
#define _mm_shldi_epi32(A, B, I) \
(__m128i)__builtin_ia32_vpshldd128((__v4si)(__m128i)(A), \
(__v4si)(__m128i)(B), (int)(I))
#define _mm_mask_shldi_epi32(S, U, A, B, I) \
(__m128i)__builtin_ia32_selectd_128((__mmask8)(U), \
(__v4si)_mm_shldi_epi32((A), (B), (I)), \
(__v4si)(__m128i)(S))
#define _mm_maskz_shldi_epi32(U, A, B, I) \
(__m128i)__builtin_ia32_selectd_128((__mmask8)(U), \
(__v4si)_mm_shldi_epi32((A), (B), (I)), \
(__v4si)_mm_setzero_si128())
#define _mm256_shldi_epi16(A, B, I) \
(__m256i)__builtin_ia32_vpshldw256((__v16hi)(__m256i)(A), \
(__v16hi)(__m256i)(B), (int)(I))
#define _mm256_mask_shldi_epi16(S, U, A, B, I) \
(__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
(__v16hi)_mm256_shldi_epi16((A), (B), (I)), \
(__v16hi)(__m256i)(S))
#define _mm256_maskz_shldi_epi16(U, A, B, I) \
(__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
(__v16hi)_mm256_shldi_epi16((A), (B), (I)), \
(__v16hi)_mm256_setzero_si256())
#define _mm_shldi_epi16(A, B, I) \
(__m128i)__builtin_ia32_vpshldw128((__v8hi)(__m128i)(A), \
(__v8hi)(__m128i)(B), (int)(I))
#define _mm_mask_shldi_epi16(S, U, A, B, I) \
(__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
(__v8hi)_mm_shldi_epi16((A), (B), (I)), \
(__v8hi)(__m128i)(S))
#define _mm_maskz_shldi_epi16(U, A, B, I) \
(__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
(__v8hi)_mm_shldi_epi16((A), (B), (I)), \
(__v8hi)_mm_setzero_si128())
#define _mm256_shrdi_epi64(A, B, I) \
(__m256i)__builtin_ia32_vpshrdq256((__v4di)(__m256i)(A), \
(__v4di)(__m256i)(B), (int)(I))
#define _mm256_mask_shrdi_epi64(S, U, A, B, I) \
(__m256i)__builtin_ia32_selectq_256((__mmask8)(U), \
(__v4di)_mm256_shrdi_epi64((A), (B), (I)), \
(__v4di)(__m256i)(S))
#define _mm256_maskz_shrdi_epi64(U, A, B, I) \
(__m256i)__builtin_ia32_selectq_256((__mmask8)(U), \
(__v4di)_mm256_shrdi_epi64((A), (B), (I)), \
(__v4di)_mm256_setzero_si256())
#define _mm_shrdi_epi64(A, B, I) \
(__m128i)__builtin_ia32_vpshrdq128((__v2di)(__m128i)(A), \
(__v2di)(__m128i)(B), (int)(I))
#define _mm_mask_shrdi_epi64(S, U, A, B, I) \
(__m128i)__builtin_ia32_selectq_128((__mmask8)(U), \
(__v2di)_mm_shrdi_epi64((A), (B), (I)), \
(__v2di)(__m128i)(S))
#define _mm_maskz_shrdi_epi64(U, A, B, I) \
(__m128i)__builtin_ia32_selectq_128((__mmask8)(U), \
(__v2di)_mm_shrdi_epi64((A), (B), (I)), \
(__v2di)_mm_setzero_si128())
#define _mm256_shrdi_epi32(A, B, I) \
(__m256i)__builtin_ia32_vpshrdd256((__v8si)(__m256i)(A), \
(__v8si)(__m256i)(B), (int)(I))
#define _mm256_mask_shrdi_epi32(S, U, A, B, I) \
(__m256i)__builtin_ia32_selectd_256((__mmask8)(U), \
(__v8si)_mm256_shrdi_epi32((A), (B), (I)), \
(__v8si)(__m256i)(S))
#define _mm256_maskz_shrdi_epi32(U, A, B, I) \
(__m256i)__builtin_ia32_selectd_256((__mmask8)(U), \
(__v8si)_mm256_shrdi_epi32((A), (B), (I)), \
(__v8si)_mm256_setzero_si256())
#define _mm_shrdi_epi32(A, B, I) \
(__m128i)__builtin_ia32_vpshrdd128((__v4si)(__m128i)(A), \
(__v4si)(__m128i)(B), (int)(I))
#define _mm_mask_shrdi_epi32(S, U, A, B, I) \
(__m128i)__builtin_ia32_selectd_128((__mmask8)(U), \
(__v4si)_mm_shrdi_epi32((A), (B), (I)), \
(__v4si)(__m128i)(S))
#define _mm_maskz_shrdi_epi32(U, A, B, I) \
(__m128i)__builtin_ia32_selectd_128((__mmask8)(U), \
(__v4si)_mm_shrdi_epi32((A), (B), (I)), \
(__v4si)_mm_setzero_si128())
#define _mm256_shrdi_epi16(A, B, I) \
(__m256i)__builtin_ia32_vpshrdw256((__v16hi)(__m256i)(A), \
(__v16hi)(__m256i)(B), (int)(I))
#define _mm256_mask_shrdi_epi16(S, U, A, B, I) \
(__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
(__v16hi)_mm256_shrdi_epi16((A), (B), (I)), \
(__v16hi)(__m256i)(S))
#define _mm256_maskz_shrdi_epi16(U, A, B, I) \
(__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
(__v16hi)_mm256_shrdi_epi16((A), (B), (I)), \
(__v16hi)_mm256_setzero_si256())
#define _mm_shrdi_epi16(A, B, I) \
(__m128i)__builtin_ia32_vpshrdw128((__v8hi)(__m128i)(A), \
(__v8hi)(__m128i)(B), (int)(I))
#define _mm_mask_shrdi_epi16(S, U, A, B, I) \
(__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
(__v8hi)_mm_shrdi_epi16((A), (B), (I)), \
(__v8hi)(__m128i)(S))
#define _mm_maskz_shrdi_epi16(U, A, B, I) \
(__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
(__v8hi)_mm_shrdi_epi16((A), (B), (I)), \
(__v8hi)_mm_setzero_si128())
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_shldv_epi64(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvq256_mask ((__v4di) __S,
(__v4di) __A,
(__v4di) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_shldv_epi64(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvq256_maskz ((__v4di) __S,
(__v4di) __A,
(__v4di) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_shldv_epi64(__m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvq256_mask ((__v4di) __S,
(__v4di) __A,
(__v4di) __B,
(__mmask8) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_shldv_epi64(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvq128_mask ((__v2di) __S,
(__v2di) __A,
(__v2di) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_shldv_epi64(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvq128_maskz ((__v2di) __S,
(__v2di) __A,
(__v2di) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_shldv_epi64(__m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvq128_mask ((__v2di) __S,
(__v2di) __A,
(__v2di) __B,
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_shldv_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvd256_mask ((__v8si) __S,
(__v8si) __A,
(__v8si) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_shldv_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvd256_maskz ((__v8si) __S,
(__v8si) __A,
(__v8si) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_shldv_epi32(__m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvd256_mask ((__v8si) __S,
(__v8si) __A,
(__v8si) __B,
(__mmask8) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_shldv_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvd128_mask ((__v4si) __S,
(__v4si) __A,
(__v4si) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_shldv_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvd128_maskz ((__v4si) __S,
(__v4si) __A,
(__v4si) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_shldv_epi32(__m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvd128_mask ((__v4si) __S,
(__v4si) __A,
(__v4si) __B,
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_shldv_epi16(__m256i __S, __mmask16 __U, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvw256_mask ((__v16hi) __S,
(__v16hi) __A,
(__v16hi) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_shldv_epi16(__mmask16 __U, __m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvw256_maskz ((__v16hi) __S,
(__v16hi) __A,
(__v16hi) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_shldv_epi16(__m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshldvw256_mask ((__v16hi) __S,
(__v16hi) __A,
(__v16hi) __B,
(__mmask16) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_shldv_epi16(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvw128_mask ((__v8hi) __S,
(__v8hi) __A,
(__v8hi) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_shldv_epi16(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvw128_maskz ((__v8hi) __S,
(__v8hi) __A,
(__v8hi) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_shldv_epi16(__m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshldvw128_mask ((__v8hi) __S,
(__v8hi) __A,
(__v8hi) __B,
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_shrdv_epi64(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvq256_mask ((__v4di) __S,
(__v4di) __A,
(__v4di) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_shrdv_epi64(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvq256_maskz ((__v4di) __S,
(__v4di) __A,
(__v4di) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_shrdv_epi64(__m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvq256_mask ((__v4di) __S,
(__v4di) __A,
(__v4di) __B,
(__mmask8) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_shrdv_epi64(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvq128_mask ((__v2di) __S,
(__v2di) __A,
(__v2di) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_shrdv_epi64(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvq128_maskz ((__v2di) __S,
(__v2di) __A,
(__v2di) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_shrdv_epi64(__m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvq128_mask ((__v2di) __S,
(__v2di) __A,
(__v2di) __B,
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_shrdv_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvd256_mask ((__v8si) __S,
(__v8si) __A,
(__v8si) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_shrdv_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvd256_maskz ((__v8si) __S,
(__v8si) __A,
(__v8si) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_shrdv_epi32(__m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvd256_mask ((__v8si) __S,
(__v8si) __A,
(__v8si) __B,
(__mmask8) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_shrdv_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvd128_mask ((__v4si) __S,
(__v4si) __A,
(__v4si) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_shrdv_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvd128_maskz ((__v4si) __S,
(__v4si) __A,
(__v4si) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_shrdv_epi32(__m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvd128_mask ((__v4si) __S,
(__v4si) __A,
(__v4si) __B,
(__mmask8) -1);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_shrdv_epi16(__m256i __S, __mmask16 __U, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvw256_mask ((__v16hi) __S,
(__v16hi) __A,
(__v16hi) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_shrdv_epi16(__mmask16 __U, __m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvw256_maskz ((__v16hi) __S,
(__v16hi) __A,
(__v16hi) __B,
__U);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_shrdv_epi16(__m256i __S, __m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_vpshrdvw256_mask ((__v16hi) __S,
(__v16hi) __A,
(__v16hi) __B,
(__mmask16) -1);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_shrdv_epi16(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvw128_mask ((__v8hi) __S,
(__v8hi) __A,
(__v8hi) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_shrdv_epi16(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvw128_maskz ((__v8hi) __S,
(__v8hi) __A,
(__v8hi) __B,
__U);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_shrdv_epi16(__m128i __S, __m128i __A, __m128i __B)
{
return (__m128i) __builtin_ia32_vpshrdvw128_mask ((__v8hi) __S,
(__v8hi) __A,
(__v8hi) __B,
(__mmask8) -1);
}
#undef __DEFAULT_FN_ATTRS128
#undef __DEFAULT_FN_ATTRS256
#endif

View File

@@ -1,68 +0,0 @@
/*===----- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics-------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error \
"Never use <avx512vpopcntdqintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512VPOPCNTDQINTRIN_H
#define __AVX512VPOPCNTDQINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq"), __min_vector_width__(512)))
static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi64(__m512i __A) {
return (__m512i)__builtin_ia32_vpopcntq_512((__v8di)__A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_popcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
return (__m512i)__builtin_ia32_selectq_512(
(__mmask8)__U, (__v8di)_mm512_popcnt_epi64(__A), (__v8di)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_popcnt_epi64(__mmask8 __U, __m512i __A) {
return _mm512_mask_popcnt_epi64((__m512i)_mm512_setzero_si512(), __U, __A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_popcnt_epi32(__m512i __A) {
return (__m512i)__builtin_ia32_vpopcntd_512((__v16si)__A);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_popcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
return (__m512i)__builtin_ia32_selectd_512(
(__mmask16)__U, (__v16si)_mm512_popcnt_epi32(__A), (__v16si)__W);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_popcnt_epi32(__mmask16 __U, __m512i __A) {
return _mm512_mask_popcnt_epi32((__m512i)_mm512_setzero_si512(), __U, __A);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,105 +0,0 @@
/*===---- avx512vpopcntdqintrin.h - AVX512VPOPCNTDQ intrinsics -------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error \
"Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __AVX512VPOPCNTDQVLINTRIN_H
#define __AVX512VPOPCNTDQVLINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS128 \
__attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq,avx512vl"), __min_vector_width__(128)))
#define __DEFAULT_FN_ATTRS256 \
__attribute__((__always_inline__, __nodebug__, __target__("avx512vpopcntdq,avx512vl"), __min_vector_width__(256)))
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_popcnt_epi64(__m128i __A) {
return (__m128i)__builtin_ia32_vpopcntq_128((__v2di)__A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_popcnt_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
return (__m128i)__builtin_ia32_selectq_128(
(__mmask8)__U, (__v2di)_mm_popcnt_epi64(__A), (__v2di)__W);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_popcnt_epi64(__mmask8 __U, __m128i __A) {
return _mm_mask_popcnt_epi64((__m128i)_mm_setzero_si128(), __U, __A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_popcnt_epi32(__m128i __A) {
return (__m128i)__builtin_ia32_vpopcntd_128((__v4si)__A);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_popcnt_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
return (__m128i)__builtin_ia32_selectd_128(
(__mmask8)__U, (__v4si)_mm_popcnt_epi32(__A), (__v4si)__W);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_popcnt_epi32(__mmask8 __U, __m128i __A) {
return _mm_mask_popcnt_epi32((__m128i)_mm_setzero_si128(), __U, __A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_popcnt_epi64(__m256i __A) {
return (__m256i)__builtin_ia32_vpopcntq_256((__v4di)__A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_popcnt_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
return (__m256i)__builtin_ia32_selectq_256(
(__mmask8)__U, (__v4di)_mm256_popcnt_epi64(__A), (__v4di)__W);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_popcnt_epi64(__mmask8 __U, __m256i __A) {
return _mm256_mask_popcnt_epi64((__m256i)_mm256_setzero_si256(), __U, __A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_popcnt_epi32(__m256i __A) {
return (__m256i)__builtin_ia32_vpopcntd_256((__v8si)__A);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_popcnt_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
return (__m256i)__builtin_ia32_selectd_256(
(__mmask8)__U, (__v8si)_mm256_popcnt_epi32(__A), (__v8si)__W);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_popcnt_epi32(__mmask8 __U, __m256i __A) {
return _mm256_mask_popcnt_epi32((__m256i)_mm256_setzero_si256(), __U, __A);
}
#undef __DEFAULT_FN_ATTRS128
#undef __DEFAULT_FN_ATTRS256
#endif

View File

@@ -1,95 +0,0 @@
/*===---- bmi2intrin.h - BMI2 intrinsics -----------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <bmi2intrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __BMI2INTRIN_H
#define __BMI2INTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi2")))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_bzhi_u32(unsigned int __X, unsigned int __Y)
{
return __builtin_ia32_bzhi_si(__X, __Y);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_pdep_u32(unsigned int __X, unsigned int __Y)
{
return __builtin_ia32_pdep_si(__X, __Y);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_pext_u32(unsigned int __X, unsigned int __Y)
{
return __builtin_ia32_pext_si(__X, __Y);
}
#ifdef __x86_64__
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
_bzhi_u64(unsigned long long __X, unsigned long long __Y)
{
return __builtin_ia32_bzhi_di(__X, __Y);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
_pdep_u64(unsigned long long __X, unsigned long long __Y)
{
return __builtin_ia32_pdep_di(__X, __Y);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
_pext_u64(unsigned long long __X, unsigned long long __Y)
{
return __builtin_ia32_pext_di(__X, __Y);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
_mulx_u64 (unsigned long long __X, unsigned long long __Y,
unsigned long long *__P)
{
unsigned __int128 __res = (unsigned __int128) __X * __Y;
*__P = (unsigned long long) (__res >> 64);
return (unsigned long long) __res;
}
#else /* !__x86_64__ */
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
{
unsigned long long __res = (unsigned long long) __X * __Y;
*__P = (unsigned int) (__res >> 32);
return (unsigned int) __res;
}
#endif /* !__x86_64__ */
#undef __DEFAULT_FN_ATTRS
#endif /* __BMI2INTRIN_H */

View File

@@ -1,113 +0,0 @@
/*===---- cetintrin.h - CET intrinsic --------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <cetintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __CETINTRIN_H
#define __CETINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("shstk")))
static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a) {
__builtin_ia32_incsspd(__a);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS _incsspq(unsigned long long __a) {
__builtin_ia32_incsspq(__a);
}
#endif /* __x86_64__ */
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
__builtin_ia32_incsspq(__a);
}
#else /* __x86_64__ */
static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
__builtin_ia32_incsspd((int)__a);
}
#endif /* __x86_64__ */
static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
return __builtin_ia32_rdsspd(__a);
}
#ifdef __x86_64__
static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
return __builtin_ia32_rdsspq(__a);
}
#endif /* __x86_64__ */
#ifdef __x86_64__
static __inline__ unsigned long long __DEFAULT_FN_ATTRS _get_ssp(void) {
return __builtin_ia32_rdsspq(0);
}
#else /* __x86_64__ */
static __inline__ unsigned int __DEFAULT_FN_ATTRS _get_ssp(void) {
return __builtin_ia32_rdsspd(0);
}
#endif /* __x86_64__ */
static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp() {
__builtin_ia32_saveprevssp();
}
static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void * __p) {
__builtin_ia32_rstorssp(__p);
}
static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void * __p) {
__builtin_ia32_wrssd(__a, __p);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS _wrssq(unsigned long long __a, void * __p) {
__builtin_ia32_wrssq(__a, __p);
}
#endif /* __x86_64__ */
static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void * __p) {
__builtin_ia32_wrussd(__a, __p);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS _wrussq(unsigned long long __a, void * __p) {
__builtin_ia32_wrussq(__a, __p);
}
#endif /* __x86_64__ */
static __inline__ void __DEFAULT_FN_ATTRS _setssbsy() {
__builtin_ia32_setssbsy();
}
static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void * __p) {
__builtin_ia32_clrssbsy(__p);
}
#undef __DEFAULT_FN_ATTRS
#endif /* __CETINTRIN_H */

View File

@@ -1,42 +0,0 @@
/*===---- cldemoteintrin.h - CLDEMOTE intrinsic ----------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <cldemoteintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __CLDEMOTEINTRIN_H
#define __CLDEMOTEINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("cldemote")))
static __inline__ void __DEFAULT_FN_ATTRS
_cldemote(const void * __P) {
__builtin_ia32_cldemote(__P);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,41 +0,0 @@
/*===---- clflushoptintrin.h - CLFLUSHOPT intrinsic ------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <clflushoptintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __CLFLUSHOPTINTRIN_H
#define __CLFLUSHOPTINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("clflushopt")))
static __inline__ void __DEFAULT_FN_ATTRS
_mm_clflushopt(void const * __m) {
__builtin_ia32_clflushopt(__m);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,52 +0,0 @@
/*===---- clwbintrin.h - CLWB intrinsic ------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <clwbintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __CLWBINTRIN_H
#define __CLWBINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("clwb")))
/// Writes back to memory the cache line (if modified) that contains the
/// linear address specified in \a __p from any level of the cache hierarchy in
/// the cache coherence domain
///
/// \headerfile <immintrin.h>
///
/// This intrinsic corresponds to the <c> CLWB </c> instruction.
///
/// \param __p
/// A pointer to the memory location used to identify the cache line to be
/// written back.
static __inline__ void __DEFAULT_FN_ATTRS
_mm_clwb(void const *__p) {
__builtin_ia32_clwb(__p);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,50 +0,0 @@
/*===----------------------- clzerointrin.h - CLZERO ----------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <clzerointrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __CLZEROINTRIN_H
#define __CLZEROINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("clzero")))
/// Loads the cache line address and zero's out the cacheline
///
/// \headerfile <clzerointrin.h>
///
/// This intrinsic corresponds to the <c> CLZERO </c> instruction.
///
/// \param __line
/// A pointer to a cacheline which needs to be zeroed out.
static __inline__ void __DEFAULT_FN_ATTRS
_mm_clzero (void * __line)
{
__builtin_ia32_clzero ((void *)__line);
}
#undef __DEFAULT_FN_ATTRS
#endif /* __CLZEROINTRIN_H */

View File

@@ -1,96 +0,0 @@
/*===---- complex - CUDA wrapper for <new> ------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __CLANG_CUDA_WRAPPERS_NEW
#define __CLANG_CUDA_WRAPPERS_NEW
#include_next <new>
#pragma push_macro("CUDA_NOEXCEPT")
#if __cplusplus >= 201103L
#define CUDA_NOEXCEPT noexcept
#else
#define CUDA_NOEXCEPT
#endif
// Device overrides for non-placement new and delete.
__device__ inline void *operator new(__SIZE_TYPE__ size) {
if (size == 0) {
size = 1;
}
return ::malloc(size);
}
__device__ inline void *operator new(__SIZE_TYPE__ size,
const std::nothrow_t &) CUDA_NOEXCEPT {
return ::operator new(size);
}
__device__ inline void *operator new[](__SIZE_TYPE__ size) {
return ::operator new(size);
}
__device__ inline void *operator new[](__SIZE_TYPE__ size,
const std::nothrow_t &) {
return ::operator new(size);
}
__device__ inline void operator delete(void* ptr) CUDA_NOEXCEPT {
if (ptr) {
::free(ptr);
}
}
__device__ inline void operator delete(void *ptr,
const std::nothrow_t &) CUDA_NOEXCEPT {
::operator delete(ptr);
}
__device__ inline void operator delete[](void* ptr) CUDA_NOEXCEPT {
::operator delete(ptr);
}
__device__ inline void operator delete[](void *ptr,
const std::nothrow_t &) CUDA_NOEXCEPT {
::operator delete(ptr);
}
// Sized delete, C++14 only.
#if __cplusplus >= 201402L
__device__ void operator delete(void *ptr, __SIZE_TYPE__ size) CUDA_NOEXCEPT {
::operator delete(ptr);
}
__device__ void operator delete[](void *ptr, __SIZE_TYPE__ size) CUDA_NOEXCEPT {
::operator delete(ptr);
}
#endif
// Device overrides for placement new and delete.
__device__ inline void *operator new(__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
return __ptr;
}
__device__ inline void *operator new[](__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
return __ptr;
}
__device__ inline void operator delete(void *, void *) CUDA_NOEXCEPT {}
__device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {}
#pragma pop_macro("CUDA_NOEXCEPT")
#endif // include guard

File diff suppressed because it is too large Load Diff

View File

@@ -1,160 +0,0 @@
/*===---- float.h - Characteristics of floating point types ----------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __FLOAT_H
#define __FLOAT_H
/* If we're on MinGW, fall back to the system's float.h, which might have
* additional definitions provided for Windows.
* For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
*
* Also fall back on Darwin to allow additional definitions and
* implementation-defined values.
*/
#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
__STDC_HOSTED__ && __has_include_next(<float.h>)
/* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
* of #include_next<float.h> to keep Metrowerks compilers happy. Avoid this
* extra indirection.
*/
#ifdef __APPLE__
#define _FLOAT_H_
#endif
# include_next <float.h>
/* Undefine anything that we'll be redefining below. */
# undef FLT_EVAL_METHOD
# undef FLT_ROUNDS
# undef FLT_RADIX
# undef FLT_MANT_DIG
# undef DBL_MANT_DIG
# undef LDBL_MANT_DIG
# if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
# undef DECIMAL_DIG
# endif
# undef FLT_DIG
# undef DBL_DIG
# undef LDBL_DIG
# undef FLT_MIN_EXP
# undef DBL_MIN_EXP
# undef LDBL_MIN_EXP
# undef FLT_MIN_10_EXP
# undef DBL_MIN_10_EXP
# undef LDBL_MIN_10_EXP
# undef FLT_MAX_EXP
# undef DBL_MAX_EXP
# undef LDBL_MAX_EXP
# undef FLT_MAX_10_EXP
# undef DBL_MAX_10_EXP
# undef LDBL_MAX_10_EXP
# undef FLT_MAX
# undef DBL_MAX
# undef LDBL_MAX
# undef FLT_EPSILON
# undef DBL_EPSILON
# undef LDBL_EPSILON
# undef FLT_MIN
# undef DBL_MIN
# undef LDBL_MIN
# if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
# undef FLT_TRUE_MIN
# undef DBL_TRUE_MIN
# undef LDBL_TRUE_MIN
# undef FLT_DECIMAL_DIG
# undef DBL_DECIMAL_DIG
# undef LDBL_DECIMAL_DIG
# endif
#endif
/* Characteristics of floating point types, C99 5.2.4.2.2 */
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#define FLT_ROUNDS (__builtin_flt_rounds())
#define FLT_RADIX __FLT_RADIX__
#define FLT_MANT_DIG __FLT_MANT_DIG__
#define DBL_MANT_DIG __DBL_MANT_DIG__
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
# define DECIMAL_DIG __DECIMAL_DIG__
#endif
#define FLT_DIG __FLT_DIG__
#define DBL_DIG __DBL_DIG__
#define LDBL_DIG __LDBL_DIG__
#define FLT_MIN_EXP __FLT_MIN_EXP__
#define DBL_MIN_EXP __DBL_MIN_EXP__
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
#define FLT_MAX_EXP __FLT_MAX_EXP__
#define DBL_MAX_EXP __DBL_MAX_EXP__
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
#define FLT_MAX __FLT_MAX__
#define DBL_MAX __DBL_MAX__
#define LDBL_MAX __LDBL_MAX__
#define FLT_EPSILON __FLT_EPSILON__
#define DBL_EPSILON __DBL_EPSILON__
#define LDBL_EPSILON __LDBL_EPSILON__
#define FLT_MIN __FLT_MIN__
#define DBL_MIN __DBL_MIN__
#define LDBL_MIN __LDBL_MIN__
#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
# define FLT_TRUE_MIN __FLT_DENORM_MIN__
# define DBL_TRUE_MIN __DBL_DENORM_MIN__
# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
#endif
#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
# define FLT16_MANT_DIG __FLT16_MANT_DIG__
# define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
# define FLT16_DIG __FLT16_DIG__
# define FLT16_MIN_EXP __FLT16_MIN_EXP__
# define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
# define FLT16_MAX_EXP __FLT16_MAX_EXP__
# define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
# define FLT16_MAX __FLT16_MAX__
# define FLT16_EPSILON __FLT16_EPSILON__
# define FLT16_MIN __FLT16_MIN__
# define FLT16_TRUE_MIN __FLT16_TRUE_MIN__
#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */
#endif /* __FLOAT_H */

View File

@@ -1,105 +0,0 @@
/*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __FXSRINTRIN_H
#define __FXSRINTRIN_H
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fxsr")))
/// Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
/// memory region pointed to by the input parameter \a __p.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> FXSAVE </c> instruction.
///
/// \param __p
/// A pointer to a 512-byte memory region. The beginning of this memory
/// region should be aligned on a 16-byte boundary.
static __inline__ void __DEFAULT_FN_ATTRS
_fxsave(void *__p)
{
__builtin_ia32_fxsave(__p);
}
/// Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
/// memory region pointed to by the input parameter \a __p. The contents of
/// this memory region should have been written to by a previous \c _fxsave
/// or \c _fxsave64 intrinsic.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> FXRSTOR </c> instruction.
///
/// \param __p
/// A pointer to a 512-byte memory region. The beginning of this memory
/// region should be aligned on a 16-byte boundary.
static __inline__ void __DEFAULT_FN_ATTRS
_fxrstor(void *__p)
{
__builtin_ia32_fxrstor(__p);
}
#ifdef __x86_64__
/// Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
/// memory region pointed to by the input parameter \a __p.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> FXSAVE64 </c> instruction.
///
/// \param __p
/// A pointer to a 512-byte memory region. The beginning of this memory
/// region should be aligned on a 16-byte boundary.
static __inline__ void __DEFAULT_FN_ATTRS
_fxsave64(void *__p)
{
__builtin_ia32_fxsave64(__p);
}
/// Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
/// memory region pointed to by the input parameter \a __p. The contents of
/// this memory region should have been written to by a previous \c _fxsave
/// or \c _fxsave64 intrinsic.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> FXRSTOR64 </c> instruction.
///
/// \param __p
/// A pointer to a 512-byte memory region. The beginning of this memory
/// region should be aligned on a 16-byte boundary.
static __inline__ void __DEFAULT_FN_ATTRS
_fxrstor64(void *__p)
{
__builtin_ia32_fxrstor64(__p);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,78 +0,0 @@
/* ===-------- ia32intrin.h ---------------------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __X86INTRIN_H
#error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __IA32INTRIN_H
#define __IA32INTRIN_H
#ifdef __x86_64__
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
__readeflags(void)
{
return __builtin_ia32_readeflags_u64();
}
static __inline__ void __attribute__((__always_inline__, __nodebug__))
__writeeflags(unsigned long long __f)
{
__builtin_ia32_writeeflags_u64(__f);
}
#else /* !__x86_64__ */
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
__readeflags(void)
{
return __builtin_ia32_readeflags_u32();
}
static __inline__ void __attribute__((__always_inline__, __nodebug__))
__writeeflags(unsigned int __f)
{
__builtin_ia32_writeeflags_u32(__f);
}
#endif /* !__x86_64__ */
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
__rdpmc(int __A) {
return __builtin_ia32_rdpmc(__A);
}
/* __rdtscp */
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
__rdtscp(unsigned int *__A) {
return __builtin_ia32_rdtscp(__A);
}
#define _rdtsc() __rdtsc()
#define _rdpmc(A) __rdpmc(A)
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_wbinvd(void) {
__builtin_ia32_wbinvd();
}
#endif /* __IA32INTRIN_H */

View File

@@ -1,905 +0,0 @@
/* ===-------- intrin.h ---------------------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
/* Only include this if we're compiling for the windows platform. */
#ifndef _MSC_VER
#include_next <intrin.h>
#else
#ifndef __INTRIN_H
#define __INTRIN_H
/* First include the standard intrinsics. */
#if defined(__i386__) || defined(__x86_64__)
#include <x86intrin.h>
#endif
#if defined(__arm__)
#include <armintr.h>
#endif
#if defined(__aarch64__)
#include <arm64intr.h>
#endif
/* For the definition of jmp_buf. */
#if __STDC_HOSTED__
#include <setjmp.h>
#endif
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__MMX__)
/* And the random ones that aren't in those files. */
__m64 _m_from_float(float);
float _m_to_float(__m64);
#endif
/* Other assorted instruction intrinsics. */
void __addfsbyte(unsigned long, unsigned char);
void __addfsdword(unsigned long, unsigned long);
void __addfsword(unsigned long, unsigned short);
void __code_seg(const char *);
static __inline__
void __cpuid(int[4], int);
static __inline__
void __cpuidex(int[4], int, int);
static __inline__
__int64 __emul(int, int);
static __inline__
unsigned __int64 __emulu(unsigned int, unsigned int);
unsigned int __getcallerseflags(void);
static __inline__
void __halt(void);
unsigned char __inbyte(unsigned short);
void __inbytestring(unsigned short, unsigned char *, unsigned long);
void __incfsbyte(unsigned long);
void __incfsdword(unsigned long);
void __incfsword(unsigned long);
unsigned long __indword(unsigned short);
void __indwordstring(unsigned short, unsigned long *, unsigned long);
void __int2c(void);
void __invlpg(void *);
unsigned short __inword(unsigned short);
void __inwordstring(unsigned short, unsigned short *, unsigned long);
void __lidt(void *);
unsigned __int64 __ll_lshift(unsigned __int64, int);
__int64 __ll_rshift(__int64, int);
unsigned int __lzcnt(unsigned int);
unsigned short __lzcnt16(unsigned short);
static __inline__
void __movsb(unsigned char *, unsigned char const *, size_t);
static __inline__
void __movsd(unsigned long *, unsigned long const *, size_t);
static __inline__
void __movsw(unsigned short *, unsigned short const *, size_t);
static __inline__
void __nop(void);
void __nvreg_restore_fence(void);
void __nvreg_save_fence(void);
void __outbyte(unsigned short, unsigned char);
void __outbytestring(unsigned short, unsigned char *, unsigned long);
void __outdword(unsigned short, unsigned long);
void __outdwordstring(unsigned short, unsigned long *, unsigned long);
void __outword(unsigned short, unsigned short);
void __outwordstring(unsigned short, unsigned short *, unsigned long);
unsigned long __readcr0(void);
unsigned long __readcr2(void);
static __inline__
unsigned long __readcr3(void);
unsigned long __readcr4(void);
unsigned long __readcr8(void);
unsigned int __readdr(unsigned int);
#ifdef __i386__
static __inline__
unsigned char __readfsbyte(unsigned long);
static __inline__
unsigned __int64 __readfsqword(unsigned long);
static __inline__
unsigned short __readfsword(unsigned long);
#endif
static __inline__
unsigned __int64 __readmsr(unsigned long);
unsigned __int64 __readpmc(unsigned long);
unsigned long __segmentlimit(unsigned long);
void __sidt(void *);
static __inline__
void __stosb(unsigned char *, unsigned char, size_t);
static __inline__
void __stosd(unsigned long *, unsigned long, size_t);
static __inline__
void __stosw(unsigned short *, unsigned short, size_t);
void __svm_clgi(void);
void __svm_invlpga(void *, int);
void __svm_skinit(int);
void __svm_stgi(void);
void __svm_vmload(size_t);
void __svm_vmrun(size_t);
void __svm_vmsave(size_t);
void __ud2(void);
unsigned __int64 __ull_rshift(unsigned __int64, int);
void __vmx_off(void);
void __vmx_vmptrst(unsigned __int64 *);
void __wbinvd(void);
void __writecr0(unsigned int);
static __inline__
void __writecr3(unsigned int);
void __writecr4(unsigned int);
void __writecr8(unsigned int);
void __writedr(unsigned int, unsigned int);
void __writefsbyte(unsigned long, unsigned char);
void __writefsdword(unsigned long, unsigned long);
void __writefsqword(unsigned long, unsigned __int64);
void __writefsword(unsigned long, unsigned short);
void __writemsr(unsigned long, unsigned __int64);
static __inline__
void *_AddressOfReturnAddress(void);
static __inline__
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask);
static __inline__
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask);
unsigned char _bittest(long const *, long);
unsigned char _bittestandcomplement(long *, long);
unsigned char _bittestandreset(long *, long);
unsigned char _bittestandset(long *, long);
void __cdecl _disable(void);
void __cdecl _enable(void);
long _InterlockedAddLargeStatistic(__int64 volatile *_Addend, long _Value);
unsigned char _interlockedbittestandreset(long volatile *, long);
unsigned char _interlockedbittestandset(long volatile *, long);
void *_InterlockedCompareExchangePointer_HLEAcquire(void *volatile *, void *,
void *);
void *_InterlockedCompareExchangePointer_HLERelease(void *volatile *, void *,
void *);
long _InterlockedExchangeAdd_HLEAcquire(long volatile *, long);
long _InterlockedExchangeAdd_HLERelease(long volatile *, long);
__int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64);
__int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64);
void __cdecl _invpcid(unsigned int, void *);
static __inline__ void
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
_ReadBarrier(void);
static __inline__ void
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
_ReadWriteBarrier(void);
unsigned int _rorx_u32(unsigned int, const unsigned int);
int _sarx_i32(int, unsigned int);
#if __STDC_HOSTED__
int __cdecl _setjmp(jmp_buf);
#endif
unsigned int _shlx_u32(unsigned int, unsigned int);
unsigned int _shrx_u32(unsigned int, unsigned int);
void _Store_HLERelease(long volatile *, long);
void _Store64_HLERelease(__int64 volatile *, __int64);
void _StorePointer_HLERelease(void *volatile *, void *);
static __inline__ void
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
_WriteBarrier(void);
unsigned __int32 xbegin(void);
void _xend(void);
static __inline__
#define _XCR_XFEATURE_ENABLED_MASK 0
unsigned __int64 __cdecl _xgetbv(unsigned int);
void __cdecl _xsetbv(unsigned int, unsigned __int64);
/* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */
#ifdef __x86_64__
void __addgsbyte(unsigned long, unsigned char);
void __addgsdword(unsigned long, unsigned long);
void __addgsqword(unsigned long, unsigned __int64);
void __addgsword(unsigned long, unsigned short);
static __inline__
void __faststorefence(void);
void __incgsbyte(unsigned long);
void __incgsdword(unsigned long);
void __incgsqword(unsigned long);
void __incgsword(unsigned long);
unsigned __int64 __lzcnt64(unsigned __int64);
static __inline__
void __movsq(unsigned long long *, unsigned long long const *, size_t);
static __inline__
unsigned char __readgsbyte(unsigned long);
static __inline__
unsigned long __readgsdword(unsigned long);
static __inline__
unsigned __int64 __readgsqword(unsigned long);
unsigned short __readgsword(unsigned long);
unsigned __int64 __shiftleft128(unsigned __int64 _LowPart,
unsigned __int64 _HighPart,
unsigned char _Shift);
unsigned __int64 __shiftright128(unsigned __int64 _LowPart,
unsigned __int64 _HighPart,
unsigned char _Shift);
static __inline__
void __stosq(unsigned __int64 *, unsigned __int64, size_t);
unsigned char __vmx_on(unsigned __int64 *);
unsigned char __vmx_vmclear(unsigned __int64 *);
unsigned char __vmx_vmlaunch(void);
unsigned char __vmx_vmptrld(unsigned __int64 *);
unsigned char __vmx_vmread(size_t, size_t *);
unsigned char __vmx_vmresume(void);
unsigned char __vmx_vmwrite(size_t, size_t);
void __writegsbyte(unsigned long, unsigned char);
void __writegsdword(unsigned long, unsigned long);
void __writegsqword(unsigned long, unsigned __int64);
void __writegsword(unsigned long, unsigned short);
unsigned char _bittest64(__int64 const *, __int64);
unsigned char _bittestandcomplement64(__int64 *, __int64);
unsigned char _bittestandreset64(__int64 *, __int64);
unsigned char _bittestandset64(__int64 *, __int64);
long _InterlockedAnd_np(long volatile *_Value, long _Mask);
short _InterlockedAnd16_np(short volatile *_Value, short _Mask);
__int64 _InterlockedAnd64_np(__int64 volatile *_Value, __int64 _Mask);
char _InterlockedAnd8_np(char volatile *_Value, char _Mask);
unsigned char _interlockedbittestandreset64(__int64 volatile *, __int64);
unsigned char _interlockedbittestandset64(__int64 volatile *, __int64);
long _InterlockedCompareExchange_np(long volatile *_Destination, long _Exchange,
long _Comparand);
unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination,
__int64 _ExchangeHigh,
__int64 _ExchangeLow,
__int64 *_CompareandResult);
unsigned char _InterlockedCompareExchange128_np(__int64 volatile *_Destination,
__int64 _ExchangeHigh,
__int64 _ExchangeLow,
__int64 *_ComparandResult);
short _InterlockedCompareExchange16_np(short volatile *_Destination,
short _Exchange, short _Comparand);
__int64 _InterlockedCompareExchange64_np(__int64 volatile *_Destination,
__int64 _Exchange, __int64 _Comparand);
void *_InterlockedCompareExchangePointer_np(void *volatile *_Destination,
void *_Exchange, void *_Comparand);
long _InterlockedOr_np(long volatile *_Value, long _Mask);
short _InterlockedOr16_np(short volatile *_Value, short _Mask);
__int64 _InterlockedOr64_np(__int64 volatile *_Value, __int64 _Mask);
char _InterlockedOr8_np(char volatile *_Value, char _Mask);
long _InterlockedXor_np(long volatile *_Value, long _Mask);
short _InterlockedXor16_np(short volatile *_Value, short _Mask);
__int64 _InterlockedXor64_np(__int64 volatile *_Value, __int64 _Mask);
char _InterlockedXor8_np(char volatile *_Value, char _Mask);
unsigned __int64 _rorx_u64(unsigned __int64, const unsigned int);
__int64 _sarx_i64(__int64, unsigned int);
unsigned __int64 _shlx_u64(unsigned __int64, unsigned int);
unsigned __int64 _shrx_u64(unsigned __int64, unsigned int);
static __inline__
__int64 __mulh(__int64, __int64);
static __inline__
unsigned __int64 __umulh(unsigned __int64, unsigned __int64);
static __inline__
__int64 _mul128(__int64, __int64, __int64*);
static __inline__
unsigned __int64 _umul128(unsigned __int64,
unsigned __int64,
unsigned __int64*);
#endif /* __x86_64__ */
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
static __inline__
unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask);
static __inline__
unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask);
static __inline__
__int64 _InterlockedDecrement64(__int64 volatile *_Addend);
static __inline__
__int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value);
static __inline__
__int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value);
static __inline__
__int64 _InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value);
static __inline__
__int64 _InterlockedIncrement64(__int64 volatile *_Addend);
static __inline__
__int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask);
static __inline__
__int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask);
static __inline__
__int64 _InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask);
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Exchange Add
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd8_acq(char volatile *_Addend, char _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd8_nf(char volatile *_Addend, char _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd8_rel(char volatile *_Addend, char _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd16_acq(short volatile *_Addend, short _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd16_nf(short volatile *_Addend, short _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd16_rel(short volatile *_Addend, short _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELEASE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd_acq(long volatile *_Addend, long _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd_nf(long volatile *_Addend, long _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd_rel(long volatile *_Addend, long _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELEASE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd64_acq(__int64 volatile *_Addend, __int64 _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd64_nf(__int64 volatile *_Addend, __int64 _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedExchangeAdd64_rel(__int64 volatile *_Addend, __int64 _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELEASE);
}
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Increment
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedIncrement16_acq(short volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_ACQUIRE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedIncrement16_nf(short volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedIncrement16_rel(short volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_RELEASE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedIncrement_acq(long volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_ACQUIRE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedIncrement_nf(long volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_RELAXED);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedIncrement_rel(long volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_RELEASE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedIncrement64_acq(__int64 volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_ACQUIRE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedIncrement64_nf(__int64 volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_RELAXED);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedIncrement64_rel(__int64 volatile *_Value) {
return __atomic_add_fetch(_Value, 1, __ATOMIC_RELEASE);
}
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Decrement
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedDecrement16_acq(short volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_ACQUIRE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedDecrement16_nf(short volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedDecrement16_rel(short volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_RELEASE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedDecrement_acq(long volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_ACQUIRE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedDecrement_nf(long volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_RELAXED);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedDecrement_rel(long volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_RELEASE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedDecrement64_acq(__int64 volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_ACQUIRE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedDecrement64_nf(__int64 volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_RELAXED);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedDecrement64_rel(__int64 volatile *_Value) {
return __atomic_sub_fetch(_Value, 1, __ATOMIC_RELEASE);
}
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked And
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedAnd8_acq(char volatile *_Value, char _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedAnd8_nf(char volatile *_Value, char _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedAnd8_rel(char volatile *_Value, char _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedAnd16_acq(short volatile *_Value, short _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedAnd16_nf(short volatile *_Value, short _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedAnd16_rel(short volatile *_Value, short _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedAnd_acq(long volatile *_Value, long _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedAnd_nf(long volatile *_Value, long _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedAnd_rel(long volatile *_Value, long _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedAnd64_acq(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedAnd64_nf(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedAnd64_rel(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_RELEASE);
}
#endif
/*----------------------------------------------------------------------------*\
|* Bit Counting and Testing
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
unsigned char _interlockedbittestandset_acq(long volatile *_BitBase,
long _BitPos);
unsigned char _interlockedbittestandset_nf(long volatile *_BitBase,
long _BitPos);
unsigned char _interlockedbittestandset_rel(long volatile *_BitBase,
long _BitPos);
unsigned char _interlockedbittestandreset_acq(long volatile *_BitBase,
long _BitPos);
unsigned char _interlockedbittestandreset_nf(long volatile *_BitBase,
long _BitPos);
unsigned char _interlockedbittestandreset_rel(long volatile *_BitBase,
long _BitPos);
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Or
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedOr8_acq(char volatile *_Value, char _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedOr8_nf(char volatile *_Value, char _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedOr8_rel(char volatile *_Value, char _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedOr16_acq(short volatile *_Value, short _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedOr16_nf(short volatile *_Value, short _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedOr16_rel(short volatile *_Value, short _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedOr_acq(long volatile *_Value, long _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedOr_nf(long volatile *_Value, long _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedOr_rel(long volatile *_Value, long _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedOr64_acq(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedOr64_nf(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedOr64_rel(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_RELEASE);
}
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Xor
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedXor8_acq(char volatile *_Value, char _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedXor8_nf(char volatile *_Value, char _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedXor8_rel(char volatile *_Value, char _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedXor16_acq(short volatile *_Value, short _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedXor16_nf(short volatile *_Value, short _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedXor16_rel(short volatile *_Value, short _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedXor_acq(long volatile *_Value, long _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedXor_nf(long volatile *_Value, long _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedXor_rel(long volatile *_Value, long _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELEASE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedXor64_acq(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_ACQUIRE);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedXor64_nf(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELAXED);
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedXor64_rel(__int64 volatile *_Value, __int64 _Mask) {
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_RELEASE);
}
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Exchange
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedExchange8_acq(char volatile *_Target, char _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_ACQUIRE);
return _Value;
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedExchange8_nf(char volatile *_Target, char _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELAXED);
return _Value;
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedExchange8_rel(char volatile *_Target, char _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELEASE);
return _Value;
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedExchange16_acq(short volatile *_Target, short _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_ACQUIRE);
return _Value;
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedExchange16_nf(short volatile *_Target, short _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELAXED);
return _Value;
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedExchange16_rel(short volatile *_Target, short _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELEASE);
return _Value;
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedExchange_acq(long volatile *_Target, long _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_ACQUIRE);
return _Value;
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedExchange_nf(long volatile *_Target, long _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELAXED);
return _Value;
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedExchange_rel(long volatile *_Target, long _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELEASE);
return _Value;
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedExchange64_acq(__int64 volatile *_Target, __int64 _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_ACQUIRE);
return _Value;
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedExchange64_nf(__int64 volatile *_Target, __int64 _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELAXED);
return _Value;
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedExchange64_rel(__int64 volatile *_Target, __int64 _Value) {
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_RELEASE);
return _Value;
}
#endif
/*----------------------------------------------------------------------------*\
|* Interlocked Compare Exchange
\*----------------------------------------------------------------------------*/
#if defined(__arm__) || defined(__aarch64__)
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedCompareExchange8_acq(char volatile *_Destination,
char _Exchange, char _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
return _Comparand;
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedCompareExchange8_nf(char volatile *_Destination,
char _Exchange, char _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
return _Comparand;
}
static __inline__ char __DEFAULT_FN_ATTRS
_InterlockedCompareExchange8_rel(char volatile *_Destination,
char _Exchange, char _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
return _Comparand;
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedCompareExchange16_acq(short volatile *_Destination,
short _Exchange, short _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
return _Comparand;
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedCompareExchange16_nf(short volatile *_Destination,
short _Exchange, short _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
return _Comparand;
}
static __inline__ short __DEFAULT_FN_ATTRS
_InterlockedCompareExchange16_rel(short volatile *_Destination,
short _Exchange, short _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
return _Comparand;
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedCompareExchange_acq(long volatile *_Destination,
long _Exchange, long _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
return _Comparand;
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedCompareExchange_nf(long volatile *_Destination,
long _Exchange, long _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
return _Comparand;
}
static __inline__ long __DEFAULT_FN_ATTRS
_InterlockedCompareExchange_rel(long volatile *_Destination,
long _Exchange, long _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
return _Comparand;
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedCompareExchange64_acq(__int64 volatile *_Destination,
__int64 _Exchange, __int64 _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
return _Comparand;
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedCompareExchange64_nf(__int64 volatile *_Destination,
__int64 _Exchange, __int64 _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
return _Comparand;
}
static __inline__ __int64 __DEFAULT_FN_ATTRS
_InterlockedCompareExchange64_rel(__int64 volatile *_Destination,
__int64 _Exchange, __int64 _Comparand) {
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
return _Comparand;
}
#endif
/*----------------------------------------------------------------------------*\
|* movs, stos
\*----------------------------------------------------------------------------*/
#if defined(__i386__) || defined(__x86_64__)
static __inline__ void __DEFAULT_FN_ATTRS
__movsb(unsigned char *__dst, unsigned char const *__src, size_t __n) {
__asm__ __volatile__("rep movsb" : "+D"(__dst), "+S"(__src), "+c"(__n)
: : "memory");
}
static __inline__ void __DEFAULT_FN_ATTRS
__movsd(unsigned long *__dst, unsigned long const *__src, size_t __n) {
__asm__ __volatile__("rep movsl" : "+D"(__dst), "+S"(__src), "+c"(__n)
: : "memory");
}
static __inline__ void __DEFAULT_FN_ATTRS
__movsw(unsigned short *__dst, unsigned short const *__src, size_t __n) {
__asm__ __volatile__("rep movsw" : "+D"(__dst), "+S"(__src), "+c"(__n)
: : "memory");
}
static __inline__ void __DEFAULT_FN_ATTRS
__stosd(unsigned long *__dst, unsigned long __x, size_t __n) {
__asm__ __volatile__("rep stosl" : "+D"(__dst), "+c"(__n) : "a"(__x)
: "memory");
}
static __inline__ void __DEFAULT_FN_ATTRS
__stosw(unsigned short *__dst, unsigned short __x, size_t __n) {
__asm__ __volatile__("rep stosw" : "+D"(__dst), "+c"(__n) : "a"(__x)
: "memory");
}
#endif
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS
__movsq(unsigned long long *__dst, unsigned long long const *__src, size_t __n) {
__asm__ __volatile__("rep movsq" : "+D"(__dst), "+S"(__src), "+c"(__n)
: : "memory");
}
static __inline__ void __DEFAULT_FN_ATTRS
__stosq(unsigned __int64 *__dst, unsigned __int64 __x, size_t __n) {
__asm__ __volatile__("rep stosq" : "+D"(__dst), "+c"(__n) : "a"(__x)
: "memory");
}
#endif
/*----------------------------------------------------------------------------*\
|* Misc
\*----------------------------------------------------------------------------*/
#if defined(__i386__) || defined(__x86_64__)
static __inline__ void __DEFAULT_FN_ATTRS
__cpuid(int __info[4], int __level) {
__asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
: "a"(__level));
}
static __inline__ void __DEFAULT_FN_ATTRS
__cpuidex(int __info[4], int __level, int __ecx) {
__asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
: "a"(__level), "c"(__ecx));
}
static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS
_xgetbv(unsigned int __xcr_no) {
unsigned int __eax, __edx;
__asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no));
return ((unsigned __int64)__edx << 32) | __eax;
}
static __inline__ void __DEFAULT_FN_ATTRS
__halt(void) {
__asm__ volatile ("hlt");
}
static __inline__ void __DEFAULT_FN_ATTRS
__nop(void) {
__asm__ volatile ("nop");
}
#endif
/*----------------------------------------------------------------------------*\
|* Privileged intrinsics
\*----------------------------------------------------------------------------*/
#if defined(__i386__) || defined(__x86_64__)
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
__readmsr(unsigned long __register) {
// Loads the contents of a 64-bit model specific register (MSR) specified in
// the ECX register into registers EDX:EAX. The EDX register is loaded with
// the high-order 32 bits of the MSR and the EAX register is loaded with the
// low-order 32 bits. If less than 64 bits are implemented in the MSR being
// read, the values returned to EDX:EAX in unimplemented bit locations are
// undefined.
unsigned long __edx;
unsigned long __eax;
__asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register));
return (((unsigned __int64)__edx) << 32) | (unsigned __int64)__eax;
}
static __inline__ unsigned long __DEFAULT_FN_ATTRS
__readcr3(void) {
unsigned long __cr3_val;
__asm__ __volatile__ ("mov %%cr3, %0" : "=q"(__cr3_val) : : "memory");
return __cr3_val;
}
static __inline__ void __DEFAULT_FN_ATTRS
__writecr3(unsigned int __cr3_val) {
__asm__ ("mov %0, %%cr3" : : "q"(__cr3_val) : "memory");
}
#endif
#ifdef __cplusplus
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif /* __INTRIN_H */
#endif /* _MSC_VER */

View File

@@ -1,106 +0,0 @@
/*===---- inttypes.h - Standard header for integer printf macros ----------===*\
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
\*===----------------------------------------------------------------------===*/
#ifndef __CLANG_INTTYPES_H
#define __CLANG_INTTYPES_H
#if defined(_MSC_VER) && _MSC_VER < 1800
#error MSVC does not have inttypes.h prior to Visual Studio 2013
#endif
#include_next <inttypes.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
/* MSVC headers define int32_t as int, but PRIx32 as "lx" instead of "x".
* This triggers format warnings, so fix it up here. */
#undef PRId32
#undef PRIdLEAST32
#undef PRIdFAST32
#undef PRIi32
#undef PRIiLEAST32
#undef PRIiFAST32
#undef PRIo32
#undef PRIoLEAST32
#undef PRIoFAST32
#undef PRIu32
#undef PRIuLEAST32
#undef PRIuFAST32
#undef PRIx32
#undef PRIxLEAST32
#undef PRIxFAST32
#undef PRIX32
#undef PRIXLEAST32
#undef PRIXFAST32
#undef SCNd32
#undef SCNdLEAST32
#undef SCNdFAST32
#undef SCNi32
#undef SCNiLEAST32
#undef SCNiFAST32
#undef SCNo32
#undef SCNoLEAST32
#undef SCNoFAST32
#undef SCNu32
#undef SCNuLEAST32
#undef SCNuFAST32
#undef SCNx32
#undef SCNxLEAST32
#undef SCNxFAST32
#define PRId32 "d"
#define PRIdLEAST32 "d"
#define PRIdFAST32 "d"
#define PRIi32 "i"
#define PRIiLEAST32 "i"
#define PRIiFAST32 "i"
#define PRIo32 "o"
#define PRIoLEAST32 "o"
#define PRIoFAST32 "o"
#define PRIu32 "u"
#define PRIuLEAST32 "u"
#define PRIuFAST32 "u"
#define PRIx32 "x"
#define PRIxLEAST32 "x"
#define PRIxFAST32 "x"
#define PRIX32 "X"
#define PRIXLEAST32 "X"
#define PRIXFAST32 "X"
#define SCNd32 "d"
#define SCNdLEAST32 "d"
#define SCNdFAST32 "d"
#define SCNi32 "i"
#define SCNiLEAST32 "i"
#define SCNiFAST32 "i"
#define SCNo32 "o"
#define SCNoLEAST32 "o"
#define SCNoFAST32 "o"
#define SCNu32 "u"
#define SCNuLEAST32 "u"
#define SCNuFAST32 "u"
#define SCNx32 "x"
#define SCNxLEAST32 "x"
#define SCNxFAST32 "x"
#endif
#endif /* __CLANG_INTTYPES_H */

View File

@@ -1,37 +0,0 @@
/*===------------- invpcidintrin.h - INVPCID intrinsic ---------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <invpcidintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __INVPCIDINTRIN_H
#define __INVPCIDINTRIN_H
static __inline__ void
__attribute__((__always_inline__, __nodebug__, __target__("invpcid")))
_invpcid(unsigned int __type, void *__descriptor) {
__builtin_ia32_invpcid(__type, __descriptor);
}
#endif /* __INVPCIDINTRIN_H */

View File

@@ -1,43 +0,0 @@
/*===---- iso646.h - Standard header for alternate spellings of operators---===
*
* Copyright (c) 2008 Eli Friedman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __ISO646_H
#define __ISO646_H
#ifndef __cplusplus
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
#endif
#endif /* __ISO646_H */

View File

@@ -1,118 +0,0 @@
/*===---- limits.h - Standard header for integer sizes --------------------===*\
*
* Copyright (c) 2009 Chris Lattner
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
\*===----------------------------------------------------------------------===*/
#ifndef __CLANG_LIMITS_H
#define __CLANG_LIMITS_H
/* The system's limits.h may, in turn, try to #include_next GCC's limits.h.
Avert this #include_next madness. */
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
#define _GCC_LIMITS_H_
#endif
/* System headers include a number of constants from POSIX in <limits.h>.
Include it if we're hosted. */
#if __STDC_HOSTED__ && __has_include_next(<limits.h>)
#include_next <limits.h>
#endif
/* Many system headers try to "help us out" by defining these. No really, we
know how big each datatype is. */
#undef SCHAR_MIN
#undef SCHAR_MAX
#undef UCHAR_MAX
#undef SHRT_MIN
#undef SHRT_MAX
#undef USHRT_MAX
#undef INT_MIN
#undef INT_MAX
#undef UINT_MAX
#undef LONG_MIN
#undef LONG_MAX
#undef ULONG_MAX
#undef CHAR_BIT
#undef CHAR_MIN
#undef CHAR_MAX
/* C90/99 5.2.4.2.1 */
#define SCHAR_MAX __SCHAR_MAX__
#define SHRT_MAX __SHRT_MAX__
#define INT_MAX __INT_MAX__
#define LONG_MAX __LONG_MAX__
#define SCHAR_MIN (-__SCHAR_MAX__-1)
#define SHRT_MIN (-__SHRT_MAX__ -1)
#define INT_MIN (-__INT_MAX__ -1)
#define LONG_MIN (-__LONG_MAX__ -1L)
#define UCHAR_MAX (__SCHAR_MAX__*2 +1)
#define USHRT_MAX (__SHRT_MAX__ *2 +1)
#define UINT_MAX (__INT_MAX__ *2U +1U)
#define ULONG_MAX (__LONG_MAX__ *2UL+1UL)
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 1
#endif
#define CHAR_BIT __CHAR_BIT__
#ifdef __CHAR_UNSIGNED__ /* -funsigned-char */
#define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX
#else
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX __SCHAR_MAX__
#endif
/* C99 5.2.4.2.1: Added long long.
C++11 18.3.3.2: same contents as the Standard C Library header <limits.h>.
*/
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
#undef LLONG_MIN
#undef LLONG_MAX
#undef ULLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__
#define LLONG_MIN (-__LONG_LONG_MAX__-1LL)
#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
#endif
/* LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX are a GNU extension. It's too bad
that we don't have something like #pragma poison that could be used to
deprecate a macro - the code should just use LLONG_MAX and friends.
*/
#if defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)
#undef LONG_LONG_MIN
#undef LONG_LONG_MAX
#undef ULONG_LONG_MAX
#define LONG_LONG_MAX __LONG_LONG_MAX__
#define LONG_LONG_MIN (-__LONG_LONG_MAX__-1LL)
#define ULONG_LONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
#endif
#endif /* __CLANG_LIMITS_H */

View File

@@ -1,122 +0,0 @@
/*===---- lzcntintrin.h - LZCNT intrinsics ---------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __LZCNTINTRIN_H
#define __LZCNTINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("lzcnt")))
/// Counts the number of leading zero bits in the operand.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c LZCNT instruction.
///
/// \param __X
/// An unsigned 16-bit integer whose leading zeros are to be counted.
/// \returns An unsigned 16-bit integer containing the number of leading zero
/// bits in the operand.
static __inline__ unsigned short __DEFAULT_FN_ATTRS
__lzcnt16(unsigned short __X)
{
return __X ? __builtin_clzs(__X) : 16;
}
/// Counts the number of leading zero bits in the operand.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c LZCNT instruction.
///
/// \param __X
/// An unsigned 32-bit integer whose leading zeros are to be counted.
/// \returns An unsigned 32-bit integer containing the number of leading zero
/// bits in the operand.
/// \see _lzcnt_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__lzcnt32(unsigned int __X)
{
return __X ? __builtin_clz(__X) : 32;
}
/// Counts the number of leading zero bits in the operand.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c LZCNT instruction.
///
/// \param __X
/// An unsigned 32-bit integer whose leading zeros are to be counted.
/// \returns An unsigned 32-bit integer containing the number of leading zero
/// bits in the operand.
/// \see __lzcnt32
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_lzcnt_u32(unsigned int __X)
{
return __X ? __builtin_clz(__X) : 32;
}
#ifdef __x86_64__
/// Counts the number of leading zero bits in the operand.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c LZCNT instruction.
///
/// \param __X
/// An unsigned 64-bit integer whose leading zeros are to be counted.
/// \returns An unsigned 64-bit integer containing the number of leading zero
/// bits in the operand.
/// \see _lzcnt_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__lzcnt64(unsigned long long __X)
{
return __X ? __builtin_clzll(__X) : 64;
}
/// Counts the number of leading zero bits in the operand.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c LZCNT instruction.
///
/// \param __X
/// An unsigned 64-bit integer whose leading zeros are to be counted.
/// \returns An unsigned 64-bit integer containing the number of leading zero
/// bits in the operand.
/// \see __lzcnt64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
_lzcnt_u64(unsigned long long __X)
{
return __X ? __builtin_clzll(__X) : 64;
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif /* __LZCNTINTRIN_H */

View File

@@ -1,75 +0,0 @@
/*===---- mm_malloc.h - Allocating and Freeing Aligned Memory Blocks -------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __MM_MALLOC_H
#define __MM_MALLOC_H
#include <stdlib.h>
#ifdef _WIN32
#include <malloc.h>
#else
#ifndef __cplusplus
extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
#else
// Some systems (e.g. those with GNU libc) declare posix_memalign with an
// exception specifier. Via an "egregious workaround" in
// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
// redeclaration of glibc's declaration.
extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
#endif
#endif
#if !(defined(_WIN32) && defined(_mm_malloc))
static __inline__ void *__attribute__((__always_inline__, __nodebug__,
__malloc__))
_mm_malloc(size_t __size, size_t __align)
{
if (__align == 1) {
return malloc(__size);
}
if (!(__align & (__align - 1)) && __align < sizeof(void *))
__align = sizeof(void *);
void *__mallocedMemory;
#if defined(__MINGW32__)
__mallocedMemory = __mingw_aligned_malloc(__size, __align);
#elif defined(_WIN32)
__mallocedMemory = _aligned_malloc(__size, __align);
#else
if (posix_memalign(&__mallocedMemory, __align, __size))
return 0;
#endif
return __mallocedMemory;
}
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_mm_free(void *__p)
{
free(__p);
}
#endif
#endif /* __MM_MALLOC_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,171 +0,0 @@
/*===---- module.modulemap - intrinsics module map -------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
module _Builtin_intrinsics [system] [extern_c] {
explicit module altivec {
requires altivec
header "altivec.h"
}
explicit module arm {
requires arm
explicit module acle {
header "arm_acle.h"
export *
}
explicit module neon {
requires neon
header "arm_neon.h"
header "arm_fp16.h"
export *
}
}
explicit module intel {
requires x86
export *
header "immintrin.h"
textual header "f16cintrin.h"
textual header "avxintrin.h"
textual header "avx2intrin.h"
textual header "avx512fintrin.h"
textual header "avx512erintrin.h"
textual header "fmaintrin.h"
header "x86intrin.h"
textual header "bmiintrin.h"
textual header "bmi2intrin.h"
textual header "lzcntintrin.h"
textual header "xopintrin.h"
textual header "fma4intrin.h"
textual header "mwaitxintrin.h"
textual header "clzerointrin.h"
textual header "wbnoinvdintrin.h"
textual header "cldemoteintrin.h"
textual header "waitpkgintrin.h"
textual header "movdirintrin.h"
textual header "pconfigintrin.h"
textual header "sgxintrin.h"
textual header "ptwriteintrin.h"
textual header "invpcidintrin.h"
textual header "__wmmintrin_aes.h"
textual header "__wmmintrin_pclmul.h"
explicit module mm_malloc {
requires !freestanding
header "mm_malloc.h"
export * // note: for <stdlib.h> dependency
}
explicit module cpuid {
requires gnuinlineasm
header "cpuid.h"
}
explicit module mmx {
header "mmintrin.h"
}
explicit module sse {
export mm_malloc
export mmx
export sse2 // note: for hackish <emmintrin.h> dependency
header "xmmintrin.h"
}
explicit module sse2 {
export sse
header "emmintrin.h"
}
explicit module sse3 {
export sse2
header "pmmintrin.h"
}
explicit module ssse3 {
export sse3
header "tmmintrin.h"
}
explicit module sse4_1 {
export ssse3
header "smmintrin.h"
}
explicit module sse4_2 {
export sse4_1
header "nmmintrin.h"
}
explicit module sse4a {
export sse3
header "ammintrin.h"
}
explicit module popcnt {
header "popcntintrin.h"
}
explicit module mm3dnow {
header "mm3dnow.h"
}
explicit module aes_pclmul {
header "wmmintrin.h"
export aes
export pclmul
}
}
explicit module systemz {
requires systemz
export *
header "s390intrin.h"
explicit module htm {
requires htm
header "htmintrin.h"
header "htmxlintrin.h"
}
explicit module zvector {
requires zvector, vx
header "vecintrin.h"
}
}
}
module _Builtin_stddef_max_align_t [system] [extern_c] {
header "__stddef_max_align_t.h"
}
module opencl_c {
requires opencl
header "opencl-c.h"
}

View File

@@ -1,63 +0,0 @@
/*===------------------------- movdirintrin.h ------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <movdirintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef _MOVDIRINTRIN_H
#define _MOVDIRINTRIN_H
/* Move doubleword as direct store */
static __inline__ void
__attribute__((__always_inline__, __nodebug__, __target__("movdiri")))
_directstoreu_u32 (void *__dst, unsigned int __value)
{
__builtin_ia32_directstore_u32((unsigned int *)__dst, (unsigned int)__value);
}
#ifdef __x86_64__
/* Move quadword as direct store */
static __inline__ void
__attribute__((__always_inline__, __nodebug__, __target__("movdiri")))
_directstoreu_u64 (void *__dst, unsigned long __value)
{
__builtin_ia32_directstore_u64((unsigned long *)__dst, __value);
}
#endif /* __x86_64__ */
/*
* movdir64b - Move 64 bytes as direct store.
* The destination must be 64 byte aligned, and the store is atomic.
* The source address has no alignment requirement, and the load from
* the source address is not atomic.
*/
static __inline__ void
__attribute__((__always_inline__, __nodebug__, __target__("movdir64b")))
_movdir64b (void *__dst __attribute__((align_value(64))), const void *__src)
{
__builtin_ia32_movdir64b(__dst, __src);
}
#endif /* _MOVDIRINTRIN_H */

View File

@@ -1,47 +0,0 @@
/*===---- mwaitxintrin.h - MONITORX/MWAITX intrinsics ----------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __X86INTRIN_H
#error "Never use <mwaitxintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __MWAITXINTRIN_H
#define __MWAITXINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mwaitx")))
static __inline__ void __DEFAULT_FN_ATTRS
_mm_monitorx(void const * __p, unsigned __extensions, unsigned __hints)
{
__builtin_ia32_monitorx((void *)__p, __extensions, __hints);
}
static __inline__ void __DEFAULT_FN_ATTRS
_mm_mwaitx(unsigned __extensions, unsigned __hints, unsigned __clock)
{
__builtin_ia32_mwaitx(__extensions, __hints, __clock);
}
#undef __DEFAULT_FN_ATTRS
#endif /* __MWAITXINTRIN_H */

View File

@@ -1,30 +0,0 @@
/*===---- nmmintrin.h - SSE4 intrinsics ------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __NMMINTRIN_H
#define __NMMINTRIN_H
/* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h,
just include it now then. */
#include <smmintrin.h>
#endif /* __NMMINTRIN_H */

View File

@@ -1,50 +0,0 @@
/*===---- pconfigintrin.h - X86 platform configuration ---------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <pconfigintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __PCONFIGINTRIN_H
#define __PCONFIGINTRIN_H
#define __PCONFIG_KEY_PROGRAM 0x00000001
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("pconfig")))
static __inline unsigned int __DEFAULT_FN_ATTRS
_pconfig_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
{
unsigned int __result;
__asm__ ("pconfig"
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
: "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
: "cc");
return __result;
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,48 +0,0 @@
/*===---- pkuintrin.h - PKU intrinsics -------------------------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <pkuintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __PKUINTRIN_H
#define __PKUINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("pku")))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_rdpkru_u32(void)
{
return __builtin_ia32_rdpkru();
}
static __inline__ void __DEFAULT_FN_ATTRS
_wrpkru(unsigned int __val)
{
__builtin_ia32_wrpkru(__val);
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,98 +0,0 @@
/*===---- popcntintrin.h - POPCNT intrinsics -------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __POPCNTINTRIN_H
#define __POPCNTINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
/// Counts the number of bits in the source operand having a value of 1.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> POPCNT </c> instruction.
///
/// \param __A
/// An unsigned 32-bit integer operand.
/// \returns A 32-bit integer containing the number of bits with value 1 in the
/// source operand.
static __inline__ int __DEFAULT_FN_ATTRS
_mm_popcnt_u32(unsigned int __A)
{
return __builtin_popcount(__A);
}
/// Counts the number of bits in the source operand having a value of 1.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> POPCNT </c> instruction.
///
/// \param __A
/// A signed 32-bit integer operand.
/// \returns A 32-bit integer containing the number of bits with value 1 in the
/// source operand.
static __inline__ int __DEFAULT_FN_ATTRS
_popcnt32(int __A)
{
return __builtin_popcount(__A);
}
#ifdef __x86_64__
/// Counts the number of bits in the source operand having a value of 1.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> POPCNT </c> instruction.
///
/// \param __A
/// An unsigned 64-bit integer operand.
/// \returns A 64-bit integer containing the number of bits with value 1 in the
/// source operand.
static __inline__ long long __DEFAULT_FN_ATTRS
_mm_popcnt_u64(unsigned long long __A)
{
return __builtin_popcountll(__A);
}
/// Counts the number of bits in the source operand having a value of 1.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the <c> POPCNT </c> instruction.
///
/// \param __A
/// A signed 64-bit integer operand.
/// \returns A 64-bit integer containing the number of bits with value 1 in the
/// source operand.
static __inline__ long long __DEFAULT_FN_ATTRS
_popcnt64(long long __A)
{
return __builtin_popcountll(__A);
}
#endif /* __x86_64__ */
#undef __DEFAULT_FN_ATTRS
#endif /* __POPCNTINTRIN_H */

View File

@@ -1,69 +0,0 @@
/*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined(__X86INTRIN_H) && !defined(_MM3DNOW_H_INCLUDED)
#error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead."
#endif
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
/// Loads a memory sequence containing the specified memory address into
/// all data cache levels. The cache-coherency state is set to exclusive.
/// Data can be read from and written to the cache line without additional
/// delay.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c PREFETCHT0 instruction.
///
/// \param __P
/// A pointer specifying the memory address to be prefetched.
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetch(void *__P)
{
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
}
/// Loads a memory sequence containing the specified memory address into
/// the L1 data cache and sets the cache-coherency to modified. This
/// provides a hint to the processor that the cache line will be modified.
/// It is intended for use when the cache line will be written to shortly
/// after the prefetch is performed.
///
/// Note that the effect of this intrinsic is dependent on the processor
/// implementation.
///
/// \headerfile <x86intrin.h>
///
/// This intrinsic corresponds to the \c PREFETCHW instruction.
///
/// \param __P
/// A pointer specifying the memory address to be prefetched.
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetchw(void *__P)
{
__builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
}
#endif /* __PRFCHWINTRIN_H */

View File

@@ -1,51 +0,0 @@
/*===------------ ptwriteintrin.h - PTWRITE intrinsic --------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <ptwriteintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __PTWRITEINTRIN_H
#define __PTWRITEINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("ptwrite")))
static __inline__ void __DEFAULT_FN_ATTRS
_ptwrite32(unsigned int __value) {
__builtin_ia32_ptwrite32(__value);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS
_ptwrite64(unsigned long long __value) {
__builtin_ia32_ptwrite64(__value);
}
#endif /* __x86_64__ */
#undef __DEFAULT_FN_ATTRS
#endif /* __PTWRITEINTRIN_H */

View File

@@ -1,56 +0,0 @@
/*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __RDSEEDINTRIN_H
#define __RDSEEDINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rdseed")))
static __inline__ int __DEFAULT_FN_ATTRS
_rdseed16_step(unsigned short *__p)
{
return __builtin_ia32_rdseed16_step(__p);
}
static __inline__ int __DEFAULT_FN_ATTRS
_rdseed32_step(unsigned int *__p)
{
return __builtin_ia32_rdseed32_step(__p);
}
#ifdef __x86_64__
static __inline__ int __DEFAULT_FN_ATTRS
_rdseed64_step(unsigned long long *__p)
{
return __builtin_ia32_rdseed64_step(__p);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif /* __RDSEEDINTRIN_H */

View File

@@ -1,59 +0,0 @@
/*===---- rtmintrin.h - RTM intrinsics -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __RTMINTRIN_H
#define __RTMINTRIN_H
#define _XBEGIN_STARTED (~0u)
#define _XABORT_EXPLICIT (1 << 0)
#define _XABORT_RETRY (1 << 1)
#define _XABORT_CONFLICT (1 << 2)
#define _XABORT_CAPACITY (1 << 3)
#define _XABORT_DEBUG (1 << 4)
#define _XABORT_NESTED (1 << 5)
#define _XABORT_CODE(x) (((x) >> 24) & 0xFF)
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rtm")))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_xbegin(void)
{
return __builtin_ia32_xbegin();
}
static __inline__ void __DEFAULT_FN_ATTRS
_xend(void)
{
__builtin_ia32_xend();
}
#define _xabort(imm) __builtin_ia32_xabort((imm))
#undef __DEFAULT_FN_ATTRS
#endif /* __RTMINTRIN_H */

View File

@@ -1,39 +0,0 @@
/*===---- s390intrin.h - SystemZ intrinsics --------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __S390INTRIN_H
#define __S390INTRIN_H
#ifndef __s390__
#error "<s390intrin.h> is for s390 only"
#endif
#ifdef __HTM__
#include <htmintrin.h>
#endif
#ifdef __VEC__
#include <vecintrin.h>
#endif
#endif /* __S390INTRIN_H*/

View File

@@ -1,70 +0,0 @@
/*===---- sgxintrin.h - X86 SGX intrinsics configuration -------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <sgxintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __SGXINTRIN_H
#define __SGXINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("sgx")))
static __inline unsigned int __DEFAULT_FN_ATTRS
_enclu_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
{
unsigned int __result;
__asm__ ("enclu"
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
: "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
: "cc");
return __result;
}
static __inline unsigned int __DEFAULT_FN_ATTRS
_encls_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
{
unsigned int __result;
__asm__ ("encls"
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
: "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
: "cc");
return __result;
}
static __inline unsigned int __DEFAULT_FN_ATTRS
_enclv_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
{
unsigned int __result;
__asm__ ("enclv"
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
: "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
: "cc");
return __result;
}
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,75 +0,0 @@
/*===---- shaintrin.h - SHA intrinsics -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __SHAINTRIN_H
#define __SHAINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sha"), __min_vector_width__(128)))
#define _mm_sha1rnds4_epu32(V1, V2, M) \
__builtin_ia32_sha1rnds4((__v4si)(__m128i)(V1), (__v4si)(__m128i)(V2), (M))
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_sha1nexte_epu32(__m128i __X, __m128i __Y)
{
return (__m128i)__builtin_ia32_sha1nexte((__v4si)__X, (__v4si)__Y);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_sha1msg1_epu32(__m128i __X, __m128i __Y)
{
return (__m128i)__builtin_ia32_sha1msg1((__v4si)__X, (__v4si)__Y);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_sha1msg2_epu32(__m128i __X, __m128i __Y)
{
return (__m128i)__builtin_ia32_sha1msg2((__v4si)__X, (__v4si)__Y);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_sha256rnds2_epu32(__m128i __X, __m128i __Y, __m128i __Z)
{
return (__m128i)__builtin_ia32_sha256rnds2((__v4si)__X, (__v4si)__Y, (__v4si)__Z);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_sha256msg1_epu32(__m128i __X, __m128i __Y)
{
return (__m128i)__builtin_ia32_sha256msg1((__v4si)__X, (__v4si)__Y);
}
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_sha256msg2_epu32(__m128i __X, __m128i __Y)
{
return (__m128i)__builtin_ia32_sha256msg2((__v4si)__X, (__v4si)__Y);
}
#undef __DEFAULT_FN_ATTRS
#endif /* __SHAINTRIN_H */

View File

@@ -1,35 +0,0 @@
/*===---- stdalign.h - Standard header for alignment ------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __STDALIGN_H
#define __STDALIGN_H
#ifndef __cplusplus
#define alignas _Alignas
#define alignof _Alignof
#endif
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#endif /* __STDALIGN_H */

View File

@@ -1,51 +0,0 @@
/*===---- stdarg.h - Variable argument handling ----------------------------===
*
* Copyright (c) 2008 Eli Friedman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __STDARG_H
#define __STDARG_H
#ifndef _VA_LIST
typedef __builtin_va_list va_list;
#define _VA_LIST
#endif
#define va_start(ap, param) __builtin_va_start(ap, param)
#define va_end(ap) __builtin_va_end(ap)
#define va_arg(ap, type) __builtin_va_arg(ap, type)
/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
* or -ansi is not specified, since it was not part of C90.
*/
#define __va_copy(d,s) __builtin_va_copy(d,s)
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__)
#define va_copy(dest, src) __builtin_va_copy(dest, src)
#endif
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST 1
typedef __builtin_va_list __gnuc_va_list;
#endif
#endif /* __STDARG_H */

View File

@@ -1,47 +0,0 @@
/*===---- stdbool.h - Standard header for booleans -------------------------===
*
* Copyright (c) 2008 Eli Friedman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __STDBOOL_H
#define __STDBOOL_H
/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Define _Bool as a GNU extension. */
#define _Bool bool
#if __cplusplus < 201103L
/* For C++98, define bool, false, true as a GNU extension. */
#define bool bool
#define false false
#define true true
#endif
#endif
#define __bool_true_false_are_defined 1
#endif /* __STDBOOL_H */

View File

@@ -1,137 +0,0 @@
/*===---- stddef.h - Basic type definitions --------------------------------===
*
* Copyright (c) 2008 Eli Friedman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined(__STDDEF_H) || defined(__need_ptrdiff_t) || \
defined(__need_size_t) || defined(__need_wchar_t) || \
defined(__need_NULL) || defined(__need_wint_t)
#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \
!defined(__need_wchar_t) && !defined(__need_NULL) && \
!defined(__need_wint_t)
/* Always define miscellaneous pieces when modules are available. */
#if !__has_feature(modules)
#define __STDDEF_H
#endif
#define __need_ptrdiff_t
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#define __need_STDDEF_H_misc
/* __need_wint_t is intentionally not defined here. */
#endif
#if defined(__need_ptrdiff_t)
#if !defined(_PTRDIFF_T) || __has_feature(modules)
/* Always define ptrdiff_t when modules are available. */
#if !__has_feature(modules)
#define _PTRDIFF_T
#endif
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#endif
#undef __need_ptrdiff_t
#endif /* defined(__need_ptrdiff_t) */
#if defined(__need_size_t)
#if !defined(_SIZE_T) || __has_feature(modules)
/* Always define size_t when modules are available. */
#if !__has_feature(modules)
#define _SIZE_T
#endif
typedef __SIZE_TYPE__ size_t;
#endif
#undef __need_size_t
#endif /*defined(__need_size_t) */
#if defined(__need_STDDEF_H_misc)
/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
* enabled. */
#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
!defined(_RSIZE_T)) || __has_feature(modules)
/* Always define rsize_t when modules are available. */
#if !__has_feature(modules)
#define _RSIZE_T
#endif
typedef __SIZE_TYPE__ rsize_t;
#endif
#endif /* defined(__need_STDDEF_H_misc) */
#if defined(__need_wchar_t)
#ifndef __cplusplus
/* Always define wchar_t when modules are available. */
#if !defined(_WCHAR_T) || __has_feature(modules)
#if !__has_feature(modules)
#define _WCHAR_T
#if defined(_MSC_EXTENSIONS)
#define _WCHAR_T_DEFINED
#endif
#endif
typedef __WCHAR_TYPE__ wchar_t;
#endif
#endif
#undef __need_wchar_t
#endif /* defined(__need_wchar_t) */
#if defined(__need_NULL)
#undef NULL
#ifdef __cplusplus
# if !defined(__MINGW32__) && !defined(_MSC_VER)
# define NULL __null
# else
# define NULL 0
# endif
#else
# define NULL ((void*)0)
#endif
#ifdef __cplusplus
#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
namespace std { typedef decltype(nullptr) nullptr_t; }
using ::std::nullptr_t;
#endif
#endif
#undef __need_NULL
#endif /* defined(__need_NULL) */
#if defined(__need_STDDEF_H_misc)
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
#include "__stddef_max_align_t.h"
#endif
#define offsetof(t, d) __builtin_offsetof(t, d)
#undef __need_STDDEF_H_misc
#endif /* defined(__need_STDDEF_H_misc) */
/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
#if defined(__need_wint_t)
/* Always define wint_t when modules are available. */
#if !defined(_WINT_T) || __has_feature(modules)
#if !__has_feature(modules)
#define _WINT_T
#endif
typedef __WINT_TYPE__ wint_t;
#endif
#undef __need_wint_t
#endif /* __need_wint_t */
#endif

View File

@@ -1,704 +0,0 @@
/*===---- stdint.h - Standard header for sized integer types --------------===*\
*
* Copyright (c) 2009 Chris Lattner
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
\*===----------------------------------------------------------------------===*/
#ifndef __CLANG_STDINT_H
#define __CLANG_STDINT_H
/* If we're hosted, fall back to the system's stdint.h, which might have
* additional definitions.
*/
#if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
// C99 7.18.3 Limits of other integer types
//
// Footnote 219, 220: C++ implementations should define these macros only when
// __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
//
// Footnote 222: C++ implementations should define these macros only when
// __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
//
// C++11 [cstdint.syn]p2:
//
// The macros defined by <cstdint> are provided unconditionally. In particular,
// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
// footnotes 219, 220, and 222 in the C standard) play no role in C++.
//
// C11 removed the problematic footnotes.
//
// Work around this inconsistency by always defining those macros in C++ mode,
// so that a C library implementation which follows the C99 standard can be
// used in C++.
# ifdef __cplusplus
# if !defined(__STDC_LIMIT_MACROS)
# define __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
# endif
# if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
# endif
# endif
# include_next <stdint.h>
# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
# undef __STDC_LIMIT_MACROS
# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
# endif
# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
# undef __STDC_CONSTANT_MACROS
# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
# endif
#else
/* C99 7.18.1.1 Exact-width integer types.
* C99 7.18.1.2 Minimum-width integer types.
* C99 7.18.1.3 Fastest minimum-width integer types.
*
* The standard requires that exact-width type be defined for 8-, 16-, 32-, and
* 64-bit types if they are implemented. Other exact width types are optional.
* This implementation defines an exact-width types for every integer width
* that is represented in the standard integer types.
*
* The standard also requires minimum-width types be defined for 8-, 16-, 32-,
* and 64-bit widths regardless of whether there are corresponding exact-width
* types.
*
* To accommodate targets that are missing types that are exactly 8, 16, 32, or
* 64 bits wide, this implementation takes an approach of cascading
* redefinitions, redefining __int_leastN_t to successively smaller exact-width
* types. It is therefore important that the types are defined in order of
* descending widths.
*
* We currently assume that the minimum-width types and the fastest
* minimum-width types are the same. This is allowed by the standard, but is
* suboptimal.
*
* In violation of the standard, some targets do not implement a type that is
* wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit).
* To accommodate these targets, a required minimum-width type is only
* defined if there exists an exact-width type of equal or greater width.
*/
#ifdef __INT64_TYPE__
# ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/
typedef __INT64_TYPE__ int64_t;
# endif /* __int8_t_defined */
typedef __UINT64_TYPE__ uint64_t;
# define __int_least64_t int64_t
# define __uint_least64_t uint64_t
# define __int_least32_t int64_t
# define __uint_least32_t uint64_t
# define __int_least16_t int64_t
# define __uint_least16_t uint64_t
# define __int_least8_t int64_t
# define __uint_least8_t uint64_t
#endif /* __INT64_TYPE__ */
#ifdef __int_least64_t
typedef __int_least64_t int_least64_t;
typedef __uint_least64_t uint_least64_t;
typedef __int_least64_t int_fast64_t;
typedef __uint_least64_t uint_fast64_t;
#endif /* __int_least64_t */
#ifdef __INT56_TYPE__
typedef __INT56_TYPE__ int56_t;
typedef __UINT56_TYPE__ uint56_t;
typedef int56_t int_least56_t;
typedef uint56_t uint_least56_t;
typedef int56_t int_fast56_t;
typedef uint56_t uint_fast56_t;
# define __int_least32_t int56_t
# define __uint_least32_t uint56_t
# define __int_least16_t int56_t
# define __uint_least16_t uint56_t
# define __int_least8_t int56_t
# define __uint_least8_t uint56_t
#endif /* __INT56_TYPE__ */
#ifdef __INT48_TYPE__
typedef __INT48_TYPE__ int48_t;
typedef __UINT48_TYPE__ uint48_t;
typedef int48_t int_least48_t;
typedef uint48_t uint_least48_t;
typedef int48_t int_fast48_t;
typedef uint48_t uint_fast48_t;
# define __int_least32_t int48_t
# define __uint_least32_t uint48_t
# define __int_least16_t int48_t
# define __uint_least16_t uint48_t
# define __int_least8_t int48_t
# define __uint_least8_t uint48_t
#endif /* __INT48_TYPE__ */
#ifdef __INT40_TYPE__
typedef __INT40_TYPE__ int40_t;
typedef __UINT40_TYPE__ uint40_t;
typedef int40_t int_least40_t;
typedef uint40_t uint_least40_t;
typedef int40_t int_fast40_t;
typedef uint40_t uint_fast40_t;
# define __int_least32_t int40_t
# define __uint_least32_t uint40_t
# define __int_least16_t int40_t
# define __uint_least16_t uint40_t
# define __int_least8_t int40_t
# define __uint_least8_t uint40_t
#endif /* __INT40_TYPE__ */
#ifdef __INT32_TYPE__
# ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/
typedef __INT32_TYPE__ int32_t;
# endif /* __int8_t_defined */
# ifndef __uint32_t_defined /* more glibc compatibility */
# define __uint32_t_defined
typedef __UINT32_TYPE__ uint32_t;
# endif /* __uint32_t_defined */
# define __int_least32_t int32_t
# define __uint_least32_t uint32_t
# define __int_least16_t int32_t
# define __uint_least16_t uint32_t
# define __int_least8_t int32_t
# define __uint_least8_t uint32_t
#endif /* __INT32_TYPE__ */
#ifdef __int_least32_t
typedef __int_least32_t int_least32_t;
typedef __uint_least32_t uint_least32_t;
typedef __int_least32_t int_fast32_t;
typedef __uint_least32_t uint_fast32_t;
#endif /* __int_least32_t */
#ifdef __INT24_TYPE__
typedef __INT24_TYPE__ int24_t;
typedef __UINT24_TYPE__ uint24_t;
typedef int24_t int_least24_t;
typedef uint24_t uint_least24_t;
typedef int24_t int_fast24_t;
typedef uint24_t uint_fast24_t;
# define __int_least16_t int24_t
# define __uint_least16_t uint24_t
# define __int_least8_t int24_t
# define __uint_least8_t uint24_t
#endif /* __INT24_TYPE__ */
#ifdef __INT16_TYPE__
#ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/
typedef __INT16_TYPE__ int16_t;
#endif /* __int8_t_defined */
typedef __UINT16_TYPE__ uint16_t;
# define __int_least16_t int16_t
# define __uint_least16_t uint16_t
# define __int_least8_t int16_t
# define __uint_least8_t uint16_t
#endif /* __INT16_TYPE__ */
#ifdef __int_least16_t
typedef __int_least16_t int_least16_t;
typedef __uint_least16_t uint_least16_t;
typedef __int_least16_t int_fast16_t;
typedef __uint_least16_t uint_fast16_t;
#endif /* __int_least16_t */
#ifdef __INT8_TYPE__
#ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/
typedef __INT8_TYPE__ int8_t;
#endif /* __int8_t_defined */
typedef __UINT8_TYPE__ uint8_t;
# define __int_least8_t int8_t
# define __uint_least8_t uint8_t
#endif /* __INT8_TYPE__ */
#ifdef __int_least8_t
typedef __int_least8_t int_least8_t;
typedef __uint_least8_t uint_least8_t;
typedef __int_least8_t int_fast8_t;
typedef __uint_least8_t uint_fast8_t;
#endif /* __int_least8_t */
/* prevent glibc sys/types.h from defining conflicting types */
#ifndef __int8_t_defined
# define __int8_t_defined
#endif /* __int8_t_defined */
/* C99 7.18.1.4 Integer types capable of holding object pointers.
*/
#define __stdint_join3(a,b,c) a ## b ## c
#ifndef _INTPTR_T
#ifndef __intptr_t_defined
typedef __INTPTR_TYPE__ intptr_t;
#define __intptr_t_defined
#define _INTPTR_T
#endif
#endif
#ifndef _UINTPTR_T
typedef __UINTPTR_TYPE__ uintptr_t;
#define _UINTPTR_T
#endif
/* C99 7.18.1.5 Greatest-width integer types.
*/
typedef __INTMAX_TYPE__ intmax_t;
typedef __UINTMAX_TYPE__ uintmax_t;
/* C99 7.18.4 Macros for minimum-width integer constants.
*
* The standard requires that integer constant macros be defined for all the
* minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width
* types are required, the corresponding integer constant macros are defined
* here. This implementation also defines minimum-width types for every other
* integer width that the target implements, so corresponding macros are
* defined below, too.
*
* These macros are defined using the same successive-shrinking approach as
* the type definitions above. It is likewise important that macros are defined
* in order of decending width.
*
* Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
*/
#define __int_c_join(a, b) a ## b
#define __int_c(v, suffix) __int_c_join(v, suffix)
#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
#ifdef __INT64_TYPE__
# ifdef __INT64_C_SUFFIX__
# define __int64_c_suffix __INT64_C_SUFFIX__
# define __int32_c_suffix __INT64_C_SUFFIX__
# define __int16_c_suffix __INT64_C_SUFFIX__
# define __int8_c_suffix __INT64_C_SUFFIX__
# else
# undef __int64_c_suffix
# undef __int32_c_suffix
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT64_C_SUFFIX__ */
#endif /* __INT64_TYPE__ */
#ifdef __int_least64_t
# ifdef __int64_c_suffix
# define INT64_C(v) __int_c(v, __int64_c_suffix)
# define UINT64_C(v) __uint_c(v, __int64_c_suffix)
# else
# define INT64_C(v) v
# define UINT64_C(v) v ## U
# endif /* __int64_c_suffix */
#endif /* __int_least64_t */
#ifdef __INT56_TYPE__
# ifdef __INT56_C_SUFFIX__
# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
# define __int32_c_suffix __INT56_C_SUFFIX__
# define __int16_c_suffix __INT56_C_SUFFIX__
# define __int8_c_suffix __INT56_C_SUFFIX__
# else
# define INT56_C(v) v
# define UINT56_C(v) v ## U
# undef __int32_c_suffix
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT56_C_SUFFIX__ */
#endif /* __INT56_TYPE__ */
#ifdef __INT48_TYPE__
# ifdef __INT48_C_SUFFIX__
# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
# define __int32_c_suffix __INT48_C_SUFFIX__
# define __int16_c_suffix __INT48_C_SUFFIX__
# define __int8_c_suffix __INT48_C_SUFFIX__
# else
# define INT48_C(v) v
# define UINT48_C(v) v ## U
# undef __int32_c_suffix
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT48_C_SUFFIX__ */
#endif /* __INT48_TYPE__ */
#ifdef __INT40_TYPE__
# ifdef __INT40_C_SUFFIX__
# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
# define __int32_c_suffix __INT40_C_SUFFIX__
# define __int16_c_suffix __INT40_C_SUFFIX__
# define __int8_c_suffix __INT40_C_SUFFIX__
# else
# define INT40_C(v) v
# define UINT40_C(v) v ## U
# undef __int32_c_suffix
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT40_C_SUFFIX__ */
#endif /* __INT40_TYPE__ */
#ifdef __INT32_TYPE__
# ifdef __INT32_C_SUFFIX__
# define __int32_c_suffix __INT32_C_SUFFIX__
# define __int16_c_suffix __INT32_C_SUFFIX__
# define __int8_c_suffix __INT32_C_SUFFIX__
#else
# undef __int32_c_suffix
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT32_C_SUFFIX__ */
#endif /* __INT32_TYPE__ */
#ifdef __int_least32_t
# ifdef __int32_c_suffix
# define INT32_C(v) __int_c(v, __int32_c_suffix)
# define UINT32_C(v) __uint_c(v, __int32_c_suffix)
# else
# define INT32_C(v) v
# define UINT32_C(v) v ## U
# endif /* __int32_c_suffix */
#endif /* __int_least32_t */
#ifdef __INT24_TYPE__
# ifdef __INT24_C_SUFFIX__
# define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
# define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
# define __int16_c_suffix __INT24_C_SUFFIX__
# define __int8_c_suffix __INT24_C_SUFFIX__
# else
# define INT24_C(v) v
# define UINT24_C(v) v ## U
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT24_C_SUFFIX__ */
#endif /* __INT24_TYPE__ */
#ifdef __INT16_TYPE__
# ifdef __INT16_C_SUFFIX__
# define __int16_c_suffix __INT16_C_SUFFIX__
# define __int8_c_suffix __INT16_C_SUFFIX__
#else
# undef __int16_c_suffix
# undef __int8_c_suffix
# endif /* __INT16_C_SUFFIX__ */
#endif /* __INT16_TYPE__ */
#ifdef __int_least16_t
# ifdef __int16_c_suffix
# define INT16_C(v) __int_c(v, __int16_c_suffix)
# define UINT16_C(v) __uint_c(v, __int16_c_suffix)
# else
# define INT16_C(v) v
# define UINT16_C(v) v ## U
# endif /* __int16_c_suffix */
#endif /* __int_least16_t */
#ifdef __INT8_TYPE__
# ifdef __INT8_C_SUFFIX__
# define __int8_c_suffix __INT8_C_SUFFIX__
#else
# undef __int8_c_suffix
# endif /* __INT8_C_SUFFIX__ */
#endif /* __INT8_TYPE__ */
#ifdef __int_least8_t
# ifdef __int8_c_suffix
# define INT8_C(v) __int_c(v, __int8_c_suffix)
# define UINT8_C(v) __uint_c(v, __int8_c_suffix)
# else
# define INT8_C(v) v
# define UINT8_C(v) v ## U
# endif /* __int8_c_suffix */
#endif /* __int_least8_t */
/* C99 7.18.2.1 Limits of exact-width integer types.
* C99 7.18.2.2 Limits of minimum-width integer types.
* C99 7.18.2.3 Limits of fastest minimum-width integer types.
*
* The presence of limit macros are completely optional in C99. This
* implementation defines limits for all of the types (exact- and
* minimum-width) that it defines above, using the limits of the minimum-width
* type for any types that do not have exact-width representations.
*
* As in the type definitions, this section takes an approach of
* successive-shrinking to determine which limits to use for the standard (8,
* 16, 32, 64) bit widths when they don't have exact representations. It is
* therefore important that the definitions be kept in order of decending
* widths.
*
* Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
*/
#ifdef __INT64_TYPE__
# define INT64_MAX INT64_C( 9223372036854775807)
# define INT64_MIN (-INT64_C( 9223372036854775807)-1)
# define UINT64_MAX UINT64_C(18446744073709551615)
# define __INT_LEAST64_MIN INT64_MIN
# define __INT_LEAST64_MAX INT64_MAX
# define __UINT_LEAST64_MAX UINT64_MAX
# define __INT_LEAST32_MIN INT64_MIN
# define __INT_LEAST32_MAX INT64_MAX
# define __UINT_LEAST32_MAX UINT64_MAX
# define __INT_LEAST16_MIN INT64_MIN
# define __INT_LEAST16_MAX INT64_MAX
# define __UINT_LEAST16_MAX UINT64_MAX
# define __INT_LEAST8_MIN INT64_MIN
# define __INT_LEAST8_MAX INT64_MAX
# define __UINT_LEAST8_MAX UINT64_MAX
#endif /* __INT64_TYPE__ */
#ifdef __INT_LEAST64_MIN
# define INT_LEAST64_MIN __INT_LEAST64_MIN
# define INT_LEAST64_MAX __INT_LEAST64_MAX
# define UINT_LEAST64_MAX __UINT_LEAST64_MAX
# define INT_FAST64_MIN __INT_LEAST64_MIN
# define INT_FAST64_MAX __INT_LEAST64_MAX
# define UINT_FAST64_MAX __UINT_LEAST64_MAX
#endif /* __INT_LEAST64_MIN */
#ifdef __INT56_TYPE__
# define INT56_MAX INT56_C(36028797018963967)
# define INT56_MIN (-INT56_C(36028797018963967)-1)
# define UINT56_MAX UINT56_C(72057594037927935)
# define INT_LEAST56_MIN INT56_MIN
# define INT_LEAST56_MAX INT56_MAX
# define UINT_LEAST56_MAX UINT56_MAX
# define INT_FAST56_MIN INT56_MIN
# define INT_FAST56_MAX INT56_MAX
# define UINT_FAST56_MAX UINT56_MAX
# define __INT_LEAST32_MIN INT56_MIN
# define __INT_LEAST32_MAX INT56_MAX
# define __UINT_LEAST32_MAX UINT56_MAX
# define __INT_LEAST16_MIN INT56_MIN
# define __INT_LEAST16_MAX INT56_MAX
# define __UINT_LEAST16_MAX UINT56_MAX
# define __INT_LEAST8_MIN INT56_MIN
# define __INT_LEAST8_MAX INT56_MAX
# define __UINT_LEAST8_MAX UINT56_MAX
#endif /* __INT56_TYPE__ */
#ifdef __INT48_TYPE__
# define INT48_MAX INT48_C(140737488355327)
# define INT48_MIN (-INT48_C(140737488355327)-1)
# define UINT48_MAX UINT48_C(281474976710655)
# define INT_LEAST48_MIN INT48_MIN
# define INT_LEAST48_MAX INT48_MAX
# define UINT_LEAST48_MAX UINT48_MAX
# define INT_FAST48_MIN INT48_MIN
# define INT_FAST48_MAX INT48_MAX
# define UINT_FAST48_MAX UINT48_MAX
# define __INT_LEAST32_MIN INT48_MIN
# define __INT_LEAST32_MAX INT48_MAX
# define __UINT_LEAST32_MAX UINT48_MAX
# define __INT_LEAST16_MIN INT48_MIN
# define __INT_LEAST16_MAX INT48_MAX
# define __UINT_LEAST16_MAX UINT48_MAX
# define __INT_LEAST8_MIN INT48_MIN
# define __INT_LEAST8_MAX INT48_MAX
# define __UINT_LEAST8_MAX UINT48_MAX
#endif /* __INT48_TYPE__ */
#ifdef __INT40_TYPE__
# define INT40_MAX INT40_C(549755813887)
# define INT40_MIN (-INT40_C(549755813887)-1)
# define UINT40_MAX UINT40_C(1099511627775)
# define INT_LEAST40_MIN INT40_MIN
# define INT_LEAST40_MAX INT40_MAX
# define UINT_LEAST40_MAX UINT40_MAX
# define INT_FAST40_MIN INT40_MIN
# define INT_FAST40_MAX INT40_MAX
# define UINT_FAST40_MAX UINT40_MAX
# define __INT_LEAST32_MIN INT40_MIN
# define __INT_LEAST32_MAX INT40_MAX
# define __UINT_LEAST32_MAX UINT40_MAX
# define __INT_LEAST16_MIN INT40_MIN
# define __INT_LEAST16_MAX INT40_MAX
# define __UINT_LEAST16_MAX UINT40_MAX
# define __INT_LEAST8_MIN INT40_MIN
# define __INT_LEAST8_MAX INT40_MAX
# define __UINT_LEAST8_MAX UINT40_MAX
#endif /* __INT40_TYPE__ */
#ifdef __INT32_TYPE__
# define INT32_MAX INT32_C(2147483647)
# define INT32_MIN (-INT32_C(2147483647)-1)
# define UINT32_MAX UINT32_C(4294967295)
# define __INT_LEAST32_MIN INT32_MIN
# define __INT_LEAST32_MAX INT32_MAX
# define __UINT_LEAST32_MAX UINT32_MAX
# define __INT_LEAST16_MIN INT32_MIN
# define __INT_LEAST16_MAX INT32_MAX
# define __UINT_LEAST16_MAX UINT32_MAX
# define __INT_LEAST8_MIN INT32_MIN
# define __INT_LEAST8_MAX INT32_MAX
# define __UINT_LEAST8_MAX UINT32_MAX
#endif /* __INT32_TYPE__ */
#ifdef __INT_LEAST32_MIN
# define INT_LEAST32_MIN __INT_LEAST32_MIN
# define INT_LEAST32_MAX __INT_LEAST32_MAX
# define UINT_LEAST32_MAX __UINT_LEAST32_MAX
# define INT_FAST32_MIN __INT_LEAST32_MIN
# define INT_FAST32_MAX __INT_LEAST32_MAX
# define UINT_FAST32_MAX __UINT_LEAST32_MAX
#endif /* __INT_LEAST32_MIN */
#ifdef __INT24_TYPE__
# define INT24_MAX INT24_C(8388607)
# define INT24_MIN (-INT24_C(8388607)-1)
# define UINT24_MAX UINT24_C(16777215)
# define INT_LEAST24_MIN INT24_MIN
# define INT_LEAST24_MAX INT24_MAX
# define UINT_LEAST24_MAX UINT24_MAX
# define INT_FAST24_MIN INT24_MIN
# define INT_FAST24_MAX INT24_MAX
# define UINT_FAST24_MAX UINT24_MAX
# define __INT_LEAST16_MIN INT24_MIN
# define __INT_LEAST16_MAX INT24_MAX
# define __UINT_LEAST16_MAX UINT24_MAX
# define __INT_LEAST8_MIN INT24_MIN
# define __INT_LEAST8_MAX INT24_MAX
# define __UINT_LEAST8_MAX UINT24_MAX
#endif /* __INT24_TYPE__ */
#ifdef __INT16_TYPE__
#define INT16_MAX INT16_C(32767)
#define INT16_MIN (-INT16_C(32767)-1)
#define UINT16_MAX UINT16_C(65535)
# define __INT_LEAST16_MIN INT16_MIN
# define __INT_LEAST16_MAX INT16_MAX
# define __UINT_LEAST16_MAX UINT16_MAX
# define __INT_LEAST8_MIN INT16_MIN
# define __INT_LEAST8_MAX INT16_MAX
# define __UINT_LEAST8_MAX UINT16_MAX
#endif /* __INT16_TYPE__ */
#ifdef __INT_LEAST16_MIN
# define INT_LEAST16_MIN __INT_LEAST16_MIN
# define INT_LEAST16_MAX __INT_LEAST16_MAX
# define UINT_LEAST16_MAX __UINT_LEAST16_MAX
# define INT_FAST16_MIN __INT_LEAST16_MIN
# define INT_FAST16_MAX __INT_LEAST16_MAX
# define UINT_FAST16_MAX __UINT_LEAST16_MAX
#endif /* __INT_LEAST16_MIN */
#ifdef __INT8_TYPE__
# define INT8_MAX INT8_C(127)
# define INT8_MIN (-INT8_C(127)-1)
# define UINT8_MAX UINT8_C(255)
# define __INT_LEAST8_MIN INT8_MIN
# define __INT_LEAST8_MAX INT8_MAX
# define __UINT_LEAST8_MAX UINT8_MAX
#endif /* __INT8_TYPE__ */
#ifdef __INT_LEAST8_MIN
# define INT_LEAST8_MIN __INT_LEAST8_MIN
# define INT_LEAST8_MAX __INT_LEAST8_MAX
# define UINT_LEAST8_MAX __UINT_LEAST8_MAX
# define INT_FAST8_MIN __INT_LEAST8_MIN
# define INT_FAST8_MAX __INT_LEAST8_MAX
# define UINT_FAST8_MAX __UINT_LEAST8_MAX
#endif /* __INT_LEAST8_MIN */
/* Some utility macros */
#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
/* C99 7.18.3 Limits of other integer types. */
#define INTPTR_MIN (-__INTPTR_MAX__-1)
#define INTPTR_MAX __INTPTR_MAX__
#define UINTPTR_MAX __UINTPTR_MAX__
#define PTRDIFF_MIN (-__PTRDIFF_MAX__-1)
#define PTRDIFF_MAX __PTRDIFF_MAX__
#define SIZE_MAX __SIZE_MAX__
/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
* is enabled. */
#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
#define RSIZE_MAX (SIZE_MAX >> 1)
#endif
/* C99 7.18.2.5 Limits of greatest-width integer types. */
#define INTMAX_MIN (-__INTMAX_MAX__-1)
#define INTMAX_MAX __INTMAX_MAX__
#define UINTMAX_MAX __UINTMAX_MAX__
/* C99 7.18.3 Limits of other integer types. */
#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
#ifdef __WINT_UNSIGNED__
# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
#else
# define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
# define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
#endif
#ifndef WCHAR_MAX
# define WCHAR_MAX __WCHAR_MAX__
#endif
#ifndef WCHAR_MIN
# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
# else
# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
# endif
#endif
/* 7.18.4.2 Macros for greatest-width integer constants. */
#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
#endif /* __STDC_HOSTED__ */
#endif /* __CLANG_STDINT_H */

View File

@@ -1,30 +0,0 @@
/*===---- stdnoreturn.h - Standard header for noreturn macro ---------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __STDNORETURN_H
#define __STDNORETURN_H
#define noreturn _Noreturn
#define __noreturn_is_defined 1
#endif /* __STDNORETURN_H */

View File

@@ -1,154 +0,0 @@
/*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __X86INTRIN_H
#error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __TBMINTRIN_H
#define __TBMINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("tbm")))
#define __bextri_u32(a, b) \
((unsigned int)__builtin_ia32_bextri_u32((unsigned int)(a), \
(unsigned int)(b)))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcfill_u32(unsigned int __a)
{
return __a & (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blci_u32(unsigned int __a)
{
return __a | ~(__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcic_u32(unsigned int __a)
{
return ~__a & (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcmsk_u32(unsigned int __a)
{
return __a ^ (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcs_u32(unsigned int __a)
{
return __a | (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blsfill_u32(unsigned int __a)
{
return __a | (__a - 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blsic_u32(unsigned int __a)
{
return ~__a | (__a - 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__t1mskc_u32(unsigned int __a)
{
return ~__a | (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__tzmsk_u32(unsigned int __a)
{
return ~__a & (__a - 1);
}
#ifdef __x86_64__
#define __bextri_u64(a, b) \
((unsigned long long)__builtin_ia32_bextri_u64((unsigned long long)(a), \
(unsigned long long)(b)))
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcfill_u64(unsigned long long __a)
{
return __a & (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blci_u64(unsigned long long __a)
{
return __a | ~(__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcic_u64(unsigned long long __a)
{
return ~__a & (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcmsk_u64(unsigned long long __a)
{
return __a ^ (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcs_u64(unsigned long long __a)
{
return __a | (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blsfill_u64(unsigned long long __a)
{
return __a | (__a - 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blsic_u64(unsigned long long __a)
{
return ~__a | (__a - 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__t1mskc_u64(unsigned long long __a)
{
return ~__a | (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__tzmsk_u64(unsigned long long __a)
{
return ~__a & (__a - 1);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif /* __TBMINTRIN_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,341 +0,0 @@
/*===---- unwind.h - Stack unwinding ----------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
#ifndef __CLANG_UNWIND_H
#define __CLANG_UNWIND_H
#if defined(__APPLE__) && __has_include_next(<unwind.h>)
/* Darwin (from 11.x on) provide an unwind.h. If that's available,
* use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
* so define that around the include.*/
# ifndef _GNU_SOURCE
# define _SHOULD_UNDEFINE_GNU_SOURCE
# define _GNU_SOURCE
# endif
// libunwind's unwind.h reflects the current visibility. However, Mozilla
// builds with -fvisibility=hidden and relies on gcc's unwind.h to reset the
// visibility to default and export its contents. gcc also allows users to
// override its override by #defining HIDE_EXPORTS (but note, this only obeys
// the user's -fvisibility setting; it doesn't hide any exports on its own). We
// imitate gcc's header here:
# ifdef HIDE_EXPORTS
# include_next <unwind.h>
# else
# pragma GCC visibility push(default)
# include_next <unwind.h>
# pragma GCC visibility pop
# endif
# ifdef _SHOULD_UNDEFINE_GNU_SOURCE
# undef _GNU_SOURCE
# undef _SHOULD_UNDEFINE_GNU_SOURCE
# endif
#else
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* It is a bit strange for a header to play with the visibility of the
symbols it declares, but this matches gcc's behavior and some programs
depend on it */
#ifndef HIDE_EXPORTS
#pragma GCC visibility push(default)
#endif
typedef uintptr_t _Unwind_Word;
typedef intptr_t _Unwind_Sword;
typedef uintptr_t _Unwind_Ptr;
typedef uintptr_t _Unwind_Internal_Ptr;
typedef uint64_t _Unwind_Exception_Class;
typedef intptr_t _sleb128_t;
typedef uintptr_t _uleb128_t;
struct _Unwind_Context;
#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__))
struct _Unwind_Control_Block;
typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */
#else
struct _Unwind_Exception;
typedef struct _Unwind_Exception _Unwind_Exception;
#endif
typedef enum {
_URC_NO_REASON = 0,
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
!defined(__ARM_DWARF_EH__)
_URC_OK = 0, /* used by ARM EHABI */
#endif
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
_URC_FATAL_PHASE2_ERROR = 2,
_URC_FATAL_PHASE1_ERROR = 3,
_URC_NORMAL_STOP = 4,
_URC_END_OF_STACK = 5,
_URC_HANDLER_FOUND = 6,
_URC_INSTALL_CONTEXT = 7,
_URC_CONTINUE_UNWIND = 8,
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
!defined(__ARM_DWARF_EH__)
_URC_FAILURE = 9 /* used by ARM EHABI */
#endif
} _Unwind_Reason_Code;
typedef enum {
_UA_SEARCH_PHASE = 1,
_UA_CLEANUP_PHASE = 2,
_UA_HANDLER_FRAME = 4,
_UA_FORCE_UNWIND = 8,
_UA_END_OF_STACK = 16 /* gcc extension to C++ ABI */
} _Unwind_Action;
typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code,
_Unwind_Exception *);
#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__))
typedef struct _Unwind_Control_Block _Unwind_Control_Block;
typedef uint32_t _Unwind_EHT_Header;
struct _Unwind_Control_Block {
uint64_t exception_class;
void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
/* unwinder cache (private fields for the unwinder's use) */
struct {
uint32_t reserved1; /* forced unwind stop function, 0 if not forced */
uint32_t reserved2; /* personality routine */
uint32_t reserved3; /* callsite */
uint32_t reserved4; /* forced unwind stop argument */
uint32_t reserved5;
} unwinder_cache;
/* propagation barrier cache (valid after phase 1) */
struct {
uint32_t sp;
uint32_t bitpattern[5];
} barrier_cache;
/* cleanup cache (preserved over cleanup) */
struct {
uint32_t bitpattern[4];
} cleanup_cache;
/* personality cache (for personality's benefit) */
struct {
uint32_t fnstart; /* function start address */
_Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */
uint32_t additional; /* additional data */
uint32_t reserved1;
} pr_cache;
long long int : 0; /* force alignment of next item to 8-byte boundary */
} __attribute__((__aligned__(8)));
#else
struct _Unwind_Exception {
_Unwind_Exception_Class exception_class;
_Unwind_Exception_Cleanup_Fn exception_cleanup;
#if !defined (__USING_SJLJ_EXCEPTIONS__) && defined (__SEH__)
_Unwind_Word private_[6];
#else
_Unwind_Word private_1;
_Unwind_Word private_2;
#endif
/* The Itanium ABI requires that _Unwind_Exception objects are "double-word
* aligned". GCC has interpreted this to mean "use the maximum useful
* alignment for the target"; so do we. */
} __attribute__((__aligned__));
#endif
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action,
_Unwind_Exception_Class,
_Unwind_Exception *,
struct _Unwind_Context *,
void *);
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(int, _Unwind_Action,
_Unwind_Exception_Class,
_Unwind_Exception *,
struct _Unwind_Context *);
typedef _Unwind_Personality_Fn __personality_routine;
typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
void *);
#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__))
typedef enum {
_UVRSC_CORE = 0, /* integer register */
_UVRSC_VFP = 1, /* vfp */
_UVRSC_WMMXD = 3, /* Intel WMMX data register */
_UVRSC_WMMXC = 4 /* Intel WMMX control register */
} _Unwind_VRS_RegClass;
typedef enum {
_UVRSD_UINT32 = 0,
_UVRSD_VFPX = 1,
_UVRSD_UINT64 = 3,
_UVRSD_FLOAT = 4,
_UVRSD_DOUBLE = 5
} _Unwind_VRS_DataRepresentation;
typedef enum {
_UVRSR_OK = 0,
_UVRSR_NOT_IMPLEMENTED = 1,
_UVRSR_FAILED = 2
} _Unwind_VRS_Result;
typedef uint32_t _Unwind_State;
#define _US_VIRTUAL_UNWIND_FRAME ((_Unwind_State)0)
#define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1)
#define _US_UNWIND_FRAME_RESUME ((_Unwind_State)2)
#define _US_ACTION_MASK ((_Unwind_State)3)
#define _US_FORCE_UNWIND ((_Unwind_State)8)
_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context,
_Unwind_VRS_RegClass __regclass,
uint32_t __regno,
_Unwind_VRS_DataRepresentation __representation,
void *__valuep);
_Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *__context,
_Unwind_VRS_RegClass __regclass,
uint32_t __regno,
_Unwind_VRS_DataRepresentation __representation,
void *__valuep);
static __inline__
_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *__context, int __index) {
_Unwind_Word __value;
_Unwind_VRS_Get(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
return __value;
}
static __inline__
void _Unwind_SetGR(struct _Unwind_Context *__context, int __index,
_Unwind_Word __value) {
_Unwind_VRS_Set(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
}
static __inline__
_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *__context) {
_Unwind_Word __ip = _Unwind_GetGR(__context, 15);
return __ip & ~(_Unwind_Word)(0x1); /* Remove thumb mode bit. */
}
static __inline__
void _Unwind_SetIP(struct _Unwind_Context *__context, _Unwind_Word __value) {
_Unwind_Word __thumb_mode_bit = _Unwind_GetGR(__context, 15) & 0x1;
_Unwind_SetGR(__context, 15, __value | __thumb_mode_bit);
}
#else
_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *, int);
void _Unwind_SetGR(struct _Unwind_Context *, int, _Unwind_Word);
_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *);
void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Word);
#endif
_Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
_Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *);
_Unwind_Word _Unwind_GetBSP(struct _Unwind_Context *);
void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Context *);
/* DWARF EH functions; currently not available on Darwin/ARM */
#if !defined(__APPLE__) || !defined(__arm__)
_Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception *);
_Unwind_Reason_Code _Unwind_ForcedUnwind(_Unwind_Exception *, _Unwind_Stop_Fn,
void *);
void _Unwind_DeleteException(_Unwind_Exception *);
void _Unwind_Resume(_Unwind_Exception *);
_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *);
#endif
_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
/* setjmp(3)/longjmp(3) stuff */
typedef struct SjLj_Function_Context *_Unwind_FunctionContext_t;
void _Unwind_SjLj_Register(_Unwind_FunctionContext_t);
void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t);
_Unwind_Reason_Code _Unwind_SjLj_RaiseException(_Unwind_Exception *);
_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(_Unwind_Exception *,
_Unwind_Stop_Fn, void *);
void _Unwind_SjLj_Resume(_Unwind_Exception *);
_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(_Unwind_Exception *);
void *_Unwind_FindEnclosingFunction(void *);
#ifdef __APPLE__
_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *)
__attribute__((__unavailable__));
_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *)
__attribute__((__unavailable__));
/* Darwin-specific functions */
void __register_frame(const void *);
void __deregister_frame(const void *);
struct dwarf_eh_bases {
uintptr_t tbase;
uintptr_t dbase;
uintptr_t func;
};
void *_Unwind_Find_FDE(const void *, struct dwarf_eh_bases *);
void __register_frame_info_bases(const void *, void *, void *, void *)
__attribute__((__unavailable__));
void __register_frame_info(const void *, void *) __attribute__((__unavailable__));
void __register_frame_info_table_bases(const void *, void*, void *, void *)
__attribute__((__unavailable__));
void __register_frame_info_table(const void *, void *)
__attribute__((__unavailable__));
void __register_frame_table(const void *) __attribute__((__unavailable__));
void __deregister_frame_info(const void *) __attribute__((__unavailable__));
void __deregister_frame_info_bases(const void *)__attribute__((__unavailable__));
#else
_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
#endif
#ifndef HIDE_EXPORTS
#pragma GCC visibility pop
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif /* __CLANG_UNWIND_H */

View File

@@ -1,65 +0,0 @@
/* ===-------- vadefs.h ---------------------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
/* Only include this if we are aiming for MSVC compatibility. */
#ifndef _MSC_VER
#include_next <vadefs.h>
#else
#ifndef __clang_vadefs_h
#define __clang_vadefs_h
#include_next <vadefs.h>
/* Override macros from vadefs.h with definitions that work with Clang. */
#ifdef _crt_va_start
#undef _crt_va_start
#define _crt_va_start(ap, param) __builtin_va_start(ap, param)
#endif
#ifdef _crt_va_end
#undef _crt_va_end
#define _crt_va_end(ap) __builtin_va_end(ap)
#endif
#ifdef _crt_va_arg
#undef _crt_va_arg
#define _crt_va_arg(ap, type) __builtin_va_arg(ap, type)
#endif
/* VS 2015 switched to double underscore names, which is an improvement, but now
* we have to intercept those names too.
*/
#ifdef __crt_va_start
#undef __crt_va_start
#define __crt_va_start(ap, param) __builtin_va_start(ap, param)
#endif
#ifdef __crt_va_end
#undef __crt_va_end
#define __crt_va_end(ap) __builtin_va_end(ap)
#endif
#ifdef __crt_va_arg
#undef __crt_va_arg
#define __crt_va_arg(ap, type) __builtin_va_arg(ap, type)
#endif
#endif
#endif

View File

@@ -1,98 +0,0 @@
/*===------------------ vaesintrin.h - VAES intrinsics ---------------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <vaesintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __VAESINTRIN_H
#define __VAESINTRIN_H
/* Default attributes for YMM forms. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("vaes"), __min_vector_width__(256)))
/* Default attributes for ZMM forms. */
#define __DEFAULT_FN_ATTRS_F __attribute__((__always_inline__, __nodebug__, __target__("avx512f,vaes"), __min_vector_width__(512)))
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_aesenc_epi128(__m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_aesenc256((__v4di) __A,
(__v4di) __B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS_F
_mm512_aesenc_epi128(__m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
(__v8di) __B);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_aesdec_epi128(__m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_aesdec256((__v4di) __A,
(__v4di) __B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS_F
_mm512_aesdec_epi128(__m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
(__v8di) __B);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_aesenclast_epi128(__m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A,
(__v4di) __B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS_F
_mm512_aesenclast_epi128(__m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
(__v8di) __B);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
{
return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A,
(__v4di) __B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS_F
_mm512_aesdeclast_epi128(__m512i __A, __m512i __B)
{
return (__m512i) __builtin_ia32_aesdeclast512((__v8di) __A,
(__v8di) __B);
}
#undef __DEFAULT_FN_ATTRS
#undef __DEFAULT_FN_ATTRS_F
#endif

View File

@@ -1,26 +0,0 @@
/*===---- varargs.h - Variable argument handling -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __VARARGS_H
#define __VARARGS_H
#error "Please use <stdarg.h> instead of <varargs.h>"
#endif

View File

@@ -1,42 +0,0 @@
/*===------------ vpclmulqdqintrin.h - VPCLMULQDQ intrinsics ---------------===
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <vpclmulqdqintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __VPCLMULQDQINTRIN_H
#define __VPCLMULQDQINTRIN_H
#define _mm256_clmulepi64_epi128(A, B, I) \
(__m256i)__builtin_ia32_pclmulqdq256((__v4di)(__m256i)(A), \
(__v4di)(__m256i)(B), \
(char)(I))
#define _mm512_clmulepi64_epi128(A, B, I) \
(__m512i)__builtin_ia32_pclmulqdq512((__v8di)(__m512i)(A), \
(__v8di)(__m512i)(B), \
(char)(I))
#endif /* __VPCLMULQDQINTRIN_H */

View File

@@ -1,56 +0,0 @@
/*===----------------------- waitpkgintrin.h - WAITPKG --------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <waitpkgintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __WAITPKGINTRIN_H
#define __WAITPKGINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS \
__attribute__((__always_inline__, __nodebug__, __target__("waitpkg")))
static __inline__ void __DEFAULT_FN_ATTRS
_umonitor (void * __address)
{
__builtin_ia32_umonitor (__address);
}
static __inline__ unsigned char __DEFAULT_FN_ATTRS
_umwait (unsigned int __control, unsigned long long __counter)
{
return __builtin_ia32_umwait (__control,
(unsigned int)(__counter >> 32), (unsigned int)__counter);
}
static __inline__ unsigned char __DEFAULT_FN_ATTRS
_tpause (unsigned int __control, unsigned long long __counter)
{
return __builtin_ia32_tpause (__control,
(unsigned int)(__counter >> 32), (unsigned int)__counter);
}
#undef __DEFAULT_FN_ATTRS
#endif /* __WAITPKGINTRIN_H */

View File

@@ -1,38 +0,0 @@
/*===-------------- wbnoinvdintrin.h - wbnoinvd intrinsic-------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
#error "Never use <wbnoinvdintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __WBNOINVDINTRIN_H
#define __WBNOINVDINTRIN_H
static __inline__ void
__attribute__((__always_inline__, __nodebug__, __target__("wbnoinvd")))
_wbnoinvd (void)
{
__builtin_ia32_wbnoinvd ();
}
#endif /* __WBNOINVDINTRIN_H */

View File

@@ -1,33 +0,0 @@
/*===---- wmmintrin.h - AES intrinsics ------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __WMMINTRIN_H
#define __WMMINTRIN_H
#include <emmintrin.h>
#include <__wmmintrin_aes.h>
#include <__wmmintrin_pclmul.h>
#endif /* __WMMINTRIN_H */

View File

@@ -1,68 +0,0 @@
/*===---- x86intrin.h - X86 intrinsics -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __X86INTRIN_H
#define __X86INTRIN_H
#include <ia32intrin.h>
#include <immintrin.h>
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__3dNOW__)
#include <mm3dnow.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PRFCHW__)
#include <prfchwintrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE4A__)
#include <ammintrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA4__)
#include <fma4intrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XOP__)
#include <xopintrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__TBM__)
#include <tbmintrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LWP__)
#include <lwpintrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MWAITX__)
#include <mwaitxintrin.h>
#endif
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLZERO__)
#include <clzerointrin.h>
#endif
#endif /* __X86INTRIN_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,48 +0,0 @@
/*===---- xsavecintrin.h - XSAVEC intrinsic --------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <xsavecintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __XSAVECINTRIN_H
#define __XSAVECINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsavec")))
static __inline__ void __DEFAULT_FN_ATTRS
_xsavec(void *__p, unsigned long long __m) {
__builtin_ia32_xsavec(__p, __m);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS
_xsavec64(void *__p, unsigned long long __m) {
__builtin_ia32_xsavec64(__p, __m);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,58 +0,0 @@
/*===---- xsaveintrin.h - XSAVE intrinsic ----------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <xsaveintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __XSAVEINTRIN_H
#define __XSAVEINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsave")))
static __inline__ void __DEFAULT_FN_ATTRS
_xsave(void *__p, unsigned long long __m) {
__builtin_ia32_xsave(__p, __m);
}
static __inline__ void __DEFAULT_FN_ATTRS
_xrstor(void *__p, unsigned long long __m) {
__builtin_ia32_xrstor(__p, __m);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS
_xsave64(void *__p, unsigned long long __m) {
__builtin_ia32_xsave64(__p, __m);
}
static __inline__ void __DEFAULT_FN_ATTRS
_xrstor64(void *__p, unsigned long long __m) {
__builtin_ia32_xrstor64(__p, __m);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,48 +0,0 @@
/*===---- xsaveoptintrin.h - XSAVEOPT intrinsic ----------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <xsaveoptintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __XSAVEOPTINTRIN_H
#define __XSAVEOPTINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsaveopt")))
static __inline__ void __DEFAULT_FN_ATTRS
_xsaveopt(void *__p, unsigned long long __m) {
__builtin_ia32_xsaveopt(__p, __m);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS
_xsaveopt64(void *__p, unsigned long long __m) {
__builtin_ia32_xsaveopt64(__p, __m);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,58 +0,0 @@
/*===---- xsavesintrin.h - XSAVES intrinsic --------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <xsavesintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __XSAVESINTRIN_H
#define __XSAVESINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsaves")))
static __inline__ void __DEFAULT_FN_ATTRS
_xsaves(void *__p, unsigned long long __m) {
__builtin_ia32_xsaves(__p, __m);
}
static __inline__ void __DEFAULT_FN_ATTRS
_xrstors(void *__p, unsigned long long __m) {
__builtin_ia32_xrstors(__p, __m);
}
#ifdef __x86_64__
static __inline__ void __DEFAULT_FN_ATTRS
_xrstors64(void *__p, unsigned long long __m) {
__builtin_ia32_xrstors64(__p, __m);
}
static __inline__ void __DEFAULT_FN_ATTRS
_xsaves64(void *__p, unsigned long long __m) {
__builtin_ia32_xsaves64(__p, __m);
}
#endif
#undef __DEFAULT_FN_ATTRS
#endif

View File

@@ -1,41 +0,0 @@
/*===---- xtestintrin.h - XTEST intrinsic ----------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __IMMINTRIN_H
#error "Never use <xtestintrin.h> directly; include <immintrin.h> instead."
#endif
#ifndef __XTESTINTRIN_H
#define __XTESTINTRIN_H
/* xtest returns non-zero if the instruction is executed within an RTM or active
* HLE region. */
/* FIXME: This can be an either or for RTM/HLE. Deal with this when HLE is
* supported. */
static __inline__ int
__attribute__((__always_inline__, __nodebug__, __target__("rtm")))
_xtest(void) {
return __builtin_ia32_xtest();
}
#endif

View File

@@ -1,17 +0,0 @@
@echo on
cd %APPVEYOR_BUILD_FOLDER%
build-msvc-release\bin\zig.exe version >version.txt
set /p ZIGVERSION=<version.txt
appveyor UpdateBuild -Version "%ZIGVERSION%"
SET "RELEASEDIR=zig-%ZIGVERSION%"
mkdir "%RELEASEDIR%"
move build-msvc-release\bin\zig.exe "%RELEASEDIR%"
move build-msvc-release\lib "%RELEASEDIR%"
move zig-cache\langref.html "%RELEASEDIR%"
move LICENSE "%RELEASEDIR%"
SET "RELEASEZIP=zig-%ZIGVERSION%.zip"
7z a "%RELEASEZIP%" "%RELEASEDIR%"
appveyor PushArtifact "%RELEASEZIP%"

View File

@@ -1,9 +0,0 @@
image: Visual Studio 2017
platform:
- x64
build_script:
- '%APPVEYOR_BUILD_FOLDER%\ci\appveyor\build_script.bat'
after_build:
- '%APPVEYOR_BUILD_FOLDER%\ci\appveyor\after_build.bat'
cache:
- 'llvm+clang-7.0.0-win64-msvc-release.tar.xz'

View File

@@ -1,26 +0,0 @@
@echo on
cd %APPVEYOR_BUILD_FOLDER%
SET "PREVPATH=%PATH%"
SET "PREVMSYSEM=%MSYSTEM%"
SET "PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%"
SET "MSYSTEM=MINGW64"
SET "APPVEYOR_CACHE_ENTRY_ZIP_ARGS=-m0=Copy"
bash -lc "cd ${APPVEYOR_BUILD_FOLDER} && if [ -s ""llvm+clang-7.0.0-win64-msvc-release.tar.xz"" ]; then echo 'skipping LLVM download'; else wget 'https://s3.amazonaws.com/ziglang.org/deps/llvm%%2bclang-7.0.0-win64-msvc-release.tar.xz'; fi && tar xf llvm+clang-7.0.0-win64-msvc-release.tar.xz" || exit /b
SET "PATH=%PREVPATH%"
SET "MSYSTEM=%PREVMSYSTEM%"
SET "ZIGBUILDDIR=%APPVEYOR_BUILD_FOLDER%\build-msvc-release"
SET "ZIGPREFIXPATH=%APPVEYOR_BUILD_FOLDER%\llvm+clang-7.0.0-win64-msvc-release"
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
call "C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\vcvarsall.bat" x86_amd64
mkdir %ZIGBUILDDIR%
cd %ZIGBUILDDIR%
cmake.exe .. -Thost=x64 -G"Visual Studio 15 2017 Win64" "-DCMAKE_INSTALL_PREFIX=%ZIGBUILDDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b
msbuild /p:Configuration=Release INSTALL.vcxproj || exit /b
bin\zig.exe build --build-file ..\build.zig test -Dskip-release || exit /b

51
ci/azure/linux_script Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
set -x
set -e
BUILDDIR="$(pwd)"
sudo sh -c 'echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list'
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -q
sudo apt-get remove -y llvm-*
sudo rm -rf /usr/local/*
sudo apt-get install -y libxml2-dev libclang-9-dev llvm-9 llvm-9-dev cmake s3cmd gcc-7 g++-7 qemu
export CC=gcc-7
export CXX=g++-7
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2 install
./zig build test -Denable-qemu
if [ "${BUILD_REASON}" != "PullRequest" ]; then
ARTIFACTSDIR="$BUILDDIR/artifacts"
mkdir "$ARTIFACTSDIR"
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm9-1 -j2 $BUILD_SOURCEVERSION
TARBALL="$(ls $ARTIFACTSDIR)"
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$ARTIFACTSDIR/$TARBALL" s3://ziglang.org/builds/
SHASUM=$(sha256sum $ARTIFACTSDIR/$TARBALL | cut '-d ' -f1)
BYTESIZE=$(wc -c < $ARTIFACTSDIR/$TARBALL)
JSONFILE="linux-$GITBRANCH.json"
touch $JSONFILE
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/linux-$VERSION.json"
# `set -x` causes these variables to be mangled.
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
set +x
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
fi

110
ci/azure/macos_script Executable file
View File

@@ -0,0 +1,110 @@
#!/bin/sh
set -x
set -e
system_profiler SPHardwareDataType
brew install s3cmd gcc@8
ZIGDIR="$(pwd)"
CACHE_BASENAME="llvm+clang-9.0.0-macos-x86_64-gcc8-release"
PREFIX="$HOME/$CACHE_BASENAME"
TMPDIR="$HOME/tmpz"
JOBS="-j2"
# I tried using the system default compiler (clang), but it couldn't statically link libc++.
# So we use gcc-8 from homebrew.
export CC=gcc-8
export CXX=g++-8
rm -rf $PREFIX
rm -rf $TMPDIR
mkdir $TMPDIR
cd $HOME
HAVE_CACHE="true"
wget -nv "https://ziglang.org/builds/$CACHE_BASENAME.tar.xz" || HAVE_CACHE="false"
if [ "${HAVE_CACHE}" = "true" ]; then
tar xf "$CACHE_BASENAME.tar.xz"
else
if [ "${BUILD_REASON}" == "PullRequest" ]; then
echo "Need cached llvm+clang for pull request builds."
exit 1
fi
cd $TMPDIR
wget https://zlib.net/zlib-1.2.11.tar.xz
tar xf zlib-1.2.11.tar.xz
cd zlib-1.2.11/
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$PREFIX
make $JOBS install
rm $PREFIX/lib/libz*dylib
cd $TMPDIR
wget https://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz
tar xf llvm-9.0.0.src.tar.xz
cd llvm-9.0.0.src/
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Release -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF
make $JOBS install
cd $TMPDIR
wget https://releases.llvm.org/9.0.0/cfe-9.0.0.src.tar.xz
tar xf cfe-9.0.0.src.tar.xz
cd cfe-9.0.0.src/
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Release
make $JOBS install
cd $HOME
tar cfJ "$CACHE_BASENAME.tar.xz" "$CACHE_BASENAME"
cp "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$CACHE_BASENAME.tar.xz" "s3://ziglang.org/builds/$CACHE_BASENAME.tar.xz"
fi
cd $ZIGDIR
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
make $JOBS install
release/bin/zig build test
if [ "${BUILD_REASON}" != "PullRequest" ]; then
mv ../LICENSE release/
mv ../zig-cache/langref.html release/
mv release/bin/zig release/
rmdir release/bin
VERSION=$(release/zig version)
DIRNAME="zig-macos-x86_64-$VERSION"
TARBALL="$DIRNAME.tar.xz"
mv release "$DIRNAME"
tar cfJ "$TARBALL" "$DIRNAME"
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
BYTESIZE=$(wc -c < $TARBALL)
JSONFILE="macos-$GITBRANCH.json"
touch $JSONFILE
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/macos-$VERSION.json"
# `set -x` causes these variables to be mangled.
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
set +x
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
fi

72
ci/azure/pipelines.yml Normal file
View File

@@ -0,0 +1,72 @@
jobs:
- job: BuildMacOS
pool:
vmImage: 'macOS 10.14'
timeoutInMinutes: 360
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: s3cfg
- script: ci/azure/macos_script
name: main
displayName: 'Build and test'
- job: BuildLinux
pool:
vmImage: 'ubuntu-16.04'
timeoutInMinutes: 360
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: s3cfg
- script: ci/azure/linux_script
name: main
displayName: 'Build and test'
- job: BuildWindows
pool:
vmImage: 'windows-2019'
timeoutInMinutes: 360
steps:
- script: |
git clone https://github.com/lazka/msys2-ci-base.git %CD:~0,2%\msys64
%CD:~0,2%\msys64\usr\bin\rm -rf %CD:~0,2%\msys64\.git
set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
%CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu
displayName: Install and Update MSYS2
- task: DownloadSecureFile@1
inputs:
secureFile: s3cfg
- script: ci/azure/windows_script.bat
name: main
displayName: 'Build and test'
- job: UpdateDownloadPage
dependsOn:
- BuildMacOS
- BuildLinux
- BuildWindows
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
strategy:
maxParallel: 1
pool:
vmImage: 'ubuntu-16.04'
variables:
macos_tarball: $[ dependencies.BuildMacOS.outputs['main.tarball'] ]
macos_shasum: $[ dependencies.BuildMacOS.outputs['main.shasum'] ]
macos_bytesize: $[ dependencies.BuildMacOS.outputs['main.bytesize'] ]
linux_tarball: $[ dependencies.BuildLinux.outputs['main.tarball'] ]
linux_shasum: $[ dependencies.BuildLinux.outputs['main.shasum'] ]
linux_bytesize: $[ dependencies.BuildLinux.outputs['main.bytesize'] ]
windows_tarball: $[ dependencies.BuildWindows.outputs['main.tarball'] ]
windows_shasum: $[ dependencies.BuildWindows.outputs['main.shasum'] ]
windows_bytesize: $[ dependencies.BuildWindows.outputs['main.bytesize'] ]
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: s3cfg
- script: ci/azure/update_download_page
displayName: 'Update download page'

41
ci/azure/update_download_page Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
set -x
set -e
SRCDIR=$(pwd)
rm -rf .git
sudo apt-get update -y
sudo apt-get install -y s3cmd curl jq
cd "$HOME"
wget "https://ziglang.org/builds/$LINUX_TARBALL"
tar xf $LINUX_TARBALL
ZIGDIR=$(basename -s .tar.xz $LINUX_TARBALL)
ZIG="$ZIGDIR/zig"
LANGREF="$ZIGDIR/langref.html"
VERSION=$($ZIG version)
SRCTARBALLDIR="zig-$VERSION"
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
mv "$SRCDIR" "$SRCTARBALLDIR"
tar cfJ "$SRC_TARBALL" "$SRCTARBALLDIR"
export SRC_SHASUM=$(sha256sum $SRC_TARBALL | cut '-d ' -f1)
export SRC_BYTESIZE=$(wc -c < $SRC_TARBALL)
# the freebsd build has to be there too
FREEBSD_JSON=$(curl --fail "https://ziglang.org/builds/freebsd-$VERSION.json" || exit 1)
export FREEBSD_TARBALL="$(echo "$FREEBSD_JSON" | jq .tarball -r)"
export FREEBSD_BYTESIZE="$(echo "$FREEBSD_JSON" | jq .size -r)"
export FREEBSD_SHASUM="$(echo "$FREEBSD_JSON" | jq .shasum -r)"
git clone https://github.com/ziglang/www.ziglang.org --depth 1
cd www.ziglang.org
export MASTER_DATE=$(date +%Y-%m-%d)
env
"../$ZIG" run update-download-page.zig
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "../$SRC_TARBALL" s3://ziglang.org/builds/
s3cmd put -P "../$LANGREF" s3://ziglang.org/documentation/master/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
s3cmd put -P www/download/index.html s3://ziglang.org/download/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
s3cmd put -P www/download/index.json s3://ziglang.org/download/index.json --add-header="Cache-Control: max-age=0, must-revalidate"

10
ci/azure/windows_install Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
set -x
set -e
pacman -Su --needed --noconfirm
pacman -S --needed --noconfirm wget p7zip python3-pip
pip install s3cmd
wget -nv "https://ziglang.org/deps/llvm%2bclang-9.0.0-win64-msvc-release.tar.xz"
tar xf llvm+clang-9.0.0-win64-msvc-release.tar.xz

View File

@@ -0,0 +1,28 @@
@echo on
SET "SRCROOT=%cd%"
SET "PREVPATH=%PATH%"
SET "PREVMSYSEM=%MSYSTEM%"
set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
SET "MSYSTEM=MINGW64"
bash -lc "cd ${SRCROOT} && ci/azure/windows_install" || exit /b
SET "PATH=%PREVPATH%"
SET "MSYSTEM=%PREVMSYSTEM%"
SET "ZIGBUILDDIR=%SRCROOT%\build"
SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist"
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang-9.0.0-win64-msvc-release"
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir %ZIGBUILDDIR%
cd %ZIGBUILDDIR%
REM Here we use MinSizeRel instead of Release to work around https://github.com/ziglang/zig/issues/3024
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=MinSizeRel || exit /b
msbuild /p:Configuration=MinSizeRel INSTALL.vcxproj || exit /b
"%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b
set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
SET "MSYSTEM=MINGW64"
bash -lc "cd ${SRCROOT} && ci/azure/windows_upload" || exit /b

41
ci/azure/windows_upload Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
set -x
set -e
if [ "${BUILD_REASON}" != "PullRequest" ]; then
cd "$ZIGBUILDDIR"
mv ../LICENSE dist/
mv ../zig-cache/langref.html dist/
mv dist/bin/zig.exe dist/
rmdir dist/bin
VERSION=$(dist/zig.exe version)
DIRNAME="zig-windows-x86_64-$VERSION"
TARBALL="$DIRNAME.zip"
mv dist "$DIRNAME"
7z a "$TARBALL" "$DIRNAME"
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
BYTESIZE=$(wc -c < $TARBALL)
JSONFILE="windows-$GITBRANCH.json"
touch $JSONFILE
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/windows-$VERSION.json"
# `set -x` causes these variables to be mangled.
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
set +x
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
fi

84
ci/srht/freebsd_script Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
set -x
set -e
ZIGDIR="$(pwd)"
CACHE_BASENAME="llvm+clang-9.0.0-freebsd-x86_64-release"
PREFIX="$HOME/$CACHE_BASENAME"
JOBS="-j$(sysctl -n hw.ncpu)"
cd $HOME
wget -nv "https://ziglang.org/builds/$CACHE_BASENAME.tar.xz"
tar xf "$CACHE_BASENAME.tar.xz"
cd $ZIGDIR
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
make $JOBS install
release/bin/zig build test-fmt
release/bin/zig build test-behavior
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-std
release/bin/zig build test-compiler-rt
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-compare-output
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-standalone
release/bin/zig build test-stack-traces
release/bin/zig build test-cli
release/bin/zig build test-asm-link
release/bin/zig build test-runtime-safety
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-translate-c
release/bin/zig build test-gen-h
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build test-compile-errors
# This test is disabled because it triggers "out of memory" on the sr.ht CI service.
# See https://github.com/ziglang/zig/issues/3210
# release/bin/zig build docs
if [ -f ~/.s3cfg ]; then
mv ../LICENSE release/
# Enable when `release/bin/zig build docs` passes without "out of memory" or failures
#mv ../zig-cache/langref.html release/
mv release/bin/zig release/
rmdir release/bin
GITBRANCH=$(basename $GITHUB_REF)
VERSION=$(release/zig version)
DIRNAME="zig-freebsd-x86_64-$VERSION"
TARBALL="$DIRNAME.tar.xz"
mv release "$DIRNAME"
tar cfJ "$TARBALL" "$DIRNAME"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
BYTESIZE=$(wc -c < $TARBALL)
JSONFILE="freebsd-$GITBRANCH.json"
touch $JSONFILE
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/freebsd-$VERSION.json"
fi

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -x
sudo sh -c 'echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main" >> /etc/apt/sources.list'
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -q

View File

@@ -1,7 +0,0 @@
#!/bin/sh
set -x
sudo apt-get remove -y llvm-*
sudo rm -rf /usr/local/*
sudo apt-get install -y libxml2-dev libclang-7-dev llvm-7 llvm-7-dev cmake s3cmd gcc-7 g++-7

View File

@@ -1,23 +0,0 @@
#!/bin/sh
set -x
set -e
export CC=gcc-7
export CXX=g++-7
echo $PATH
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2 install
./zig build --build-file ../build.zig test -Dskip-release-small
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
mkdir $TRAVIS_BUILD_DIR/artifacts
docker run -it --mount type=bind,source="$TRAVIS_BUILD_DIR/artifacts",target=/z ziglang/static-base:llvm7-1 -j2 $TRAVIS_COMMIT
echo "access_key = $AWS_ACCESS_KEY_ID" >> ~/.s3cfg
echo "secret_key = $AWS_SECRET_ACCESS_KEY" >> ~/.s3cfg
s3cmd put -P $TRAVIS_BUILD_DIR/artifacts/* s3://ziglang.org/builds/
touch empty
s3cmd put -P empty s3://ziglang.org/builds/zig-linux-x86_64-$TRAVIS_BRANCH.tar.xz --add-header="Cache-Control: max-age=0, must-revalidate" --add-header=x-amz-website-redirect-location:/builds/$(ls $TRAVIS_BUILD_DIR/artifacts)
fi

View File

@@ -1,5 +0,0 @@
#!/bin/sh
set -x
brew update

View File

@@ -1,7 +0,0 @@
#!/bin/sh
set -x
brew install llvm@7
brew outdated llvm@7 || brew upgrade llvm@7

View File

@@ -1,12 +0,0 @@
#!/bin/sh
set -x
set -e
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm@7/ -DCMAKE_BUILD_TYPE=Release
make VERBOSE=1
make install
./zig build --build-file ../build.zig test -Dskip-release-small

Some files were not shown because too many files have changed in this diff Show More