summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_compile
diff options
context:
space:
mode:
authorKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
committerKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
commit84c2ad99582391005b5e873198b15e9e9eb4f78d (patch)
treecaa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /testsuite/tests/codeGen/should_compile
parent8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff)
parente68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff)
downloadhaskell-wip/T13904.tar.gz
update to current master againwip/T13904
Diffstat (limited to 'testsuite/tests/codeGen/should_compile')
-rw-r--r--testsuite/tests/codeGen/should_compile/Makefile11
-rw-r--r--testsuite/tests/codeGen/should_compile/T14626.hs15
-rw-r--r--testsuite/tests/codeGen/should_compile/T14626.stdout2
-rw-r--r--testsuite/tests/codeGen/should_compile/T14999.cmm11
-rw-r--r--testsuite/tests/codeGen/should_compile/T14999.stdout13
-rw-r--r--testsuite/tests/codeGen/should_compile/T15196.hs4
-rw-r--r--testsuite/tests/codeGen/should_compile/T15196.stdout1
-rw-r--r--testsuite/tests/codeGen/should_compile/all.T16
8 files changed, 72 insertions, 1 deletions
diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile
index a3e03d244b..c94c8b6f92 100644
--- a/testsuite/tests/codeGen/should_compile/Makefile
+++ b/testsuite/tests/codeGen/should_compile/Makefile
@@ -5,6 +5,9 @@ include $(TOP)/mk/test.mk
T2578:
'$(TEST_HC)' $(TEST_HC_OPTS) --make T2578 -fforce-recomp -v0
+T14626:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -ddump-prep -dsuppress-uniques T14626.hs | grep case
+
debug:
# Without optimisations, we should get annotations for basically
# all expressions in the example program.
@@ -30,3 +33,11 @@ debug:
./debug
rm debug
+
+T14999:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -O2 -g -c T14999.cmm -o T14999.o
+ gdb --batch -ex 'file T14999.o' -ex 'disassemble stg_catch_frame_info' --nx | tr -s '[[:blank:]\n]'
+ readelf --debug-dump=frames-interp T14999.o | tr -s '[[:blank:]\n]'
+
+T15196:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -ddump-asm T15196.hs | grep "jp " ; echo $$?
diff --git a/testsuite/tests/codeGen/should_compile/T14626.hs b/testsuite/tests/codeGen/should_compile/T14626.hs
new file mode 100644
index 0000000000..a665694bfc
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T14626.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE MagicHash #-}
+
+module T14626 where
+
+import GHC.Prim
+
+data T = MkT !Bool
+
+f v = case v of
+ MkT y -> dataToTag# y
+
+-- This should /not/ produce an inner case on the y, thus:
+-- f v = case v of
+-- MkT y -> case y of z -> dataToTag# z
+-- But it was! See Trac #14626 comment:4
diff --git a/testsuite/tests/codeGen/should_compile/T14626.stdout b/testsuite/tests/codeGen/should_compile/T14626.stdout
new file mode 100644
index 0000000000..389d3e733a
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T14626.stdout
@@ -0,0 +1,2 @@
+ case dt of dt [Occ=Once] { __DEFAULT -> T14626.MkT dt }
+ case v of { T14626.MkT y [Occ=Once] ->
diff --git a/testsuite/tests/codeGen/should_compile/T14999.cmm b/testsuite/tests/codeGen/should_compile/T14999.cmm
new file mode 100644
index 0000000000..a3e283b0be
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T14999.cmm
@@ -0,0 +1,11 @@
+#define CATCH_FRAME 34
+
+#define SIZEOF_StgCatchFrame (SIZEOF_StgHeader+16)
+
+INFO_TABLE_RET(stg_catch_frame, CATCH_FRAME,
+ bits64 info_ptr, bits64 exceptions_blocked, gcptr handler)
+ return (gcptr ret)
+{
+ return (ret);
+}
+
diff --git a/testsuite/tests/codeGen/should_compile/T14999.stdout b/testsuite/tests/codeGen/should_compile/T14999.stdout
new file mode 100644
index 0000000000..546be1b73c
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T14999.stdout
@@ -0,0 +1,13 @@
+Dump of assembler code for function stg_catch_frame_info:
+ 0x0000000000000010 <+0>: add $0x18,%rbp
+ 0x0000000000000014 <+4>: jmpq *0x0(%rbp)
+End of assembler dump.
+Contents of the .debug_frame section:
+00000000 0000000000000014 ffffffff CIE "" cf=1 df=-8 ra=16
+ LOC CFA rbp rsp ra
+0000000000000000 rbp+0 v+0 s c+0
+00000018 000000000000002c 00000000 FDE cie=00000000 pc=000000000000000f..0000000000000017
+ LOC CFA rbp rsp ra
+000000000000000f rbp+0 v+0 s c+0
+000000000000000f rbp+24 v+0 s c+0
+0000000000000014 rbp+0 v+0 s c+0
diff --git a/testsuite/tests/codeGen/should_compile/T15196.hs b/testsuite/tests/codeGen/should_compile/T15196.hs
new file mode 100644
index 0000000000..6df88d8432
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T15196.hs
@@ -0,0 +1,4 @@
+module M where
+
+f :: Double -> Double -> Bool
+f x y = if x < y then True else False
diff --git a/testsuite/tests/codeGen/should_compile/T15196.stdout b/testsuite/tests/codeGen/should_compile/T15196.stdout
new file mode 100644
index 0000000000..56a6051ca2
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T15196.stdout
@@ -0,0 +1 @@
+1 \ No newline at end of file
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index 6ae4e1cb4e..dd6931f235 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -30,8 +30,22 @@ test('debug',
run_command, ['$MAKE -s --no-print-directory debug'])
test('T9964', normal, compile, ['-O'])
test('T10518', [cmm_src], compile, [''])
-test('T10667', [ when((arch('powerpc64') or arch('powerpc64le')),
+test('T10667', [ when((arch('powerpc64') or arch('powerpc64le')),
expect_broken(11261))],
compile, ['-g'])
test('T12115', normal, compile, [''])
test('T12355', normal, compile, [''])
+test('T14626',
+ normal,
+ run_command, ['$MAKE -s --no-print-directory T14626'])
+test('T14999',
+ [when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261)),
+ unless(opsys('linux') and arch('x86_64') and have_gdb() and
+ have_readelf(), skip)],
+ run_command, ['$MAKE -s --no-print-directory T14999'])
+
+# Verify that we optimize away redundant jumps for unordered comparisons.
+test('T15196',
+ [ unless(arch('x86_64'),skip),
+ only_ways('normal'),
+ ], run_command, ['$MAKE -s --no-print-directory T15196'])