| ... | ... | @@ -136,7 +136,7 @@ export fn zig_f64(x: f64) void { |
| 136 | 136 | expect(x == 56.78) catch @panic("test failure: zig_f64"); |
| 137 | 137 | } |
| 138 | 138 | export fn zig_longdouble(x: c_longdouble) void { |
| 139 | | if (!builtin.cpu.arch.isWasm()) return; // waiting for #1481 |
| 139 | if (!builtin.target.isWasm()) return; // waiting for #1481 |
| 140 | 140 | expect(x == 12.34) catch @panic("test failure: zig_longdouble"); |
| 141 | 141 | } |
| 142 | 142 | |
| ... | ... | @@ -1671,7 +1671,7 @@ test "bool simd vector" { |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | { |
| 1674 | | if (builtin.target.cpu.arch != .wasm32) c_vector_256_bool(.{ |
| 1674 | if (!builtin.target.isWasm()) c_vector_256_bool(.{ |
| 1675 | 1675 | false, |
| 1676 | 1676 | true, |
| 1677 | 1677 | true, |
| ... | ... | @@ -2189,7 +2189,7 @@ test "bool simd vector" { |
| 2189 | 2189 | try expect(vec[255] == false); |
| 2190 | 2190 | } |
| 2191 | 2191 | { |
| 2192 | | if (builtin.target.cpu.arch != .wasm32) c_vector_512_bool(.{ |
| 2192 | if (!builtin.target.isWasm()) c_vector_512_bool(.{ |
| 2193 | 2193 | true, |
| 2194 | 2194 | true, |
| 2195 | 2195 | true, |
| ... | ... | @@ -5614,23 +5614,64 @@ test "f80 extra struct" { |
| 5614 | 5614 | try expect(a.b == 24); |
| 5615 | 5615 | } |
| 5616 | 5616 | |
| 5617 | | extern fn c_f128(f128) f128; |
| 5618 | | test "f128 bare" { |
| 5619 | | if (!have_f128) return error.SkipZigTest; |
| 5617 | comptime { |
| 5618 | skip: { |
| 5619 | if (builtin.target.isWasm()) break :skip; |
| 5620 | 5620 | |
| 5621 | | const a = c_f128(12.34); |
| 5622 | | try expect(@as(f64, @floatCast(a)) == 56.78); |
| 5623 | | } |
| 5621 | _ = struct { |
| 5622 | export fn zig_f128(x: f128) f128 { |
| 5623 | expect(x == 12) catch @panic("test failure"); |
| 5624 | return 34; |
| 5625 | } |
| 5626 | extern fn c_f128(f128) f128; |
| 5627 | test "f128 bare" { |
| 5628 | if (!have_f128) return error.SkipZigTest; |
| 5624 | 5629 | |
| 5625 | | const f128_struct = extern struct { |
| 5626 | | a: f128, |
| 5627 | | }; |
| 5628 | | extern fn c_f128_struct(f128_struct) f128_struct; |
| 5629 | | test "f128 struct" { |
| 5630 | | if (!have_f128) return error.SkipZigTest; |
| 5630 | const a = c_f128(12.34); |
| 5631 | try expect(@as(f64, @floatCast(a)) == 56.78); |
| 5632 | } |
| 5631 | 5633 | |
| 5632 | | const a = c_f128_struct(.{ .a = 12.34 }); |
| 5633 | | try expect(@as(f64, @floatCast(a.a)) == 56.78); |
| 5634 | const f128_struct = extern struct { |
| 5635 | a: f128, |
| 5636 | }; |
| 5637 | export fn zig_f128_struct(a: f128_struct) f128_struct { |
| 5638 | expect(a.a == 12345) catch @panic("test failure"); |
| 5639 | return .{ .a = 98765 }; |
| 5640 | } |
| 5641 | extern fn c_f128_struct(f128_struct) f128_struct; |
| 5642 | test "f128 struct" { |
| 5643 | if (!have_f128) return error.SkipZigTest; |
| 5644 | |
| 5645 | const a = c_f128_struct(.{ .a = 12.34 }); |
| 5646 | try expect(@as(f64, @floatCast(a.a)) == 56.78); |
| 5647 | |
| 5648 | const b = c_f128_f128_struct(.{ .a = 12.34, .b = 87.65 }); |
| 5649 | try expect(@as(f64, @floatCast(b.a)) == 56.78); |
| 5650 | try expect(@as(f64, @floatCast(b.b)) == 43.21); |
| 5651 | } |
| 5652 | |
| 5653 | const f128_f128_struct = extern struct { |
| 5654 | a: f128, |
| 5655 | b: f128, |
| 5656 | }; |
| 5657 | export fn zig_f128_f128_struct(a: f128_f128_struct) f128_f128_struct { |
| 5658 | expect(a.a == 13) catch @panic("test failure"); |
| 5659 | expect(a.b == 57) catch @panic("test failure"); |
| 5660 | return .{ .a = 24, .b = 68 }; |
| 5661 | } |
| 5662 | extern fn c_f128_f128_struct(f128_f128_struct) f128_f128_struct; |
| 5663 | test "f128 f128 struct" { |
| 5664 | if (!have_f128) return error.SkipZigTest; |
| 5665 | |
| 5666 | const a = c_f128_struct(.{ .a = 12.34 }); |
| 5667 | try expect(@as(f64, @floatCast(a.a)) == 56.78); |
| 5668 | |
| 5669 | const b = c_f128_f128_struct(.{ .a = 12.34, .b = 87.65 }); |
| 5670 | try expect(@as(f64, @floatCast(b.a)) == 56.78); |
| 5671 | try expect(@as(f64, @floatCast(b.b)) == 43.21); |
| 5672 | } |
| 5673 | }; |
| 5674 | } |
| 5634 | 5675 | } |
| 5635 | 5676 | |
| 5636 | 5677 | // The stdcall attribute on C functions is ignored when compiled on non-x86 |