Helio Machado
941b6830b1
std.crypto: generate AES constants at compile time ( #11612 )
...
* std/crypto: generate AES constants at compile time
* Apply suggestions from code review
Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
* Update lib/std/crypto/aes/soft.zig
* Separate encryption and decryption tables
* Run `zig fmt`
* Increase branch quota and remove redundant align
* Update lib/std/crypto/aes/soft.zig
Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
* Rename identifiers and simplify dataflow
* Increase branch quota (again) and fix comment
Co-authored-by: Frank Denis <124872+jedisct1@users.noreply.github.com>
2022-05-09 18:50:01 +02:00
Evan Haas
94b9bcd034
stdlib: escape backslashes and double quotes in Builder response file
...
Fixes #11595
2022-05-09 18:42:42 +03:00
Andrew Kelley
d7f8368da8
Merge pull request #11609 from ziglang/win-compiler-rt
...
compiler-rt: avoid symbol collisions with Windows libc
2022-05-08 19:29:21 -04:00
Hannes Bredberg
ea3f5905f0
Add Win64 calling convention
...
Closes ziglang/zig#11585
2022-05-08 16:28:10 -04:00
Andrew Kelley
cd019ee502
compiler_rt: avoid weak aliases on Windows
...
When exporting math functions for Windows, we provide weak exports of
'l' variants rather than weak aliases. We still use aliases on other
operating systems so that the 'l' variants have one less jump
instruction in this case.
2022-05-08 13:06:21 -07:00
Andrew Kelley
6fde2fcd51
allow in-memory coercion of differently-named floats with same bits
...
For example, this allows passing a `*c_longdouble` where a `*f80` is
expected, provided that `c_longdouble` maps to `f80` for this target.
2022-05-08 13:05:16 -07:00
Jakub Konka
9416b4d993
Merge pull request #11608 from ziglang/stage2-regalloc
2022-05-08 11:20:14 +02:00
Andrew Kelley
663b67783e
compiler-rt: avoid symbol collisions with Windows libc
...
closes #11600
2022-05-07 17:44:49 -07:00
Andrew Kelley
aa05cd4809
CI: fix universal libc step name
...
This was a merge conflict that went undetected.
2022-05-07 17:44:37 -07:00
Jakub Konka
f161d3875a
Merge pull request #11605 from Luukdegram/wasm-mul-overflow
...
stage2: wasm - Improve `@mulWithOverflow` implementation
2022-05-07 23:30:08 +02:00
Jakub Konka
6bf67eada4
arm: lock dest register in shl_overflow so that we do not spill it
...
Nerf two tests - they will require further investigation, but arm
now passes all tests with the safety PR.
2022-05-07 22:53:17 +02:00
Jakub Konka
756ddf0925
arm: fix CF flags spilling and implement genSetStack for reg with overflow flags
2022-05-07 22:35:41 +02:00
Luuk de Gram
a110979582
stage2: Split @mulWithOverflow tests
2022-05-07 20:02:02 +02:00
Luuk de Gram
ad4f0dda8b
wasm: Fix @floatToInt and split overflow ops
...
As we now store negative signed integers as two's complement,
we must also ensure that when truncating a float, its value is wrapped
around the integer's size.
This also splits `@mulWithOverflow` into its own function to make
the code more maintainable and reduce branching.
2022-05-07 17:04:19 +02:00
Luuk de Gram
0c51e703f1
wasm: @addWithOverflow for bitsize 32
2022-05-07 14:24:18 +02:00
Jakub Konka
f57b059e58
regalloc: refactor locking multiple registers at once
2022-05-07 13:27:11 +02:00
Jakub Konka
bf11cdc9d8
x64: refactor code to avoid stage1 sema limitations
2022-05-07 13:19:53 +02:00
Jakub Konka
197c2a465f
regalloc: rename freeze/unfreeze to lock/unlock registers
2022-05-07 10:46:05 +02:00
Andrew Kelley
e8c85450fe
Merge pull request #11592 from ziglang/stage3-macos-linker
...
Sema: solve a false positive "depends on itself"
2022-05-07 04:38:19 -04:00
Jakub Konka
43a627927f
x64: fix misused register locks
2022-05-07 10:31:08 +02:00
Andrew Kelley
ec95e00e28
flatten lib/std/special and improve "pkg inside another" logic
...
stage2: change logic for detecting whether the main package is inside
the std package. Previously it relied on realpath() which is not portable.
This uses resolve() which is how imports already work.
* stage2: fix cleanup bug when creating Module
* flatten lib/std/special/* to lib/*
- this was motivated by making main_pkg_is_inside_std false for
compiler_rt & friends.
* rename "mini libc" to "universal libc"
2022-05-06 22:41:00 -07:00
Andrew Kelley
3b60ab4872
stage2: fix std lib tests always filtering out all tests
2022-05-06 22:41:00 -07:00
Andrew Kelley
f034cef262
link/MachO: use const instead of var and limit scope of vars
2022-05-06 22:41:00 -07:00
Andrew Kelley
9afc4fe0e2
Sema: solve a false positive "depends on itself"
...
This improves the ABI alignment resolution code.
This commit fully enables the MachO linker code in stage3. Note,
however, that there are still miscompilations in stage3.
2022-05-06 22:40:57 -07:00
Andrew Kelley
0df28f9d45
Merge pull request #11492 from ziglang/ci-stage3-behavior
...
CI: add non-LLVM backends to the test matrix
2022-05-06 22:51:55 -04:00
Jakub Konka
efeb031b79
macho: skip cache if cache_mode is .whole
2022-05-07 01:52:00 +02:00
Jakub Konka
a2dbe6589e
macho: share traditional codepaths with stage2+llvm backend
2022-05-07 01:44:26 +02:00
Andrew Kelley
a2b8a9756f
CI: macos: disable stage2 test-behavior
...
stage2 on macOS is not yet capable of passing these tests. Such
improvements will be done in a follow-up change.
2022-05-06 16:26:04 -07:00
Jakub Konka
ac954eb539
regalloc: ensure we only freeze/unfreeze at the outermost scope
...
This prevents a nasty type of bugs where we accidentally unfreeze
a register that was frozen purposely in the outer scope, risking
accidental realloc of a taken register.
Fix CF flags spilling on aarch64 backend.
2022-05-07 00:57:55 +02:00
Andrew Kelley
6d605ca690
CI: macos: stage2 zig build test-behavior
2022-05-06 15:42:52 -07:00
Luuk de Gram
4df65fc264
wasm: Store signed ints as two's complement
...
When a signed integer is negative, the integer will be stored as a two's complement,
rather than its signed value. Instead, we verify the signed bits during arithmetic operations.
This fixes signed cases of `@mulWithOverflow`.
2022-05-06 21:58:25 +02:00
Andrew Kelley
d136cd3202
LLVM: rework the previous commit
...
Idiomatic Zig, use const instead of var, simplify the logic.
2022-05-06 11:43:06 -07:00
Jakub Konka
ac1aaec9c3
x64: handle CF flags spilling in overflow calls
...
Handle spilling of CF flags set with an overflow call.
Add saving stack offset to memory.
2022-05-06 13:42:11 +02:00
Jakub Konka
edb3adaa33
stage2,llvm: handle softfloats in @intToFloat and @floatToInt
...
If the hw doesn't have support for exotic floating-point types such
as `f80`, we lower the call to a compiler-rt function call instead.
I've added a behavior test specifically targeting this use case which
now passes on `aarch64-macos`.
Additionally, this commit makes it possible to successfully build
stage3 on `aarch64-macos`. We can print the compiler's help message,
however, building with it needs a little bit more love still.
2022-05-05 22:29:30 -07:00
Andrew Kelley
413b789e06
std.os.linux.arm-eabi: upgrade to new fn ptr semantics
2022-05-05 22:29:25 -07:00
Andrew Kelley
496eb69273
CI: add non-LLVM backends to the test matrix
...
We can't yet run the behavior tests with stage3, but at least we can run
them with stage2, and we can use the proper test matrix.
This commit also adds use_llvm and ofmt to the zig build system.
2022-05-05 22:29:25 -07:00
Jakub Konka
df38dfa4d1
Merge pull request #11591 from ziglang/x64-overflow
2022-05-06 07:28:44 +02:00
Jakub Konka
09d2b6c4e1
Merge pull request #11487 from koachan/sparc64-codegen
2022-05-06 07:27:30 +02:00
Jakub Konka
c592f0ca21
test: pass extended mul_with_overflow tests on x64
2022-05-05 22:53:11 +02:00
Jakub Konka
e3160ec573
x64: mul_with_overflow: cannot reuse operand if not the result
2022-05-05 22:51:12 +02:00
Jakub Konka
0728847ce7
x64: handle unsigned mul_with_overflow for non-pow-2 ints
2022-05-05 22:51:12 +02:00
Jakub Konka
0fc1e8b54f
x64: handle signed mul_with_overflow for non-pow-2 ints
2022-05-05 22:51:12 +02:00
Jakub Konka
ebfc2825ab
x64: explicitly handle Vector vs Int types for overflow arith
2022-05-05 22:51:12 +02:00
Jakub Konka
13d1798ea0
Merge pull request #11574 from ziglang/stage2-aarch64
...
stage2,aarch64: basic overflow arithmetic support
2022-05-05 22:50:38 +02:00
Jakub Konka
90a8817f55
aarch64: ensure we set correct operand size at codegen stage
2022-05-05 22:33:03 +02:00
Jakub Konka
eab5a1bd5a
test: test bitwidths between 1...8 and 8...16 for mul_with_overflow
2022-05-05 21:43:36 +02:00
Jakub Konka
3cef23129a
test: test more int sizes for @mulWithOverflow builtin
2022-05-05 21:43:36 +02:00
Jakub Konka
d112cd52f3
aarch64: fix mul_with_overflow for ints <= 32bits
2022-05-05 21:43:36 +02:00
Jakub Konka
f4421c01e8
aarch64: implement mul_with_overflow for ints in range 33-64 bits incl
2022-05-05 21:43:36 +02:00
Jakub Konka
8715b01005
aarch64: implement mul_with_overflow for <= 32bit ints
...
Add emitters for `smull`, `umull` and `tst (immediate)` instructions.
2022-05-05 21:43:36 +02:00