mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Merge pull request #8497 from LemonBoy/some-ppc-fixes
Improve Improve PowerPC support
This commit is contained in:
commit
c5e662d860
@ -69,7 +69,7 @@ const tls_tcb_size = switch (builtin.arch) {
|
|||||||
|
|
||||||
// Controls if the TP points to the end of the TCB instead of its beginning
|
// Controls if the TP points to the end of the TCB instead of its beginning
|
||||||
const tls_tp_points_past_tcb = switch (builtin.arch) {
|
const tls_tp_points_past_tcb = switch (builtin.arch) {
|
||||||
.riscv32, .riscv64, .mips, .mipsel, .powerpc64, .powerpc64le => true,
|
.riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => true,
|
||||||
else => false,
|
else => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -165,7 +165,14 @@ pub fn setThreadPointer(addr: usize) void {
|
|||||||
const rc = std.os.linux.syscall1(.set_thread_area, addr);
|
const rc = std.os.linux.syscall1(.set_thread_area, addr);
|
||||||
assert(rc == 0);
|
assert(rc == 0);
|
||||||
},
|
},
|
||||||
.powerpc, .powerpc64, .powerpc64le => {
|
.powerpc => {
|
||||||
|
asm volatile (
|
||||||
|
\\ mr 2, %[addr]
|
||||||
|
:
|
||||||
|
: [addr] "r" (addr)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
.powerpc64, .powerpc64le => {
|
||||||
asm volatile (
|
asm volatile (
|
||||||
\\ mr 13, %[addr]
|
\\ mr 13, %[addr]
|
||||||
:
|
:
|
||||||
|
|||||||
@ -939,7 +939,7 @@ export fn sqrt(x: f64) f64 {
|
|||||||
|
|
||||||
r = sign;
|
r = sign;
|
||||||
while (r != 0) {
|
while (r != 0) {
|
||||||
t = s1 +% r;
|
t1 = s1 +% r;
|
||||||
t = s0;
|
t = s0;
|
||||||
if (t < ix0 or (t == ix0 and t1 <= ix1)) {
|
if (t < ix0 or (t == ix0 and t1 <= ix1)) {
|
||||||
s1 = t1 +% r;
|
s1 = t1 +% r;
|
||||||
|
|||||||
@ -296,6 +296,33 @@ comptime {
|
|||||||
@export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
|
@export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (builtin.arch == .powerpc or builtin.arch.isPPC64()) {
|
||||||
|
@export(@import("compiler_rt/addXf3.zig").__addtf3, .{ .name = "__addkf3", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/addXf3.zig").__subtf3, .{ .name = "__subkf3", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/mulXf3.zig").__multf3, .{ .name = "__mulkf3", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/divtf3.zig").__divtf3, .{ .name = "__divkf3", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/extendXfYf2.zig").__extendsftf2, .{ .name = "__extendsfkf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/extendXfYf2.zig").__extenddftf2, .{ .name = "__extenddfkf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/truncXfYf2.zig").__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/truncXfYf2.zig").__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/fixtfdi.zig").__fixtfdi, .{ .name = "__fixkfdi", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/fixtfsi.zig").__fixtfsi, .{ .name = "__fixkfsi", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/fixunstfsi.zig").__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/fixunstfdi.zig").__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/floatsiXf.zig").__floatsitf, .{ .name = "__floatsikf", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/floatditf.zig").__floatditf, .{ .name = "__floatdikf", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/floatunditf.zig").__floatunditf, .{ .name = "__floatundikf", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/floatunsitf.zig").__floatunsitf, .{ .name = "__floatunsikf", .linkage = linkage });
|
||||||
|
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__eqkf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__nekf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__getf2, .{ .name = "__gekf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__ltkf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__lekf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__getf2, .{ .name = "__gtkf2", .linkage = linkage });
|
||||||
|
@export(@import("compiler_rt/compareXf2.zig").__unordtf2, .{ .name = "__unordkf2", .linkage = linkage });
|
||||||
|
}
|
||||||
|
|
||||||
if (builtin.os.tag == .windows) {
|
if (builtin.os.tag == .windows) {
|
||||||
// Default stack-probe functions emitted by LLVM
|
// Default stack-probe functions emitted by LLVM
|
||||||
if (is_mingw) {
|
if (is_mingw) {
|
||||||
|
|||||||
@ -60,6 +60,6 @@ test "bug 920 fixed" {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (NormalDist1.f) |_, i| {
|
for (NormalDist1.f) |_, i| {
|
||||||
std.testing.expect(NormalDist1.f[i] == NormalDist.f[i]);
|
std.testing.expectEqual(NormalDist1.f[i], NormalDist.f[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,14 +17,15 @@ test "integer literal to pointer cast" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "pointer reinterpret const float to int" {
|
test "pointer reinterpret const float to int" {
|
||||||
// https://github.com/ziglang/zig/issues/3345
|
// The hex representation is 0x3fe3333333333303.
|
||||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
|
||||||
|
|
||||||
const float: f64 = 5.99999999999994648725e-01;
|
const float: f64 = 5.99999999999994648725e-01;
|
||||||
const float_ptr = &float;
|
const float_ptr = &float;
|
||||||
const int_ptr = @ptrCast(*const i32, float_ptr);
|
const int_ptr = @ptrCast(*const i32, float_ptr);
|
||||||
const int_val = int_ptr.*;
|
const int_val = int_ptr.*;
|
||||||
expect(int_val == 858993411);
|
if (std.builtin.endian == .Little)
|
||||||
|
expect(int_val == 0x33333303)
|
||||||
|
else
|
||||||
|
expect(int_val == 0x3fe33333);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "implicitly cast indirect pointer to maybe-indirect pointer" {
|
test "implicitly cast indirect pointer to maybe-indirect pointer" {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user