aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorWilliam Sengir <william@sengir.com>2022-03-19 23:44:55 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-21 16:54:19 -0700
commit0f4830704171b734bb4a0235fc14809282457dc3 (patch)
treef14d426793b2878db30315195c068e6d28ca608d /src/codegen/c.zig
parent862e63f535ec8d65e33ed7ea67eb9cf03bfc7d6a (diff)
downloadzig-0f4830704171b734bb4a0235fc14809282457dc3.tar.gz
zig-0f4830704171b734bb4a0235fc14809282457dc3.zip
stage2: add AIR instruction `cmp_vector`
The existing `cmp_*` instructions get their result type from `lhs`, but vector comparison will always return a vector of bools with only the length derived from its operands. This necessitates the creation of a new AIR instruction.
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 23ccdc007b..f5a1036479 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -1715,6 +1715,8 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO
.cmp_eq => try airEquality(f, inst, "((", "=="),
.cmp_neq => try airEquality(f, inst, "!((", "!="),
+ .cmp_vector => return f.fail("TODO: C backend: implement binary op for tag '{s}'", .{@tagName(Air.Inst.Tag.cmp_vector)}),
+
// bool_and and bool_or are non-short-circuit operations
.bool_and => try airBinOp(f, inst, " & "),
.bool_or => try airBinOp(f, inst, " | "),