zig/test/behavior/bugs/10147.zig
Andrew Kelley ad5770eba4 organize behavior tests
* Identify the ones that are passing and stop skipping them.
 * Flatten out the main behavior.zig file and have each individual test
   disable itself if it is not passing.
2022-03-18 15:02:52 -07:00

20 lines
896 B
Zig

const builtin = @import("builtin");
const std = @import("std");
test "uses correct LLVM builtin" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
var x: u32 = 0x1;
var y: @Vector(4, u32) = [_]u32{ 0x1, 0x1, 0x1, 0x1 };
// The stage1 compiler used to call the same builtin function for both
// scalar and vector inputs, causing the LLVM module verification to fail.
var a = @clz(u32, x);
var b = @clz(u32, y);
try std.testing.expectEqual(@as(u6, 31), a);
try std.testing.expectEqual([_]u6{ 31, 31, 31, 31 }, b);
}