Debian Codegraph @

test/fixedbugs/issue38356.go

raw
1 // compile
2
3 // Copyright 2020 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 // Make sure floating point operations that generate flags
8 // are scheduled correctly on s390x.
9
10 package p
11
12 func f1(x, y float64, z int) float64 {
13 a := x + y // generate flags
14 if z == 0 { // create basic block that does not clobber flags
15 return a
16 }
17 if a > 0 { // use flags in different basic block
18 return y
19 }
20 return x
21 }
22
23 func f2(x, y float64, z int) float64 {
24 a := x - y // generate flags
25 if z == 0 { // create basic block that does not clobber flags
26 return a
27 }
28 if a > 0 { // use flags in different basic block
29 return y
30 }
31 return x
32 }
33
34 func f3(x, y float32, z int) float32 {
35 a := x + y // generate flags
36 if z == 0 { // create basic block that does not clobber flags
37 return a
38 }
39 if a > 0 { // use flags in different basic block
40 return y
41 }
42 return x
43 }
44
45 func f4(x, y float32, z int) float32 {
46 a := x - y // generate flags
47 if z == 0 { // create basic block that does not clobber flags
48 return a
49 }
50 if a > 0 { // use flags in different basic block
51 return y
52 }
53 return x
54 }