256-bit floating-point SIMD primitives unnecessarily require `-mavx2`
Summary
When using 256-bit floating-point SIMD primitives (i.e. FloatX8#
or DoubleX4#
), GHC requires -mavx2
. -mavx
should be sufficient.
Steps to reproduce
-- Test.hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
import GHC.Exts
main = do
let (# x0, x1, x2, x3 #) = unpackDoubleX4# (negateDoubleX4# (packDoubleX4# (# 0.0##, 1.1##, 2.2##, 3.3## #)))
print (D# x0, D# x1, D# x2, D# x3)
$ _build/stage1/bin/ghc -fllvm -mavx Test.hs
[1 of 2] Compiling Main ( Test.hs, Test.o )
<no location info>: error:
sorry! (unimplemented feature or known bug)
GHC version 9.9.20231124:
256-bit wide integer SIMD vector instructions require at least -mavx2.
$ _build/stage1/bin/ghc -fllvm -mavx2 Test.hs
[1 of 2] Compiling Main ( Test.hs, Test.o )
[2 of 2] Linking Test
Expected behavior
ghc -fllvm -mavx Test.hs
should compile.
Environment
- GHC version used: 9.9.20231124 (34d86315)
- Operating System: Ubuntu 22.04
- System Architecture: x86-64