authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-12-16 00:34:30+01:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-12-16 00:34:30+01:00
log41a7670a38fe41272d60704cfbbf112575f0037e
treec8832144d5ac117b0c3cdc4da89afd2b14cc2ccb
parent20c5b6ad65711c83ebbff7d0147ace03be795f1f

compiler_rt: remove stage1 switch case


1 files changed, 5 insertions(+), 18 deletions(-)

lib/compiler_rt/clzsi2_test.zig+5-18
...@@ -3,24 +3,11 @@ const clz = @import("count0bits.zig");...@@ -3,24 +3,11 @@ const clz = @import("count0bits.zig");
3const testing = @import("std").testing;3const testing = @import("std").testing;
44
5fn test__clzsi2(a: u32, expected: i32) !void {5fn test__clzsi2(a: u32, expected: i32) !void {
6 // stage1 and stage2 diverge on function pointer semantics6 const nakedClzsi2 = clz.__clzsi2;
7 switch (builtin.zig_backend) {7 const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2);
8 .stage1 => {8 const x = @bitCast(i32, a);
9 // Use of `var` here is working around a stage1 bug.9 const result = actualClzsi2(x);
10 var nakedClzsi2 = clz.__clzsi2;10 try testing.expectEqual(expected, result);
11 var actualClzsi2 = @ptrCast(fn (a: i32) callconv(.C) i32, nakedClzsi2);
12 var x = @bitCast(i32, a);
13 var result = actualClzsi2(x);
14 try testing.expectEqual(expected, result);
15 },
16 else => {
17 const nakedClzsi2 = clz.__clzsi2;
18 const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2);
19 const x = @bitCast(i32, a);
20 const result = actualClzsi2(x);
21 try testing.expectEqual(expected, result);
22 },
23 }
24}11}
2512
26test "clzsi2" {13test "clzsi2" {