aboutsummaryrefslogtreecommitdiff
path: root/src/arch/arm/CodeGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-07 18:52:57 -0500
committerGitHub <noreply@github.com>2022-02-07 18:52:57 -0500
commit9bbfbacae0707cf0712e4d6b227b17d097708c7e (patch)
treed61c60e53f167ecb3c5b24235f5fa30f01fd8c23 /src/arch/arm/CodeGen.zig
parentdd49ed1c642d917af40bf4a0e03d013f40b3903b (diff)
parenta028488384c599aa997ba04bbd5ed98f2172630c (diff)
downloadzig-9bbfbacae0707cf0712e4d6b227b17d097708c7e.tar.gz
zig-9bbfbacae0707cf0712e4d6b227b17d097708c7e.zip
Merge pull request #10801 from schmee/stage2-sqrt
stage2: implement @sqrt for f{16,32,64}
Diffstat (limited to 'src/arch/arm/CodeGen.zig')
-rw-r--r--src/arch/arm/CodeGen.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig
index 1859ce874f..fb473ef412 100644
--- a/src/arch/arm/CodeGen.zig
+++ b/src/arch/arm/CodeGen.zig
@@ -520,6 +520,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
.max => try self.airMax(inst),
.slice => try self.airSlice(inst),
+ .sqrt => try self.airUnaryMath(inst),
+
.add_with_overflow => try self.airAddWithOverflow(inst),
.sub_with_overflow => try self.airSubWithOverflow(inst),
.mul_with_overflow => try self.airMulWithOverflow(inst),
@@ -1377,6 +1379,15 @@ fn airPopcount(self: *Self, inst: Air.Inst.Index) !void {
// return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
}
+fn airUnaryMath(self: *Self, inst: Air.Inst.Index) !void {
+ const un_op = self.air.instructions.items(.data)[inst].un_op;
+ const result: MCValue = if (self.liveness.isUnused(inst))
+ .dead
+ else
+ return self.fail("TODO implement airUnaryMath for {}", .{self.target.cpu.arch});
+ return self.finishAir(inst, result, .{ un_op, .none, .none });
+}
+
fn reuseOperand(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, op_index: Liveness.OperandInt, mcv: MCValue) bool {
if (!self.liveness.operandDies(inst, op_index))
return false;