mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
x86_64: fix incorrect mnemonic selection
This commit is contained in:
parent
55f437b92b
commit
ab6f9e3d10
@ -6,7 +6,7 @@ const has_aesni = std.Target.x86.featureSetHas(builtin.cpu.features, .aes);
|
||||
const has_avx = std.Target.x86.featureSetHas(builtin.cpu.features, .avx);
|
||||
const has_armaes = std.Target.aarch64.featureSetHas(builtin.cpu.features, .aes);
|
||||
// C backend doesn't currently support passing vectors to inline asm.
|
||||
const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and has_aesni and has_avx) impl: {
|
||||
const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and has_aesni and has_avx) impl: {
|
||||
break :impl @import("aes/aesni.zig");
|
||||
} else if (builtin.cpu.arch == .aarch64 and builtin.zig_backend != .stage2_c and has_armaes)
|
||||
impl: {
|
||||
|
||||
@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {
|
||||
return;
|
||||
},
|
||||
// C backend doesn't currently support passing vectors to inline asm.
|
||||
.x86_64 => if (builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
|
||||
.x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
|
||||
var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };
|
||||
var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };
|
||||
const s_v = @as(*[16]v4u32, @ptrCast(&s));
|
||||
|
||||
@ -13619,25 +13619,26 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
|
||||
label_gop.value_ptr.target = @intCast(self.mir_instructions.len);
|
||||
} else continue;
|
||||
|
||||
var mnem_size: ?Memory.Size = null;
|
||||
const mnem_tag = mnem: {
|
||||
mnem_size = if (mem.endsWith(u8, mnem_str, "b"))
|
||||
.byte
|
||||
else if (mem.endsWith(u8, mnem_str, "w"))
|
||||
.word
|
||||
else if (mem.endsWith(u8, mnem_str, "l"))
|
||||
.dword
|
||||
else if (mem.endsWith(u8, mnem_str, "q"))
|
||||
.qword
|
||||
else if (mem.endsWith(u8, mnem_str, "t"))
|
||||
.tbyte
|
||||
else
|
||||
break :mnem null;
|
||||
break :mnem std.meta.stringToEnum(Instruction.Mnemonic, mnem_str[0 .. mnem_str.len - 1]);
|
||||
} orelse mnem: {
|
||||
var mnem_size: ?Memory.Size = if (mem.endsWith(u8, mnem_str, "b"))
|
||||
.byte
|
||||
else if (mem.endsWith(u8, mnem_str, "w"))
|
||||
.word
|
||||
else if (mem.endsWith(u8, mnem_str, "l"))
|
||||
.dword
|
||||
else if (mem.endsWith(u8, mnem_str, "q") and
|
||||
(std.mem.indexOfScalar(u8, "vp", mnem_str[0]) == null or !mem.endsWith(u8, mnem_str, "dq")))
|
||||
.qword
|
||||
else if (mem.endsWith(u8, mnem_str, "t"))
|
||||
.tbyte
|
||||
else
|
||||
null;
|
||||
const mnem_tag = while (true) break std.meta.stringToEnum(
|
||||
Instruction.Mnemonic,
|
||||
mnem_str[0 .. mnem_str.len - @intFromBool(mnem_size != null)],
|
||||
) orelse if (mnem_size) |_| {
|
||||
mnem_size = null;
|
||||
break :mnem std.meta.stringToEnum(Instruction.Mnemonic, mnem_str);
|
||||
} orelse return self.fail("invalid mnemonic: '{s}'", .{mnem_str});
|
||||
continue;
|
||||
} else return self.fail("invalid mnemonic: '{s}'", .{mnem_str});
|
||||
if (@as(?Memory.Size, switch (mnem_tag) {
|
||||
.clflush => .byte,
|
||||
.fldenv, .fnstenv, .fstenv => .none,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user