/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/codegen/known_bits.go
51 строка
770 B
Jorropo
cmd/compile: add known bits pass
23 апр 2026, 18:17
23 апр 2026, 18:17
7a8dcab
Код
Авторство
О чём код?
// asmcheck // 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. package codegen func knownBitsPhiAnd(cond bool) int { x := 1 if cond { x = 3 } // amd64:-"AND" // arm64:-"AND" return x & 1 } func knownBitsDeferPattern(a, b bool) int { bits := 0 bits |= 1 << 0 if a { bits |= 1 << 1 } bits |= 1 << 2 if b { bits |= 1 << 3 } // amd64:-"AND" // arm64:-"AND" return bits & (1<<2 | 1<<0) } func knownBitsXorToggle(a, b, c bool) int { bits := 0 bits ^= 1 << 0 if a { bits ^= 1 << 1 } bits ^= 1 << 2 if b { bits ^= 1 << 3 } bits ^= 1 << 2 if c { bits ^= 1 << 4 } // amd64:-"AND" // arm64:-"AND" return bits & (1<<2 | 1<<0) }