| author | |
| committer | |
| log | bbb58b10f6c0f7ce01fc61e8f64b69dd91d638dc |
| tree | c45795b6525c9a2f51b1ff73d22981e30af5c980 |
| parent | 2faf8c53d226cec1445156cafdec59af5e909fb2 |
2 files changed, 99 insertions(+), 0 deletions(-)
lib/std/special/compiler_rt.zig+19| ... | @@ -277,6 +277,25 @@ comptime { | ... | @@ -277,6 +277,25 @@ comptime { |
| 277 | @export(@import("compiler_rt/aullrem.zig")._aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); | 277 | @export(@import("compiler_rt/aullrem.zig")._aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | if (builtin.arch.isSPARC()) { | ||
| 281 | // SPARC systems use a different naming scheme | ||
| 282 | @export(@import("compiler_rt/sparc.zig")._Qp_add, .{ .name = "_Qp_add", .linkage = linkage }); | ||
| 283 | @export(@import("compiler_rt/sparc.zig")._Qp_div, .{ .name = "_Qp_div", .linkage = linkage }); | ||
| 284 | @export(@import("compiler_rt/sparc.zig")._Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage }); | ||
| 285 | @export(@import("compiler_rt/sparc.zig")._Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage }); | ||
| 286 | |||
| 287 | @export(@import("compiler_rt/sparc.zig")._Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage }); | ||
| 288 | @export(@import("compiler_rt/sparc.zig")._Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage }); | ||
| 289 | @export(@import("compiler_rt/sparc.zig")._Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage }); | ||
| 290 | @export(@import("compiler_rt/sparc.zig")._Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage }); | ||
| 291 | @export(@import("compiler_rt/sparc.zig")._Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage }); | ||
| 292 | @export(@import("compiler_rt/sparc.zig")._Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage }); | ||
| 293 | @export(@import("compiler_rt/sparc.zig")._Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage }); | ||
| 294 | |||
| 295 | @export(@import("compiler_rt/sparc.zig")._Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage }); | ||
| 296 | @export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage }); | ||
| 297 | } | ||
| 298 | |||
| 280 | if (builtin.os.tag == .windows) { | 299 | if (builtin.os.tag == .windows) { |
| 281 | // Default stack-probe functions emitted by LLVM | 300 | // Default stack-probe functions emitted by LLVM |
| 282 | if (is_mingw) { | 301 | if (is_mingw) { |
lib/std/special/compiler_rt/sparc.zig created+80| ... | @@ -0,0 +1,80 @@ | ||
| 1 | // SPDX-License-Identifier: MIT | ||
| 2 | // Copyright (c) 2015-2020 Zig Contributors | ||
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | ||
| 4 | // The MIT license requires this copyright notice to be included in all copies | ||
| 5 | // and substantial portions of the software. | ||
| 6 | // | ||
| 7 | // SPARC uses a different naming scheme for its support routines so we map it here to the x86 name. | ||
| 8 | |||
| 9 | const std = @import("std"); | ||
| 10 | const builtin = @import("builtin"); | ||
| 11 | |||
| 12 | // The SPARC Architecture Manual, Version 9: | ||
| 13 | // A.13 Floating-Point Compare | ||
| 14 | const FCMP = extern enum(i32) { | ||
| 15 | Equal = 0, | ||
| 16 | Less = 1, | ||
| 17 | Greater = 2, | ||
| 18 | Unordered = 3, | ||
| 19 | }; | ||
| 20 | |||
| 21 | // Basic arithmetic | ||
| 22 | |||
| 23 | pub fn _Qp_add(c: *f128, a: *f128, b: *f128) callconv(.C) void { | ||
| 24 | c.* = @import("addXf3.zig").__addtf3(a.*, b.*); | ||
| 25 | } | ||
| 26 | |||
| 27 | pub fn _Qp_div(c: *f128, a: *f128, b: *f128) callconv(.C) void { | ||
| 28 | c.* = @import("divtf3.zig").__divtf3(a.*, b.*); | ||
| 29 | } | ||
| 30 | |||
| 31 | pub fn _Qp_mul(c: *f128, a: *f128, b: *f128) callconv(.C) void { | ||
| 32 | c.* = @import("mulXf3.zig").__multf3(a.*, b.*); | ||
| 33 | } | ||
| 34 | |||
| 35 | pub fn _Qp_sub(c: *f128, a: *f128, b: *f128) callconv(.C) void { | ||
| 36 | c.* = @import("addXf3.zig").__subtf3(a.*, b.*); | ||
| 37 | } | ||
| 38 | |||
| 39 | // Comparison | ||
| 40 | |||
| 41 | pub fn _Qp_cmp(a: f128, b: f128) callconv(.C) i32 { | ||
| 42 | return @enumToInt(@import("compareXf2.zig").cmp(f128, FCMP, a, b)); | ||
| 43 | } | ||
| 44 | |||
| 45 | pub fn _Qp_feq(a: *f128, b: *f128) callconv(.C) bool { | ||
| 46 | return _Qp_cmp(a.*, b.*) == @enumToInt(FCMP.Equal); | ||
| 47 | } | ||
| 48 | |||
| 49 | pub fn _Qp_fne(a: *f128, b: *f128) callconv(.C) bool { | ||
| 50 | return _Qp_cmp(a.*, b.*) != @enumToInt(FCMP.Equal); | ||
| 51 | } | ||
| 52 | |||
| 53 | pub fn _Qp_flt(a: *f128, b: *f128) callconv(.C) bool { | ||
| 54 | return _Qp_cmp(a.*, b.*) == @enumToInt(FCMP.Less); | ||
| 55 | } | ||
| 56 | |||
| 57 | pub fn _Qp_fle(a: *f128, b: *f128) callconv(.C) bool { | ||
| 58 | const cmp = _Qp_cmp(a.*, b.*); | ||
| 59 | return cmp == @enumToInt(FCMP.Less) or cmp == @enumToInt(FCMP.Equal); | ||
| 60 | } | ||
| 61 | |||
| 62 | pub fn _Qp_fgt(a: *f128, b: *f128) callconv(.C) bool { | ||
| 63 | return _Qp_cmp(a.*, b.*) == @enumToInt(FCMP.Greater); | ||
| 64 | } | ||
| 65 | |||
| 66 | pub fn _Qp_fge(a: *f128, b: *f128) callconv(.C) bool { | ||
| 67 | const cmp = _Qp_cmp(a.*, b.*); | ||
| 68 | return cmp == @enumToInt(FCMP.Greater) or cmp == @enumToInt(FCMP.Equal); | ||
| 69 | } | ||
| 70 | |||
| 71 | |||
| 72 | // Casting | ||
| 73 | |||
| 74 | pub fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void { | ||
| 75 | c.* = @import("extendXfYf2.zig").__extenddftf2(a); | ||
| 76 | } | ||
| 77 | |||
| 78 | pub fn _Qp_qtod(a: *f128) callconv(.C) f64 { | ||
| 79 | return @import("truncXfYf2.zig").__trunctfdf2(a.*); | ||
| 80 | } | ||