aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm/bindings.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-14 21:17:30 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-14 21:17:30 -0700
commit55eea3b045c86c78eb8d9cc862122d260352a631 (patch)
treea8e234fa3a68c1c62233f047b2b1647be2e091dd /src/codegen/llvm/bindings.zig
parent8b882747813878a40b63572636a6e86a59a8581e (diff)
downloadzig-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/codegen/llvm/bindings.zig')
-rw-r--r--src/codegen/llvm/bindings.zig29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig
index 7b91d70fbe..5b6824f02a 100644
--- a/src/codegen/llvm/bindings.zig
+++ b/src/codegen/llvm/bindings.zig
@@ -212,6 +212,9 @@ pub const Type = opaque {
pub const arrayType = LLVMArrayType;
extern fn LLVMArrayType(ElementType: *const Type, ElementCount: c_uint) *const Type;
+ pub const vectorType = LLVMVectorType;
+ extern fn LLVMVectorType(ElementType: *const Type, ElementCount: c_uint) *const Type;
+
pub const structSetBody = LLVMStructSetBody;
extern fn LLVMStructSetBody(
StructTy: *const Type,
@@ -553,6 +556,14 @@ pub const Builder = opaque {
Name: [*:0]const u8,
) *const Value;
+ pub const buildExtractElement = LLVMBuildExtractElement;
+ extern fn LLVMBuildExtractElement(
+ *const Builder,
+ VecVal: *const Value,
+ Index: *const Value,
+ Name: [*:0]const u8,
+ ) *const Value;
+
pub const buildPtrToInt = LLVMBuildPtrToInt;
extern fn LLVMBuildPtrToInt(
*const Builder,
@@ -700,6 +711,24 @@ pub const Builder = opaque {
Size: *const Value,
is_volatile: bool,
) *const Value;
+
+ pub const buildMaxNum = ZigLLVMBuildMaxNum;
+ extern fn ZigLLVMBuildMaxNum(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value;
+
+ pub const buildMinNum = ZigLLVMBuildMinNum;
+ extern fn ZigLLVMBuildMinNum(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value;
+
+ pub const buildUMax = ZigLLVMBuildUMax;
+ extern fn ZigLLVMBuildUMax(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value;
+
+ pub const buildUMin = ZigLLVMBuildUMin;
+ extern fn ZigLLVMBuildUMin(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value;
+
+ pub const buildSMax = ZigLLVMBuildSMax;
+ extern fn ZigLLVMBuildSMax(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value;
+
+ pub const buildSMin = ZigLLVMBuildSMin;
+ extern fn ZigLLVMBuildSMin(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value;
};
pub const IntPredicate = enum(c_uint) {