diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-14 21:17:30 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-14 21:17:30 -0700 |
| commit | 55eea3b045c86c78eb8d9cc862122d260352a631 (patch) | |
| tree | a8e234fa3a68c1c62233f047b2b1647be2e091dd /src/Air.zig | |
| parent | 8b882747813878a40b63572636a6e86a59a8581e (diff) | |
| download | zig-55eea3b045c86c78eb8d9cc862122d260352a631.tar.gz zig-55eea3b045c86c78eb8d9cc862122d260352a631.zip | |
stage2: implement `@minimum` and `@maximum`, including vectors
* std.os: take advantage of `@minimum`. It's probably time to
deprecate `std.min` and `std.max`.
* New AIR instructions: min and max
* Introduce SIMD vector support to stage2
* Add `@Type` support for vectors
* Sema: add `checkSimdBinOp` which can be re-used for other arithmatic
operators that want to support vectors.
* Implement coercion from vectors to arrays.
- In backends this is handled with bitcast for vector to array,
however maybe we want to reduce the amount of branching by
introducing an explicit AIR instruction for it in the future.
* LLVM backend: implement lowering vector types
* Sema: Implement `slice.ptr` at comptime
* Value: improve `numberMin` and `numberMax` to support floats in
addition to integers, and make them behave properly in the presence
of NaN.
Diffstat (limited to 'src/Air.zig')
| -rw-r--r-- | src/Air.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Air.zig b/src/Air.zig index 9ad8bc9ae4..86e16487bb 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -107,6 +107,18 @@ pub const Inst = struct { /// The lhs is the pointer, rhs is the offset. Result type is the same as lhs. /// Uses the `bin_op` field. ptr_sub, + /// Given two operands which can be floats, integers, or vectors, returns the + /// greater of the operands. For vectors it operates element-wise. + /// Both operands are guaranteed to be the same type, and the result type + /// is the same as both operands. + /// Uses the `bin_op` field. + max, + /// Given two operands which can be floats, integers, or vectors, returns the + /// lesser of the operands. For vectors it operates element-wise. + /// Both operands are guaranteed to be the same type, and the result type + /// is the same as both operands. + /// Uses the `bin_op` field. + min, /// Allocates stack local memory. /// Uses the `ty` field. alloc, @@ -640,6 +652,8 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index) Type { .shl, .shl_exact, .shl_sat, + .min, + .max, => return air.typeOf(datas[inst].bin_op.lhs), .cmp_lt, |
