mmcloughlin / avo

Generate x86 Assembly with Go
BSD 3-Clause "New" or "Revised" License
2.72k stars 89 forks source link

How to have a fall-back scheme on arm machine #412

Closed chasingegg closed 10 months ago

chasingegg commented 10 months ago

Let's say we have optimized code for x86 machine and a pure go implementation as pasted, and we want use the same piece of code to run on arm, seems it complains the compilation. How to avoid this?

if cpu.X86.HasAVX2 {
  // avo optimized code
} else {
  // pure go
}
chasingegg commented 10 months ago

could add some build constraints to solve this problem