Commit Graph
424 Commits
Author SHA1 Message Date
Louis Novy 39770ab15e Apply sanitizer attributes to procedure literals 2026-10-24 14:25:19 -04:00
Barinzaya 1233c7fc69 Fixed SIMD shift behavior.
This addresses two issues:
- LLVM errors if the sizes of the two sides don't match, e.g.
  `simd_shr(#simd[4]i32, #simd[4]u8)`
- Negative values on the LHS becoming 0 if a shr overflows.
2026-10-17 16:11:57 -04:00
gingerBill 5ea706da75 Fix named arguments on constant proc values whose parameter names differ from the callee type 2026-10-12 12:08:29 +01:00
gingerBill eda84b4cfe Check a callee is a procedure before reading Procedure.is_objc_impl_or_import 2026-10-11 21:51:37 +01:00
gingerBill 97c7f0214f Move a DeclInfo's procedure-only fields to a ProcDeclInfo only procedures allocate; remove the unused type_and_value_mutex fields 2026-10-11 20:08:31 +01:00
gingerBill 992839ebea Store a node's constant value out of line (as few nodes have one) 2026-10-11 19:16:22 +01:00
gingerBill 0f991097d8 Print the missing runtime procedure's name in lb_lookup_runtime_procedure 2026-10-11 10:31:16 +01:00
gingerBill 93f71c2751 Merge pull request #7842 from bbodi/fix/llvm-objc-varargs
Fix/llvm objc varargs
2026-10-09 10:54:21 +01:00
bbodi 27c2527e2a Read the AAPCS64 va_list in c_va_arg by hand
LLVM's va_arg instruction only implements the Darwin char* va_list on
arm64. On Linux and the BSDs the va_list is the AAPCS64 struct, and the
instruction walked its first field, __stack, as if it were the Darwin
list. Arguments passed in registers were never read from the register
save areas, so c_va_arg returned whatever lay at the incoming stack
pointer.

c_va_arg now lowers the struct form the way clang does: take the value
from the general or floating-point register save area while the class
offset is negative, otherwise from __stack, with 16-byte alignment and
indirect composites handled.

The new test passes more arguments than any target keeps in registers,
so both the register and the stack path are covered.
2026-10-09 11:33:11 +02:00
bbodi ded59d40f0 Name the va_start intrinsics for LLVM 18
LLVM 19 made llvm.va_start, llvm.va_end and llvm.va_copy overloaded on
the pointer type, so the backend asked for the "llvm.va_start.p0"
declaration. On LLVM 18, which the FreeBSD and riscv64 CI jobs use, that
name is not an intrinsic, so it became an undefined symbol at link time
for any procedure that uses c_va_start.

The overload type is only passed on LLVM 19 and later.
2026-10-09 11:33:11 +02:00
BBandClaude Opus 5.5 38319c6aa8 Read promoted types in c_va_arg
Callers pass C variadic arguments with the default argument promotions
applied (f16/f32 as f64, small integers and booleans as i32, see
lb_emit_c_vararg), but c_va_arg read the slot as the requested type.
For f32 and f16 that read part of a double, which gave garbage such as
0 instead of 2.25 on arm64 Darwin, x86-64 SysV and Win64 alike. Small
integers happened to work on these little-endian targets because the
low bytes of the slot hold the value.

c_va_arg now reads the promoted type and converts it back, as C code
must do, which also makes the integer case explicit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 22:08:15 +02:00
bbodi bd530ccc0a Enable evex512 with explicit AVX-512 target features
LLVM only adds evex512 by itself for the generic x86 CPUs, so with the
default x86-64-v2 microarch, -target-features:avx512f left 512-bit
vectors split into ymm pairs and C got garbage lanes back from Odin
(and the other way round). Clang adds it whenever an AVX-512 feature is
on and evex512 isn't named, do the same for the global features and for
@(enable_target_feature).
2026-10-08 21:19:25 +02:00
gingerBill 1a136c13bd Merge pull request #7824 from MatzeOGH/debug-info-string
Fix the debug info for indirect parameters that get a callee copy
2026-10-08 16:12:23 +01:00
Matthias Huerbe 6fb0d77cdb Fix the debug info for indirect parameters that get a callee copy 2026-10-08 14:20:11 +02:00
gingerBill 4d8e8aaf4a Mark optimized procedures, add assignment tracking, and add MD5 file checksums on LLVM 22+ 2026-10-08 12:28:21 +01:00
gingerBill 399b6d4a36 Name procedures and globals in debug info by package and enclosing procedure, with literals named by line, one shared name for all polymorphic instances, and exported and custom link names kept 2026-10-08 10:10:15 +01:00
gingerBill 6cfa3dafb7 Finalize debug info per module in parallel, and skip debug info work that was never used 2026-10-08 01:05:24 +01:00
gingerBill ad685e1144 Compare floats by their bits in atomic compare-exchange; reject atomics on what is within a struct #packed 2026-10-07 21:50:16 +01:00
gingerBill 6961b36425 Fix the core:sys/llvm bindings for current LLVM, add the missing ones; allow #const parameters to take their defaults, and reuse an intrinsic already declared by the compiler 2026-10-07 16:56:25 +01:00
gingerBill 9fb76aa3ba Add intrinsics return_address, frame_address, stack_pointer, and address_of_return_address 2026-10-07 16:32:32 +01:00
Mihail Moskov 55c6cf3dea fixes regressions at sites needing true address caused by temp copy 2026-10-06 20:21:05 +03:00
gingerBill 7cbb04159d Name nested and anonymous procedures from their enclosing declarations alone so the name never depends on which module names them first 2026-10-04 23:22:32 +01:00
gingerBill cd08004d33 Free the temporary memory of each procedure once it is generated; keep the strings used as keys of the constant string maps permanently 2026-10-03 18:38:09 +01:00
gingerBill e5cc35c445 Lower what LLVM's fast instruction selector cannot select before emitting objects, and declare debug variables through stack slots 2026-10-03 11:02:55 +01:00
gingerBill 29106aaa1e Cache type layouts and union constantability, build nested constants once, create debug files lazily 2026-10-03 01:26:01 +01:00
gingerBill c628768c5e Strip constant parameters from specialized procedure types; fix calling a parenthesized polymorphic callee 2026-10-02 23:11:13 +01:00
gingerBill 38fa57e907 Make global checking and codegen order-independent 2026-10-01 15:01:14 +01:00
corleypc 6c5651638c Merge branch 'master' into lifetime-markers 2026-09-29 16:04:59 +03:00
corley a931018a24 fixes #must_tail on wasm targets 2026-09-29 01:57:49 +03:00
corley 08166787f3 fixes context attributes in dummy procedures 2026-09-23 23:54:51 +03:00
corley bac6130710 lifetime markers for named locals 2026-09-20 15:55:26 +03:00
Senthilnathan 699973abd6 Merge branch 'master' into fix/location-global-initializer 2026-09-16 18:45:52 +05:30
Senthilnathan ed2d5304d1 fix: #location in global variable initializers 2026-09-16 18:42:10 +05:30
gingerBill 9b2cb3277f Merge pull request #7561 from corleypc/simd-masked-crash-fix
Fixes simd gather/scatter and masked load/store randomly crashing the compiler
2026-09-16 13:23:21 +01:00
Mihail Moskov d5db73dc06 fixes simd gather/scatter and masked load/store randomly crashing the compiler 2026-09-14 15:26:46 +03:00
corley 4ce5148e8c fixes simd_select and simd_runtime_swizzle 2026-09-12 18:45:32 +03:00
Jeroen van Rijn 7f6a66302f Merge pull request #7548 from corleypc/simd-recip-fix
Fixes simd_approx_recip and simd_approx_recip_sqrt
2026-09-12 06:49:10 -07:00
corley feebf91fd5 fixes simd_approx_recip and simd_approx_recip_sqrt 2026-09-12 16:27:23 +03:00
Xaryen f4d1cc5e87 Fix #6917 2026-09-12 07:50:04 +09:00
Mihail Moskov c0cd25ba76 simd_abs optimization + fix for unsigned 2026-09-09 17:13:20 +03:00
Jeroen van Rijn 650c558cb9 Merge pull request #7445 from kalsprite/target_feature_empty_element
string_split_iterator fix
2026-08-24 18:03:35 -07:00
kalsprite 7bf266ef93 string_split_iterator fix 2026-08-24 17:32:30 -07:00
Mihail Moskov 74ac336ef1 fixes -o:size 2026-08-24 12:53:05 +03:00
gingerBill 9870cd4c36 Merge pull request #7271 from odin-lang/bill/inline-asm
`asm` templates
2026-08-18 19:19:40 +02:00
kalsprite c6fcad51f8 riscv64: use a Slice for the coerce offsets 2026-08-17 18:54:58 -07:00
gingerBill 645b57be9f Merge pull request #7327 from kalsprite/abi_conformance
ABI Conformance Harness + Fixes
2026-08-17 16:28:01 +02:00
gingerBill 1f2234a4b2 Merge branch 'master' into bill/inline-asm 2026-08-17 11:44:14 +01:00
gingerBill a03d5addfa Merge pull request #7334 from kalsprite/riscv64_arg_coerce
riscv64: read a flattened aggregate's members from their real offsets
2026-08-17 12:40:36 +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