Skip to content

Commit baad55a

Browse files
committed
x86 backend doesn't support genBinOp for greater than or equal yet.
1 parent 40a48b0 commit baad55a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/std/static_array_map.zig

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,27 @@ pub fn defaultEql(comptime expected: anytype, actual: anytype) bool {
5050

5151
fn ignoreCaseEql(comptime expected: anytype, actual: anytype) bool {
5252
const lower_expected = comptime toLowerSimd(expected);
53-
const lower_actual = toLowerSimd(actual);
53+
54+
// TODO: x86_64 self hosted backend hasn't implemented genBinOp for cmp_gte
55+
const lower_actual = blk: {
56+
if (@import("builtin").zig_backend == .stage2_x86_64) {
57+
break :blk toLowerSimple(actual.len, actual);
58+
} else {
59+
break :blk toLowerSimd(actual);
60+
}
61+
};
62+
5463
return defaultEql(lower_expected, lower_actual);
5564
}
5665

66+
fn toLowerSimple(comptime len: usize, input: anytype) [len]u8 {
67+
var output: [len]u8 = undefined;
68+
for (input, &output) |in_byte, *out_byte| {
69+
out_byte.* = std.ascii.toLower(in_byte);
70+
}
71+
return output;
72+
}
73+
5774
fn toLowerSimd(input: anytype) [@typeInfo(@TypeOf(input)).array.len]u8 {
5875
const array_info = @typeInfo(@TypeOf(input)).array;
5976
comptime assert(array_info.child == u8);

0 commit comments

Comments
 (0)