| 1 |
// run |
| 2 |
|
| 3 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Bad AND/BTR combination rule. |
| 8 |
|
| 9 |
package main |
| 10 |
|
| 11 |
import "fmt" |
| 12 |
|
| 13 |
//go:noinline |
| 14 |
func f(x uint64) uint64 { |
| 15 |
return (x >> 48) &^ (uint64(0x4000)) |
| 16 |
} |
| 17 |
|
| 18 |
func main() { |
| 19 |
bad := false |
| 20 |
if got, want := f(^uint64(0)), uint64(0xbfff); got != want { |
| 21 |
fmt.Printf("got %x, want %x\n", got, want) |
| 22 |
bad = true |
| 23 |
} |
| 24 |
if bad { |
| 25 |
panic("bad") |
| 26 |
} |
| 27 |
} |