parent
5e6fc94b7f
commit
6ae631d1a7
|
@ -4,4 +4,4 @@ set -x
|
|||
|
||||
sudo apt-get remove -y llvm-*
|
||||
sudo rm -rf /usr/local/*
|
||||
sudo apt-get install -y clang-5.0 libclang-5.0 libclang-5.0-dev llvm-5.0 llvm-5.0-dev liblld-5.0 liblld-5.0-dev cmake
|
||||
sudo apt-get install -y clang-5.0 libclang-5.0 libclang-5.0-dev llvm-5.0 llvm-5.0-dev liblld-5.0 liblld-5.0-dev cmake wine1.6-amd64
|
||||
|
|
|
@ -13,3 +13,22 @@ cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print
|
|||
make VERBOSE=1
|
||||
make install
|
||||
./zig build --build-file ../build.zig test
|
||||
|
||||
./zig test ../std/behavior.zig --target-os windows --target-arch x86_64 --target-environ msvc
|
||||
wine64 test.exe
|
||||
|
||||
./zig test ../std/behavior.zig --target-os windows --target-arch i386 --target-environ msvc
|
||||
wine test.exe
|
||||
|
||||
./zig test ../std/behavior.zig --target-os windows --target-arch x86_64 --target-environ msvc --release-fast
|
||||
wine64 test.exe
|
||||
|
||||
./zig test ../std/behavior.zig --target-os windows --target-arch i386 --target-environ msvc --release-fast
|
||||
wine test.exe
|
||||
|
||||
# TODO fix bug
|
||||
# ./zig test ../std/behavior.zig --target-os windows --target-arch x86_64 --target-environ msvc --release-safe
|
||||
# wine64 test.exe
|
||||
|
||||
./zig test ../std/behavior.zig --target-os windows --target-arch i386 --target-environ msvc --release-safe
|
||||
wine test.exe
|
||||
|
|
|
@ -164,16 +164,16 @@ fn MersenneTwister(
|
|||
|
||||
while (i < n - m) : (i += 1) {
|
||||
const x = (mt.array[i] & UM) | (mt.array[i + 1] & LM);
|
||||
mt.array[i] = mt.array[i + m] ^ (x >> 1) ^ mag01[x & 0x1];
|
||||
mt.array[i] = mt.array[i + m] ^ (x >> 1) ^ mag01[usize(x & 0x1)];
|
||||
}
|
||||
|
||||
while (i < n - 1) : (i += 1) {
|
||||
const x = (mt.array[i] & UM) | (mt.array[i + 1] & LM);
|
||||
mt.array[i] = mt.array[i + m - n] ^ (x >> 1) ^ mag01[x & 0x1];
|
||||
mt.array[i] = mt.array[i + m - n] ^ (x >> 1) ^ mag01[usize(x & 0x1)];
|
||||
|
||||
}
|
||||
const x = (mt.array[i] & UM) | (mt.array[0] & LM);
|
||||
mt.array[i] = mt.array[m - 1] ^ (x >> 1) ^ mag01[x & 0x1];
|
||||
mt.array[i] = mt.array[m - 1] ^ (x >> 1) ^ mag01[usize(x & 0x1)];
|
||||
|
||||
mt.index = 0;
|
||||
}
|
||||
|
|
|
@ -110,6 +110,44 @@ export nakedcc fn __aeabi_uidivmod() {
|
|||
@setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
// _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments,
|
||||
// then decrement %esp by %eax. Preserves all registers except %esp and flags.
|
||||
// This routine is windows specific
|
||||
// http://msdn.microsoft.com/en-us/library/ms648426.aspx
|
||||
export nakedcc fn _chkstk() align(4) {
|
||||
@setDebugSafety(this, false);
|
||||
|
||||
if (comptime builtin.os == builtin.Os.windows) {
|
||||
if (comptime builtin.arch == builtin.Arch.i386) {
|
||||
asm volatile (
|
||||
\\ push %%ecx
|
||||
\\ cmp $0x1000,%%eax
|
||||
\\ lea 8(%%esp),%%ecx // esp before calling this routine -> ecx
|
||||
\\ jb 1f
|
||||
\\ 2:
|
||||
\\ sub $0x1000,%%ecx
|
||||
\\ test %%ecx,(%%ecx)
|
||||
\\ sub $0x1000,%%eax
|
||||
\\ cmp $0x1000,%%eax
|
||||
\\ ja 2b
|
||||
\\ 1:
|
||||
\\ sub %%eax,%%ecx
|
||||
\\ test %%ecx,(%%ecx)
|
||||
\\
|
||||
\\ lea 4(%%esp),%%eax // load pointer to the return address into eax
|
||||
\\ mov %%ecx,%%esp // install the new top of stack pointer into esp
|
||||
\\ mov -4(%%eax),%%ecx // restore ecx
|
||||
\\ push (%%eax) // push return address onto the stack
|
||||
\\ sub %%esp,%%eax // restore the original value in eax
|
||||
\\ ret
|
||||
);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
||||
@setGlobalLinkage(_chkstk, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
export nakedcc fn __chkstk() align(4) {
|
||||
@setDebugSafety(this, false);
|
||||
|
||||
|
@ -144,6 +182,40 @@ export nakedcc fn __chkstk() align(4) {
|
|||
@setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
// _chkstk routine
|
||||
// This routine is windows specific
|
||||
// http://msdn.microsoft.com/en-us/library/ms648426.aspx
|
||||
export nakedcc fn __chkstk_ms() align(4) {
|
||||
@setDebugSafety(this, false);
|
||||
|
||||
if (comptime builtin.os == builtin.Os.windows) {
|
||||
if (comptime builtin.arch == builtin.Arch.i386) {
|
||||
asm volatile (
|
||||
\\ push %%ecx
|
||||
\\ push %%eax
|
||||
\\ cmp $0x1000,%%eax
|
||||
\\ lea 12(%%esp),%%ecx
|
||||
\\ jb 1f
|
||||
\\ 2:
|
||||
\\ sub $0x1000,%%ecx
|
||||
\\ test %%ecx,(%%ecx)
|
||||
\\ sub $0x1000,%%eax
|
||||
\\ cmp $0x1000,%%eax
|
||||
\\ ja 2b
|
||||
\\ 1:
|
||||
\\ sub %%eax,%%ecx
|
||||
\\ test %%ecx,(%%ecx)
|
||||
\\ pop %%eax
|
||||
\\ pop %%ecx
|
||||
\\ ret
|
||||
);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
||||
@setGlobalLinkage(__chkstk_ms, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
export nakedcc fn ___chkstk_ms() align(4) {
|
||||
@setDebugSafety(this, false);
|
||||
|
||||
|
|
|
@ -41,6 +41,11 @@ const test_targets = []TestTarget {
|
|||
.arch = builtin.Arch.x86_64,
|
||||
.environ = builtin.Environ.msvc,
|
||||
},
|
||||
TestTarget {
|
||||
.os = builtin.Os.windows,
|
||||
.arch = builtin.Arch.i386,
|
||||
.environ = builtin.Environ.msvc,
|
||||
},
|
||||
};
|
||||
|
||||
error TestFailed;
|
||||
|
|
Loading…
Reference in New Issue