CodeGen Emits CMOV instructions when targeting architectures before i686
Summary
CMOV instruction are not supported in processor architectures such as i586 and i486, but GHC seems to use them anyway.
Steps to reproduce
{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Word ( Word32(..) )
import GHC.Exts ( clz32# )
main :: IO ()
main = do
let W32# w = 100
print $ W32# (clz32# w)
Compiling this results in an executable which crashes with the error "Illegal Instruction" on i586 machines. Even without an i586 machine, you can see that it does contain a cmovne
instruction with objdump -d <exe> | grep cmov
Expected behavior
Not crash
Environment
- GHC version used: 8.6.5
Optional:
- Operating System: Gentoo
- System Architecture: i586