Commit Graph
109 Commits
Author SHA1 Message Date
Louis Novy 8fe3b9b57b Fix compound literals of array backed bit_fields 2026-10-01 12:43:00 -04:00
gingerBill 383a2fe1e5 Reject complex/quaternion component overflow to match normal floats 2026-09-29 16:34:06 +01:00
gingerBill 28d8a790d7 Add more tests for the float constant builtins 2026-09-29 15:27:07 +01:00
gingerBill 19f7b5e2e2 Add f16/f32 precision checks; Fix macOS MSIZE macro collision 2026-09-29 14:53:28 +01:00
gingerBill a910a0794d Add test_number_literals.odin 2026-09-29 14:39:15 +01:00
gingerBill 3f24a82469 Merge pull request #7656 from alyekypo/fix/union-constant-non-constantable
fix(llvm): emit union constants for non-constantable unions
2026-09-29 13:03:37 +01:00
gingerBill bd87143db7 Add some regression tests for bit_set backed by arrays 2026-09-29 12:20:52 +01:00
alyekypo b9c4067f78 fix(llvm): emit union constants for non-constantable unions
`constant: U : value` produced a constant of the wrong type:
lb_const_value took its union-lowering branch only when
`is_type_union_constantable(type)` held, so for a union with a variant
that whitelist rejects (`union{bool, ^int}`) the value fell through to
the scalar branch and reached `LLVMConstInt(lb_type(m, union_type),
...)`.  The constant emitted there does not match the union's type:
bytes that change between runs for `true`, a compiler crash for `1.0`,
an `is_type_string` assertion for a string literal.

The checker already resolves which variant a constant represents and
records it in `ExactValue::variant_type` - the variant type, tag index,
payload and padding the union branch needs - so that branch is now also
taken when the value pins a variant this backend can build as a
constant.  The type-level whitelist was re-guessing information the
value already carries; variant types this backend cannot build as
constants (`any`) stay excluded.

lb_build_static_variables had the same defect in another place: it
lowered an initializer with the expression's type instead of the
declared type, so `@(static) s: U` emitted a payload-only constant and
LLVM rejected the module with “Global variable initializer type does not
match global variable type!”.  It now passes the declared type and gives
the global the constant's layout-compatible type, the way the file-scope
path already does.

Blast radius: every union-typed constant, i.e. typed constants, global
static initializers, @(static)/@(thread_local)/@(rodata), default
parameters and constant aggregate elements.  Unions whose variants are
all constantable keep the previous path.
2026-09-28 19:32:04 +00:00
gingerBill 2911bed812 Merge pull request #7569 from michtesar/7525/inline-asm-tests
tests: add coverage for inline-asm label definitions on amd64 [7525]
2026-09-16 12:56:14 +01:00
gingerBill ba92c2ebed Merge pull request #7570 from michtesar/7544/bit-field-constant-access
fix constant bit_field field access returning zero value [7544]
2026-09-16 11:56:28 +01:00
Michael Tesař a26aca2fe6 fix constant bit_field field access returning zero value 2026-09-15 22:28:53 +02:00
Michael Tesař 85b1e42b19 tests: add coverage for inline-asm label definitions on amd64 2026-09-15 22:17:49 +02:00
corley 4ce5148e8c fixes simd_select and simd_runtime_swizzle 2026-09-12 18:45:32 +03:00
corley feebf91fd5 fixes simd_approx_recip and simd_approx_recip_sqrt 2026-09-12 16:27:23 +03:00
Mihail Moskov c0cd25ba76 simd_abs optimization + fix for unsigned 2026-09-09 17:13:20 +03:00
kalsprite 5628815bfe mod -1 2026-08-24 19:46:47 -07:00
kalsprite 7fe49fbffb Fix compiler panic on a selector into 2026-08-21 16:38:56 -07:00
Jeroen van Rijn 00a03e72b5 Merge pull request #7400 from kalsprite/union_slice_assert
backend: only reuse a compound literal's storage for a variable of its type
2026-08-20 03:38:09 +02:00
Jeroen van Rijn 6695ca537d Merge pull request #7087 from korvahkh/const-union-fixes
Implement fixes for constant unions
2026-08-20 03:35:36 +02:00
Jeroen van Rijn e551ef5f15 Merge pull request #7397 from kalsprite/union_ternary_phi
backend: a union constant in a ternary or  builds an ill-typed phi
2026-08-20 03:24:04 +02:00
korvahkh feb008ab6e Add tests for constant unions 2026-08-19 20:16:51 -05:00
kalsprite bc2649bacd backend: only reuse a compound literal's storage for a variable of its type 2026-08-19 17:53:34 -07:00
kalsprite f360a37ccd cmplx & quat take type from args 2026-08-19 17:36:50 -07:00
kalsprite a13a4b418d backend: a union constant in a ternary or builds an ill-typed phi 2026-08-19 16:45:58 -07:00
kalsprite cf5f181228 peel union constant to its variant 2026-08-19 16:30:37 -07:00
gingerBill 6defecf436 Merge pull request #7392 from kalsprite/asm_extend_mnemonics
amd64 asm: extend family emits mnemonic that doesnt exist
2026-08-19 23:54:37 +02:00
kalsprite 40a64a9dbb move test to build specific 2026-08-19 14:39:12 -07:00
kalsprite 26ae28dfb7 asm: multi-instruction template computed with one operand twice 2026-08-19 14:32:03 -07:00
kalsprite b9983105bd amd64 asm: extend family emits mnemonic that doesnt exist 2026-08-19 14:03:56 -07:00
Jeroen van Rijn b7944229e5 Merge pull request #7385 from kalsprite/bit_field_value_range
bitfield: a constant is range-checked only while it is untyped
2026-08-19 20:48:58 +02:00
kalsprite 8c239a8f43 range check bitfield fields for untyped constants 2026-08-19 10:52:58 -07:00
kalsprite 8189bb9730 abs const fold 2026-08-17 22:41:22 -07:00
Jeroen van Rijn ee89002c24 Add more %% tests 2026-08-17 12:40:49 +02:00
Mihail Moskov e92c04eb73 Fixes the %% operator 2026-08-16 23:08:24 +03:00
Jeroen van Rijn 889ad95c7e Merge pull request #7342 from kalsprite/alpha
quat/cmplx nan cmp & accessors
2026-08-16 12:31:55 +02:00
Jeroen van Rijn 7aa805e22a Merge pull request #7343 from kalsprite/rune_unsigned_mapping
intrinsics.type_integer_to_unsigned(rune) returns f16
2026-08-16 12:28:59 +02:00
Jeroen van Rijn 3eeda58634 Merge pull request #7344 from kalsprite/simd_builtin_diagnostics
simd: enforce the `#simd` construction rules and stop two crashes
2026-08-16 12:17:39 +02:00
Jeroen van Rijn 94528dde45 Merge branch 'master' into pr/7345 2026-08-16 11:19:48 +02:00
kalsprite f7b734c82b deinterleave -> shuffle 2026-08-16 00:24:09 -07:00
kalsprite 95c4004239 switch to shuffle intrinsic since #simd is pow2 2026-08-16 00:16:21 -07:00
kalsprite d52aff5c4b impl riffle for llvm<=20 fallback on interleave 2026-08-15 23:53:54 -07:00
kalsprite a7029ef7b6 bitset subset 2026-08-15 23:25:13 -07:00
kalsprite 885e12d21d and-not fold 2026-08-15 23:06:35 -07:00
kalsprite 5f0251fec2 5791,6748 2026-08-15 22:44:52 -07:00
kalsprite e53fc6a879 simd [?] type fix; count recovery 2026-08-15 22:23:15 -07:00
kalsprite ae742cb9f3 rune unsigned mapping 2026-08-15 20:53:03 -07:00
kalsprite 4cf4607c8b fix #5964 2026-08-15 20:41:22 -07:00
kalsprite b378f21f4c update tests 2026-08-15 20:24:41 -07:00
kalsprite 617293c5f0 quat/cmplx nan cmp 2026-08-15 20:08:27 -07:00
Mihail Moskov 6a81351de3 fixes float to 128-bit int/uint conversion 2026-08-12 19:25:46 +03:00