[Git][ghc/ghc][wip/sjakobi/T16122] Add regression test for #16122
Simon Jakobi pushed to branch wip/sjakobi/T16122 at Glasgow Haskell Compiler / GHC Commits: 0159e431 by Simon Jakobi at 2026-03-08T15:25:37+01:00 Add regression test for #16122 - - - - - 3 changed files: - + testsuite/tests/simplCore/should_compile/T16122.hs - + testsuite/tests/simplCore/should_compile/T16122.stderr - testsuite/tests/simplCore/should_compile/all.T Changes: ===================================== testsuite/tests/simplCore/should_compile/T16122.hs ===================================== @@ -0,0 +1,12 @@ +{-# LANGUAGE TypeApplications #-} +-- Test that the Core for f isn't "worse" than g's. +-- The optimized Core for f used to involve dictionary-passing. See #16122. +module T16122 (f, g) where + +import Data.Int (Int64) + +f :: Double -> Int64 +f = round + +g :: Double -> Int64 +g = fromIntegral @Int @Int64 . round ===================================== testsuite/tests/simplCore/should_compile/T16122.stderr ===================================== @@ -0,0 +1,26 @@ +f = \ x -> + I64# + (case x of { D# ds1 -> + case {__ffi_static_ccall_unsafe ghc-internal:rintDouble :: Double# + -> State# RealWorld + -> (# State# RealWorld, Double# #)} + ds1 realWorld# + of + { (# _, ds3 #) -> + intToInt64# (double2Int# ds3) + } + }) + +g = \ x -> + I64# + (case x of { D# ds1 -> + case {__ffi_static_ccall_unsafe ghc-internal:rintDouble :: Double# + -> State# RealWorld + -> (# State# RealWorld, Double# #)} + ds1 realWorld# + of + { (# _, ds3 #) -> + intToInt64# (double2Int# ds3) + } + }) + ===================================== testsuite/tests/simplCore/should_compile/all.T ===================================== @@ -295,6 +295,10 @@ test('T15631', normal, makefile_test, ['T15631']) test('T15673', normal, compile, ['-O']) +test('T16122', [when(wordsize(32), skip)], + multimod_compile_filter, + ['T16122', '-O -ddump-simpl -dsuppress-all -dsuppress-uniques -dno-typeable-binds', + "sed -n '/^f = /,/^$/p;/^g = /,/^$/p'"]) test('T16288', normal, multimod_compile, ['T16288B', '-O -dcore-lint -v0']) test('T16348', normal, compile, ['-O']) test('T16918', normal, compile, ['-O']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0159e43152e2b43529c3b56ad7cdaac7... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0159e43152e2b43529c3b56ad7cdaac7... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Jakobi (@sjakobi2)