go: Illegal instructions (SSE4) in go1.19+ -race builds (fails on some Intel Atom cores)

What version of Go are you using (go version)?

go version go1.19rc1 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

go build -race generates SSE4 instruction(s) that are executed on non-SSE4 capable CPUs (old Intel Atom).

(pinsrq specifically)

go1.18 works as expected

What did you expect to see?

program should run

What did you see instead?

crash, no output, fails in early runtime:

$ ./program
Illegal instruction

using gdb:

Program received signal SIGILL, Illegal instruction.
0x0000000000431737 in __sanitizer::SizeClassAllocator32LocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >::Refill(
__sanitizer::SizeClassAllocator32LocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >::PerClass*, __sanitizer::SizeC
lassAllocator32<__sanitizer::AP32>*, unsigned long) ()

   0x0000000000431726 <+406>:   movdqa %xmm1,%xmm0
   0x000000000043172a <+410>:   mov    $0x14,%edx
   0x000000000043172f <+415>:   shl    $0x4,%rax
   0x0000000000431733 <+419>:   shl    $0xa,%rdi
=> 0x0000000000431737 <+423>:   pinsrq $0x1,%rax,%xmm0
   0x000000000043173e <+430>:   mov    %rsi,%rax
   0x0000000000431741 <+433>:   add    $0x1,%rsi
   0x0000000000431745 <+437>:   movups %xmm0,0x8(%rbx,%rdi,1)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I’m ok with a ~15% slowdown, to keep -race working on older processors. We can come up with GOAMD64 versioning scheme for 1.20.