LemonBoy
df99cfdf1e
stage1: Fix typeInfo generation for arrays w/o sentinel
...
ZigTypeIdOptional types have a different way of specifying their payload
value depending on whether the child type is a pointer or not (plus some
other special cases).
Fixes #7251
2020-11-29 10:39:10 -08:00
LemonBoy
c80d196094
stage1: Add missing bitcast when rendering var ptr
...
Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.
Fixes #7250
2020-11-29 10:37:06 -08:00
LemonBoy
f91df39ad2
stage1: Fix crash in *[N]T to []T conversion with zst
...
Prevent the crash by not making the codegen try to access the
non-existing ptr field in the slice.
Closes #6951
2020-11-27 14:33:26 -08:00
LemonBoy
58c2bec589
stage1: Fix ICE when generating struct fields with padding
...
Make gen_const_ptr_struct_recursive aware of the possible presence of
some trailing padding by always bitcasting the pointer to its expected
type.
Not an elegant solution but makes LLVM happy and is consistent with how
the other callsites are handling this case.
Fixes #5398
2020-11-25 15:36:33 -08:00
Andrew Kelley
bf0cc32aa6
Merge pull request #7165 from LemonBoy/ppc64final
...
Make the PPC64 port usable
2020-11-20 17:40:17 -08:00
LemonBoy
6029114f84
stage1: Resolve usingnamespace decls when calling @typeInfo
...
Closes #7176
2020-11-20 17:01:23 -08:00
LemonBoy
2193bbfd93
Skip f16 to f128 conversion test for ppc64
...
As for aarch64 we're waiting for LLVM to emit calls to the specific
builtins that implement this conversion.
2020-11-20 08:38:11 +01:00
LemonBoy
f2b4e6b2e7
Better coverage in @splat tests
...
Cover more common and uncommon cases.
2020-11-20 08:38:10 +01:00
Andrew Kelley
73be59433f
Merge pull request #6928 from data-man/reduce_tests
...
Add more tests for reduce
2020-11-19 17:48:18 -08:00
Veikka Tuominen
cf819b95fe
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
...
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 19:03:08 +02:00
Tadeo Kondrak
25ec2dbc1e
Add builtin.Signedness, use it instead of is_signed
2020-11-19 18:59:21 +02:00
Tadeo Kondrak
c002a5026a
Update code to not use unsupported calling conventions for target
2020-11-19 14:01:07 +02:00
LemonBoy
2b7781d82a
stage1: Fix undefined assignment for bitfields
...
Prevents silent memory corruption.
Closes #7055
2020-11-18 21:49:39 -08:00
LemonBoy
fa27420b72
stage1: Fix asyncCall with non-abi-aligned arguments
...
Make the code used to calculate the variable slot index into the frame
match what's done during the structure layout calculation.
Prevents a few nasty LLVM errors when such types are passed around.
2020-11-17 15:55:12 -08:00
data-man
86b86bef23
Added links to the relevant issue
2020-11-17 14:41:05 +05:00
Andrew Kelley
d9c36cb250
Merge pull request #6878 from frmdstryr/multiline-string-comments
...
Support comments in multiline string literals
2020-11-16 14:05:15 -08:00
Alexandros Naskos
6e2e747b0b
Merge pull request #7112 from LemonBoy/fix-7104
...
stage1: Fix generation of pass-by-value args in async fns
2020-11-16 09:12:42 +02:00
LemonBoy
7ebbc717c0
stage1: Fix generation of pass-by-value args in async fns
...
The mismatch between the argument slot type in the frame structure and
the one used in the store operation made the generated code write
garbage over the nearby fields.
Fixes #7104
2020-11-14 15:30:06 +01:00
LemonBoy
c4fd3fc270
stage1: Resolve ErrorUnion children types
...
Since the code is accessing the abi_size field compute the full type
size for both err_set_type and payload_type, not only for the latter.
2020-11-13 14:28:40 -07:00
LemonBoy
5872ae5111
stage1: Fix crash in comptime struct generation
...
Using the gen_index rather than the src_index is needed to handle
structures containing zero-sized or comptime only types.
Closes #7027
2020-11-11 15:35:19 +02:00
LemonBoy
f0b1b74d21
stage1: Avoid resolving type entry in [0]T
...
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.
Closes #7058
2020-11-11 13:53:24 +02:00
LemonBoy
4d4ab1e69a
stage1: Fix comparison of unions containing zero-sized types
...
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!
Fixes #7047
2020-11-10 17:21:49 -05:00
xackus
5c8f7f81cd
change debug.assert to testing.expect in tests
2020-11-06 22:48:54 +01:00
LemonBoy
ff14451b4a
std: Implement more useful approxEq semantics
...
Comparisons with absolute epsilons are usually useful when comparing
numbers to zero, for non-zero numbers it's advised to switch to relative
epsilons instead to obtain meaningful results (check [1] for more
details).
The new API introduces approxEqAbs and approxEqRel, where the former
aliases and deprecated the old `approxEq`, allowing the user to pick the
right tool for the job.
The documentation is meant to guide the user in the choice of the
correct alternative.
[1] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
2020-11-05 16:08:49 +01:00
data-man
df4fd94525
remove f128 tests, disable min/max for NaNs
2020-11-04 17:42:57 +05:00
LemonBoy
be26c3bf4e
stage1: Fix *WithOverflow intrinsics with u0 values
...
Closes #5369
2020-11-02 13:40:00 -05:00
data-man
ae73e0911d
Remove min/max tests for NaNs
2020-11-02 20:40:41 +05:00
data-man
f0610d99f1
Add more tests for reduce
2020-11-02 16:48:59 +05:00
LemonBoy
4fd1ec78e9
std: Re-enable union behaviour test for mips targets
2020-11-02 11:46:26 +01:00
LemonBoy
0d6a7088dc
stage1: Implement Add/Mul reduction operators
2020-11-01 14:30:31 -07:00
frmdstryr
1d22591299
Add tests and fix \n between comments
2020-10-30 11:20:16 -04:00
LemonBoy
4fb896f16e
stage1: Fix bug in internal string slicing ( #6843 )
...
Closes #6456
2020-10-29 14:38:13 -04:00
LemonBoy
b3314a8be6
stage1: Fix small bug in pointer type analysis
...
A flag meant to catch recursively-defined types was never reset, leading
the compiler to generate wrong answers when asked for its
type/alignment.
Closes #6850
2020-10-29 15:41:45 +02:00
LemonBoy
7bc9531698
stage1: Correctly generated optional constant values
...
Closes #6799
2020-10-28 21:56:28 +02:00
LemonBoy
6d2f103bfb
stage1: Fix crash in comptime struct value copy
...
Comptime fields are never materialized in the ZigValue so pay attention
when iterating over the fields array.
Fixes #6800
2020-10-28 21:13:32 +02:00
frmdstryr
1ce0994897
Fix @import of empty file
2020-10-26 13:29:32 -07:00
Andrew Kelley
e83334274f
add regression test for already fixed bug
...
closes #6781
2020-10-26 13:18:44 -07:00
Andrew Kelley
e6ac082437
Merge pull request #6744 from LemonBoy/intcast-vec
...
stage1: Implement `@intCast` between vectors
2020-10-22 17:36:18 -04:00
LemonBoy
44f8e6a534
stage1: Fix edge case in Union ZigValue generation
...
Unions that passed the one_possible_value check were incorrectly
generated, none of their internal fields were initialized.
Fixes #6758
2020-10-21 22:42:03 -04:00
LemonBoy
2f465761bb
stage1: Implement @intCast between vectors
...
Explicit and implicit integer casts on vector types are now supported
and follow the same rules as their scalar counterparts.
Implicit float casts are accidentally supported, `@floatCast` is still
not vector-aware.
2020-10-19 20:05:09 +02:00
Jan Prudil
132813849c
Convert remaining call sites
2020-10-17 14:50:26 +02:00
vegecode
2545f44db0
byteOffsetOf add fields to non-packet struct to maintain symmetry
2020-10-16 20:04:42 -07:00
vegecode
0456b2145d
byteOffsetOf rounds up using bit offset in host integer
2020-10-16 20:04:42 -07:00
LemonBoy
ab585c680b
stage1: Off-by-one error in int to float conversion
...
The base is 2^64 and not 2^64-1.
Closes #6683
2020-10-15 21:25:59 +03:00
Tadeo Kondrak
0e57f220fb
stage1: Disallow arrays in function parameters or return types
...
Closes #6535 .
2020-10-08 04:17:32 -04:00
Tadeo Kondrak
2b4b03d301
Update zig files for opaque type syntax
2020-10-06 22:08:25 -06:00
Tadeo Kondrak
069fbb3c01
Add opaque type syntax
2020-10-06 22:08:24 -06:00
LemonBoy
22b5e47839
stage1: Implement @reduce builtin for vector types
...
The builtin folds a Vector(N,T) into a scalar T using a specified
operator.
Closes #2698
2020-10-05 04:51:45 -04:00
Alexandros Naskos
e31cc80130
Merge pull request #6427 from tadeokondrak/enums-explicit-tag-type-extern-allowed
...
Allow enums with explicit extern-allowed tag types in extern types
2020-10-03 12:51:39 +03:00
Tadeo Kondrak
cae49b1b9d
Add tests for enums with explicit extern-allowed tag types in extern types
2020-10-01 18:09:47 -06:00