diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-11 14:27:37 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-11 14:27:37 -0500 |
| commit | 433c17aeb192740053b1b9aea6220dca760303e2 (patch) | |
| tree | cd6a06a06215879cfafe9981913025f9cc1550da /src/codegen.cpp | |
| parent | 8fcb1a141b1f76a0c6b28338723535ec5fbf638b (diff) | |
| download | zig-433c17aeb192740053b1b9aea6220dca760303e2.tar.gz zig-433c17aeb192740053b1b9aea6220dca760303e2.zip | |
IR: implement divExact builtin
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index dca316e84e..e4eb8dd323 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1871,6 +1871,14 @@ static LLVMValueRef ir_render_fence(CodeGen *g, IrExecutable *executable, IrInst return nullptr; } +static LLVMValueRef ir_render_div_exact(CodeGen *g, IrExecutable *executable, IrInstructionDivExact *instruction) { + LLVMValueRef op1_val = ir_llvm_value(g, instruction->op1); + LLVMValueRef op2_val = ir_llvm_value(g, instruction->op2); + + bool want_debug_safety = ir_want_debug_safety(g, &instruction->base); + return gen_div(g, want_debug_safety, op1_val, op2_val, instruction->base.type_entry, true); +} + static void set_debug_location(CodeGen *g, IrInstruction *instruction) { AstNode *source_node = instruction->source_node; Scope *scope = instruction->scope; @@ -1964,6 +1972,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable, return ir_render_cmpxchg(g, executable, (IrInstructionCmpxchg *)instruction); case IrInstructionIdFence: return ir_render_fence(g, executable, (IrInstructionFence *)instruction); + case IrInstructionIdDivExact: + return ir_render_div_exact(g, executable, (IrInstructionDivExact *)instruction); case IrInstructionIdSwitchVar: case IrInstructionIdContainerInitList: case IrInstructionIdStructInit: |
