amd64: align on 16 bytes instead of 8
Some instructions emitted by LLVM (like movaps) expect 16-byte alignment, while the allocator assumed that 8-byte alignment is good enough. TODO: this issue came to light with LLVM optimizing a complex128 store to the movaps instruction, which must be aligned. It looks like this means that the <2 x double> IR type is actually 16-byte aligned instead of 8-byte like a double. If this is the case, the alignment of complex numbers needs to be updated in the whole compiler.
Этот коммит содержится в:
родитель
63f2a3dfe9
коммит
eb34afde4b
1 изменённых файлов: 4 добавлений и 2 удалений
|
@ -5,7 +5,9 @@ const GOARCH = "amd64"
|
||||||
// The bitness of the CPU (e.g. 8, 32, 64).
|
// The bitness of the CPU (e.g. 8, 32, 64).
|
||||||
const TargetBits = 64
|
const TargetBits = 64
|
||||||
|
|
||||||
// Align on word boundary.
|
// Align a pointer.
|
||||||
|
// Note that some amd64 instructions (like movaps) expect 16-byte aligned
|
||||||
|
// memory, thus the result must be 16-byte aligned.
|
||||||
func align(ptr uintptr) uintptr {
|
func align(ptr uintptr) uintptr {
|
||||||
return (ptr + 7) &^ 7
|
return (ptr + 15) &^ 15
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче