diff options
| author | Robin Voetter <robin@voetter.nl> | 2021-07-26 02:37:11 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-26 20:05:48 -0400 |
| commit | 50a29f7c213d4a906839dfd625b6280663348781 (patch) | |
| tree | f0371b90219e295987d33f6335ad0aeb60fd2f7a /src/BuiltinFn.zig | |
| parent | fc105f268149b195ea4a4189da59d40e96e455b4 (diff) | |
| download | zig-50a29f7c213d4a906839dfd625b6280663348781.tar.gz zig-50a29f7c213d4a906839dfd625b6280663348781.zip | |
Add @select
@select(
comptime T: type,
pred: std.meta.Vector(len, bool),
a: std.meta.Vector(len, T),
b: std.meta.Vector(len, T)
) std.meta.Vector(len, T)
Constructs a vector from a & b, based on the values in the predicate vector. For indices where the predicate value is true, the corresponding
element from the a vector is selected, and otherwise from b.
Diffstat (limited to 'src/BuiltinFn.zig')
| -rw-r--r-- | src/BuiltinFn.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/BuiltinFn.zig b/src/BuiltinFn.zig index 3964512838..07371b3192 100644 --- a/src/BuiltinFn.zig +++ b/src/BuiltinFn.zig @@ -69,6 +69,7 @@ pub const Tag = enum { ptr_to_int, rem, return_address, + select, set_align_stack, set_cold, set_eval_branch_quota, @@ -602,6 +603,13 @@ pub const list = list: { }, }, .{ + "@select", + .{ + .tag = .select, + .param_count = 4, + }, + }, + .{ "@setAlignStack", .{ .tag = .set_align_stack, |
