/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/fixedbugs/shrd_zero_count.go
25 строк
640 B
Josh Bleecher Snyder
cmd/compile: remove multi-register shift optimization on amd64
04 июн 2026, 19:57
04 июн 2026, 19:57
a531ad4
Код
Авторство
О чём код?
// run // Copyright 2026 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Folding a paired modulo-count shift into a double-register shift // (SHRD/SHLD on amd64) must not drop the second operand when the // shift count is zero modulo 64. package main //go:noinline func shrd(lo, hi uint64, bits uint) uint64 { return lo>>(bits&63) | hi<<((-bits)&63) } func main() { got := shrd(0x1111000000000000, 0x2222, 0) want := uint64(0x1111000000002222) if got != want { println("shrd zero count: got", got, "want", want) panic("FAIL") } }