NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: stoffel on January 06, 2012, 02:02:05 PM

Title: build in avx instructions on non avx processor
Post by: stoffel on January 06, 2012, 02:02:05 PM
Hi,
Can I build an executable that includes avx instructions on a processor that is not avx capable?
I suspect there is some flag that one can specify to build binary for avx capable processor
even though build system is not an avx vintage processor.
Thanks.
Title: Re: build in avx instructions on non avx processor
Post by: Frank Kotler on January 06, 2012, 05:55:23 PM
Hi stoffel,

Yeah, shouldn't be a problem. I just tried avx005.asm (from the "test" directory in the source code) on my clunky old P4 with nasm-2.09.10 and it seemed to go okay. I can't test the result, of course!

Nasm's "cpu" directive disables instructions "higher" than the specified cpu (causes an error). Without a "cpu" directive, or any other special flag, Nasm should assemble "anything". You'll want a fairly recent version of Nasm, to get "bug free" (we hope) avx instructions.

Try it, and let us know if you encounter any problem.

Best,
Frank