17979 Commits

Author SHA1 Message Date
Koakuma
f6b95166eb stage2: sparcv9: Add simple test case 2022-04-14 22:18:06 +07:00
Koakuma
47b136e3b3 stage2: Add SPARC function alignment
This is based on @kubkon's suggestion.
2022-04-14 22:18:06 +07:00
Koakuma
a6ce2fc3dc linker: ELF: Add page sizes for ppc64le and sparcv9 2022-04-14 22:18:06 +07:00
Koakuma
43e69be196 stage2: sparcv9: Add exit2 implementation 2022-04-14 22:18:06 +07:00
Koakuma
b916ba18b6 stage2: sparcv9: Fix Tcc encoding 2022-04-14 22:18:06 +07:00
Koakuma
dcb12a7941 stage2: sparcv9: Use regular structs to encode instructions
Currently packed structs still has endian-dependent behavior, so it results
in code that is not portable across platforms (see also issue 10113).
2022-04-14 22:18:06 +07:00
Koakuma
1467590e40 stage2: sparcv9: Implement enough instruction to compile simple exes 2022-04-14 22:18:06 +07:00
Koakuma
1f63afa7c9 stage2: sparcv9: Register the backend in stdlib & driver 2022-04-14 22:18:06 +07:00
Koakuma
cfd389f927 stage2: sparcv9: zig fmt 2022-04-14 22:18:06 +07:00
Flandre Scarlet
ab2ea9fb09 stage2: sparcv9: Test failure error logging 2022-04-14 22:18:06 +07:00
Koakuma
7051970ad7 stage2: sparcv9: implement basic instruction lowering 2022-04-14 22:18:06 +07:00
Koakuma
5e2045cbe5 stage2: sparcv9: Implement basic asm codegen 2022-04-14 22:18:06 +07:00
Koakuma
42f4bd3421 stage2: sparcv9: Add breakpoint, ret, and calling mechanism 2022-04-14 22:18:06 +07:00
Koakuma
1972a2b080 stage2: sparcv9: Add placeholders to generate a minimal program 2022-04-14 22:18:06 +07:00
Koakuma
cec48f2cf1 stage2: sparcv9: Different formatting for genBody 2022-04-14 22:18:06 +07:00
Koakuma
5ab6b5a777 stage2: sparcv9: implement dbgAdvancePCAndLine 2022-04-14 22:18:06 +07:00
Koakuma
71cd3466ec stage2: sparcv9: Adjust RegisterManager settings 2022-04-14 22:18:06 +07:00
Koakuma
18c98eb429 stage2: sparcv9: Placeholder for Air instructions in genBody 2022-04-14 22:18:06 +07:00
Koakuma
94d70bdb69 stage2: sparcv9: Change ordering in Mir Tag 2022-04-14 22:18:05 +07:00
Koakuma
94a84e783e stage2: sparcv9: Implement basic prologue/epilogue Mir emission 2022-04-14 22:18:05 +07:00
Koakuma
927706e6d0 stage2: sparcv9: Emit debug inst placeholder 2022-04-14 22:18:05 +07:00
Koakuma
cf13356dab stage2: sparcv9: Mir extraData implementation 2022-04-14 22:18:05 +07:00
Koakuma
1ba5227216 stage2: sparcv9: Initial resolveCallingConventionValues implementation 2022-04-14 22:18:05 +07:00
Koakuma
a5a89fde13 stage2: sparcv9: Add skeleton codegen impl and necessary fields 2022-04-14 22:18:05 +07:00
Koakuma
a30688ef2a stage2: sparcv9: Add some initial checks in codegen 2022-04-14 22:18:05 +07:00
Andrew Kelley
2a00df9c09 Sema: fix generic instantiation false negatives
The problem was that types of non-anytype parameters were being included
as part of the check to see if generic function instantiations were
equal. Now, Module.Fn additionally stores the information for whether each
parameter is anytype or not. `generic_poison` cannot be used to signal
this because the type is still needed for comptime arguments; in such
case the type will not be present in the newly generated function
prototype.

This presented one additional challenge: we need to compare equality of
two values where one of them is post-coercion and the other is not. So
we make some minor adjustments to `Type.eql` to support this. I think
this small complexity tradeoff is worth it because it means the compiler
does much less work on the hot path that a generic function is called
and there is already an existing matching instantiation.

closes #11146
2022-04-14 06:08:28 -07:00
Andrew Lee
9b82e7f558 std/bounded_array.zig: Add Writer interface 2022-04-14 02:56:40 -04:00
vi
6ad9ac59e7 std.math.float: fix f80-backed c_longdouble consts 2022-04-14 02:55:46 -04:00
Eric Shrewsberry
497f8a6098 Fix bug in PriorityQueue::removeIndex()
Fix to call siftDown on the removed index instead of always on index 0.
Updated test to a test that fails before and passes now.

PriorityDequeue does not have this issue.
2022-04-14 02:54:41 -04:00
Andrew Kelley
59fa548be8
Merge pull request #11429 from ziglang/stage2-alive-decls
stage2: fix (recursively) marking decls as alive, and improve DWARF for local vars
2022-04-14 02:01:16 -04:00
Ryan Liptak
9c509f1526 Enable passing 'Dir.rename directories' fs test on Windows
Looks like d3f87f8ac01039722197a13a12342fc747a90567 fixed the standard cases of dir renaming, but the edge cases (renaming onto an existing empty/non-empty directory) are still behaving differently than on non-Windows.
2022-04-13 19:55:16 +02:00
Jakub Konka
edb428fae4 macho,x64: resolve debug info relocs for RIP-based addressing
Sometimes we will want to generate debug info for a constant that
has been lowered to memory and not copied anywhere else. For this
we will need to defer resolution on PIE platforms until all locals
(including GOT entries) have been allocated.
2022-04-13 19:50:23 +02:00
Jakub Konka
3f912430bd stage2,x64: deref memory if referenced via GOT for local vars 2022-04-13 16:24:56 +02:00
Jakub Konka
0bf7283330 dwarf: gen debug info for arrays 2022-04-13 16:22:24 +02:00
Jakub Konka
4c50a27d68 stage2,x64: generate debug info for local vars at hardcoded mem addr 2022-04-13 14:31:04 +02:00
Jakub Konka
baeff1762b stage2,x64: recursively mark decls as alive when lowering 2022-04-13 13:52:01 +02:00
Cody Tapscott
aaac8eae68 Use 0-indexing for incremental compile error tests 2022-04-13 01:09:21 -04:00
Andrew Kelley
8ada446b1f
Merge pull request #11407 from topolarity/float-fix
compiler_rt: Add `f80` support to `floatXiYf`/`fixXfYi`
2022-04-13 01:08:33 -04:00
Cody Tapscott
319555a669 Add floatFractionalBits to replace floatMantissaDigits 2022-04-12 12:33:16 -07:00
Andrew Kelley
7972bc8aa8 Sema: fix struct init ref 2022-04-12 12:20:08 -07:00
Andrew Kelley
ff7ef624f5 Sema: fix comptime call with generic function as parameter 2022-04-12 12:19:32 -07:00
Andrew Kelley
99657dca1f Sema: fix comptime equality of extern unions with same tag 2022-04-12 11:36:26 -07:00
Andrew Kelley
b0edd8752a Liveness: modify encoding to support over 32 operands
Prior to this, Liveness encoded `asm`, `call`, and `aggregate_init` with
a single 32-bit integer, allowing up to 35 operands (3 are provided by
the regular tomb_bits). However, the Zig language allows function calls
with more than 35 arguments, inline assembly with more than 35 inputs,
and anonymous tuples with more than 35 elements.

The new encoding stores an index to the extra array instead of the bits
directly, and then as many extra elements as needed to encode all the
operands. The MSB is used as a flag to tell which element is the last
one, allowing for 31 bits per element.

Prior to this, print_air did not bother correctly printing tombstones
for these instructions; now it does.

In addition to updating the BigTomb iteration logic in the machine code
backends, this commit extracts the common logic into the Liveness namespace.
2022-04-12 11:22:12 -07:00
Cody Tapscott
319b5cbce5 Do not detect byte-order using _BIG/_LITTLE_ENDIAN
These defines are present on some FreeBSD systems, regardless of
whether the system is big- or little- endian. This was causing the
FreeBSD CI to be incorrectly flagged as big-endian.

Resolves https://github.com/ziglang/zig/issues/11391
2022-04-12 11:14:33 -07:00
Cody Tapscott
04dd43934a Skip some floatXiYf tests on non-x86 platforms
These need to be skipped because of a bug with `@floatToInt`
on stage1:  https://github.com/ziglang/zig/issues/11408
2022-04-12 10:25:29 -07:00
Cody Tapscott
1c1cfe1533 Skip @rem/@mod tests on stage2, due to missing fmodl implementation 2022-04-12 10:25:29 -07:00
Cody Tapscott
b5d5685a4e compiler_rt: Implement floatXiYf/fixXfYi, incl f80
This change:
 - Adds  generic implementation of the float -> integer conversion
   functions floatXiYf, including support for f80
 - Updates the existing implementation of integer -> float conversion
   fixXiYf to support f16 and f80
 - Fixes the handling of the explicit integer bit in `__trunctfxf2`
 - Combines the test cases for fixXfYi/floatXiYf into a single file
 - Renames `fmodl` to `fmodq`, since it operates on 128-bit floats

The new implementation for floatXiYf has been benchmarked, and generally
provides equal or better performance versus the current implementations:

Throughput (MiB/s) - Before
     |    u32   |    i32   |    u64   |    i64   |   u128   |   i128   |
-----|----------|----------|----------|----------|----------|----------|
 f16 |     none |     none |     none |     none |     none |     none |
 f32 |  2231.67 |  2001.19 |  1745.66 |  1405.77 |  2173.99 |  1874.63 |
 f64 |  1407.17 |  1055.83 |  2911.68 |  2437.21 |  1676.05 |  1476.67 |
 f80 |     none |     none |     none |     none |     none |     none |
f128 |   327.56 |   321.25 |   645.92 |   654.52 |  1153.56 |  1096.27 |

Throughput (MiB/s) - After
     |    u32   |    i32   |    u64   |    i64   |   u128   |   i128   |
-----|----------|----------|----------|----------|----------|----------|
 f16 |  1407.61 |  1637.25 |  3555.03 |  2594.56 |  3680.60 |  3063.34 |
 f32 |  2101.36 |  2122.62 |  3225.46 |  3123.86 |  2860.05 |  1985.21 |
 f64 |  1395.57 |  1314.87 |  2409.24 |  2196.30 |  2384.95 |  1908.15 |
 f80 |   475.53 |   457.92 |   884.50 |   812.12 |  1475.27 |  1382.16 |
f128 |   359.60 |   350.91 |   723.08 |   706.80 |  1296.42 |  1198.87 |
2022-04-12 10:25:26 -07:00
Andrew Kelley
17631cb2d3
Merge pull request #11401 from viriuwu/float-category-misc
math: simplify inf (+f80 support), deprecate old constants (followup for #10133)
2022-04-12 06:37:12 -04:00
Ryan Liptak
17daba1806 std/fs/test.zig: Add test for renaming a dir onto an empty dir
Also split the Dir.rename on directories test into 3 tests:
- General rename of a directory
- Rename of a directory onto an existing empty directory
- Rename of a directory onto an existing non-empty directory

The only new case is the rename onto an existing empty directory, but splitting the tests this way made them much more understandable.
2022-04-12 06:28:16 -04:00
Andrew Kelley
bb4e74103b
Merge pull request #11417 from topolarity/incremental-tests
Add file support for incremental compile error tests
2022-04-12 06:27:09 -04:00