aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-02-01 14:32:43 -0800
committerGitHub <noreply@github.com>2025-02-01 14:32:43 -0800
commit963651bbf292b21017cac9e977a933b5e2a8c671 (patch)
tree4b2dc8071e8ebe522f24d8dec8584582b25261d5 /src/codegen/llvm.zig
parentcdc9d65b0db3e988ae0f4006e05c178312518bfb (diff)
parent4c5abe5ac664a7214d822b09703682a5cac6891c (diff)
downloadzig-963651bbf292b21017cac9e977a933b5e2a8c671.tar.gz
zig-963651bbf292b21017cac9e977a933b5e2a8c671.zip
Merge pull request #22672 from jacobly0/x86_64-rewrite
x86_64: rewrite float conversions
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 7ca35d149b..97ed00c98d 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -5154,7 +5154,6 @@ pub const FuncGen = struct {
.ret_ptr => try self.airRetPtr(inst),
.arg => try self.airArg(inst),
.bitcast => try self.airBitCast(inst),
- .int_from_bool => try self.airIntFromBool(inst),
.breakpoint => try self.airBreakpoint(inst),
.ret_addr => try self.airRetAddr(inst),
.frame_addr => try self.airFrameAddress(inst),
@@ -5167,7 +5166,6 @@ pub const FuncGen = struct {
.trunc => try self.airTrunc(inst),
.fptrunc => try self.airFptrunc(inst),
.fpext => try self.airFpext(inst),
- .int_from_ptr => try self.airIntFromPtr(inst),
.load => try self.airLoad(body[i..]),
.not => try self.airNot(inst),
.store => try self.airStore(inst, false),
@@ -9435,16 +9433,6 @@ pub const FuncGen = struct {
}
}
- fn airIntFromPtr(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
- const o = self.ng.object;
- const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
- const operand = try self.resolveInst(un_op);
- const ptr_ty = self.typeOf(un_op);
- const operand_ptr = try self.sliceOrArrayPtr(operand, ptr_ty);
- const dest_llvm_ty = try o.lowerType(self.typeOfIndex(inst));
- return self.wip.cast(.ptrtoint, operand_ptr, dest_llvm_ty, "");
- }
-
fn airBitCast(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
const operand_ty = self.typeOf(ty_op.operand);
@@ -9476,6 +9464,10 @@ pub const FuncGen = struct {
return self.wip.cast(.inttoptr, operand, llvm_dest_ty, "");
}
+ if (operand_ty.isPtrAtRuntime(zcu) and inst_ty.zigTypeTag(zcu) == .int) {
+ return self.wip.cast(.ptrtoint, operand, llvm_dest_ty, "");
+ }
+
if (operand_ty.zigTypeTag(zcu) == .vector and inst_ty.zigTypeTag(zcu) == .array) {
const elem_ty = operand_ty.childType(zcu);
if (!result_is_ref) {
@@ -9564,12 +9556,6 @@ pub const FuncGen = struct {
return self.wip.cast(.bitcast, operand, llvm_dest_ty, "");
}
- fn airIntFromBool(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
- const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
- const operand = try self.resolveInst(un_op);
- return operand;
- }
-
fn airArg(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
const o = self.ng.object;
const pt = o.pt;