authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-10-27 21:15:22-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-10-27 21:15:22-04:00
log1d1c7ae5de3e981099522a8610764a6595b1b7a1
treeb879cc51fd26ff9d0c12e5b7a05026639968bfdd
parentd03c47bf85b17f7727d2f1fe5bd497b311c9eba7
parent4ecc384f99e5f4c5a320714484866fb48699245f
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #13257 from topolarity/ctype-fixes

stage 2: Update `CType` size/alignment

41 files changed, 542 insertions(+), 355 deletions(-)

lib/compiler_rt/addtf3.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__addkf3, .{ .name = "__addkf3", .linkage = common.linkage });8 @export(__addtf3, .{ .name = "__addkf3", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage });10 @export(_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage });
11 } else {
12 @export(__addtf3, .{ .name = "__addtf3", .linkage = common.linkage });
13 }11 }
12 @export(__addtf3, .{ .name = "__addtf3", .linkage = common.linkage });
14}13}
1514
16pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 {15pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 {
17 return addf3(f128, a, b);16 return addf3(f128, a, b);
18}17}
1918
20fn __addkf3(a: f128, b: f128) callconv(.C) f128 {
21 return addf3(f128, a, b);
22}
23
24fn _Qp_add(c: *f128, a: *f128, b: *f128) callconv(.C) void {19fn _Qp_add(c: *f128, a: *f128, b: *f128) callconv(.C) void {
25 c.* = addf3(f128, a.*, b.*);20 c.* = addf3(f128, a.*, b.*);
26}21}
lib/compiler_rt/ceil.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(ceilf, .{ .name = "ceilf", .linkage = common.linkage });18 @export(ceilf, .{ .name = "ceilf", .linkage = common.linkage });
19 @export(ceil, .{ .name = "ceil", .linkage = common.linkage });19 @export(ceil, .{ .name = "ceil", .linkage = common.linkage });
20 @export(__ceilx, .{ .name = "__ceilx", .linkage = common.linkage });20 @export(__ceilx, .{ .name = "__ceilx", .linkage = common.linkage });
21 const ceilq_sym_name = if (common.want_ppc_abi) "ceilf128" else "ceilq";21 if (common.want_ppc_abi) {
22 @export(ceilq, .{ .name = ceilq_sym_name, .linkage = common.linkage });22 @export(ceilq, .{ .name = "ceilf128", .linkage = common.linkage });
23 }
24 @export(ceilq, .{ .name = "ceilq", .linkage = common.linkage });
23 @export(ceill, .{ .name = "ceill", .linkage = common.linkage });25 @export(ceill, .{ .name = "ceill", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/cmptf2.zig+9-26
...@@ -7,10 +7,10 @@ pub const panic = common.panic;...@@ -7,10 +7,10 @@ pub const panic = common.panic;
77
8comptime {8comptime {
9 if (common.want_ppc_abi) {9 if (common.want_ppc_abi) {
10 @export(__eqkf2, .{ .name = "__eqkf2", .linkage = common.linkage });10 @export(__eqtf2, .{ .name = "__eqkf2", .linkage = common.linkage });
11 @export(__nekf2, .{ .name = "__nekf2", .linkage = common.linkage });11 @export(__netf2, .{ .name = "__nekf2", .linkage = common.linkage });
12 @export(__ltkf2, .{ .name = "__ltkf2", .linkage = common.linkage });12 @export(__lttf2, .{ .name = "__ltkf2", .linkage = common.linkage });
13 @export(__lekf2, .{ .name = "__lekf2", .linkage = common.linkage });13 @export(__letf2, .{ .name = "__lekf2", .linkage = common.linkage });
14 } else if (common.want_sparc_abi) {14 } else if (common.want_sparc_abi) {
15 @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = common.linkage });15 @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = common.linkage });
16 @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = common.linkage });16 @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = common.linkage });
...@@ -19,13 +19,12 @@ comptime {...@@ -19,13 +19,12 @@ comptime {
19 @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = common.linkage });19 @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = common.linkage });
20 @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = common.linkage });20 @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = common.linkage });
21 @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = common.linkage });21 @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = common.linkage });
22 } else {
23 @export(__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage });
24 @export(__netf2, .{ .name = "__netf2", .linkage = common.linkage });
25 @export(__letf2, .{ .name = "__letf2", .linkage = common.linkage });
26 @export(__cmptf2, .{ .name = "__cmptf2", .linkage = common.linkage });
27 @export(__lttf2, .{ .name = "__lttf2", .linkage = common.linkage });
28 }22 }
23 @export(__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage });
24 @export(__netf2, .{ .name = "__netf2", .linkage = common.linkage });
25 @export(__letf2, .{ .name = "__letf2", .linkage = common.linkage });
26 @export(__cmptf2, .{ .name = "__cmptf2", .linkage = common.linkage });
27 @export(__lttf2, .{ .name = "__lttf2", .linkage = common.linkage });
29}28}
3029
31/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;30/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
...@@ -64,22 +63,6 @@ fn __lttf2(a: f128, b: f128) callconv(.C) i32 {...@@ -64,22 +63,6 @@ fn __lttf2(a: f128, b: f128) callconv(.C) i32 {
64 return __cmptf2(a, b);63 return __cmptf2(a, b);
65}64}
6665
67fn __eqkf2(a: f128, b: f128) callconv(.C) i32 {
68 return __cmptf2(a, b);
69}
70
71fn __nekf2(a: f128, b: f128) callconv(.C) i32 {
72 return __cmptf2(a, b);
73}
74
75fn __ltkf2(a: f128, b: f128) callconv(.C) i32 {
76 return __cmptf2(a, b);
77}
78
79fn __lekf2(a: f128, b: f128) callconv(.C) i32 {
80 return __cmptf2(a, b);
81}
82
83const SparcFCMP = enum(i32) {66const SparcFCMP = enum(i32) {
84 Equal = 0,67 Equal = 0,
85 Less = 1,68 Less = 1,
lib/compiler_rt/cos.zig+4-2
...@@ -16,8 +16,10 @@ comptime {...@@ -16,8 +16,10 @@ comptime {
16 @export(cosf, .{ .name = "cosf", .linkage = common.linkage });16 @export(cosf, .{ .name = "cosf", .linkage = common.linkage });
17 @export(cos, .{ .name = "cos", .linkage = common.linkage });17 @export(cos, .{ .name = "cos", .linkage = common.linkage });
18 @export(__cosx, .{ .name = "__cosx", .linkage = common.linkage });18 @export(__cosx, .{ .name = "__cosx", .linkage = common.linkage });
19 const cosq_sym_name = if (common.want_ppc_abi) "cosf128" else "cosq";19 if (common.want_ppc_abi) {
20 @export(cosq, .{ .name = cosq_sym_name, .linkage = common.linkage });20 @export(cosq, .{ .name = "cosf128", .linkage = common.linkage });
21 }
22 @export(cosq, .{ .name = "cosq", .linkage = common.linkage });
21 @export(cosl, .{ .name = "cosl", .linkage = common.linkage });23 @export(cosl, .{ .name = "cosl", .linkage = common.linkage });
22}24}
2325
lib/compiler_rt/divtf3.zig+3-7
...@@ -9,22 +9,18 @@ pub const panic = common.panic;...@@ -9,22 +9,18 @@ pub const panic = common.panic;
99
10comptime {10comptime {
11 if (common.want_ppc_abi) {11 if (common.want_ppc_abi) {
12 @export(__divkf3, .{ .name = "__divkf3", .linkage = common.linkage });12 // TODO: why did this not error?
13 @export(__divtf3, .{ .name = "__divkf3", .linkage = common.linkage });
13 } else if (common.want_sparc_abi) {14 } else if (common.want_sparc_abi) {
14 @export(_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage });15 @export(_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage });
15 } else {
16 @export(__divtf3, .{ .name = "__divtf3", .linkage = common.linkage });
17 }16 }
17 @export(__divtf3, .{ .name = "__divtf3", .linkage = common.linkage });
18}18}
1919
20pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 {20pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 {
21 return div(a, b);21 return div(a, b);
22}22}
2323
24fn __divkf3(a: f128, b: f128) callconv(.C) f128 {
25 return div(a, b);
26}
27
28fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {24fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
29 c.* = div(a.*, b.*);25 c.* = div(a.*, b.*);
30}26}
lib/compiler_rt/exp.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(expf, .{ .name = "expf", .linkage = common.linkage });18 @export(expf, .{ .name = "expf", .linkage = common.linkage });
19 @export(exp, .{ .name = "exp", .linkage = common.linkage });19 @export(exp, .{ .name = "exp", .linkage = common.linkage });
20 @export(__expx, .{ .name = "__expx", .linkage = common.linkage });20 @export(__expx, .{ .name = "__expx", .linkage = common.linkage });
21 const expq_sym_name = if (common.want_ppc_abi) "expf128" else "expq";21 if (common.want_ppc_abi) {
22 @export(expq, .{ .name = expq_sym_name, .linkage = common.linkage });22 @export(expq, .{ .name = "expf128", .linkage = common.linkage });
23 }
24 @export(expq, .{ .name = "expq", .linkage = common.linkage });
23 @export(expl, .{ .name = "expl", .linkage = common.linkage });25 @export(expl, .{ .name = "expl", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/exp2.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(exp2f, .{ .name = "exp2f", .linkage = common.linkage });18 @export(exp2f, .{ .name = "exp2f", .linkage = common.linkage });
19 @export(exp2, .{ .name = "exp2", .linkage = common.linkage });19 @export(exp2, .{ .name = "exp2", .linkage = common.linkage });
20 @export(__exp2x, .{ .name = "__exp2x", .linkage = common.linkage });20 @export(__exp2x, .{ .name = "__exp2x", .linkage = common.linkage });
21 const exp2q_sym_name = if (common.want_ppc_abi) "exp2f128" else "exp2q";21 if (common.want_ppc_abi) {
22 @export(exp2q, .{ .name = exp2q_sym_name, .linkage = common.linkage });22 @export(exp2q, .{ .name = "exp2f128", .linkage = common.linkage });
23 }
24 @export(exp2q, .{ .name = "exp2q", .linkage = common.linkage });
23 @export(exp2l, .{ .name = "exp2l", .linkage = common.linkage });25 @export(exp2l, .{ .name = "exp2l", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/extenddftf2.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__extenddfkf2, .{ .name = "__extenddfkf2", .linkage = common.linkage });8 @export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = common.linkage });10 @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = common.linkage });
11 } else {
12 @export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage });
13 }11 }
12 @export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage });
14}13}
1514
16pub fn __extenddftf2(a: f64) callconv(.C) f128 {15pub fn __extenddftf2(a: f64) callconv(.C) f128 {
17 return extendf(f128, f64, @bitCast(u64, a));16 return extendf(f128, f64, @bitCast(u64, a));
18}17}
1918
20fn __extenddfkf2(a: f64) callconv(.C) f128 {
21 return extendf(f128, f64, @bitCast(u64, a));
22}
23
24fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void {19fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void {
25 c.* = extendf(f128, f64, @bitCast(u64, a));20 c.* = extendf(f128, f64, @bitCast(u64, a));
26}21}
lib/compiler_rt/extendsftf2.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__extendsfkf2, .{ .name = "__extendsfkf2", .linkage = common.linkage });8 @export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage });10 @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage });
11 } else {
12 @export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage });
13 }11 }
12 @export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage });
14}13}
1514
16pub fn __extendsftf2(a: f32) callconv(.C) f128 {15pub fn __extendsftf2(a: f32) callconv(.C) f128 {
17 return extendf(f128, f32, @bitCast(u32, a));16 return extendf(f128, f32, @bitCast(u32, a));
18}17}
1918
20fn __extendsfkf2(a: f32) callconv(.C) f128 {
21 return extendf(f128, f32, @bitCast(u32, a));
22}
23
24fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void {19fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void {
25 c.* = extendf(f128, f32, @bitCast(u32, a));20 c.* = extendf(f128, f32, @bitCast(u32, a));
26}21}
lib/compiler_rt/fabs.zig+4-2
...@@ -10,8 +10,10 @@ comptime {...@@ -10,8 +10,10 @@ comptime {
10 @export(fabsf, .{ .name = "fabsf", .linkage = common.linkage });10 @export(fabsf, .{ .name = "fabsf", .linkage = common.linkage });
11 @export(fabs, .{ .name = "fabs", .linkage = common.linkage });11 @export(fabs, .{ .name = "fabs", .linkage = common.linkage });
12 @export(__fabsx, .{ .name = "__fabsx", .linkage = common.linkage });12 @export(__fabsx, .{ .name = "__fabsx", .linkage = common.linkage });
13 const fabsq_sym_name = if (common.want_ppc_abi) "fabsf128" else "fabsq";13 if (common.want_ppc_abi) {
14 @export(fabsq, .{ .name = fabsq_sym_name, .linkage = common.linkage });14 @export(fabsq, .{ .name = "fabsf128", .linkage = common.linkage });
15 }
16 @export(fabsq, .{ .name = "fabsq", .linkage = common.linkage });
15 @export(fabsl, .{ .name = "fabsl", .linkage = common.linkage });17 @export(fabsl, .{ .name = "fabsl", .linkage = common.linkage });
16}18}
1719
lib/compiler_rt/fixtfdi.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__fixkfdi, .{ .name = "__fixkfdi", .linkage = common.linkage });8 @export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = common.linkage });10 @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = common.linkage });
11 } else {
12 @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage });
13 }11 }
12 @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage });
14}13}
1514
16pub fn __fixtfdi(a: f128) callconv(.C) i64 {15pub fn __fixtfdi(a: f128) callconv(.C) i64 {
17 return floatToInt(i64, a);16 return floatToInt(i64, a);
18}17}
1918
20fn __fixkfdi(a: f128) callconv(.C) i64 {
21 return floatToInt(i64, a);
22}
23
24fn _Qp_qtox(a: *const f128) callconv(.C) i64 {19fn _Qp_qtox(a: *const f128) callconv(.C) i64 {
25 return floatToInt(i64, a.*);20 return floatToInt(i64, a.*);
26}21}
lib/compiler_rt/fixtfsi.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__fixkfsi, .{ .name = "__fixkfsi", .linkage = common.linkage });8 @export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = common.linkage });10 @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = common.linkage });
11 } else {
12 @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage });
13 }11 }
12 @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage });
14}13}
1514
16pub fn __fixtfsi(a: f128) callconv(.C) i32 {15pub fn __fixtfsi(a: f128) callconv(.C) i32 {
17 return floatToInt(i32, a);16 return floatToInt(i32, a);
18}17}
1918
20fn __fixkfsi(a: f128) callconv(.C) i32 {
21 return floatToInt(i32, a);
22}
23
24fn _Qp_qtoi(a: *const f128) callconv(.C) i32 {19fn _Qp_qtoi(a: *const f128) callconv(.C) i32 {
25 return floatToInt(i32, a.*);20 return floatToInt(i32, a.*);
26}21}
lib/compiler_rt/fixunstfdi.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__fixunskfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage });8 @export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage });10 @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage });
11 } else {
12 @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage });
13 }11 }
12 @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage });
14}13}
1514
16pub fn __fixunstfdi(a: f128) callconv(.C) u64 {15pub fn __fixunstfdi(a: f128) callconv(.C) u64 {
17 return floatToInt(u64, a);16 return floatToInt(u64, a);
18}17}
1918
20fn __fixunskfdi(a: f128) callconv(.C) u64 {
21 return floatToInt(u64, a);
22}
23
24fn _Qp_qtoux(a: *const f128) callconv(.C) u64 {19fn _Qp_qtoux(a: *const f128) callconv(.C) u64 {
25 return floatToInt(u64, a.*);20 return floatToInt(u64, a.*);
26}21}
lib/compiler_rt/fixunstfsi.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__fixunskfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage });8 @export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage });10 @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage });
11 } else {
12 @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage });
13 }11 }
12 @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage });
14}13}
1514
16pub fn __fixunstfsi(a: f128) callconv(.C) u32 {15pub fn __fixunstfsi(a: f128) callconv(.C) u32 {
17 return floatToInt(u32, a);16 return floatToInt(u32, a);
18}17}
1918
20fn __fixunskfsi(a: f128) callconv(.C) u32 {
21 return floatToInt(u32, a);
22}
23
24fn _Qp_qtoui(a: *const f128) callconv(.C) u32 {19fn _Qp_qtoui(a: *const f128) callconv(.C) u32 {
25 return floatToInt(u32, a.*);20 return floatToInt(u32, a.*);
26}21}
lib/compiler_rt/floatditf.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__floatdikf, .{ .name = "__floatdikf", .linkage = common.linkage });8 @export(__floatditf, .{ .name = "__floatdikf", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = common.linkage });10 @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = common.linkage });
11 } else {
12 @export(__floatditf, .{ .name = "__floatditf", .linkage = common.linkage });
13 }11 }
12 @export(__floatditf, .{ .name = "__floatditf", .linkage = common.linkage });
14}13}
1514
16pub fn __floatditf(a: i64) callconv(.C) f128 {15pub fn __floatditf(a: i64) callconv(.C) f128 {
17 return intToFloat(f128, a);16 return intToFloat(f128, a);
18}17}
1918
20fn __floatdikf(a: i64) callconv(.C) f128 {
21 return intToFloat(f128, a);
22}
23
24fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void {19fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void {
25 c.* = intToFloat(f128, a);20 c.* = intToFloat(f128, a);
26}21}
lib/compiler_rt/floatsitf.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__floatsikf, .{ .name = "__floatsikf", .linkage = common.linkage });8 @export(__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage });10 @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage });
11 } else {
12 @export(__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage });
13 }11 }
12 @export(__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage });
14}13}
1514
16pub fn __floatsitf(a: i32) callconv(.C) f128 {15pub fn __floatsitf(a: i32) callconv(.C) f128 {
17 return intToFloat(f128, a);16 return intToFloat(f128, a);
18}17}
1918
20fn __floatsikf(a: i32) callconv(.C) f128 {
21 return intToFloat(f128, a);
22}
23
24fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void {19fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void {
25 c.* = intToFloat(f128, a);20 c.* = intToFloat(f128, a);
26}21}
lib/compiler_rt/floatunditf.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__floatundikf, .{ .name = "__floatundikf", .linkage = common.linkage });8 @export(__floatunditf, .{ .name = "__floatundikf", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage });10 @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage });
11 } else {
12 @export(__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage });
13 }11 }
12 @export(__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage });
14}13}
1514
16pub fn __floatunditf(a: u64) callconv(.C) f128 {15pub fn __floatunditf(a: u64) callconv(.C) f128 {
17 return intToFloat(f128, a);16 return intToFloat(f128, a);
18}17}
1918
20fn __floatundikf(a: u64) callconv(.C) f128 {
21 return intToFloat(f128, a);
22}
23
24fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void {19fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void {
25 c.* = intToFloat(f128, a);20 c.* = intToFloat(f128, a);
26}21}
lib/compiler_rt/floatunsitf.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__floatunsikf, .{ .name = "__floatunsikf", .linkage = common.linkage });8 @export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage });10 @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage });
11 } else {
12 @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage });
13 }11 }
12 @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage });
14}13}
1514
16pub fn __floatunsitf(a: u32) callconv(.C) f128 {15pub fn __floatunsitf(a: u32) callconv(.C) f128 {
17 return intToFloat(f128, a);16 return intToFloat(f128, a);
18}17}
1918
20fn __floatunsikf(a: u32) callconv(.C) f128 {
21 return intToFloat(f128, a);
22}
23
24fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {19fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {
25 c.* = intToFloat(f128, a);20 c.* = intToFloat(f128, a);
26}21}
lib/compiler_rt/floatuntitf.zig+5-4
...@@ -5,12 +5,13 @@ const intToFloat = @import("./int_to_float.zig").intToFloat;...@@ -5,12 +5,13 @@ const intToFloat = @import("./int_to_float.zig").intToFloat;
5pub const panic = common.panic;5pub const panic = common.panic;
66
7comptime {7comptime {
8 const symbol_name = if (common.want_ppc_abi) "__floatuntikf" else "__floatuntitf";
9
10 if (common.want_windows_v2u64_abi) {8 if (common.want_windows_v2u64_abi) {
11 @export(__floatuntitf_windows_x86_64, .{ .name = symbol_name, .linkage = common.linkage });9 @export(__floatuntitf_windows_x86_64, .{ .name = "__floatuntitf", .linkage = common.linkage });
12 } else {10 } else {
13 @export(__floatuntitf, .{ .name = symbol_name, .linkage = common.linkage });11 if (common.want_ppc_abi) {
12 @export(__floatuntitf, .{ .name = "__floatuntikf", .linkage = common.linkage });
13 }
14 @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = common.linkage });
14 }15 }
15}16}
1617
lib/compiler_rt/floor.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(floorf, .{ .name = "floorf", .linkage = common.linkage });18 @export(floorf, .{ .name = "floorf", .linkage = common.linkage });
19 @export(floor, .{ .name = "floor", .linkage = common.linkage });19 @export(floor, .{ .name = "floor", .linkage = common.linkage });
20 @export(__floorx, .{ .name = "__floorx", .linkage = common.linkage });20 @export(__floorx, .{ .name = "__floorx", .linkage = common.linkage });
21 const floorq_sym_name = if (common.want_ppc_abi) "floorf128" else "floorq";21 if (common.want_ppc_abi) {
22 @export(floorq, .{ .name = floorq_sym_name, .linkage = common.linkage });22 @export(floorq, .{ .name = "floorf128", .linkage = common.linkage });
23 }
24 @export(floorq, .{ .name = "floorq", .linkage = common.linkage });
23 @export(floorl, .{ .name = "floorl", .linkage = common.linkage });25 @export(floorl, .{ .name = "floorl", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/fma.zig+4-2
...@@ -19,8 +19,10 @@ comptime {...@@ -19,8 +19,10 @@ comptime {
19 @export(fmaf, .{ .name = "fmaf", .linkage = common.linkage });19 @export(fmaf, .{ .name = "fmaf", .linkage = common.linkage });
20 @export(fma, .{ .name = "fma", .linkage = common.linkage });20 @export(fma, .{ .name = "fma", .linkage = common.linkage });
21 @export(__fmax, .{ .name = "__fmax", .linkage = common.linkage });21 @export(__fmax, .{ .name = "__fmax", .linkage = common.linkage });
22 const fmaq_sym_name = if (common.want_ppc_abi) "fmaf128" else "fmaq";22 if (common.want_ppc_abi) {
23 @export(fmaq, .{ .name = fmaq_sym_name, .linkage = common.linkage });23 @export(fmaq, .{ .name = "fmaf128", .linkage = common.linkage });
24 }
25 @export(fmaq, .{ .name = "fmaq", .linkage = common.linkage });
24 @export(fmal, .{ .name = "fmal", .linkage = common.linkage });26 @export(fmal, .{ .name = "fmal", .linkage = common.linkage });
25}27}
2628
lib/compiler_rt/fmax.zig+4-2
...@@ -11,8 +11,10 @@ comptime {...@@ -11,8 +11,10 @@ comptime {
11 @export(fmaxf, .{ .name = "fmaxf", .linkage = common.linkage });11 @export(fmaxf, .{ .name = "fmaxf", .linkage = common.linkage });
12 @export(fmax, .{ .name = "fmax", .linkage = common.linkage });12 @export(fmax, .{ .name = "fmax", .linkage = common.linkage });
13 @export(__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage });13 @export(__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage });
14 const fmaxq_sym_name = if (common.want_ppc_abi) "fmaxf128" else "fmaxq";14 if (common.want_ppc_abi) {
15 @export(fmaxq, .{ .name = fmaxq_sym_name, .linkage = common.linkage });15 @export(fmaxq, .{ .name = "fmaxf128", .linkage = common.linkage });
16 }
17 @export(fmaxq, .{ .name = "fmaxq", .linkage = common.linkage });
16 @export(fmaxl, .{ .name = "fmaxl", .linkage = common.linkage });18 @export(fmaxl, .{ .name = "fmaxl", .linkage = common.linkage });
17}19}
1820
lib/compiler_rt/fmin.zig+4-2
...@@ -11,8 +11,10 @@ comptime {...@@ -11,8 +11,10 @@ comptime {
11 @export(fminf, .{ .name = "fminf", .linkage = common.linkage });11 @export(fminf, .{ .name = "fminf", .linkage = common.linkage });
12 @export(fmin, .{ .name = "fmin", .linkage = common.linkage });12 @export(fmin, .{ .name = "fmin", .linkage = common.linkage });
13 @export(__fminx, .{ .name = "__fminx", .linkage = common.linkage });13 @export(__fminx, .{ .name = "__fminx", .linkage = common.linkage });
14 const fminq_sym_name = if (common.want_ppc_abi) "fminf128" else "fminq";14 if (common.want_ppc_abi) {
15 @export(fminq, .{ .name = fminq_sym_name, .linkage = common.linkage });15 @export(fminq, .{ .name = "fminf128", .linkage = common.linkage });
16 }
17 @export(fminq, .{ .name = "fminq", .linkage = common.linkage });
16 @export(fminl, .{ .name = "fminl", .linkage = common.linkage });18 @export(fminl, .{ .name = "fminl", .linkage = common.linkage });
17}19}
1820
lib/compiler_rt/fmod.zig+4-2
...@@ -13,8 +13,10 @@ comptime {...@@ -13,8 +13,10 @@ comptime {
13 @export(fmodf, .{ .name = "fmodf", .linkage = common.linkage });13 @export(fmodf, .{ .name = "fmodf", .linkage = common.linkage });
14 @export(fmod, .{ .name = "fmod", .linkage = common.linkage });14 @export(fmod, .{ .name = "fmod", .linkage = common.linkage });
15 @export(__fmodx, .{ .name = "__fmodx", .linkage = common.linkage });15 @export(__fmodx, .{ .name = "__fmodx", .linkage = common.linkage });
16 const fmodq_sym_name = if (common.want_ppc_abi) "fmodf128" else "fmodq";16 if (common.want_ppc_abi) {
17 @export(fmodq, .{ .name = fmodq_sym_name, .linkage = common.linkage });17 @export(fmodq, .{ .name = "fmodf128", .linkage = common.linkage });
18 }
19 @export(fmodq, .{ .name = "fmodq", .linkage = common.linkage });
18 @export(fmodl, .{ .name = "fmodl", .linkage = common.linkage });20 @export(fmodl, .{ .name = "fmodl", .linkage = common.linkage });
19}21}
2022
lib/compiler_rt/getf2.zig+4-13
...@@ -7,15 +7,14 @@ pub const panic = common.panic;...@@ -7,15 +7,14 @@ pub const panic = common.panic;
77
8comptime {8comptime {
9 if (common.want_ppc_abi) {9 if (common.want_ppc_abi) {
10 @export(__gekf2, .{ .name = "__gekf2", .linkage = common.linkage });10 @export(__getf2, .{ .name = "__gekf2", .linkage = common.linkage });
11 @export(__gtkf2, .{ .name = "__gtkf2", .linkage = common.linkage });11 @export(__gttf2, .{ .name = "__gtkf2", .linkage = common.linkage });
12 } else if (common.want_sparc_abi) {12 } else if (common.want_sparc_abi) {
13 // These exports are handled in cmptf2.zig because gt and ge on sparc13 // These exports are handled in cmptf2.zig because gt and ge on sparc
14 // are based on calling _Qp_cmp.14 // are based on calling _Qp_cmp.
15 } else {
16 @export(__getf2, .{ .name = "__getf2", .linkage = common.linkage });
17 @export(__gttf2, .{ .name = "__gttf2", .linkage = common.linkage });
18 }15 }
16 @export(__getf2, .{ .name = "__getf2", .linkage = common.linkage });
17 @export(__gttf2, .{ .name = "__gttf2", .linkage = common.linkage });
19}18}
2019
21/// "These functions return a value greater than or equal to zero if neither20/// "These functions return a value greater than or equal to zero if neither
...@@ -29,11 +28,3 @@ fn __getf2(a: f128, b: f128) callconv(.C) i32 {...@@ -29,11 +28,3 @@ fn __getf2(a: f128, b: f128) callconv(.C) i32 {
29fn __gttf2(a: f128, b: f128) callconv(.C) i32 {28fn __gttf2(a: f128, b: f128) callconv(.C) i32 {
30 return __getf2(a, b);29 return __getf2(a, b);
31}30}
32
33fn __gekf2(a: f128, b: f128) callconv(.C) i32 {
34 return __getf2(a, b);
35}
36
37fn __gtkf2(a: f128, b: f128) callconv(.C) i32 {
38 return __getf2(a, b);
39}
lib/compiler_rt/log.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(logf, .{ .name = "logf", .linkage = common.linkage });18 @export(logf, .{ .name = "logf", .linkage = common.linkage });
19 @export(log, .{ .name = "log", .linkage = common.linkage });19 @export(log, .{ .name = "log", .linkage = common.linkage });
20 @export(__logx, .{ .name = "__logx", .linkage = common.linkage });20 @export(__logx, .{ .name = "__logx", .linkage = common.linkage });
21 const logq_sym_name = if (common.want_ppc_abi) "logf128" else "logq";21 if (common.want_ppc_abi) {
22 @export(logq, .{ .name = logq_sym_name, .linkage = common.linkage });22 @export(logq, .{ .name = "logf128", .linkage = common.linkage });
23 }
24 @export(logq, .{ .name = "logq", .linkage = common.linkage });
23 @export(logl, .{ .name = "logl", .linkage = common.linkage });25 @export(logl, .{ .name = "logl", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/log10.zig+4-2
...@@ -19,8 +19,10 @@ comptime {...@@ -19,8 +19,10 @@ comptime {
19 @export(log10f, .{ .name = "log10f", .linkage = common.linkage });19 @export(log10f, .{ .name = "log10f", .linkage = common.linkage });
20 @export(log10, .{ .name = "log10", .linkage = common.linkage });20 @export(log10, .{ .name = "log10", .linkage = common.linkage });
21 @export(__log10x, .{ .name = "__log10x", .linkage = common.linkage });21 @export(__log10x, .{ .name = "__log10x", .linkage = common.linkage });
22 const log10q_sym_name = if (common.want_ppc_abi) "log10f128" else "log10q";22 if (common.want_ppc_abi) {
23 @export(log10q, .{ .name = log10q_sym_name, .linkage = common.linkage });23 @export(log10q, .{ .name = "log10f128", .linkage = common.linkage });
24 }
25 @export(log10q, .{ .name = "log10q", .linkage = common.linkage });
24 @export(log10l, .{ .name = "log10l", .linkage = common.linkage });26 @export(log10l, .{ .name = "log10l", .linkage = common.linkage });
25}27}
2628
lib/compiler_rt/log2.zig+4-2
...@@ -19,8 +19,10 @@ comptime {...@@ -19,8 +19,10 @@ comptime {
19 @export(log2f, .{ .name = "log2f", .linkage = common.linkage });19 @export(log2f, .{ .name = "log2f", .linkage = common.linkage });
20 @export(log2, .{ .name = "log2", .linkage = common.linkage });20 @export(log2, .{ .name = "log2", .linkage = common.linkage });
21 @export(__log2x, .{ .name = "__log2x", .linkage = common.linkage });21 @export(__log2x, .{ .name = "__log2x", .linkage = common.linkage });
22 const log2q_sym_name = if (common.want_ppc_abi) "log2f128" else "log2q";22 if (common.want_ppc_abi) {
23 @export(log2q, .{ .name = log2q_sym_name, .linkage = common.linkage });23 @export(log2q, .{ .name = "log2f128", .linkage = common.linkage });
24 }
25 @export(log2q, .{ .name = "log2q", .linkage = common.linkage });
24 @export(log2l, .{ .name = "log2l", .linkage = common.linkage });26 @export(log2l, .{ .name = "log2l", .linkage = common.linkage });
25}27}
2628
lib/compiler_rt/multf3.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__mulkf3, .{ .name = "__mulkf3", .linkage = common.linkage });8 @export(__multf3, .{ .name = "__mulkf3", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage });10 @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage });
11 } else {
12 @export(__multf3, .{ .name = "__multf3", .linkage = common.linkage });
13 }11 }
12 @export(__multf3, .{ .name = "__multf3", .linkage = common.linkage });
14}13}
1514
16pub fn __multf3(a: f128, b: f128) callconv(.C) f128 {15pub fn __multf3(a: f128, b: f128) callconv(.C) f128 {
17 return mulf3(f128, a, b);16 return mulf3(f128, a, b);
18}17}
1918
20fn __mulkf3(a: f128, b: f128) callconv(.C) f128 {
21 return mulf3(f128, a, b);
22}
23
24fn _Qp_mul(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {19fn _Qp_mul(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
25 c.* = mulf3(f128, a.*, b.*);20 c.* = mulf3(f128, a.*, b.*);
26}21}
lib/compiler_rt/round.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(roundf, .{ .name = "roundf", .linkage = common.linkage });18 @export(roundf, .{ .name = "roundf", .linkage = common.linkage });
19 @export(round, .{ .name = "round", .linkage = common.linkage });19 @export(round, .{ .name = "round", .linkage = common.linkage });
20 @export(__roundx, .{ .name = "__roundx", .linkage = common.linkage });20 @export(__roundx, .{ .name = "__roundx", .linkage = common.linkage });
21 const roundq_sym_name = if (common.want_ppc_abi) "roundf128" else "roundq";21 if (common.want_ppc_abi) {
22 @export(roundq, .{ .name = roundq_sym_name, .linkage = common.linkage });22 @export(roundq, .{ .name = "roundf128", .linkage = common.linkage });
23 }
24 @export(roundq, .{ .name = "roundq", .linkage = common.linkage });
23 @export(roundl, .{ .name = "roundl", .linkage = common.linkage });25 @export(roundl, .{ .name = "roundl", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/sin.zig+4-2
...@@ -22,8 +22,10 @@ comptime {...@@ -22,8 +22,10 @@ comptime {
22 @export(sinf, .{ .name = "sinf", .linkage = common.linkage });22 @export(sinf, .{ .name = "sinf", .linkage = common.linkage });
23 @export(sin, .{ .name = "sin", .linkage = common.linkage });23 @export(sin, .{ .name = "sin", .linkage = common.linkage });
24 @export(__sinx, .{ .name = "__sinx", .linkage = common.linkage });24 @export(__sinx, .{ .name = "__sinx", .linkage = common.linkage });
25 const sinq_sym_name = if (common.want_ppc_abi) "sinf128" else "sinq";25 if (common.want_ppc_abi) {
26 @export(sinq, .{ .name = sinq_sym_name, .linkage = common.linkage });26 @export(sinq, .{ .name = "sinf128", .linkage = common.linkage });
27 }
28 @export(sinq, .{ .name = "sinq", .linkage = common.linkage });
27 @export(sinl, .{ .name = "sinl", .linkage = common.linkage });29 @export(sinl, .{ .name = "sinl", .linkage = common.linkage });
28}30}
2931
lib/compiler_rt/sincos.zig+4-2
...@@ -14,8 +14,10 @@ comptime {...@@ -14,8 +14,10 @@ comptime {
14 @export(sincosf, .{ .name = "sincosf", .linkage = common.linkage });14 @export(sincosf, .{ .name = "sincosf", .linkage = common.linkage });
15 @export(sincos, .{ .name = "sincos", .linkage = common.linkage });15 @export(sincos, .{ .name = "sincos", .linkage = common.linkage });
16 @export(__sincosx, .{ .name = "__sincosx", .linkage = common.linkage });16 @export(__sincosx, .{ .name = "__sincosx", .linkage = common.linkage });
17 const sincosq_sym_name = if (common.want_ppc_abi) "sincosf128" else "sincosq";17 if (common.want_ppc_abi) {
18 @export(sincosq, .{ .name = sincosq_sym_name, .linkage = common.linkage });18 @export(sincosq, .{ .name = "sincosf128", .linkage = common.linkage });
19 }
20 @export(sincosq, .{ .name = "sincosq", .linkage = common.linkage });
19 @export(sincosl, .{ .name = "sincosl", .linkage = common.linkage });21 @export(sincosl, .{ .name = "sincosl", .linkage = common.linkage });
20}22}
2123
lib/compiler_rt/sqrt.zig+4-2
...@@ -11,8 +11,10 @@ comptime {...@@ -11,8 +11,10 @@ comptime {
11 @export(sqrtf, .{ .name = "sqrtf", .linkage = common.linkage });11 @export(sqrtf, .{ .name = "sqrtf", .linkage = common.linkage });
12 @export(sqrt, .{ .name = "sqrt", .linkage = common.linkage });12 @export(sqrt, .{ .name = "sqrt", .linkage = common.linkage });
13 @export(__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage });13 @export(__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage });
14 const sqrtq_sym_name = if (common.want_ppc_abi) "sqrtf128" else "sqrtq";14 if (common.want_ppc_abi) {
15 @export(sqrtq, .{ .name = sqrtq_sym_name, .linkage = common.linkage });15 @export(sqrtq, .{ .name = "sqrtf128", .linkage = common.linkage });
16 }
17 @export(sqrtq, .{ .name = "sqrtq", .linkage = common.linkage });
16 @export(sqrtl, .{ .name = "sqrtl", .linkage = common.linkage });18 @export(sqrtl, .{ .name = "sqrtl", .linkage = common.linkage });
17}19}
1820
lib/compiler_rt/subtf3.zig+2-7
...@@ -4,22 +4,17 @@ pub const panic = common.panic;...@@ -4,22 +4,17 @@ pub const panic = common.panic;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (common.want_ppc_abi) {
7 @export(__subkf3, .{ .name = "__subkf3", .linkage = common.linkage });7 @export(__subtf3, .{ .name = "__subkf3", .linkage = common.linkage });
8 } else if (common.want_sparc_abi) {8 } else if (common.want_sparc_abi) {
9 @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage });9 @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage });
10 } else {
11 @export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage });
12 }10 }
11 @export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage });
13}12}
1413
15pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {14pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
16 return sub(a, b);15 return sub(a, b);
17}16}
1817
19fn __subkf3(a: f128, b: f128) callconv(.C) f128 {
20 return sub(a, b);
21}
22
23fn _Qp_sub(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {18fn _Qp_sub(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
24 c.* = sub(a.*, b.*);19 c.* = sub(a.*, b.*);
25}20}
lib/compiler_rt/trunc.zig+4-2
...@@ -18,8 +18,10 @@ comptime {...@@ -18,8 +18,10 @@ comptime {
18 @export(truncf, .{ .name = "truncf", .linkage = common.linkage });18 @export(truncf, .{ .name = "truncf", .linkage = common.linkage });
19 @export(trunc, .{ .name = "trunc", .linkage = common.linkage });19 @export(trunc, .{ .name = "trunc", .linkage = common.linkage });
20 @export(__truncx, .{ .name = "__truncx", .linkage = common.linkage });20 @export(__truncx, .{ .name = "__truncx", .linkage = common.linkage });
21 const truncq_sym_name = if (common.want_ppc_abi) "truncf128" else "truncq";21 if (common.want_ppc_abi) {
22 @export(truncq, .{ .name = truncq_sym_name, .linkage = common.linkage });22 @export(truncq, .{ .name = "truncf128", .linkage = common.linkage });
23 }
24 @export(truncq, .{ .name = "truncq", .linkage = common.linkage });
23 @export(truncl, .{ .name = "truncl", .linkage = common.linkage });25 @export(truncl, .{ .name = "truncl", .linkage = common.linkage });
24}26}
2527
lib/compiler_rt/trunctfdf2.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__trunckfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage });8 @export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage });10 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage });
11 } else {
12 @export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage });
13 }11 }
12 @export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage });
14}13}
1514
16pub fn __trunctfdf2(a: f128) callconv(.C) f64 {15pub fn __trunctfdf2(a: f128) callconv(.C) f64 {
17 return truncf(f64, f128, a);16 return truncf(f64, f128, a);
18}17}
1918
20fn __trunckfdf2(a: f128) callconv(.C) f64 {
21 return truncf(f64, f128, a);
22}
23
24fn _Qp_qtod(a: *const f128) callconv(.C) f64 {19fn _Qp_qtod(a: *const f128) callconv(.C) f64 {
25 return truncf(f64, f128, a.*);20 return truncf(f64, f128, a.*);
26}21}
lib/compiler_rt/trunctfsf2.zig+2-7
...@@ -5,22 +5,17 @@ pub const panic = common.panic;...@@ -5,22 +5,17 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__trunckfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage });8 @export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = common.linkage });10 @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = common.linkage });
11 } else {
12 @export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage });
13 }11 }
12 @export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage });
14}13}
1514
16pub fn __trunctfsf2(a: f128) callconv(.C) f32 {15pub fn __trunctfsf2(a: f128) callconv(.C) f32 {
17 return truncf(f32, f128, a);16 return truncf(f32, f128, a);
18}17}
1918
20fn __trunckfsf2(a: f128) callconv(.C) f32 {
21 return truncf(f32, f128, a);
22}
23
24fn _Qp_qtos(a: *const f128) callconv(.C) f32 {19fn _Qp_qtos(a: *const f128) callconv(.C) f32 {
25 return truncf(f32, f128, a.*);20 return truncf(f32, f128, a.*);
26}21}
lib/compiler_rt/unordtf2.zig+2-7
...@@ -5,19 +5,14 @@ pub const panic = common.panic;...@@ -5,19 +5,14 @@ pub const panic = common.panic;
55
6comptime {6comptime {
7 if (common.want_ppc_abi) {7 if (common.want_ppc_abi) {
8 @export(__unordkf2, .{ .name = "__unordkf2", .linkage = common.linkage });8 @export(__unordtf2, .{ .name = "__unordkf2", .linkage = common.linkage });
9 } else if (common.want_sparc_abi) {9 } else if (common.want_sparc_abi) {
10 // These exports are handled in cmptf2.zig because unordered comparisons10 // These exports are handled in cmptf2.zig because unordered comparisons
11 // are based on calling _Qp_cmp.11 // are based on calling _Qp_cmp.
12 } else {
13 @export(__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage });
14 }12 }
13 @export(__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage });
15}14}
1615
17fn __unordtf2(a: f128, b: f128) callconv(.C) i32 {16fn __unordtf2(a: f128, b: f128) callconv(.C) i32 {
18 return comparef.unordcmp(f128, a, b);17 return comparef.unordcmp(f128, a, b);
19}18}
20
21fn __unordkf2(a: f128, b: f128) callconv(.C) i32 {
22 return comparef.unordcmp(f128, a, b);
23}
lib/std/target.zig+1-66
...@@ -1780,71 +1780,6 @@ pub const Target = struct {...@@ -1780,71 +1780,6 @@ pub const Target = struct {
1780 };1780 };
1781 }1781 }
17821782
1783 pub inline fn longDoubleIs(target: Target, comptime F: type) bool {
1784 if (target.abi == .msvc or (target.abi == .android and target.cpu.arch == .i386)) {
1785 return F == f64;
1786 }
1787 return switch (F) {
1788 f128 => switch (target.cpu.arch) {
1789 .aarch64 => {
1790 // According to Apple's official guide:
1791 // > The long double type is a double precision IEEE754 binary floating-point type,
1792 // > which makes it identical to the double type. This behavior contrasts to the
1793 // > standard specification, in which a long double is a quad-precision, IEEE754
1794 // > binary, floating-point type.
1795 // https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
1796 return !target.isDarwin();
1797 },
1798
1799 .riscv64,
1800 .aarch64_be,
1801 .aarch64_32,
1802 .s390x,
1803 .mips64,
1804 .mips64el,
1805 .sparc,
1806 .sparc64,
1807 .sparcel,
1808 .powerpc,
1809 .powerpcle,
1810 .powerpc64,
1811 .powerpc64le,
1812 .wasm32,
1813 .wasm64,
1814 => true,
1815
1816 else => false,
1817 },
1818 f80 => switch (target.cpu.arch) {
1819 .x86_64, .i386 => true,
1820 else => false,
1821 },
1822 f64 => switch (target.cpu.arch) {
1823 .aarch64 => target.isDarwin(),
1824
1825 .x86_64,
1826 .i386,
1827 .riscv64,
1828 .aarch64_be,
1829 .aarch64_32,
1830 .s390x,
1831 .mips64,
1832 .mips64el,
1833 .sparc,
1834 .sparc64,
1835 .sparcel,
1836 .powerpc,
1837 .powerpcle,
1838 .powerpc64,
1839 .powerpc64le,
1840 => false,
1841
1842 else => true,
1843 },
1844 else => false,
1845 };
1846 }
1847
1848 pub inline fn maxIntAlignment(target: Target) u16 {1783 pub inline fn maxIntAlignment(target: Target) u16 {
1849 return switch (target.cpu.arch) {1784 return switch (target.cpu.arch) {
1850 .avr => 1,1785 .avr => 1,
...@@ -1872,7 +1807,7 @@ pub const Target = struct {...@@ -1872,7 +1807,7 @@ pub const Target = struct {
1872 => 8,1807 => 8,
18731808
1874 .i386 => return switch (target.os.tag) {1809 .i386 => return switch (target.os.tag) {
1875 .windows => 8,1810 .windows, .uefi => 8,
1876 else => 4,1811 else => 4,
1877 },1812 },
18781813
src/codegen/llvm.zig+2-2
...@@ -10730,8 +10730,8 @@ fn backendSupportsF128(target: std.Target) bool {...@@ -10730,8 +10730,8 @@ fn backendSupportsF128(target: std.Target) bool {
10730fn intrinsicsAllowed(scalar_ty: Type, target: std.Target) bool {10730fn intrinsicsAllowed(scalar_ty: Type, target: std.Target) bool {
10731 return switch (scalar_ty.tag()) {10731 return switch (scalar_ty.tag()) {
10732 .f16 => backendSupportsF16(target),10732 .f16 => backendSupportsF16(target),
10733 .f80 => target.longDoubleIs(f80) and backendSupportsF80(target),10733 .f80 => (CType.longdouble.sizeInBits(target) == 80) and backendSupportsF80(target),
10734 .f128 => target.longDoubleIs(f128) and backendSupportsF128(target),10734 .f128 => (CType.longdouble.sizeInBits(target) == 128) and backendSupportsF128(target),
10735 else => true,10735 else => true,
10736 };10736 };
10737}10737}
src/type.zig+414-89
...@@ -2892,41 +2892,24 @@ pub const Type = extern union {...@@ -2892,41 +2892,24 @@ pub const Type = extern union {
2892 .anyframe_T,2892 .anyframe_T,
2893 => return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) },2893 => return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) },
28942894
2895 .c_short => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.short.sizeInBits(target), 8) },2895 .c_short => return AbiAlignmentAdvanced{ .scalar = CType.short.alignment(target) },
2896 .c_ushort => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.ushort.sizeInBits(target), 8) },2896 .c_ushort => return AbiAlignmentAdvanced{ .scalar = CType.ushort.alignment(target) },
2897 .c_int => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.int.sizeInBits(target), 8) },2897 .c_int => return AbiAlignmentAdvanced{ .scalar = CType.int.alignment(target) },
2898 .c_uint => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.uint.sizeInBits(target), 8) },2898 .c_uint => return AbiAlignmentAdvanced{ .scalar = CType.uint.alignment(target) },
2899 .c_long => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.long.sizeInBits(target), 8) },2899 .c_long => return AbiAlignmentAdvanced{ .scalar = CType.long.alignment(target) },
2900 .c_ulong => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.ulong.sizeInBits(target), 8) },2900 .c_ulong => return AbiAlignmentAdvanced{ .scalar = CType.ulong.alignment(target) },
2901 .c_longlong => switch (target.cpu.arch) {2901 .c_longlong => return AbiAlignmentAdvanced{ .scalar = CType.longlong.alignment(target) },
2902 .i386 => switch (target.os.tag) {2902 .c_ulonglong => return AbiAlignmentAdvanced{ .scalar = CType.ulonglong.alignment(target) },
2903 .windows, .uefi => return AbiAlignmentAdvanced{ .scalar = 8 },2903 .c_longdouble => return AbiAlignmentAdvanced{ .scalar = CType.longdouble.alignment(target) },
2904 else => return AbiAlignmentAdvanced{ .scalar = 4 },
2905 },
2906 else => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.longlong.sizeInBits(target), 8) },
2907 },
2908 .c_ulonglong => switch (target.cpu.arch) {
2909 .i386 => switch (target.os.tag) {
2910 .windows, .uefi => return AbiAlignmentAdvanced{ .scalar = 8 },
2911 else => return AbiAlignmentAdvanced{ .scalar = 4 },
2912 },
2913 else => return AbiAlignmentAdvanced{ .scalar = @divExact(CType.ulonglong.sizeInBits(target), 8) },
2914 },
29152904
2916 .f16 => return AbiAlignmentAdvanced{ .scalar = 2 },2905 .f16 => return AbiAlignmentAdvanced{ .scalar = 2 },
2917 .f32 => return AbiAlignmentAdvanced{ .scalar = 4 },2906 .f32 => return AbiAlignmentAdvanced{ .scalar = CType.float.alignment(target) },
2918 .f64 => switch (target.cpu.arch) {2907 .f64 => switch (CType.double.sizeInBits(target)) {
2919 .i386 => switch (target.os.tag) {2908 64 => return AbiAlignmentAdvanced{ .scalar = CType.double.alignment(target) },
2920 .windows, .uefi => return AbiAlignmentAdvanced{ .scalar = 8 },
2921 else => return AbiAlignmentAdvanced{ .scalar = 4 },
2922 },
2923 else => return AbiAlignmentAdvanced{ .scalar = 8 },2909 else => return AbiAlignmentAdvanced{ .scalar = 8 },
2924 },2910 },
2925 .f128 => return AbiAlignmentAdvanced{ .scalar = 16 },2911 .f80 => switch (CType.longdouble.sizeInBits(target)) {
29262912 80 => return AbiAlignmentAdvanced{ .scalar = CType.longdouble.alignment(target) },
2927 .f80 => switch (target.cpu.arch) {
2928 .i386 => return AbiAlignmentAdvanced{ .scalar = 4 },
2929 .x86_64 => return AbiAlignmentAdvanced{ .scalar = 16 },
2930 else => {2913 else => {
2931 var payload: Payload.Bits = .{2914 var payload: Payload.Bits = .{
2932 .base = .{ .tag = .int_unsigned },2915 .base = .{ .tag = .int_unsigned },
...@@ -2936,17 +2919,7 @@ pub const Type = extern union {...@@ -2936,17 +2919,7 @@ pub const Type = extern union {
2936 return AbiAlignmentAdvanced{ .scalar = abiAlignment(u80_ty, target) };2919 return AbiAlignmentAdvanced{ .scalar = abiAlignment(u80_ty, target) };
2937 },2920 },
2938 },2921 },
2939 .c_longdouble => switch (CType.longdouble.sizeInBits(target)) {2922 .f128 => return AbiAlignmentAdvanced{ .scalar = 16 },
2940 16 => return AbiAlignmentAdvanced{ .scalar = abiAlignment(Type.f16, target) },
2941 32 => return AbiAlignmentAdvanced{ .scalar = abiAlignment(Type.f32, target) },
2942 64 => return AbiAlignmentAdvanced{ .scalar = abiAlignment(Type.f64, target) },
2943 80 => if (target.cpu.arch == .i386 and target.isMinGW())
2944 return AbiAlignmentAdvanced{ .scalar = 4 }
2945 else
2946 return AbiAlignmentAdvanced{ .scalar = abiAlignment(Type.f80, target) },
2947 128 => return AbiAlignmentAdvanced{ .scalar = abiAlignment(Type.f128, target) },
2948 else => unreachable,
2949 },
29502923
2951 // TODO revisit this when we have the concept of the error tag type2924 // TODO revisit this when we have the concept of the error tag type
2952 .anyerror_void_error_union,2925 .anyerror_void_error_union,
...@@ -3411,16 +3384,8 @@ pub const Type = extern union {...@@ -3411,16 +3384,8 @@ pub const Type = extern union {
3411 .f32 => return AbiSizeAdvanced{ .scalar = 4 },3384 .f32 => return AbiSizeAdvanced{ .scalar = 4 },
3412 .f64 => return AbiSizeAdvanced{ .scalar = 8 },3385 .f64 => return AbiSizeAdvanced{ .scalar = 8 },
3413 .f128 => return AbiSizeAdvanced{ .scalar = 16 },3386 .f128 => return AbiSizeAdvanced{ .scalar = 16 },
34143387 .f80 => switch (CType.longdouble.sizeInBits(target)) {
3415 .f80 => switch (target.cpu.arch) {3388 80 => return AbiSizeAdvanced{ .scalar = std.mem.alignForward(10, CType.longdouble.alignment(target)) },
3416 .i386 => switch (target.os.tag) {
3417 .windows => switch (target.abi) {
3418 .msvc => return AbiSizeAdvanced{ .scalar = 16 },
3419 else => return AbiSizeAdvanced{ .scalar = 12 },
3420 },
3421 else => return AbiSizeAdvanced{ .scalar = 12 },
3422 },
3423 .x86_64 => return AbiSizeAdvanced{ .scalar = 16 },
3424 else => {3389 else => {
3425 var payload: Payload.Bits = .{3390 var payload: Payload.Bits = .{
3426 .base = .{ .tag = .int_unsigned },3391 .base = .{ .tag = .int_unsigned },
...@@ -6654,45 +6619,80 @@ pub const CType = enum {...@@ -6654,45 +6619,80 @@ pub const CType = enum {
6654 ulonglong,6619 ulonglong,
6655 longdouble,6620 longdouble,
66566621
6622 // We don't have a `c_float`/`c_double` type in Zig, but these
6623 // are useful for querying target-correct alignment and checking
6624 // whether C's double is f64 or f32
6625 float,
6626 double,
6627
6657 pub fn sizeInBits(self: CType, target: Target) u16 {6628 pub fn sizeInBits(self: CType, target: Target) u16 {
6658 switch (target.os.tag) {6629 switch (target.os.tag) {
6659 .freestanding, .other => switch (target.cpu.arch) {6630 .freestanding, .other => switch (target.cpu.arch) {
6660 .msp430 => switch (self) {6631 .msp430 => switch (self) {
6661 .short, .ushort, .int, .uint => return 16,6632 .short, .ushort, .int, .uint => return 16,
6662 .long, .ulong => return 32,6633 .float, .long, .ulong => return 32,
6663 .longlong, .ulonglong, .longdouble => return 64,6634 .longlong, .ulonglong, .double, .longdouble => return 64,
6664 },6635 },
6665 .avr => switch (self) {6636 .avr => switch (self) {
6666 .short, .ushort, .int, .uint => return 16,6637 .short, .ushort, .int, .uint => return 16,
6667 .long, .ulong, .longdouble => return 32,6638 .long, .ulong, .float, .double, .longdouble => return 32,
6668 .longlong, .ulonglong => return 64,6639 .longlong, .ulonglong => return 64,
6669 },6640 },
6641 .tce, .tcele => switch (self) {
6642 .short, .ushort => return 16,
6643 .int, .uint, .long, .ulong, .longlong, .ulonglong => return 32,
6644 .float, .double, .longdouble => return 32,
6645 },
6646 .mips64, .mips64el => switch (self) {
6647 .short, .ushort => return 16,
6648 .int, .uint, .float => return 32,
6649 .long, .ulong => return if (target.abi != .gnuabin32) 64 else 32,
6650 .longlong, .ulonglong, .double => return 64,
6651 .longdouble => return 128,
6652 },
6653 .x86_64 => switch (self) {
6654 .short, .ushort => return 16,
6655 .int, .uint, .float => return 32,
6656 .long, .ulong => switch (target.abi) {
6657 .gnux32, .muslx32 => return 32,
6658 else => return 64,
6659 },
6660 .longlong, .ulonglong, .double => return 64,
6661 .longdouble => return 80,
6662 },
6670 else => switch (self) {6663 else => switch (self) {
6671 .short, .ushort => return 16,6664 .short, .ushort => return 16,
6672 .int, .uint => return 32,6665 .int, .uint, .float => return 32,
6673 .long, .ulong => return target.cpu.arch.ptrBitWidth(),6666 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
6674 .longlong, .ulonglong => return 64,6667 .longlong, .ulonglong, .double => return 64,
6675 .longdouble => switch (target.cpu.arch) {6668 .longdouble => switch (target.cpu.arch) {
6676 .i386 => switch (target.abi) {6669 .i386 => switch (target.abi) {
6677 .android => return 64,6670 .android => return 64,
6678 else => return 80,6671 else => return 80,
6679 },6672 },
6680 .x86_64 => return 80,
66816673
6674 .powerpc,
6675 .powerpcle,
6676 .powerpc64,
6677 .powerpc64le,
6678 => switch (target.abi) {
6679 .musl,
6680 .musleabi,
6681 .musleabihf,
6682 .muslx32,
6683 => return 64,
6684 else => return 128,
6685 },
6686
6687 .riscv32,
6682 .riscv64,6688 .riscv64,
6683 .aarch64,6689 .aarch64,
6684 .aarch64_be,6690 .aarch64_be,
6685 .aarch64_32,6691 .aarch64_32,
6686 .s390x,6692 .s390x,
6687 .mips64,
6688 .mips64el,
6689 .sparc,6693 .sparc,
6690 .sparc64,6694 .sparc64,
6691 .sparcel,6695 .sparcel,
6692 .powerpc,
6693 .powerpcle,
6694 .powerpc64,
6695 .powerpc64le,
6696 .wasm32,6696 .wasm32,
6697 .wasm64,6697 .wasm64,
6698 => return 128,6698 => return 128,
...@@ -6716,23 +6716,78 @@ pub const CType = enum {...@@ -6716,23 +6716,78 @@ pub const CType = enum {
6716 .fuchsia,6716 .fuchsia,
6717 .minix,6717 .minix,
6718 => switch (target.cpu.arch) {6718 => switch (target.cpu.arch) {
6719 .msp430 => switch (self) {
6720 .short, .ushort, .int, .uint => return 16,
6721 .long, .ulong, .float => return 32,
6722 .longlong, .ulonglong, .double, .longdouble => return 64,
6723 },
6719 .avr => switch (self) {6724 .avr => switch (self) {
6720 .short, .ushort, .int, .uint => return 16,6725 .short, .ushort, .int, .uint => return 16,
6721 .long, .ulong, .longdouble => return 32,6726 .long, .ulong, .float, .double, .longdouble => return 32,
6722 .longlong, .ulonglong => return 64,6727 .longlong, .ulonglong => return 64,
6723 },6728 },
6729 .tce, .tcele => switch (self) {
6730 .short, .ushort => return 16,
6731 .int, .uint, .long, .ulong, .longlong, .ulonglong => return 32,
6732 .float, .double, .longdouble => return 32,
6733 },
6734 .mips64, .mips64el => switch (self) {
6735 .short, .ushort => return 16,
6736 .int, .uint, .float => return 32,
6737 .long, .ulong => return if (target.abi != .gnuabin32) 64 else 32,
6738 .longlong, .ulonglong, .double => return 64,
6739 .longdouble => if (target.os.tag == .freebsd) return 64 else return 128,
6740 },
6741 .x86_64 => switch (self) {
6742 .short, .ushort => return 16,
6743 .int, .uint, .float => return 32,
6744 .long, .ulong => switch (target.abi) {
6745 .gnux32, .muslx32 => return 32,
6746 else => return 64,
6747 },
6748 .longlong, .ulonglong, .double => return 64,
6749 .longdouble => return 80,
6750 },
6724 else => switch (self) {6751 else => switch (self) {
6725 .short, .ushort => return 16,6752 .short, .ushort => return 16,
6726 .int, .uint => return 32,6753 .int, .uint, .float => return 32,
6727 .long, .ulong => return target.cpu.arch.ptrBitWidth(),6754 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
6728 .longlong, .ulonglong => return 64,6755 .longlong, .ulonglong, .double => return 64,
6729 .longdouble => switch (target.cpu.arch) {6756 .longdouble => switch (target.cpu.arch) {
6730 .i386 => switch (target.abi) {6757 .i386 => switch (target.abi) {
6731 .android => return 64,6758 .android => return 64,
6732 else => return 80,6759 else => return 80,
6733 },6760 },
6734 .x86_64 => return 80,
67356761
6762 .powerpc,
6763 .powerpcle,
6764 => switch (target.abi) {
6765 .musl,
6766 .musleabi,
6767 .musleabihf,
6768 .muslx32,
6769 => return 64,
6770 else => switch (target.os.tag) {
6771 .freebsd, .netbsd, .openbsd => return 64,
6772 else => return 128,
6773 },
6774 },
6775
6776 .powerpc64,
6777 .powerpc64le,
6778 => switch (target.abi) {
6779 .musl,
6780 .musleabi,
6781 .musleabihf,
6782 .muslx32,
6783 => return 64,
6784 else => switch (target.os.tag) {
6785 .freebsd, .openbsd => return 64,
6786 else => return 128,
6787 },
6788 },
6789
6790 .riscv32,
6736 .riscv64,6791 .riscv64,
6737 .aarch64,6792 .aarch64,
6738 .aarch64_be,6793 .aarch64_be,
...@@ -6743,10 +6798,6 @@ pub const CType = enum {...@@ -6743,10 +6798,6 @@ pub const CType = enum {
6743 .sparc,6798 .sparc,
6744 .sparc64,6799 .sparc64,
6745 .sparcel,6800 .sparcel,
6746 .powerpc,
6747 .powerpcle,
6748 .powerpc64,
6749 .powerpc64le,
6750 .wasm32,6801 .wasm32,
6751 .wasm64,6802 .wasm64,
6752 => return 128,6803 => return 128,
...@@ -6756,37 +6807,77 @@ pub const CType = enum {...@@ -6756,37 +6807,77 @@ pub const CType = enum {
6756 },6807 },
6757 },6808 },
67586809
6759 .windows, .uefi => switch (self) {6810 .windows, .uefi => switch (target.cpu.arch) {
6760 .short, .ushort => return 16,6811 .i386 => switch (self) {
6761 .int, .uint, .long, .ulong => return 32,6812 .short, .ushort => return 16,
6762 .longlong, .ulonglong => return 64,6813 .int, .uint, .float => return 32,
6763 .longdouble => switch (target.cpu.arch) {6814 .long, .ulong => return 32,
6764 .i386 => switch (target.abi) {6815 .longlong, .ulonglong, .double => return 64,
6765 .gnu => return 80,6816 .longdouble => switch (target.abi) {
6817 .gnu, .gnuilp32, .cygnus => return 80,
6766 else => return 64,6818 else => return 64,
6767 },6819 },
6768 .x86_64 => switch (target.abi) {6820 },
6769 .gnu => return 80,6821 .x86_64 => switch (self) {
6822 .short, .ushort => return 16,
6823 .int, .uint, .float => return 32,
6824 .long, .ulong => switch (target.abi) {
6825 .cygnus => return 64,
6826 else => return 32,
6827 },
6828 .longlong, .ulonglong, .double => return 64,
6829 .longdouble => switch (target.abi) {
6830 .gnu, .gnuilp32, .cygnus => return 80,
6770 else => return 64,6831 else => return 64,
6771 },6832 },
6772 else => return 64,6833 },
6834 else => switch (self) {
6835 .short, .ushort => return 16,
6836 .int, .uint, .float => return 32,
6837 .long, .ulong => return 32,
6838 .longlong, .ulonglong, .double => return 64,
6839 .longdouble => return 64,
6773 },6840 },
6774 },6841 },
67756842
6776 .macos, .ios, .tvos, .watchos => switch (self) {6843 .macos, .ios, .tvos, .watchos => switch (self) {
6777 .short, .ushort => return 16,6844 .short, .ushort => return 16,
6778 .int, .uint => return 32,6845 .int, .uint, .float => return 32,
6779 .long, .ulong, .longlong, .ulonglong => return 64,6846 .long, .ulong => switch (target.cpu.arch) {
6847 .i386, .arm, .aarch64_32 => return 32,
6848 .x86_64 => switch (target.abi) {
6849 .gnux32, .muslx32 => return 32,
6850 else => return 64,
6851 },
6852 else => return 64,
6853 },
6854 .longlong, .ulonglong, .double => return 64,
6780 .longdouble => switch (target.cpu.arch) {6855 .longdouble => switch (target.cpu.arch) {
6781 .i386, .x86_64 => return 80,6856 .i386 => switch (target.abi) {
6857 .android => return 64,
6858 else => return 80,
6859 },
6860 .x86_64 => return 80,
6861 else => return 64,
6862 },
6863 },
6864
6865 .nvcl, .cuda => switch (self) {
6866 .short, .ushort => return 16,
6867 .int, .uint, .float => return 32,
6868 .long, .ulong => switch (target.cpu.arch) {
6869 .nvptx => return 32,
6870 .nvptx64 => return 64,
6782 else => return 64,6871 else => return 64,
6783 },6872 },
6873 .longlong, .ulonglong, .double => return 64,
6874 .longdouble => return 64,
6784 },6875 },
67856876
6786 .amdhsa, .amdpal => switch (self) {6877 .amdhsa, .amdpal => switch (self) {
6787 .short, .ushort => return 16,6878 .short, .ushort => return 16,
6788 .int, .uint => return 32,6879 .int, .uint, .float => return 32,
6789 .long, .ulong, .longlong, .ulonglong => return 64,6880 .long, .ulong, .longlong, .ulonglong, .double => return 64,
6790 .longdouble => return 128,6881 .longdouble => return 128,
6791 },6882 },
67926883
...@@ -6797,8 +6888,6 @@ pub const CType = enum {...@@ -6797,8 +6888,6 @@ pub const CType = enum {
6797 .rtems,6888 .rtems,
6798 .nacl,6889 .nacl,
6799 .aix,6890 .aix,
6800 .cuda,
6801 .nvcl,
6802 .ps4,6891 .ps4,
6803 .ps5,6892 .ps5,
6804 .elfiamcu,6893 .elfiamcu,
...@@ -6814,4 +6903,240 @@ pub const CType = enum {...@@ -6814,4 +6903,240 @@ pub const CType = enum {
6814 => @panic("TODO specify the C integer and float type sizes for this OS"),6903 => @panic("TODO specify the C integer and float type sizes for this OS"),
6815 }6904 }
6816 }6905 }
6906
6907 pub fn alignment(self: CType, target: Target) u16 {
6908
6909 // Overrides for unusual alignments
6910 switch (target.cpu.arch) {
6911 .avr => switch (self) {
6912 .short, .ushort => return 2,
6913 else => return 1,
6914 },
6915 .i386 => switch (target.os.tag) {
6916 .windows, .uefi => switch (self) {
6917 .longlong, .ulonglong, .double => return 8,
6918 .longdouble => switch (target.abi) {
6919 .gnu, .gnuilp32, .cygnus => return 4,
6920 else => return 8,
6921 },
6922 else => {},
6923 },
6924 else => {},
6925 },
6926 else => {},
6927 }
6928
6929 // Next-power-of-two-aligned, up to a maximum.
6930 return @min(
6931 std.math.ceilPowerOfTwoAssert(u16, (self.sizeInBits(target) + 7) / 8),
6932 switch (target.cpu.arch) {
6933 .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
6934 .netbsd => switch (target.abi) {
6935 .gnueabi,
6936 .gnueabihf,
6937 .eabi,
6938 .eabihf,
6939 .android,
6940 .musleabi,
6941 .musleabihf,
6942 => 8,
6943
6944 else => @as(u16, 4),
6945 },
6946 .ios, .tvos, .watchos => 4,
6947 else => 8,
6948 },
6949
6950 .msp430,
6951 .avr,
6952 => 2,
6953
6954 .arc,
6955 .csky,
6956 .i386,
6957 .xcore,
6958 .dxil,
6959 .loongarch32,
6960 .tce,
6961 .tcele,
6962 .le32,
6963 .amdil,
6964 .hsail,
6965 .spir,
6966 .spirv32,
6967 .kalimba,
6968 .shave,
6969 .renderscript32,
6970 .ve,
6971 .spu_2,
6972 => 4,
6973
6974 .aarch64_32,
6975 .amdgcn,
6976 .amdil64,
6977 .bpfel,
6978 .bpfeb,
6979 .hexagon,
6980 .hsail64,
6981 .loongarch64,
6982 .m68k,
6983 .mips,
6984 .mipsel,
6985 .sparc,
6986 .sparcel,
6987 .sparc64,
6988 .lanai,
6989 .le64,
6990 .nvptx,
6991 .nvptx64,
6992 .r600,
6993 .s390x,
6994 .spir64,
6995 .spirv64,
6996 .renderscript64,
6997 => 8,
6998
6999 .aarch64,
7000 .aarch64_be,
7001 .mips64,
7002 .mips64el,
7003 .powerpc,
7004 .powerpcle,
7005 .powerpc64,
7006 .powerpc64le,
7007 .riscv32,
7008 .riscv64,
7009 .x86_64,
7010 .wasm32,
7011 .wasm64,
7012 => 16,
7013 },
7014 );
7015 }
7016
7017 pub fn preferredAlignment(self: CType, target: Target) u16 {
7018
7019 // Overrides for unusual alignments
7020 switch (target.cpu.arch) {
7021 .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
7022 .netbsd => switch (target.abi) {
7023 .gnueabi,
7024 .gnueabihf,
7025 .eabi,
7026 .eabihf,
7027 .android,
7028 .musleabi,
7029 .musleabihf,
7030 => {},
7031
7032 else => switch (self) {
7033 .longdouble => return 4,
7034 else => {},
7035 },
7036 },
7037 .ios, .tvos, .watchos => switch (self) {
7038 .longdouble => return 4,
7039 else => {},
7040 },
7041 else => {},
7042 },
7043 .arc => switch (self) {
7044 .longdouble => return 4,
7045 else => {},
7046 },
7047 .avr => switch (self) {
7048 .int, .uint, .long, .ulong, .float, .longdouble => return 1,
7049 .short, .ushort => return 2,
7050 .double => return 4,
7051 .longlong, .ulonglong => return 8,
7052 },
7053 .i386 => switch (target.os.tag) {
7054 .windows, .uefi => switch (self) {
7055 .longdouble => switch (target.abi) {
7056 .gnu, .gnuilp32, .cygnus => return 4,
7057 else => return 8,
7058 },
7059 else => {},
7060 },
7061 else => switch (self) {
7062 .longdouble => return 4,
7063 else => {},
7064 },
7065 },
7066 else => {},
7067 }
7068
7069 // Next-power-of-two-aligned, up to a maximum.
7070 return @min(
7071 std.math.ceilPowerOfTwoAssert(u16, (self.sizeInBits(target) + 7) / 8),
7072 switch (target.cpu.arch) {
7073 .msp430 => @as(u16, 2),
7074
7075 .csky,
7076 .xcore,
7077 .dxil,
7078 .loongarch32,
7079 .tce,
7080 .tcele,
7081 .le32,
7082 .amdil,
7083 .hsail,
7084 .spir,
7085 .spirv32,
7086 .kalimba,
7087 .shave,
7088 .renderscript32,
7089 .ve,
7090 .spu_2,
7091 => 4,
7092
7093 .arc,
7094 .arm,
7095 .armeb,
7096 .avr,
7097 .thumb,
7098 .thumbeb,
7099 .aarch64_32,
7100 .amdgcn,
7101 .amdil64,
7102 .bpfel,
7103 .bpfeb,
7104 .hexagon,
7105 .hsail64,
7106 .i386,
7107 .loongarch64,
7108 .m68k,
7109 .mips,
7110 .mipsel,
7111 .sparc,
7112 .sparcel,
7113 .sparc64,
7114 .lanai,
7115 .le64,
7116 .nvptx,
7117 .nvptx64,
7118 .r600,
7119 .s390x,
7120 .spir64,
7121 .spirv64,
7122 .renderscript64,
7123 => 8,
7124
7125 .aarch64,
7126 .aarch64_be,
7127 .mips64,
7128 .mips64el,
7129 .powerpc,
7130 .powerpcle,
7131 .powerpc64,
7132 .powerpc64le,
7133 .riscv32,
7134 .riscv64,
7135 .x86_64,
7136 .wasm32,
7137 .wasm64,
7138 => 16,
7139 },
7140 );
7141 }
6817};7142};