authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-22 13:05:28+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-22 14:52:26+03:00
log5e0b4836a1f48181b0d6df2b272add5aa79654c3
tree7ee97e61af253c029d90cd35b26cd03ef0747522
parent8fa91939a880ac5394aaac457238251d2c937059

stage2: implement RISCV C ABI


6 files changed, 138 insertions(+), 43 deletions(-)

src/arch/aarch64/abi.zig+2-2
...@@ -10,13 +10,13 @@ pub const Class = union(enum) {...@@ -10,13 +10,13 @@ pub const Class = union(enum) {
10 byval,10 byval,
11 integer,11 integer,
12 double_integer,12 double_integer,
13 none,
14 float_array: u8,13 float_array: u8,
15};14};
1615
17/// For `float_array` the second element will be the amount of floats.16/// For `float_array` the second element will be the amount of floats.
18pub fn classifyType(ty: Type, target: std.Target) Class {17pub fn classifyType(ty: Type, target: std.Target) Class {
19 if (!ty.hasRuntimeBitsIgnoreComptime()) return .none;18 std.debug.assert(ty.hasRuntimeBitsIgnoreComptime());
19
20 var maybe_float_bits: ?u16 = null;20 var maybe_float_bits: ?u16 = null;
21 switch (ty.zigTypeTag()) {21 switch (ty.zigTypeTag()) {
22 .Struct => {22 .Struct => {
src/arch/arm/abi.zig+1-2
...@@ -7,7 +7,6 @@ const Type = @import("../../type.zig").Type;...@@ -7,7 +7,6 @@ const Type = @import("../../type.zig").Type;
7pub const Class = union(enum) {7pub const Class = union(enum) {
8 memory,8 memory,
9 byval,9 byval,
10 none,
11 i32_array: u8,10 i32_array: u8,
12 i64_array: u8,11 i64_array: u8,
1312
...@@ -24,7 +23,7 @@ pub const Class = union(enum) {...@@ -24,7 +23,7 @@ pub const Class = union(enum) {
24pub const Context = enum { ret, arg };23pub const Context = enum { ret, arg };
2524
26pub fn classifyType(ty: Type, target: std.Target, ctx: Context) Class {25pub fn classifyType(ty: Type, target: std.Target, ctx: Context) Class {
27 if (!ty.hasRuntimeBitsIgnoreComptime()) return .none;26 std.debug.assert(ty.hasRuntimeBitsIgnoreComptime());
2827
29 var maybe_float_bits: ?u16 = null;28 var maybe_float_bits: ?u16 = null;
30 const max_byval_size = 512;29 const max_byval_size = 512;
src/arch/riscv64/abi.zig+69
...@@ -2,6 +2,75 @@ const std = @import("std");...@@ -2,6 +2,75 @@ const std = @import("std");
2const bits = @import("bits.zig");2const bits = @import("bits.zig");
3const Register = bits.Register;3const Register = bits.Register;
4const RegisterManagerFn = @import("../../register_manager.zig").RegisterManager;4const RegisterManagerFn = @import("../../register_manager.zig").RegisterManager;
5const Type = @import("../../type.zig").Type;
6
7pub const Class = enum { memory, byval, integer, double_integer };
8
9pub fn classifyType(ty: Type, target: std.Target) Class {
10 std.debug.assert(ty.hasRuntimeBitsIgnoreComptime());
11
12 const max_byval_size = target.cpu.arch.ptrBitWidth() * 2;
13 switch (ty.zigTypeTag()) {
14 .Struct => {
15 const bit_size = ty.bitSize(target);
16 if (ty.containerLayout() == .Packed) {
17 if (bit_size > max_byval_size) return .memory;
18 return .byval;
19 }
20 // TODO this doesn't exactly match what clang produces but its better than nothing
21 if (bit_size > max_byval_size) return .memory;
22 if (bit_size > max_byval_size / 2) return .double_integer;
23 return .integer;
24 },
25 .Union => {
26 const bit_size = ty.bitSize(target);
27 if (ty.containerLayout() == .Packed) {
28 if (bit_size > max_byval_size) return .memory;
29 return .byval;
30 }
31 // TODO this doesn't exactly match what clang produces but its better than nothing
32 if (bit_size > max_byval_size) return .memory;
33 if (bit_size > max_byval_size / 2) return .double_integer;
34 return .integer;
35 },
36 .Bool => return .integer,
37 .Float => return .byval,
38 .Int, .Enum, .ErrorSet => {
39 const bit_size = ty.bitSize(target);
40 if (bit_size > max_byval_size) return .memory;
41 return .byval;
42 },
43 .Vector => {
44 const bit_size = ty.bitSize(target);
45 if (bit_size > max_byval_size) return .memory;
46 return .integer;
47 },
48 .Optional => {
49 std.debug.assert(ty.isPtrLikeOptional());
50 return .byval;
51 },
52 .Pointer => {
53 std.debug.assert(!ty.isSlice());
54 return .byval;
55 },
56 .ErrorUnion,
57 .Frame,
58 .AnyFrame,
59 .NoReturn,
60 .Void,
61 .Type,
62 .ComptimeFloat,
63 .ComptimeInt,
64 .Undefined,
65 .Null,
66 .BoundFn,
67 .Fn,
68 .Opaque,
69 .EnumLiteral,
70 .Array,
71 => unreachable,
72 }
73}
574
6pub const callee_preserved_regs = [_]Register{75pub const callee_preserved_regs = [_]Register{
7 .s0, .s1, .s2, .s3, .s4, .s5, .s6, .s7, .s8, .s9, .s10, .s11,76 .s0, .s1, .s2, .s3, .s4, .s5, .s6, .s7, .s8, .s9, .s10, .s11,
src/codegen/llvm.zig+45-15
...@@ -25,6 +25,7 @@ const x86_64_abi = @import("../arch/x86_64/abi.zig");...@@ -25,6 +25,7 @@ const x86_64_abi = @import("../arch/x86_64/abi.zig");
25const wasm_c_abi = @import("../arch/wasm/abi.zig");25const wasm_c_abi = @import("../arch/wasm/abi.zig");
26const aarch64_c_abi = @import("../arch/aarch64/abi.zig");26const aarch64_c_abi = @import("../arch/aarch64/abi.zig");
27const arm_c_abi = @import("../arch/arm/abi.zig");27const arm_c_abi = @import("../arch/arm/abi.zig");
28const riscv_c_abi = @import("../arch/riscv64/abi.zig");
2829
29const Error = error{ OutOfMemory, CodegenFail };30const Error = error{ OutOfMemory, CodegenFail };
3031
...@@ -10117,8 +10118,9 @@ fn firstParamSRet(fn_info: Type.Payload.Function.Data, target: std.Target) bool...@@ -10117,8 +10118,9 @@ fn firstParamSRet(fn_info: Type.Payload.Function.Data, target: std.Target) bool
10117 .arm, .armeb => switch (arm_c_abi.classifyType(fn_info.return_type, target, .ret)) {10118 .arm, .armeb => switch (arm_c_abi.classifyType(fn_info.return_type, target, .ret)) {
10118 .memory, .i64_array => return true,10119 .memory, .i64_array => return true,
10119 .i32_array => |size| return size != 1,10120 .i32_array => |size| return size != 1,
10120 .none, .byval => return false,10121 .byval => return false,
10121 },10122 },
10123 .riscv32, .riscv64 => return riscv_c_abi.classifyType(fn_info.return_type, target) == .memory,
10122 else => return false, // TODO investigate C ABI for other architectures10124 else => return false, // TODO investigate C ABI for other architectures
10123 },10125 },
10124 else => return false,10126 else => return false,
...@@ -10230,7 +10232,7 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*llvm.Type {...@@ -10230,7 +10232,7 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*llvm.Type {
10230 },10232 },
10231 .aarch64, .aarch64_be => {10233 .aarch64, .aarch64_be => {
10232 switch (aarch64_c_abi.classifyType(fn_info.return_type, target)) {10234 switch (aarch64_c_abi.classifyType(fn_info.return_type, target)) {
10233 .memory, .none => return dg.context.voidType(),10235 .memory => return dg.context.voidType(),
10234 .float_array => return dg.lowerType(fn_info.return_type),10236 .float_array => return dg.lowerType(fn_info.return_type),
10235 .byval => return dg.lowerType(fn_info.return_type),10237 .byval => return dg.lowerType(fn_info.return_type),
10236 .integer => {10238 .integer => {
...@@ -10249,7 +10251,23 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*llvm.Type {...@@ -10249,7 +10251,23 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*llvm.Type {
10249 return dg.context.voidType();10251 return dg.context.voidType();
10250 },10252 },
10251 .byval => return dg.lowerType(fn_info.return_type),10253 .byval => return dg.lowerType(fn_info.return_type),
10252 .none => unreachable,10254 }
10255 },
10256 .riscv32, .riscv64 => {
10257 switch (riscv_c_abi.classifyType(fn_info.return_type, target)) {
10258 .memory => return dg.context.voidType(),
10259 .integer => {
10260 const bit_size = fn_info.return_type.bitSize(target);
10261 return dg.context.intType(@intCast(c_uint, bit_size));
10262 },
10263 .double_integer => {
10264 var llvm_types_buffer: [2]*llvm.Type = .{
10265 dg.context.intType(64),
10266 dg.context.intType(64),
10267 };
10268 return dg.context.structType(&llvm_types_buffer, 2, .False);
10269 },
10270 .byval => return dg.lowerType(fn_info.return_type),
10253 }10271 }
10254 },10272 },
10255 // TODO investigate C ABI for other architectures10273 // TODO investigate C ABI for other architectures
...@@ -10328,15 +10346,6 @@ const ParamTypeIterator = struct {...@@ -10328,15 +10346,6 @@ const ParamTypeIterator = struct {
10328 .C => {10346 .C => {
10329 const is_scalar = isScalar(ty);10347 const is_scalar = isScalar(ty);
10330 switch (it.target.cpu.arch) {10348 switch (it.target.cpu.arch) {
10331 .riscv32, .riscv64 => {
10332 it.zig_index += 1;
10333 it.llvm_index += 1;
10334 if (ty.tag() == .f16) {
10335 return .as_u16;
10336 } else {
10337 return .byval;
10338 }
10339 },
10340 .mips, .mipsel => {10349 .mips, .mipsel => {
10341 it.zig_index += 1;10350 it.zig_index += 1;
10342 it.llvm_index += 1;10351 it.llvm_index += 1;
...@@ -10451,7 +10460,6 @@ const ParamTypeIterator = struct {...@@ -10451,7 +10460,6 @@ const ParamTypeIterator = struct {
10451 it.zig_index += 1;10460 it.zig_index += 1;
10452 it.llvm_index += 1;10461 it.llvm_index += 1;
10453 switch (aarch64_c_abi.classifyType(ty, it.target)) {10462 switch (aarch64_c_abi.classifyType(ty, it.target)) {
10454 .none => unreachable,
10455 .memory => return .byref,10463 .memory => return .byref,
10456 .float_array => |len| return Lowering{ .float_array = len },10464 .float_array => |len| return Lowering{ .float_array = len },
10457 .byval => return .byval,10465 .byval => return .byval,
...@@ -10467,7 +10475,6 @@ const ParamTypeIterator = struct {...@@ -10467,7 +10475,6 @@ const ParamTypeIterator = struct {
10467 it.zig_index += 1;10475 it.zig_index += 1;
10468 it.llvm_index += 1;10476 it.llvm_index += 1;
10469 switch (arm_c_abi.classifyType(ty, it.target, .arg)) {10477 switch (arm_c_abi.classifyType(ty, it.target, .arg)) {
10470 .none => unreachable,
10471 .memory => {10478 .memory => {
10472 it.byval_attr = true;10479 it.byval_attr = true;
10473 return .byref;10480 return .byref;
...@@ -10477,6 +10484,21 @@ const ParamTypeIterator = struct {...@@ -10477,6 +10484,21 @@ const ParamTypeIterator = struct {
10477 .i64_array => |size| return Lowering{ .i64_array = size },10484 .i64_array => |size| return Lowering{ .i64_array = size },
10478 }10485 }
10479 },10486 },
10487 .riscv32, .riscv64 => {
10488 it.zig_index += 1;
10489 it.llvm_index += 1;
10490 if (ty.tag() == .f16) {
10491 return .as_u16;
10492 }
10493 switch (riscv_c_abi.classifyType(ty, it.target)) {
10494 .memory => {
10495 return .byref;
10496 },
10497 .byval => return .byval,
10498 .integer => return .abi_sized_int,
10499 .double_integer => return Lowering{ .i64_array = 2 },
10500 }
10501 },
10480 // TODO investigate C ABI for other architectures10502 // TODO investigate C ABI for other architectures
10481 else => {10503 else => {
10482 it.zig_index += 1;10504 it.zig_index += 1;
...@@ -10523,8 +10545,16 @@ fn ccAbiPromoteInt(...@@ -10523,8 +10545,16 @@ fn ccAbiPromoteInt(
10523 };10545 };
10524 if (int_info.bits <= 16) return int_info.signedness;10546 if (int_info.bits <= 16) return int_info.signedness;
10525 switch (target.cpu.arch) {10547 switch (target.cpu.arch) {
10548 .riscv64 => {
10549 if (int_info.bits == 32) {
10550 // LLVM always signextends 32 bit ints, unsure if bug.
10551 return .signed;
10552 }
10553 if (int_info.bits < 64) {
10554 return int_info.signedness;
10555 }
10556 },
10526 .sparc64,10557 .sparc64,
10527 .riscv64,
10528 .powerpc64,10558 .powerpc64,
10529 .powerpc64le,10559 .powerpc64le,
10530 => {10560 => {
test/c_abi/cfuncs.c+20-10
...@@ -16,6 +16,10 @@ static void assert_or_panic(bool ok) {...@@ -16,6 +16,10 @@ static void assert_or_panic(bool ok) {
16# define ZIG_PPC3216# define ZIG_PPC32
17#endif17#endif
1818
19#if defined __riscv && defined _ILP32
20# define ZIG_RISCV32
21#endif
22
19#ifdef __i386__23#ifdef __i386__
20# define ZIG_NO_I12824# define ZIG_NO_I128
21#endif25#endif
...@@ -32,6 +36,10 @@ static void assert_or_panic(bool ok) {...@@ -32,6 +36,10 @@ static void assert_or_panic(bool ok) {
32# define ZIG_NO_I12836# define ZIG_NO_I128
33#endif37#endif
3438
39#ifdef ZIG_RISCV32
40# define ZIG_NO_I128
41#endif
42
35#ifdef __i386__43#ifdef __i386__
36# define ZIG_NO_COMPLEX44# define ZIG_NO_COMPLEX
37#endif45#endif
...@@ -48,6 +56,10 @@ static void assert_or_panic(bool ok) {...@@ -48,6 +56,10 @@ static void assert_or_panic(bool ok) {
48# define ZIG_NO_COMPLEX56# define ZIG_NO_COMPLEX
49#endif57#endif
5058
59#ifdef __riscv
60# define ZIG_NO_COMPLEX
61#endif
62
51#ifndef ZIG_NO_I12863#ifndef ZIG_NO_I128
52struct i128 {64struct i128 {
53 __int128 value;65 __int128 value;
...@@ -265,7 +277,7 @@ void run_c_tests(void) {...@@ -265,7 +277,7 @@ void run_c_tests(void) {
265 }277 }
266#endif278#endif
267279
268#if !defined __mips__ && !defined __riscv && !defined ZIG_PPC32280#if !defined __mips__ && !defined ZIG_PPC32
269 {281 {
270 struct BigStruct s = {1, 2, 3, 4, 5};282 struct BigStruct s = {1, 2, 3, 4, 5};
271 zig_big_struct(s);283 zig_big_struct(s);
...@@ -273,7 +285,7 @@ void run_c_tests(void) {...@@ -273,7 +285,7 @@ void run_c_tests(void) {
273#endif285#endif
274286
275#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \287#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \
276 !defined __riscv && !defined ZIG_PPC32 && !defined _ARCH_PPC64288 !defined ZIG_PPC32 && !defined _ARCH_PPC64
277 {289 {
278 struct SmallStructInts s = {1, 2, 3, 4};290 struct SmallStructInts s = {1, 2, 3, 4};
279 zig_small_struct_ints(s);291 zig_small_struct_ints(s);
...@@ -299,14 +311,14 @@ void run_c_tests(void) {...@@ -299,14 +311,14 @@ void run_c_tests(void) {
299 }311 }
300312
301#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \313#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \
302 !defined __riscv && !defined ZIG_PPC32 && !defined _ARCH_PPC64314 !defined ZIG_PPC32 && !defined _ARCH_PPC64
303 {315 {
304 struct SplitStructInts s = {1234, 100, 1337};316 struct SplitStructInts s = {1234, 100, 1337};
305 zig_split_struct_ints(s);317 zig_split_struct_ints(s);
306 }318 }
307#endif319#endif
308320
309#if !defined __arm__ && !defined __riscv && !defined ZIG_PPC32 && !defined _ARCH_PPC64321#if !defined __arm__ && !defined ZIG_PPC32 && !defined _ARCH_PPC64
310 {322 {
311 struct MedStructMixed s = {1234, 100.0f, 1337.0f};323 struct MedStructMixed s = {1234, 100.0f, 1337.0f};
312 zig_med_struct_mixed(s);324 zig_med_struct_mixed(s);
...@@ -314,14 +326,14 @@ void run_c_tests(void) {...@@ -314,14 +326,14 @@ void run_c_tests(void) {
314#endif326#endif
315327
316#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \328#if !defined __i386__ && !defined __arm__ && !defined __mips__ && \
317 !defined __riscv && !defined ZIG_PPC32 && !defined _ARCH_PPC64329 !defined ZIG_PPC32 && !defined _ARCH_PPC64
318 {330 {
319 struct SplitStructMixed s = {1234, 100, 1337.0f};331 struct SplitStructMixed s = {1234, 100, 1337.0f};
320 zig_split_struct_mixed(s);332 zig_split_struct_mixed(s);
321 }333 }
322#endif334#endif
323335
324#if !defined __mips__ && !defined __riscv && !defined ZIG_PPC32336#if !defined __mips__ && !defined ZIG_PPC32
325 {337 {
326 struct BigStruct s = {30, 31, 32, 33, 34};338 struct BigStruct s = {30, 31, 32, 33, 34};
327 struct BigStruct res = zig_big_struct_both(s);339 struct BigStruct res = zig_big_struct_both(s);
...@@ -333,7 +345,7 @@ void run_c_tests(void) {...@@ -333,7 +345,7 @@ void run_c_tests(void) {
333 }345 }
334#endif346#endif
335347
336#if !defined __riscv && !defined ZIG_PPC32 && !defined _ARCH_PPC64348#if !defined ZIG_PPC32 && !defined _ARCH_PPC64
337 {349 {
338 struct Rect r1 = {1, 21, 16, 4};350 struct Rect r1 = {1, 21, 16, 4};
339 struct Rect r2 = {178, 189, 21, 15};351 struct Rect r2 = {178, 189, 21, 15};
...@@ -341,7 +353,7 @@ void run_c_tests(void) {...@@ -341,7 +353,7 @@ void run_c_tests(void) {
341 }353 }
342#endif354#endif
343355
344#if !defined __mips__ && !defined __riscv && !defined ZIG_PPC32356#if !defined __mips__ && !defined ZIG_PPC32
345 {357 {
346 struct FloatRect r1 = {1, 21, 16, 4};358 struct FloatRect r1 = {1, 21, 16, 4};
347 struct FloatRect r2 = {178, 189, 21, 15};359 struct FloatRect r2 = {178, 189, 21, 15};
...@@ -354,9 +366,7 @@ void run_c_tests(void) {...@@ -354,9 +366,7 @@ void run_c_tests(void) {
354366
355 assert_or_panic(zig_ret_u8() == 0xff);367 assert_or_panic(zig_ret_u8() == 0xff);
356 assert_or_panic(zig_ret_u16() == 0xffff);368 assert_or_panic(zig_ret_u16() == 0xffff);
357#ifndef __riscv
358 assert_or_panic(zig_ret_u32() == 0xffffffff);369 assert_or_panic(zig_ret_u32() == 0xffffffff);
359#endif
360 assert_or_panic(zig_ret_u64() == 0xffffffffffffffff);370 assert_or_panic(zig_ret_u64() == 0xffffffffffffffff);
361371
362 assert_or_panic(zig_ret_i8() == -1);372 assert_or_panic(zig_ret_i8() == -1);
test/c_abi/main.zig+1-14
...@@ -171,7 +171,7 @@ extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat;...@@ -171,7 +171,7 @@ extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat;
171extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble;171extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble;
172172
173const complex_abi_compatible = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isMIPS() and173const complex_abi_compatible = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isMIPS() and
174 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC();174 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV();
175175
176test "C ABI complex float" {176test "C ABI complex float" {
177 if (!complex_abi_compatible) return error.SkipZigTest;177 if (!complex_abi_compatible) return error.SkipZigTest;
...@@ -265,7 +265,6 @@ extern fn c_big_struct(BigStruct) void;...@@ -265,7 +265,6 @@ extern fn c_big_struct(BigStruct) void;
265265
266test "C ABI big struct" {266test "C ABI big struct" {
267 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;267 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
268 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
269 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;268 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
270269
271 var s = BigStruct{270 var s = BigStruct{
...@@ -292,7 +291,6 @@ const BigUnion = extern union {...@@ -292,7 +291,6 @@ const BigUnion = extern union {
292extern fn c_big_union(BigUnion) void;291extern fn c_big_union(BigUnion) void;
293292
294test "C ABI big union" {293test "C ABI big union" {
295 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
296 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;294 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
297295
298 var x = BigUnion{296 var x = BigUnion{
...@@ -327,7 +325,6 @@ extern fn c_ret_med_struct_mixed() MedStructMixed;...@@ -327,7 +325,6 @@ extern fn c_ret_med_struct_mixed() MedStructMixed;
327test "C ABI medium struct of ints and floats" {325test "C ABI medium struct of ints and floats" {
328 if (builtin.cpu.arch == .i386) return error.SkipZigTest;326 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
329 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;327 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
330 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
331 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;328 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
332 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;329 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
333330
...@@ -361,7 +358,6 @@ extern fn c_ret_small_struct_ints() SmallStructInts;...@@ -361,7 +358,6 @@ extern fn c_ret_small_struct_ints() SmallStructInts;
361test "C ABI small struct of ints" {358test "C ABI small struct of ints" {
362 if (builtin.cpu.arch == .i386) return error.SkipZigTest;359 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
363 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;360 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
364 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
365 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;361 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
366 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;362 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
367363
...@@ -444,7 +440,6 @@ extern fn c_split_struct_ints(SplitStructInt) void;...@@ -444,7 +440,6 @@ extern fn c_split_struct_ints(SplitStructInt) void;
444test "C ABI split struct of ints" {440test "C ABI split struct of ints" {
445 if (builtin.cpu.arch == .i386) return error.SkipZigTest;441 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
446 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;442 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
447 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
448 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;443 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
449 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;444 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
450445
...@@ -473,7 +468,6 @@ extern fn c_ret_split_struct_mixed() SplitStructMixed;...@@ -473,7 +468,6 @@ extern fn c_ret_split_struct_mixed() SplitStructMixed;
473test "C ABI split struct of ints and floats" {468test "C ABI split struct of ints and floats" {
474 if (builtin.cpu.arch == .i386) return error.SkipZigTest;469 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
475 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;470 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
476 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
477 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;471 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
478 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;472 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
479473
...@@ -502,7 +496,6 @@ extern fn c_multiple_struct_floats(FloatRect, FloatRect) void;...@@ -502,7 +496,6 @@ extern fn c_multiple_struct_floats(FloatRect, FloatRect) void;
502496
503test "C ABI sret and byval together" {497test "C ABI sret and byval together" {
504 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;498 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
505 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
506 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;499 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
507500
508 var s = BigStruct{501 var s = BigStruct{
...@@ -555,7 +548,6 @@ extern fn c_big_struct_floats(Vector5) void;...@@ -555,7 +548,6 @@ extern fn c_big_struct_floats(Vector5) void;
555548
556test "C ABI structs of floats as parameter" {549test "C ABI structs of floats as parameter" {
557 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;550 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
558 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
559 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;551 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
560 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;552 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
561553
...@@ -596,7 +588,6 @@ export fn zig_multiple_struct_ints(x: Rect, y: Rect) void {...@@ -596,7 +588,6 @@ export fn zig_multiple_struct_ints(x: Rect, y: Rect) void {
596}588}
597589
598test "C ABI structs of ints as multiple parameters" {590test "C ABI structs of ints as multiple parameters" {
599 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
600 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;591 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
601 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;592 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
602593
...@@ -635,7 +626,6 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {...@@ -635,7 +626,6 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {
635626
636test "C ABI structs of floats as multiple parameters" {627test "C ABI structs of floats as multiple parameters" {
637 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;628 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
638 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
639 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;629 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
640630
641 var r1 = FloatRect{631 var r1 = FloatRect{
...@@ -741,7 +731,6 @@ extern fn c_ret_struct_with_array() StructWithArray;...@@ -741,7 +731,6 @@ extern fn c_ret_struct_with_array() StructWithArray;
741test "Struct with array as padding." {731test "Struct with array as padding." {
742 if (builtin.cpu.arch == .i386) return error.SkipZigTest;732 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
743 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;733 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
744 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
745 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;734 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
746 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;735 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
747736
...@@ -768,7 +757,6 @@ extern fn c_ret_float_array_struct() FloatArrayStruct;...@@ -768,7 +757,6 @@ extern fn c_ret_float_array_struct() FloatArrayStruct;
768757
769test "Float array like struct" {758test "Float array like struct" {
770 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;759 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
771 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
772 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;760 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
773761
774 c_float_array_struct(.{762 c_float_array_struct(.{
...@@ -796,7 +784,6 @@ extern fn c_ret_small_vec() SmallVec;...@@ -796,7 +784,6 @@ extern fn c_ret_small_vec() SmallVec;
796784
797test "small simd vector" {785test "small simd vector" {
798 if (builtin.cpu.arch == .i386) return error.SkipZigTest;786 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
799 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
800 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;787 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
801788
802 c_small_vec(.{ 1, 2 });789 c_small_vec(.{ 1, 2 });