aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorgracefu <81774659+gracefuu@users.noreply.github.com>2021-04-08 05:24:17 +0800
committergracefu <81774659+gracefuu@users.noreply.github.com>2021-04-08 05:26:56 +0800
commit4c71942f84261e9872cd27139c45b6d5fb1ab6c7 (patch)
tree29edf638919b456298339933be1ac9ec68893054 /src/codegen/c.zig
parentbcc371618fd71185e71a889c09eb68733ca66842 (diff)
downloadzig-4c71942f84261e9872cd27139c45b6d5fb1ab6c7.tar.gz
zig-4c71942f84261e9872cd27139c45b6d5fb1ab6c7.zip
stage2: Add .div to ir.zig
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 876f86ed02..d3ddbdeef9 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -582,6 +582,9 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi
.mul => try genBinOp(o, inst.castTag(.sub).?, " * "),
// TODO make this do wrapping multiplication for signed ints
.mulwrap => try genBinOp(o, inst.castTag(.sub).?, " * "),
+ // TODO use a different strategy for div that communicates to the optimizer
+ // that wrapping is UB.
+ .div => try genBinOp(o, inst.castTag(.div).?, " / "),
.constant => unreachable, // excluded from function bodies
.alloc => try genAlloc(o, inst.castTag(.alloc).?),