authorgravatar for vesim809@pm.meMaciej 'vesim' Kuliński <vesim809@pm.me> 2024-09-07 17:29:43+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-07 23:46:30-07:00
logfb0028a0d7b43a2a5dd05f075ded22746f92faf6
treee7fad4715b811acd7e51fd44b2d078c9b37b9d94
parentfb81522e0ba97294a475df040ccfea493342498d

mips: fix C ABI compatibility


4 files changed, 145 insertions(+), 43 deletions(-)

src/arch/mips/abi.zig created+86
......@@ -0,0 +1,86 @@
1const std = @import("std");
2const Type = @import("../../Type.zig");
3const Zcu = @import("../../Zcu.zig");
4const assert = std.debug.assert;
5
6pub const Class = union(enum) {
7 memory,
8 byval,
9 i32_array: u8,
10};
11
12pub const Context = enum { ret, arg };
13
14pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
15 const target = zcu.getTarget();
16 std.debug.assert(ty.hasRuntimeBitsIgnoreComptime(zcu));
17
18 const max_direct_size = target.ptrBitWidth() * 2;
19 switch (ty.zigTypeTag(zcu)) {
20 .@"struct" => {
21 const bit_size = ty.bitSize(zcu);
22 if (ty.containerLayout(zcu) == .@"packed") {
23 if (bit_size > max_direct_size) return .memory;
24 return .byval;
25 }
26 if (bit_size > max_direct_size) return .memory;
27 // TODO: for bit_size <= 32 using byval is more correct, but that needs inreg argument attribute
28 const count = @as(u8, @intCast(std.mem.alignForward(u64, bit_size, 32) / 32));
29 return .{ .i32_array = count };
30 },
31 .@"union" => {
32 const bit_size = ty.bitSize(zcu);
33 if (ty.containerLayout(zcu) == .@"packed") {
34 if (bit_size > max_direct_size) return .memory;
35 return .byval;
36 }
37 if (bit_size > max_direct_size) return .memory;
38
39 return .byval;
40 },
41 .bool => return .byval,
42 .float => return .byval,
43 .int, .@"enum", .error_set => {
44 const bit_size = ty.bitSize(zcu);
45 if (bit_size > max_direct_size) return .memory;
46 return .byval;
47 },
48 .vector => {
49 const elem_type = ty.elemType2(zcu);
50 switch (elem_type.zigTypeTag(zcu)) {
51 .bool, .int => {
52 const bit_size = ty.bitSize(zcu);
53 if (ctx == .ret and bit_size > 128) return .memory;
54 if (bit_size > 512) return .memory;
55 // TODO: byval vector arguments with non power of 2 size need inreg attribute
56 return .byval;
57 },
58 .float => return .memory,
59 else => unreachable,
60 }
61 },
62 .optional => {
63 std.debug.assert(ty.isPtrLikeOptional(zcu));
64 return .byval;
65 },
66 .pointer => {
67 std.debug.assert(!ty.isSlice(zcu));
68 return .byval;
69 },
70 .error_union,
71 .frame,
72 .@"anyframe",
73 .noreturn,
74 .void,
75 .type,
76 .comptime_float,
77 .comptime_int,
78 .undefined,
79 .null,
80 .@"fn",
81 .@"opaque",
82 .enum_literal,
83 .array,
84 => unreachable,
85 }
86}
src/codegen/llvm.zig+19-3
......@@ -26,6 +26,7 @@ const wasm_c_abi = @import("../arch/wasm/abi.zig");
2626const aarch64_c_abi = @import("../arch/aarch64/abi.zig");
2727const arm_c_abi = @import("../arch/arm/abi.zig");
2828const riscv_c_abi = @import("../arch/riscv64/abi.zig");
29const mips_c_abi = @import("../arch/mips/abi.zig");
2930const dev = @import("../dev.zig");
3031
3132const target_util = @import("../target.zig");
......@@ -11681,7 +11682,10 @@ fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Targe
1168111682 return switch (fn_info.cc) {
1168211683 .Unspecified, .Inline => returnTypeByRef(zcu, target, return_type),
1168311684 .C => switch (target.cpu.arch) {
11684 .mips, .mipsel => false,
11685 .mips, .mipsel => switch (mips_c_abi.classifyType(return_type, zcu, .ret)) {
11686 .memory, .i32_array => true,
11687 .byval => false,
11688 },
1168511689 .x86 => isByRef(return_type, zcu),
1168611690 .x86_64 => switch (target.os.tag) {
1168711691 .windows => x86_64_abi.classifyWindows(return_type, zcu) == .memory,
......@@ -11732,7 +11736,12 @@ fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Error!Bu
1173211736
1173311737 .C => {
1173411738 switch (target.cpu.arch) {
11735 .mips, .mipsel => return o.lowerType(return_type),
11739 .mips, .mipsel => {
11740 switch (mips_c_abi.classifyType(return_type, zcu, .ret)) {
11741 .memory, .i32_array => return .void,
11742 .byval => return o.lowerType(return_type),
11743 }
11744 },
1173611745 .x86 => return if (isByRef(return_type, zcu)) .void else o.lowerType(return_type),
1173711746 .x86_64 => switch (target.os.tag) {
1173811747 .windows => return lowerWin64FnRetTy(o, fn_info),
......@@ -11978,7 +11987,14 @@ const ParamTypeIterator = struct {
1197811987 .mips, .mipsel => {
1197911988 it.zig_index += 1;
1198011989 it.llvm_index += 1;
11981 return .byval;
11990 switch (mips_c_abi.classifyType(ty, zcu, .arg)) {
11991 .memory => {
11992 it.byval_attr = true;
11993 return .byref;
11994 },
11995 .byval => return .byval,
11996 .i32_array => |size| return Lowering{ .i32_array = size },
11997 }
1198211998 },
1198311999 .x86_64 => switch (target.os.tag) {
1198412000 .windows => return it.nextWin64(ty),
test/c_abi/cfuncs.c+7-7
......@@ -2657,7 +2657,7 @@ void run_c_tests(void) {
26572657 }
26582658#endif
26592659
2660#if !defined(__mips__) && !defined(ZIG_PPC32)
2660#if !defined(ZIG_PPC32)
26612661 {
26622662 struct Struct_u64_u64 s = zig_ret_struct_u64_u64();
26632663 assert_or_panic(s.a == 1);
......@@ -2708,7 +2708,7 @@ void run_c_tests(void) {
27082708#endif
27092709
27102710#if !defined __i386__ && !defined __arm__ && !defined __aarch64__ && \
2711 !defined __mips__ && !defined __powerpc__ && !defined ZIG_RISCV64
2711 !defined __powerpc__ && !defined ZIG_RISCV64
27122712 {
27132713 struct SmallStructInts s = {1, 2, 3, 4};
27142714 zig_small_struct_ints(s);
......@@ -2716,7 +2716,7 @@ void run_c_tests(void) {
27162716#endif
27172717
27182718#if !defined __arm__ && !defined __aarch64__ && \
2719 !defined __mips__ && !defined __powerpc__ && !defined ZIG_RISCV64
2719 !defined __powerpc__ && !defined ZIG_RISCV64
27202720 {
27212721 struct MedStructInts s = {1, 2, 3};
27222722 zig_med_struct_ints(s);
......@@ -2741,7 +2741,7 @@ void run_c_tests(void) {
27412741 zig_small_packed_struct(s);
27422742 }
27432743
2744#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \
2744#if !defined __i386__ && !defined __arm__ && \
27452745 !defined ZIG_PPC32 && !defined _ARCH_PPC64
27462746 {
27472747 struct SplitStructInts s = {1234, 100, 1337};
......@@ -2756,7 +2756,7 @@ void run_c_tests(void) {
27562756 }
27572757#endif
27582758
2759#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \
2759#if !defined __i386__ && !defined __arm__ && \
27602760 !defined ZIG_PPC32 && !defined _ARCH_PPC64
27612761 {
27622762 struct SplitStructMixed s = {1234, 100, 1337.0f};
......@@ -2764,7 +2764,7 @@ void run_c_tests(void) {
27642764 }
27652765#endif
27662766
2767#if !defined __mips__ && !defined ZIG_PPC32
2767#if !defined ZIG_PPC32
27682768 {
27692769 struct BigStruct s = {30, 31, 32, 33, 34};
27702770 struct BigStruct res = zig_big_struct_both(s);
......@@ -2784,7 +2784,7 @@ void run_c_tests(void) {
27842784 }
27852785#endif
27862786
2787#if !defined __mips__ && !defined ZIG_PPC32
2787#if !defined ZIG_PPC32
27882788 {
27892789 struct FloatRect r1 = {1, 21, 16, 4};
27902790 struct FloatRect r2 = {178, 189, 21, 15};
test/c_abi/main.zig+33-33
......@@ -322,7 +322,7 @@ extern fn c_struct_u64_u64_7(usize, usize, usize, usize, usize, usize, usize, St
322322extern fn c_struct_u64_u64_8(usize, usize, usize, usize, usize, usize, usize, usize, Struct_u64_u64) void;
323323
324324test "C ABI struct u64 u64" {
325 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
325 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
326326 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
327327
328328 const s = c_ret_struct_u64_u64();
......@@ -359,7 +359,7 @@ extern fn c_ret_struct_f32f32_f32() Struct_f32f32_f32;
359359extern fn c_struct_f32f32_f32(Struct_f32f32_f32) void;
360360
361361test "C ABI struct {f32,f32} f32" {
362 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
362 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
363363 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
364364
365365 const s = c_ret_struct_f32f32_f32();
......@@ -389,7 +389,7 @@ extern fn c_ret_struct_f32_f32f32() Struct_f32_f32f32;
389389extern fn c_struct_f32_f32f32(Struct_f32_f32f32) void;
390390
391391test "C ABI struct f32 {f32,f32}" {
392 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
392 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
393393 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
394394
395395 const s = c_ret_struct_f32_f32f32();
......@@ -424,7 +424,7 @@ extern fn c_ret_struct_u32_union_u32_u32u32() Struct_u32_Union_u32_u32u32;
424424extern fn c_struct_u32_union_u32_u32u32(Struct_u32_Union_u32_u32u32) void;
425425
426426test "C ABI struct{u32,union{u32,struct{u32,u32}}}" {
427 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
427 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
428428 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
429429
430430 const s = c_ret_struct_u32_union_u32_u32u32();
......@@ -444,7 +444,7 @@ const BigStruct = extern struct {
444444extern fn c_big_struct(BigStruct) void;
445445
446446test "C ABI big struct" {
447 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
447 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
448448 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
449449
450450 const s = BigStruct{
......@@ -503,7 +503,7 @@ extern fn c_med_struct_mixed(MedStructMixed) void;
503503extern fn c_ret_med_struct_mixed() MedStructMixed;
504504
505505test "C ABI medium struct of ints and floats" {
506 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
506 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
507507 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
508508
509509 const s = MedStructMixed{
......@@ -535,7 +535,7 @@ extern fn c_ret_small_struct_ints() SmallStructInts;
535535
536536test "C ABI small struct of ints" {
537537 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
538 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
538 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
539539 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
540540
541541 const s = SmallStructInts{
......@@ -568,7 +568,7 @@ extern fn c_med_struct_ints(MedStructInts) void;
568568extern fn c_ret_med_struct_ints() MedStructInts;
569569
570570test "C ABI medium struct of ints" {
571 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
571 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
572572 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
573573
574574 const s = MedStructInts{
......@@ -646,7 +646,7 @@ extern fn c_split_struct_ints(SplitStructInt) void;
646646
647647test "C ABI split struct of ints" {
648648 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
649 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
649 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
650650 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
651651
652652 const s = SplitStructInt{
......@@ -673,7 +673,7 @@ extern fn c_ret_split_struct_mixed() SplitStructMixed;
673673
674674test "C ABI split struct of ints and floats" {
675675 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
676 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
676 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
677677 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
678678
679679 const s = SplitStructMixed{
......@@ -700,7 +700,7 @@ extern fn c_multiple_struct_ints(Rect, Rect) void;
700700extern fn c_multiple_struct_floats(FloatRect, FloatRect) void;
701701
702702test "C ABI sret and byval together" {
703 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
703 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
704704 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
705705
706706 const s = BigStruct{
......@@ -752,7 +752,7 @@ const Vector5 = extern struct {
752752extern fn c_big_struct_floats(Vector5) void;
753753
754754test "C ABI structs of floats as parameter" {
755 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
755 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
756756 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
757757
758758 const v3 = Vector3{
......@@ -828,7 +828,7 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {
828828}
829829
830830test "C ABI structs of floats as multiple parameters" {
831 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
831 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
832832 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
833833
834834 const r1 = FloatRect{
......@@ -941,7 +941,7 @@ extern fn c_ret_struct_with_array() StructWithArray;
941941
942942test "Struct with array as padding." {
943943 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
944 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
944 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
945945 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
946946
947947 c_struct_with_array(.{ .a = 1, .padding = undefined, .b = 2 });
......@@ -966,7 +966,7 @@ extern fn c_float_array_struct(FloatArrayStruct) void;
966966extern fn c_ret_float_array_struct() FloatArrayStruct;
967967
968968test "Float array like struct" {
969 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
969 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
970970 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
971971
972972 c_float_array_struct(.{
......@@ -1031,7 +1031,7 @@ extern fn c_ret_big_vec() BigVec;
10311031test "big simd vector" {
10321032 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
10331033
1034 if (builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
1034 if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest;
10351035 if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
10361036 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .x86_64 and builtin.os.tag == .macos and builtin.mode != .Debug) return error.SkipZigTest;
10371037
......@@ -5340,7 +5340,7 @@ extern fn c_ptr_size_float_struct(Vector2) void;
53405340extern fn c_ret_ptr_size_float_struct() Vector2;
53415341
53425342test "C ABI pointer sized float struct" {
5343 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5343 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
53445344 if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
53455345 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
53465346
......@@ -5362,25 +5362,25 @@ pub inline fn expectOk(c_err: c_int) !void {
53625362/// Tests for Double + Char struct
53635363const DC = extern struct { v1: f64, v2: u8 };
53645364test "DC: Zig passes to C" {
5365 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5365 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
53665366 if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
53675367 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
53685368 try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 }));
53695369}
53705370test "DC: Zig returns to C" {
5371 if (builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
5371 if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest;
53725372 if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
53735373 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
53745374 try expectOk(c_assert_ret_DC());
53755375}
53765376test "DC: C passes to Zig" {
5377 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5377 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
53785378 if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
53795379 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
53805380 try expectOk(c_send_DC());
53815381}
53825382test "DC: C returns to Zig" {
5383 if (builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
5383 if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest;
53845384 if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
53855385 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
53865386 try expectEqual(DC{ .v1 = -0.25, .v2 = 15 }, c_ret_DC());
......@@ -5406,12 +5406,12 @@ const CFF = extern struct { v1: u8, v2: f32, v3: f32 };
54065406
54075407test "CFF: Zig passes to C" {
54085408 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
5409 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5409 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
54105410 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54115411 try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }));
54125412}
54135413test "CFF: Zig returns to C" {
5414 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5414 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
54155415 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54165416 try expectOk(c_assert_ret_CFF());
54175417}
......@@ -5419,7 +5419,7 @@ test "CFF: C passes to Zig" {
54195419 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
54205420 if (builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;
54215421 if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest;
5422 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5422 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
54235423 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54245424
54255425 try expectOk(c_send_CFF());
......@@ -5427,7 +5427,7 @@ test "CFF: C passes to Zig" {
54275427test "CFF: C returns to Zig" {
54285428 if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest;
54295429 if (builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;
5430 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5430 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
54315431 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54325432 try expectEqual(CFF{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }, c_ret_CFF());
54335433}
......@@ -5451,22 +5451,22 @@ pub export fn zig_ret_CFF() CFF {
54515451const PD = extern struct { v1: ?*anyopaque, v2: f64 };
54525452
54535453test "PD: Zig passes to C" {
5454 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5454 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
54555455 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54565456 try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 }));
54575457}
54585458test "PD: Zig returns to C" {
5459 if (builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
5459 if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest;
54605460 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54615461 try expectOk(c_assert_ret_PD());
54625462}
54635463test "PD: C passes to Zig" {
5464 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5464 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
54655465 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54665466 try expectOk(c_send_PD());
54675467}
54685468test "PD: C returns to Zig" {
5469 if (builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
5469 if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest;
54705470 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
54715471 try expectEqual(PD{ .v1 = null, .v2 = 0.5 }, c_ret_PD());
54725472}
......@@ -5520,7 +5520,7 @@ const ByVal = extern struct {
55205520
55215521extern fn c_func_ptr_byval(*anyopaque, *anyopaque, ByVal, c_ulong, *anyopaque, c_ulong) void;
55225522test "C function that takes byval struct called via function pointer" {
5523 if (builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
5523 if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest;
55245524 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
55255525
55265526 var fn_ptr = &c_func_ptr_byval;
......@@ -5551,7 +5551,7 @@ const f16_struct = extern struct {
55515551};
55525552extern fn c_f16_struct(f16_struct) f16_struct;
55535553test "f16 struct" {
5554 if (builtin.target.cpu.arch.isMIPS()) return error.SkipZigTest;
5554 if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest;
55555555 if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest;
55565556 if (builtin.cpu.arch.isARM() and builtin.mode != .Debug) return error.SkipZigTest;
55575557
......@@ -5666,7 +5666,7 @@ const Coord2 = extern struct {
56665666
56675667extern fn stdcall_coord2(Coord2, Coord2, Coord2) callconv(stdcall_callconv) Coord2;
56685668test "Stdcall ABI structs" {
5669 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5669 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
56705670 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
56715671
56725672 const res = stdcall_coord2(
......@@ -5751,7 +5751,7 @@ const byval_tail_callsite_attr = struct {
57515751};
57525752
57535753test "byval tail callsite attribute" {
5754 if (builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
5754 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
57555755 if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest;
57565756
57575757 // Originally reported at https://github.com/ziglang/zig/issues/16290