| ... | ... | @@ -3,7 +3,7 @@ const builtin = @import("builtin"); |
| 3 | 3 | const print = std.debug.print; |
| 4 | 4 | const expect = std.testing.expect; |
| 5 | 5 | const has_i128 = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isARM() and |
| 6 | | !builtin.cpu.arch.isMIPS(); |
| 6 | !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPPC(); |
| 7 | 7 | |
| 8 | 8 | extern fn run_c_tests() void; |
| 9 | 9 | |
| ... | ... | @@ -112,6 +112,9 @@ test "C ABI floats" { |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | test "C ABI long double" { |
| 115 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 116 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 117 | |
| 115 | 118 | c_long_double(12.34); |
| 116 | 119 | } |
| 117 | 120 | |
| ... | ... | @@ -168,7 +171,7 @@ extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat; |
| 168 | 171 | extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble; |
| 169 | 172 | |
| 170 | 173 | const complex_abi_compatible = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isMIPS() and |
| 171 | | !builtin.cpu.arch.isARM(); |
| 174 | !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC(); |
| 172 | 175 | |
| 173 | 176 | test "C ABI complex float" { |
| 174 | 177 | if (!complex_abi_compatible) return error.SkipZigTest; |
| ... | ... | @@ -263,6 +266,7 @@ extern fn c_big_struct(BigStruct) void; |
| 263 | 266 | test "C ABI big struct" { |
| 264 | 267 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 265 | 268 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 269 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 266 | 270 | |
| 267 | 271 | var s = BigStruct{ |
| 268 | 272 | .a = 1, |
| ... | ... | @@ -289,6 +293,7 @@ extern fn c_big_union(BigUnion) void; |
| 289 | 293 | |
| 290 | 294 | test "C ABI big union" { |
| 291 | 295 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 296 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 292 | 297 | |
| 293 | 298 | var x = BigUnion{ |
| 294 | 299 | .a = BigStruct{ |
| ... | ... | @@ -323,6 +328,8 @@ test "C ABI medium struct of ints and floats" { |
| 323 | 328 | if (builtin.cpu.arch == .i386) return error.SkipZigTest; |
| 324 | 329 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 325 | 330 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 331 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 332 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 326 | 333 | |
| 327 | 334 | var s = MedStructMixed{ |
| 328 | 335 | .a = 1234, |
| ... | ... | @@ -355,6 +362,8 @@ test "C ABI small struct of ints" { |
| 355 | 362 | if (builtin.cpu.arch == .i386) return error.SkipZigTest; |
| 356 | 363 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 357 | 364 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 365 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 366 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 358 | 367 | |
| 359 | 368 | var s = SmallStructInts{ |
| 360 | 369 | .a = 1, |
| ... | ... | @@ -436,6 +445,8 @@ test "C ABI split struct of ints" { |
| 436 | 445 | if (builtin.cpu.arch == .i386) return error.SkipZigTest; |
| 437 | 446 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 438 | 447 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 448 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 449 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 439 | 450 | |
| 440 | 451 | var s = SplitStructInt{ |
| 441 | 452 | .a = 1234, |
| ... | ... | @@ -463,6 +474,8 @@ test "C ABI split struct of ints and floats" { |
| 463 | 474 | if (builtin.cpu.arch == .i386) return error.SkipZigTest; |
| 464 | 475 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 465 | 476 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 477 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 478 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 466 | 479 | |
| 467 | 480 | var s = SplitStructMixed{ |
| 468 | 481 | .a = 1234, |
| ... | ... | @@ -490,6 +503,7 @@ extern fn c_multiple_struct_floats(FloatRect, FloatRect) void; |
| 490 | 503 | test "C ABI sret and byval together" { |
| 491 | 504 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 492 | 505 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 506 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 493 | 507 | |
| 494 | 508 | var s = BigStruct{ |
| 495 | 509 | .a = 1, |
| ... | ... | @@ -542,6 +556,8 @@ extern fn c_big_struct_floats(Vector5) void; |
| 542 | 556 | test "C ABI structs of floats as parameter" { |
| 543 | 557 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 544 | 558 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 559 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 560 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 545 | 561 | |
| 546 | 562 | var v3 = Vector3{ |
| 547 | 563 | .x = 3.0, |
| ... | ... | @@ -581,6 +597,8 @@ export fn zig_multiple_struct_ints(x: Rect, y: Rect) void { |
| 581 | 597 | |
| 582 | 598 | test "C ABI structs of ints as multiple parameters" { |
| 583 | 599 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 600 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 601 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 584 | 602 | |
| 585 | 603 | var r1 = Rect{ |
| 586 | 604 | .left = 1, |
| ... | ... | @@ -618,6 +636,7 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void { |
| 618 | 636 | test "C ABI structs of floats as multiple parameters" { |
| 619 | 637 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 620 | 638 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 639 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 621 | 640 | |
| 622 | 641 | var r1 = FloatRect{ |
| 623 | 642 | .left = 1, |
| ... | ... | @@ -723,6 +742,8 @@ test "Struct with array as padding." { |
| 723 | 742 | if (builtin.cpu.arch == .i386) return error.SkipZigTest; |
| 724 | 743 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 725 | 744 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 745 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 746 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 726 | 747 | |
| 727 | 748 | c_struct_with_array(.{ .a = 1, .padding = undefined, .b = 2 }); |
| 728 | 749 | |
| ... | ... | @@ -748,6 +769,7 @@ extern fn c_ret_float_array_struct() FloatArrayStruct; |
| 748 | 769 | test "Float array like struct" { |
| 749 | 770 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 750 | 771 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 772 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 751 | 773 | |
| 752 | 774 | c_float_array_struct(.{ |
| 753 | 775 | .origin = .{ |
| ... | ... | @@ -775,6 +797,7 @@ extern fn c_ret_small_vec() SmallVec; |
| 775 | 797 | test "small simd vector" { |
| 776 | 798 | if (builtin.cpu.arch == .i386) return error.SkipZigTest; |
| 777 | 799 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 800 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 778 | 801 | |
| 779 | 802 | c_small_vec(.{ 1, 2 }); |
| 780 | 803 | |
| ... | ... | @@ -789,6 +812,8 @@ extern fn c_big_vec(BigVec) void; |
| 789 | 812 | extern fn c_ret_big_vec() BigVec; |
| 790 | 813 | |
| 791 | 814 | test "big simd vector" { |
| 815 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 816 | |
| 792 | 817 | c_big_vec(.{ 1, 2, 3, 4, 5, 6, 7, 8 }); |
| 793 | 818 | |
| 794 | 819 | var x = c_ret_big_vec(); |