Source file src/cmd/cgo/internal/testplugin/testdata/simd/main.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"fmt"
     9  	"plugin"
    10  	"simd"
    11  )
    12  
    13  func main() {
    14  	p, err := plugin.Open("simd.so")
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  
    19  	sym, err := p.Lookup("Lanes")
    20  	if err != nil {
    21  		panic(err)
    22  	}
    23  	got := sym.(func() int)()
    24  	if want := simd.VectorBits() / 32; got != want {
    25  		panic(fmt.Sprintf("Lanes() = %d, want %d", got, want))
    26  	}
    27  }
    28  

View as plain text