diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-05-26 05:07:13 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-06-01 08:24:01 +0100 |
| commit | add2976a9ba76ec661ae5668eb2a8dca2ccfad42 (patch) | |
| tree | 54ea8377660395007c1ac5188863f5cbe3a3310e /src/Zcu/PerThread.zig | |
| parent | b48d6ff619de424e664cf11b43e2a03fecbca6ce (diff) | |
| download | zig-add2976a9ba76ec661ae5668eb2a8dca2ccfad42.tar.gz zig-add2976a9ba76ec661ae5668eb2a8dca2ccfad42.zip | |
compiler: implement better shuffle AIR
Runtime `@shuffle` has two cases which backends generally want to handle
differently for efficiency:
* One runtime vector operand; some result elements may be comptime-known
* Two runtime vector operands; some result elements may be undefined
The latter case happens if both vectors given to `@shuffle` are
runtime-known and they are both used (i.e. the mask refers to them).
Otherwise, if the result is not entirely comptime-known, we are in the
former case. `Sema` now diffentiates these two cases in the AIR so that
backends can easily handle them however they want to. Note that this
*doesn't* really involve Sema doing any more work than it would
otherwise need to, so there's not really a negative here!
Most existing backends have their lowerings for `@shuffle` migrated in
this commit. The LLVM backend uses new lowerings suggested by Jacob as
ones which it will handle effectively. The x86_64 backend has not yet
been migrated; for now there's a panic in there. Jacob will implement
that before this is merged anywhere.
Diffstat (limited to 'src/Zcu/PerThread.zig')
| -rw-r--r-- | src/Zcu/PerThread.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index f8ae173b75..8e3d07627f 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -1745,7 +1745,7 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: *A try air.legalize(pt, @import("../codegen.zig").legalizeFeatures(pt, nav_index) orelse break :legalize); } - var liveness = try Air.Liveness.analyze(gpa, air.*, ip); + var liveness = try Air.Liveness.analyze(zcu, air.*, ip); defer liveness.deinit(gpa); if (build_options.enable_debug_extensions and comp.verbose_air) { @@ -1757,6 +1757,7 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: *A if (std.debug.runtime_safety) { var verify: Air.Liveness.Verify = .{ .gpa = gpa, + .zcu = zcu, .air = air.*, .liveness = liveness, .intern_pool = ip, |
