Source file test/fixedbugs/issue82777.go

     1  // run
     2  
     3  // Copyright 2026 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  package main
     8  
     9  import (
    10  	"fmt"
    11  	"math/bits"
    12  )
    13  
    14  //go:noinline
    15  func f(x, y int64) int64 {
    16  	r := x >> 33
    17  	if bits.OnesCount8(128) > 0 {
    18  		r = ^y
    19  	}
    20  	return r
    21  }
    22  
    23  func main() {
    24  	if got := f(0, 2); got != -3 {
    25  		fmt.Printf("selected ^2 = %d, want -3\n", got)
    26  		panic("FAIL")
    27  	}
    28  }
    29  

View as plain text