]> Cypherpunks.ru repositories - gostls13.git/blob - test/prove_constant_folding.go
cmd/compile: add indexed SET* opcodes for amd64
[gostls13.git] / test / prove_constant_folding.go
1 // +build amd64
2 // errorcheck -0 -d=ssa/prove/debug=2
3
4 // Copyright 2022 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file.
7
8 package main
9
10 func f0i(x int) int {
11   if x == 20 {
12     return x // ERROR "Proved.+is constant 20$"
13   }
14
15   if (x + 20) == 20 {
16     return x + 5 // ERROR "Proved.+is constant 0$"
17   }
18
19   return x / 2
20 }
21
22 func f0u(x uint) uint {
23   if x == 20 {
24     return x // ERROR "Proved.+is constant 20$"
25   }
26
27   if (x + 20) == 20 {
28     return x + 5 // ERROR "Proved.+is constant 0$"
29   }
30
31   return x / 2
32 }