1// run 2 3// Copyright 2022 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// Issue 50671: sign extension eliminated incorrectly on MIPS64. 8 9package main 10 11//go:noinline 12func F(x int32) (float64, int64) { 13 a := float64(x) 14 b := int64(x) 15 return a, b 16} 17 18var a, b, c float64 19 20// Poison some floating point registers with non-zero high bits. 21// 22//go:noinline 23func poison(x float64) { 24 a = x - 123.45 25 b = a * 1.2 26 c = b + 3.4 27} 28 29func main() { 30 poison(333.3) 31 _, b := F(123) 32 if b != 123 { 33 panic("FAIL") 34 } 35} 36