vecmath: update to zig 0.17.0, remove x8 transpose methods (for now)
This commit is contained in:
@@ -26,60 +26,16 @@ pub const Complex_x8 = struct {
|
||||
return .{ .re = vm.ps(complex.re), .im = vm.ps(complex.im) };
|
||||
}
|
||||
|
||||
pub inline fn initArrayOfComplex(complex: [8]vm.Complex) Complex_x8 {
|
||||
const vector: @Vector(16, f32) = @as([16]f32, @bitCast(complex));
|
||||
return .{
|
||||
.re = @shuffle(f32, vector, undefined, [_]i32{ 0, 2, 4, 6, 8, 10, 12, 14 }),
|
||||
.im = @shuffle(f32, vector, undefined, [_]i32{ 1, 3, 5, 7, 9, 11, 13, 15 }),
|
||||
};
|
||||
}
|
||||
|
||||
pub inline fn splat(complex: vm.Complex) Complex_x8 {
|
||||
return .{ .re = vm.ps(complex.re), .im = vm.ps(complex.im) };
|
||||
}
|
||||
|
||||
// --- CONVERSION ----------------------------------------------------------
|
||||
|
||||
pub inline fn asArrayOfComplex(self: Complex_x8) [8]vm.Complex {
|
||||
const vector: @Vector(16, f32) = self.re ++ self.im;
|
||||
return @bitCast(@as([16]f32, @shuffle(f32, vector, undefined, [_]i32{
|
||||
0, 8,
|
||||
1, 9,
|
||||
2, 10,
|
||||
3, 11,
|
||||
4, 12,
|
||||
5, 13,
|
||||
6, 14,
|
||||
7, 15,
|
||||
})));
|
||||
}
|
||||
|
||||
pub inline fn unpack(self: Complex_x8) [2]vm.f32x8 {
|
||||
return .{ self.re, self.im };
|
||||
}
|
||||
|
||||
// --- LOAD AND STORE ------------------------------------------------------
|
||||
|
||||
pub inline fn loadArrayOfComplex(self: *Complex_x8, array: *const [8]vm.Complex) void {
|
||||
const vector: @Vector(16, f32) = @as(*const [16]f32, @ptrCast(array)).*;
|
||||
self.re = @shuffle(f32, vector, undefined, [_]i32{ 0, 2, 4, 6, 8, 10, 12, 14 });
|
||||
self.im = @shuffle(f32, vector, undefined, [_]i32{ 1, 3, 5, 7, 9, 11, 13, 15 });
|
||||
}
|
||||
|
||||
pub inline fn storeArrayOfComplex(self: *const Complex_x8, array: *[8]vm.Complex) void {
|
||||
const vector: @Vector(16, f32) = self.re ++ self.im;
|
||||
@as(*[16]f32, @ptrCast(array)).* = @shuffle(f32, vector, undefined, [_]i32{
|
||||
0, 8,
|
||||
1, 9,
|
||||
2, 10,
|
||||
3, 11,
|
||||
4, 12,
|
||||
5, 13,
|
||||
6, 14,
|
||||
7, 15,
|
||||
});
|
||||
}
|
||||
|
||||
// --- COMPONENT-WISE ------------------------------------------------------
|
||||
|
||||
pub inline fn add(self: Complex_x8, other: Complex_x8) Complex_x8 {
|
||||
|
||||
Reference in New Issue
Block a user