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