diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-26 00:33:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-26 00:33:22 -0400 |
| commit | 88e98a0611b9fb41c1da026febac2467548bb129 (patch) | |
| tree | 038ccb88c632580be1898a536aa2433077c2e6d0 /src/Air.zig | |
| parent | bae35bdf2d8919b60dee9a0af3afbdd93dd72b59 (diff) | |
| parent | cd46daf7d047eeceb7690e2739af5952d60c3884 (diff) | |
| download | zig-88e98a0611b9fb41c1da026febac2467548bb129.tar.gz zig-88e98a0611b9fb41c1da026febac2467548bb129.zip | |
Merge pull request #11289 from schmee/stage2-select
stage2: implement `@select`
Diffstat (limited to 'src/Air.zig')
| -rw-r--r-- | src/Air.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Air.zig b/src/Air.zig index 404ee8f9b7..5120e0fd67 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -344,7 +344,7 @@ pub const Inst = struct { /// to the storage for the variable. The local may be a const or a var. /// Result type is always void. /// Uses `pl_op`. The payload index is the variable name. It points to the extra - /// array, reinterpreting the bytes there as a null-terminated string. + /// array, reinterpreting the bytes there as a null-terminated string. dbg_var_ptr, /// Same as `dbg_var_ptr` except the local is a const, not a var, and the /// operand is the local's value. @@ -553,6 +553,9 @@ pub const Inst = struct { /// Constructs a vector by selecting elements from `a` and `b` based on `mask`. /// Uses the `ty_pl` field with payload `Shuffle`. shuffle, + /// Constructs a vector element-wise from `a` or `b` based on `pred`. + /// Uses the `pl_op` field with `pred` as operand, and payload `Bin`. + select, /// Given dest ptr, value, and len, set all elements at dest to value. /// Result type is always void. @@ -1067,6 +1070,10 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index) Type { .reduce => return air.typeOf(datas[inst].reduce.operand).childType(), .mul_add => return air.typeOf(datas[inst].pl_op.operand), + .select => { + const extra = air.extraData(Air.Bin, datas[inst].pl_op.payload).data; + return air.typeOf(extra.lhs); + }, .add_with_overflow, .sub_with_overflow, |
