aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorJohn Schmidt <john.schmidt.h@gmail.com>2022-03-23 21:41:35 +0100
committerJohn Schmidt <john.schmidt.h@gmail.com>2022-03-25 16:13:54 +0100
commit12d5efcbe621b98b5a99c5f84a9d5b605e4acc40 (patch)
tree9188b875170a4c23511213f8002fe48908ea3729 /src/codegen/c.zig
parent1c33ea2c35e9260babedb116ad527256e0a4ef5e (diff)
downloadzig-12d5efcbe621b98b5a99c5f84a9d5b605e4acc40.tar.gz
zig-12d5efcbe621b98b5a99c5f84a9d5b605e4acc40.zip
stage2: implement `@select`
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 16558c6e04..84bb3a211b 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -1825,6 +1825,7 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO
.tag_name => try airTagName(f, inst),
.error_name => try airErrorName(f, inst),
.splat => try airSplat(f, inst),
+ .select => try airSelect(f, inst),
.shuffle => try airShuffle(f, inst),
.reduce => try airReduce(f, inst),
.aggregate_init => try airAggregateInit(f, inst),
@@ -3794,6 +3795,21 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue {
return f.fail("TODO: C backend: implement airSplat", .{});
}
+fn airSelect(f: *Function, inst: Air.Inst.Index) !CValue {
+ if (f.liveness.isUnused(inst)) return CValue.none;
+
+ const inst_ty = f.air.typeOfIndex(inst);
+ const ty_pl = f.air.instructions.items(.data)[inst].ty_pl;
+
+ const writer = f.object.writer();
+ const local = try f.allocLocal(inst_ty, .Const);
+ try writer.writeAll(" = ");
+
+ _ = local;
+ _ = ty_pl;
+ return f.fail("TODO: C backend: implement airSelect", .{});
+}
+
fn airShuffle(f: *Function, inst: Air.Inst.Index) !CValue {
if (f.liveness.isUnused(inst)) return CValue.none;