Aha, thanks! And there -tags is, on `go help build`. I wasn't sure what 'noasm' was; I was copying from an example by searching my ~/go/pkg; in this case the 'snappy' source (github.com/golang/snappy). I had assumed it was something that gets set automatically, if for whatever reason assembly is not available in the current toolchain. It being a non–standard tag explains why my other searches and scanning of CLI help pages were fruitless.
My complaint about the language support... well, it's great that it's in the standard library. I guess I was more meaning, here is an elementary operation for integers, supported on most architectures, but languages like C that "set the tone" of how we express operations skipped this one. I realize punctuation was scarce when C was written and they had to draw the line somewhere, but since it didn't get its own operator, and so now we need to use tricks like the ones found in math/bits, or use the assembly escape hatch. Perhaps it's just the way I write code but I often find myself wishing there was a simple way to get the rough scale of an integer without reaching for math.Log2. Leading zeroes is an integer log₂, and logarithms are common enough to get a button on most scientific calculators. Looks like `math/bits` could use some assembly alternatives, too. Clever as those functions are, they're almost certainly not going to beat the microcode/silicon. I'm looking into the contribution guidelines now! Cheers, Sam On Tuesday, 25 April 2023 at 11:59:28 UTC-4 Ian Lance Taylor wrote: > On Tue, Apr 25, 2023 at 8:38 AM Sam Vilain <s...@vilain.net> wrote: > > > > I have a module that has a couple of assembly functions (for CLZ aka > BSR/LZCNT, which despite widespread availability[1] don't get any language > support). So I've got the assembly versions in per–arch files, and a > "noasm" version that builds with "noasm" (amongst other typical conditions. > > > > My question is: is there a way to specify this "noasm" when running 'go > test'? > > > > I tried using `-gcflags -complete`, but now I just get complaints about > missing the function body: > > > > $ go test -gcflags '-complete' -v . > > ... > > ./primitives_asm.go:17:6: missing function body > > ./primitives_asm.go:20:6: missing function body > > FAIL ... > > > > Is this a bug in the compiler, i.e. should "noasm" always be set with > "-complete", which disables assembly/C ? Or is there some other way to set > 'noasm', like a define flag, that I missed? > > Have you considered using the functions in the math/bits package? > > I don't think you really said exactly how noasm works, but if it's a > build tag then the answer is "go test -tags=noasm". The conventional > name for a tag like that is "purego". > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/397c98f6-adb0-408d-8b41-81f017e4d702n%40googlegroups.com.