Jacob Young
b9198b708f
x86_64: rewrite @abs
2025-01-20 14:47:07 -05:00
Alex Rønne Petersen
d5db02728c
Merge pull request #22530 from alexrp/omit-unwind-tables
...
Fix building the standard library without CFI directives
2025-01-20 07:24:12 +01:00
Jacob Young
5cfcb01503
llvm: convert @divFloor and @mod to forms llvm will recognize
...
On x86_64, the `@divFloor` change is a strict improvement, and the
`@mod` change adds one zero latency instruction. In return, once we
upgrade to LLVM 20, when the optimizer discovers one of these operations
has a power-of-two constant rhs, it will be able to optimize the entire
operation into an `ashr` or `and`, respectively.
#I CPL CPT
old `@divFloor` | 8 | 15 | .143 |
new `@divFloor` | 7 | 15 | .148 |
old `@mod` | 9 | 17 | .134 | (rip llvm
new `@mod` | 10 | 17 | .138 | scheduler)
2025-01-19 22:10:39 -05:00
Alex Rønne Petersen
0ead0beb83
Merge pull request #22524 from alexrp/libunwind-exceptions
...
`libunwind`: Build C files with `-fexceptions`.
2025-01-19 06:46:24 +01:00
Jacob Young
8ee80d61f6
x86_64: add a bunch of instruction encodings
...
Closes #19773
2025-01-18 23:30:45 -05:00
Matthew Lugg
ebf782e944
Merge pull request #22531 from mlugg/various-fixes
...
incremental, Sema: minor fixes
2025-01-19 00:16:26 +00:00
Jacob Young
a446101677
x86_64: enable struct field reordering
...
The blocker for enabling this feature was my need to debug the emitted
assembly without debug info and having to manually inspect memory to
determine struct contents. However, we now have debug info!
(lldb) v -L foo bar
0x00007fffffffda20: (repro.repro.Foo) foo = {
0x00007fffffffda24: .x = 12
0x00007fffffffda20: .y = 34
}
0x00007fffffffda28: (repro.repro.Bar) bar = {
0x00007fffffffda28: .x = 56
0x00007fffffffda2c: .y = 78
}
Updates #21530
2025-01-18 16:14:51 -05:00
mlugg
3b6e5ba490
Sema: don't try to initialize global union pointer at comptime
...
Resolves : #19832
2025-01-18 14:30:06 +00:00
mlugg
f7b9f84df2
incremental: fix enum resolution bugs
2025-01-18 14:30:06 +00:00
Alex Rønne Petersen
566cc4f99d
compiler: Fix @import("builtin").unwind_tables logic.
2025-01-18 14:57:41 +01:00
Alex Rønne Petersen
332add7a65
libunwind: Build C files with -fexceptions.
...
See: https://github.com/llvm/llvm-project/pull/121819
This fixes LTO for libunwind, so also re-enable support for that.
Closes #12828 .
2025-01-18 13:15:58 +01:00
Andrew Kelley
f7f6217df9
macho linker: adjust symbol priority
...
strong symbols always take precedence over weak symbols.
2025-01-17 15:12:01 -08:00
Andrew Kelley
e6dc85f1b4
remove memcpy and memmove from bundled libcs
...
These are provided instead by compiler_rt.
Part of #2879
2025-01-17 12:34:15 -08:00
Jacob Young
8c8dfb35f3
x86_64: fix crashes compiling the compiler and tests
2025-01-16 20:47:30 -05:00
Jacob Young
c3d33440f0
x86_64: pass more behavior tests
2025-01-16 20:47:30 -05:00
Jacob Young
666d76d85c
x86_64: implement load and store
2025-01-16 20:47:30 -05:00
Jacob Young
6d1fc0f51c
x86_64: implement aggregate access
2025-01-16 20:47:30 -05:00
Jacob Young
63730441d0
x86_64: implement union access
2025-01-16 20:47:30 -05:00
Jacob Young
5069f574f4
x86_64: remove pointless jump to epilogue
2025-01-16 20:47:30 -05:00
Jacob Young
3240adfa16
x86_64: implement pointer addition and subtraction
2025-01-16 20:47:30 -05:00
Jacob Young
0d9079f466
x86_64: implement element access
2025-01-16 20:47:30 -05:00
Jacob Young
870443f7fa
x86_64: implement passing undefined as a call arg with the new cc
2025-01-16 20:47:30 -05:00
Jacob Young
094ac8c3dc
x86_64: fix f16 miscomp exposed by new calling convention
2025-01-16 20:47:30 -05:00
Jacob Young
b7acd97789
x86_64: fix hazards exposed by new calling convention
2025-01-16 20:47:30 -05:00
Jacob Young
074232b3e5
x86_64: implement a custom calling convention for the Zig language
2025-01-16 20:47:30 -05:00
Jacob Young
3c74a478a4
x86_64: fix unnecessary register saving
2025-01-16 20:42:08 -05:00
Jacob Young
7f22c41e09
x86_64: add some ReleaseSmall support
2025-01-16 20:42:08 -05:00
Jacob Young
df7661b8d3
x86_64: optimize value copying slightly
2025-01-16 20:42:08 -05:00
Jacob Young
e5d5a8bc4e
x86_64: implement switch jump tables
2025-01-16 20:42:08 -05:00
Jacob Young
ac1a975f9b
x86_64: implement clz and not
2025-01-16 20:42:08 -05:00
Jacob Young
a7efc56d86
x86_64: the previous loop abstraction was too confusing
...
The temp usage was non-obvious, and implicit instructions hard to
reason about.
2025-01-16 20:42:08 -05:00
Jacob Young
a1828ebcda
x86_64: demolish the old
2025-01-16 20:42:08 -05:00
Jacob Young
73a42953c9
x86_64: 2 means better
2025-01-16 20:42:08 -05:00
Jacob Young
b9c4400776
x86_64: implement fallback for pcmpeqq
2025-01-16 20:42:08 -05:00
Jacob Young
c4b93555b0
x86_64: testing
2025-01-16 20:42:08 -05:00
Jacob Young
7c713251ca
x86_64: looped instructions
2025-01-16 20:42:08 -05:00
Jacob Young
beadf702b8
x86_64: rewrite arithmetic
2025-01-16 20:42:08 -05:00
Jacob Young
af1191ea8b
x86_64: rewrite
2025-01-16 20:42:07 -05:00
mlugg
9804cc8bc6
all: update to std.builtin.Type.{Pointer,Array,StructField} field renames
2025-01-16 12:49:58 +00:00
mlugg
726c94d5f1
Sema: prepare for sentinel -> sentinel_ptr field rename
...
The commit 2 after this will explain this diff.
2025-01-16 12:49:58 +00:00
mlugg
b6abe1dbf7
compiler: make it easier to apply breaking changes to std.builtin
...
Documentation for this will be on the wiki shortly.
Resolves : #21842
2025-01-16 12:49:48 +00:00
mlugg
d00e05f186
all: update to std.builtin.Type.Pointer.Size field renames
...
This was done by regex substitution with `sed`. I then manually went
over the entire diff and fixed any incorrect changes.
This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since
my regex happened to also trigger here. I opted to leave these changes
in, since they *are* a correct migration, even if they're not the one I
was trying to do!
2025-01-16 12:46:29 +00:00
Andrew Kelley
eda8b6e137
link.MachO: fix error reporting in flushModule
2025-01-15 20:21:33 -08:00
Andrew Kelley
ed810eeb06
link.Elf: fix error reporting for failed hot swap
2025-01-15 20:16:40 -08:00
Andrew Kelley
e4868693a5
Compilation: windows doesn't prelink yet
2025-01-15 19:59:53 -08:00
Andrew Kelley
605311211b
wasm linker: omit data count section when value is zero
2025-01-15 19:43:31 -08:00
Andrew Kelley
744bb5d16a
wasm linker: change rules about symbol visibility
...
export by default means export, as expected. if you want hidden
visibility then use hidden visibility.
2025-01-15 18:31:44 -08:00
Andrew Kelley
dcb4134835
wasm linker: delete commented out code
...
this logic has not yet been ported to the new design, but the logic is
safe and sound in the git history and does not need to also live as
commented out code
2025-01-15 18:19:46 -08:00
Andrew Kelley
9dd6efb7e4
wasm linker: fix TLS data segments
...
fix calculation of alignment and size
include __tls_align and __tls_size globals along with __tls_base
include them only if the TLS segment is emitted
add missing reloc logic for memory_addr_tls_sleb
fix name of data segments to include only the prefix
2025-01-15 18:17:37 -08:00
Andrew Kelley
10db1b9eda
wasm linker: fix explicit exports not affecting object files
2025-01-15 18:17:20 -08:00