Source file test/fixedbugs/issue28688.go

     1  // run -gcflags=-d=softfloat
     2  
     3  // Copyright 2018 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  )
    12  
    13  // When using soft-float, OMUL might be rewritten to function
    14  // call so we should ensure it was evaluated first. Stack frame
    15  // setup for "test" function call should happen after call to runtime.fmul32
    16  
    17  var x int32 = 1
    18  
    19  func main() {
    20  	var y float32 = 1.0
    21  	test(x, y*y)
    22  }
    23  
    24  //go:noinline
    25  func test(id int32, a float32) {
    26  
    27  	if id != x {
    28  		fmt.Printf("got: %d, want: %d\n", id, x)
    29  		panic("FAIL")
    30  	}
    31  }
    32  

View as plain text