From 7d9a2e44e8cce00e24671325aebe47d9e529aee5 Mon Sep 17 00:00:00 2001
From: ARATA Mizuki <minorinoki@gmail.com>
Date: Sun, 26 Nov 2023 12:50:46 +0900
Subject: [PATCH] x86: Don't require -mavx2 when using 256-bit floating-point
 SIMD primitives

Fixes #24222
---
 compiler/GHC/StgToCmm/Prim.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs
index fcb70a8270dc..83ed9ea56516 100644
--- a/compiler/GHC/StgToCmm/Prim.hs
+++ b/compiler/GHC/StgToCmm/Prim.hs
@@ -2350,13 +2350,15 @@ checkVecCompatibility cfg vcat l w =
       ArchX86 -> True
       _ -> False
     checkX86 :: Width -> PrimOpVecCat -> Length -> Width -> FCode ()
-    checkX86 W128 FloatVec 4 W32 | not (isSseEnabled platform) =
+    checkX86 W128 FloatVec 4 W32 | isSseEnabled platform = return ()
+                                 | otherwise =
         sorry $ "128-bit wide single-precision floating point " ++
                 "SIMD vector instructions require at least -msse."
     checkX86 W128 _ _ _ | not (isSse2Enabled platform) =
         sorry $ "128-bit wide integer and double precision " ++
                 "SIMD vector instructions require at least -msse2."
-    checkX86 W256 FloatVec _ _ | not (stgToCmmAvx cfg) =
+    checkX86 W256 FloatVec _ _ | stgToCmmAvx cfg = return ()
+                               | otherwise =
         sorry $ "256-bit wide floating point " ++
                 "SIMD vector instructions require at least -mavx."
     checkX86 W256 _ _ _ | not (stgToCmmAvx2 cfg) =
-- 
GitLab