Cherry pick: fix AVX & AVX2 detection

fixes issue #790 which resulted in a SIGILL on OpenBSD
code is mostly from libwebp, based on the following:

https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family

https://gerrit.chromium.org/gerrit/73502

TBR=tomfinegan@chromium.org

Review URL: https://codereview.chromium.org//864393002
1 file changed