Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/compile: mark s390x int <-> float conversions as clobbering flags
These conversion instructions set the condition code and so should be marked as clobbering flags. Fixes #39651. Change-Id: I91cc9687ea70ef0551bb3139c1875071c349d43e Reviewed-on: https://go-review.googlesource.com/c/go/+/238628 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
- Loading branch information
Showing
3 changed files
with
109 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// run | ||
|
||
// Copyright 2020 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. | ||
|
||
// Test that float -> integer conversion doesn't clobber | ||
// flags. | ||
|
||
package main | ||
|
||
//go:noinline | ||
func f(x, y float64, a, b *bool, r *int64) { | ||
*a = x < y // set flags | ||
*r = int64(x) // clobber flags | ||
*b = x == y // use flags | ||
} | ||
|
||
func main() { | ||
var a, b bool | ||
var r int64 | ||
f(1, 1, &a, &b, &r) | ||
if a || !b { | ||
panic("comparison incorrect") | ||
} | ||
} |