summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/simd000.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/codeGen/should_run/simd000.hs')
-rw-r--r--testsuite/tests/codeGen/should_run/simd000.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/simd000.hs b/testsuite/tests/codeGen/should_run/simd000.hs
new file mode 100644
index 0000000000..47d69497c0
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/simd000.hs
@@ -0,0 +1,21 @@
+{-# OPTIONS_GHC -mavx #-}
+{-# OPTIONS_GHC -msse4 #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnboxedTuples #-}
+-- !!! test broadcasting, packing and unpacking for vector types
+
+import GHC.Exts
+
+main :: IO ()
+main = do
+ -- FloatX4#
+ case unpackFloatX4# (broadcastFloatX4# 1.5#) of
+ (# a, b, c, d #) -> print (F# a, F# b, F# c, F# d)
+ case unpackFloatX4# (packFloatX4# (# 4.5#,7.8#, 2.3#, 6.5# #)) of
+ (# a, b, c, d #) -> print (F# a, F# b, F# c, F# d)
+
+ -- DoubleX2#
+ case unpackDoubleX2# (broadcastDoubleX2# 6.5##) of
+ (# a, b #) -> print (D# a, D# b)
+ case unpackDoubleX2# (packDoubleX2# (# 8.9##,7.2## #)) of
+ (# a, b #) -> print (D# a, D# b)