authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-01 11:11:38-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-01 11:11:38-04:00
log6ae631d1a74e6918a67f55217a2581c65672b4dc
tree1359a3d8bb59e5b2258d00eb71f8907d271edfb4
parent5e6fc94b7f43dda028de779a874f12591fa0a50d

add windows 32 bit to test matrix

See #302

5 files changed, 100 insertions(+), 4 deletions(-)

ci/travis_linux_install+1-1
...@@ -4,4 +4,4 @@ set -x...@@ -4,4 +4,4 @@ set -x
44
5sudo apt-get remove -y llvm-*5sudo apt-get remove -y llvm-*
6sudo rm -rf /usr/local/*6sudo rm -rf /usr/local/*
7sudo 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 cmake7sudo 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
ci/travis_linux_script+19
...@@ -13,3 +13,22 @@ cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print...@@ -13,3 +13,22 @@ cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print
13make VERBOSE=113make VERBOSE=1
14make install14make install
15./zig build --build-file ../build.zig test15./zig build --build-file ../build.zig test
16
17./zig test ../std/behavior.zig --target-os windows --target-arch x86_64 --target-environ msvc
18wine64 test.exe
19
20./zig test ../std/behavior.zig --target-os windows --target-arch i386 --target-environ msvc
21wine test.exe
22
23./zig test ../std/behavior.zig --target-os windows --target-arch x86_64 --target-environ msvc --release-fast
24wine64 test.exe
25
26./zig test ../std/behavior.zig --target-os windows --target-arch i386 --target-environ msvc --release-fast
27wine test.exe
28
29# TODO fix bug
30# ./zig test ../std/behavior.zig --target-os windows --target-arch x86_64 --target-environ msvc --release-safe
31# wine64 test.exe
32
33./zig test ../std/behavior.zig --target-os windows --target-arch i386 --target-environ msvc --release-safe
34wine test.exe
std/rand.zig+3-3
...@@ -164,16 +164,16 @@ fn MersenneTwister(...@@ -164,16 +164,16 @@ fn MersenneTwister(
164164
165 while (i < n - m) : (i += 1) {165 while (i < n - m) : (i += 1) {
166 const x = (mt.array[i] & UM) | (mt.array[i + 1] & LM);166 const x = (mt.array[i] & UM) | (mt.array[i + 1] & LM);
167 mt.array[i] = mt.array[i + m] ^ (x >> 1) ^ mag01[x & 0x1];167 mt.array[i] = mt.array[i + m] ^ (x >> 1) ^ mag01[usize(x & 0x1)];
168 }168 }
169169
170 while (i < n - 1) : (i += 1) {170 while (i < n - 1) : (i += 1) {
171 const x = (mt.array[i] & UM) | (mt.array[i + 1] & LM);171 const x = (mt.array[i] & UM) | (mt.array[i + 1] & LM);
172 mt.array[i] = mt.array[i + m - n] ^ (x >> 1) ^ mag01[x & 0x1];172 mt.array[i] = mt.array[i + m - n] ^ (x >> 1) ^ mag01[usize(x & 0x1)];
173173
174 }174 }
175 const x = (mt.array[i] & UM) | (mt.array[0] & LM);175 const x = (mt.array[i] & UM) | (mt.array[0] & LM);
176 mt.array[i] = mt.array[m - 1] ^ (x >> 1) ^ mag01[x & 0x1];176 mt.array[i] = mt.array[m - 1] ^ (x >> 1) ^ mag01[usize(x & 0x1)];
177177
178 mt.index = 0;178 mt.index = 0;
179 }179 }
std/special/compiler_rt/index.zig+72
...@@ -110,6 +110,44 @@ export nakedcc fn __aeabi_uidivmod() {...@@ -110,6 +110,44 @@ export nakedcc fn __aeabi_uidivmod() {
110 @setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.Internal);110 @setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.Internal);
111}111}
112112
113// _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments,
114// then decrement %esp by %eax. Preserves all registers except %esp and flags.
115// This routine is windows specific
116// http://msdn.microsoft.com/en-us/library/ms648426.aspx
117export nakedcc fn _chkstk() align(4) {
118 @setDebugSafety(this, false);
119
120 if (comptime builtin.os == builtin.Os.windows) {
121 if (comptime builtin.arch == builtin.Arch.i386) {
122 asm volatile (
123 \\ push %%ecx
124 \\ cmp $0x1000,%%eax
125 \\ lea 8(%%esp),%%ecx // esp before calling this routine -> ecx
126 \\ jb 1f
127 \\ 2:
128 \\ sub $0x1000,%%ecx
129 \\ test %%ecx,(%%ecx)
130 \\ sub $0x1000,%%eax
131 \\ cmp $0x1000,%%eax
132 \\ ja 2b
133 \\ 1:
134 \\ sub %%eax,%%ecx
135 \\ test %%ecx,(%%ecx)
136 \\
137 \\ lea 4(%%esp),%%eax // load pointer to the return address into eax
138 \\ mov %%ecx,%%esp // install the new top of stack pointer into esp
139 \\ mov -4(%%eax),%%ecx // restore ecx
140 \\ push (%%eax) // push return address onto the stack
141 \\ sub %%esp,%%eax // restore the original value in eax
142 \\ ret
143 );
144 unreachable;
145 }
146 }
147
148 @setGlobalLinkage(_chkstk, builtin.GlobalLinkage.Internal);
149}
150
113export nakedcc fn __chkstk() align(4) {151export nakedcc fn __chkstk() align(4) {
114 @setDebugSafety(this, false);152 @setDebugSafety(this, false);
115153
...@@ -144,6 +182,40 @@ export nakedcc fn __chkstk() align(4) {...@@ -144,6 +182,40 @@ export nakedcc fn __chkstk() align(4) {
144 @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);182 @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
145}183}
146184
185// _chkstk routine
186// This routine is windows specific
187// http://msdn.microsoft.com/en-us/library/ms648426.aspx
188export nakedcc fn __chkstk_ms() align(4) {
189 @setDebugSafety(this, false);
190
191 if (comptime builtin.os == builtin.Os.windows) {
192 if (comptime builtin.arch == builtin.Arch.i386) {
193 asm volatile (
194 \\ push %%ecx
195 \\ push %%eax
196 \\ cmp $0x1000,%%eax
197 \\ lea 12(%%esp),%%ecx
198 \\ jb 1f
199 \\ 2:
200 \\ sub $0x1000,%%ecx
201 \\ test %%ecx,(%%ecx)
202 \\ sub $0x1000,%%eax
203 \\ cmp $0x1000,%%eax
204 \\ ja 2b
205 \\ 1:
206 \\ sub %%eax,%%ecx
207 \\ test %%ecx,(%%ecx)
208 \\ pop %%eax
209 \\ pop %%ecx
210 \\ ret
211 );
212 unreachable;
213 }
214 }
215
216 @setGlobalLinkage(__chkstk_ms, builtin.GlobalLinkage.Internal);
217}
218
147export nakedcc fn ___chkstk_ms() align(4) {219export nakedcc fn ___chkstk_ms() align(4) {
148 @setDebugSafety(this, false);220 @setDebugSafety(this, false);
149221
test/tests.zig+5
...@@ -41,6 +41,11 @@ const test_targets = []TestTarget {...@@ -41,6 +41,11 @@ const test_targets = []TestTarget {
41 .arch = builtin.Arch.x86_64,41 .arch = builtin.Arch.x86_64,
42 .environ = builtin.Environ.msvc,42 .environ = builtin.Environ.msvc,
43 },43 },
44 TestTarget {
45 .os = builtin.Os.windows,
46 .arch = builtin.Arch.i386,
47 .environ = builtin.Environ.msvc,
48 },
44};49};
4550
46error TestFailed;51error TestFailed;