Commit 485e20884c

Jacob Young <jacobly0@users.noreply.github.com>
2023-12-04 05:07:03
x86_64: implement movement for pointer vectors
1 parent 0be7c23
Changed files (2)
src
arch
test
behavior
src/arch/x86_64/CodeGen.zig
@@ -13046,6 +13046,24 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
                     },
                     else => {},
                 },
+                .Pointer, .Optional => if (ty.childType(mod).isPtrAtRuntime(mod))
+                    switch (ty.vectorLen(mod)) {
+                        1 => return .{ .move = if (self.hasFeature(.avx))
+                            .{ .v_q, .mov }
+                        else
+                            .{ ._q, .mov } },
+                        2 => return .{ .move = if (self.hasFeature(.avx))
+                            if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
+                        else if (aligned) .{ ._, .movdqa } else .{ ._, .movdqu } },
+                        3...4 => if (self.hasFeature(.avx))
+                            return .{ .move = if (aligned)
+                                .{ .v_, .movdqa }
+                            else
+                                .{ .v_, .movdqu } },
+                        else => {},
+                    }
+                else
+                    unreachable,
                 .Float => switch (ty.childType(mod).floatBits(self.target.*)) {
                     16 => switch (ty.vectorLen(mod)) {
                         1 => return if (self.hasFeature(.avx)) .{ .vex_insert_extract = .{
test/behavior/cast.zig
@@ -2355,7 +2355,6 @@ test "@ptrFromInt on vector" {
 
 test "@intFromPtr on vector" {
     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_sparc64) return error.SkipZigTest; // TODO