| ... | ... | @@ -203,7 +203,11 @@ pub fn MultiArrayList(comptime S: type) type { |
| 203 | 203 | const other_slice = other.slice(); |
| 204 | 204 | inline for (fields) |field_info, i| { |
| 205 | 205 | const field = @intToEnum(Field, i); |
| 206 | | mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field)); |
| 206 | // TODO we should be able to use std.mem.copy here but it causes a |
| 207 | // test failure on aarch64 with -OReleaseFast |
| 208 | const src_slice = mem.sliceAsBytes(self_slice.items(field)); |
| 209 | const dst_slice = mem.sliceAsBytes(other_slice.items(field)); |
| 210 | @memcpy(dst_slice.ptr, src_slice.ptr, src_slice.len); |
| 207 | 211 | } |
| 208 | 212 | gpa.free(self.allocatedBytes()); |
| 209 | 213 | self.* = other; |
| ... | ... | @@ -256,25 +260,20 @@ pub fn MultiArrayList(comptime S: type) type { |
| 256 | 260 | const other_slice = other.slice(); |
| 257 | 261 | inline for (fields) |field_info, i| { |
| 258 | 262 | const field = @intToEnum(Field, i); |
| 259 | | mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field)); |
| 263 | // TODO we should be able to use std.mem.copy here but it causes a |
| 264 | // test failure on aarch64 with -OReleaseFast |
| 265 | const src_slice = mem.sliceAsBytes(self_slice.items(field)); |
| 266 | const dst_slice = mem.sliceAsBytes(other_slice.items(field)); |
| 267 | @memcpy(dst_slice.ptr, src_slice.ptr, src_slice.len); |
| 260 | 268 | } |
| 261 | 269 | gpa.free(self.allocatedBytes()); |
| 262 | 270 | self.* = other; |
| 263 | 271 | } |
| 264 | 272 | |
| 265 | 273 | fn capacityInBytes(capacity: usize) usize { |
| 266 | | // TODO move this workaround of LLVM SIMD bugs into the Zig frontend. |
| 267 | | if (std.Target.current.cpu.arch == .aarch64) { |
| 268 | | var sum: usize = 0; |
| 269 | | for (sizes.bytes) |size| { |
| 270 | | sum += capacity * size; |
| 271 | | } |
| 272 | | return sum; |
| 273 | | } else { |
| 274 | | const sizes_vector: std.meta.Vector(sizes.bytes.len, usize) = sizes.bytes; |
| 275 | | const capacity_vector = @splat(sizes.bytes.len, capacity); |
| 276 | | return @reduce(.Add, capacity_vector * sizes_vector); |
| 277 | | } |
| 274 | const sizes_vector: std.meta.Vector(sizes.bytes.len, usize) = sizes.bytes; |
| 275 | const capacity_vector = @splat(sizes.bytes.len, capacity); |
| 276 | return @reduce(.Add, capacity_vector * sizes_vector); |
| 278 | 277 | } |
| 279 | 278 | |
| 280 | 279 | fn allocatedBytes(self: Self) []align(@alignOf(S)) u8 { |