diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2020-10-22 12:08:34 +0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-26 16:00:32 -0500 |
commit | be5d74caab64abf9d986fc7290f62731db7e73e7 (patch) | |
tree | 7b1f374333ff0fb0449e9c6834c2a8210cfba7c5 /testsuite/tests/numeric | |
parent | 2ed3e6c0f179c06828712832d1176519cdfa82a6 (diff) | |
download | haskell-be5d74caab64abf9d986fc7290f62731db7e73e7.tar.gz |
[Sized Cmm] properly retain sizes.
This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int# with
Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us
with properly sized primitives in the codegenerator instead of pretending
they are all full machine words.
This came up when implementing darwinpcs for arm64. The darwinpcs reqires
us to pack function argugments in excess of registers on the stack. While
most procedure call standards (pcs) assume arguments are just passed in
8 byte slots; and thus the caller does not know the exact signature to make
the call, darwinpcs requires us to adhere to the prototype, and thus have
the correct sizes. If we specify CInt in the FFI call, it should correspond
to the C int, and not just be Word sized, when it's only half the size.
This does change the expected output of T16402 but the new result is no
less correct as it eliminates the narrowing (instead of the `and` as was
previously done).
Bumps the array, bytestring, text, and binary submodules.
Co-Authored-By: Ben Gamari <ben@well-typed.com>
Metric Increase:
T13701
T14697
Diffstat (limited to 'testsuite/tests/numeric')
-rw-r--r-- | testsuite/tests/numeric/should_compile/T16402.stderr-ws-32 | 133 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 (renamed from testsuite/tests/numeric/should_compile/T16402.stderr) | 11 |
2 files changed, 139 insertions, 5 deletions
diff --git a/testsuite/tests/numeric/should_compile/T16402.stderr-ws-32 b/testsuite/tests/numeric/should_compile/T16402.stderr-ws-32 new file mode 100644 index 0000000000..726bcc374e --- /dev/null +++ b/testsuite/tests/numeric/should_compile/T16402.stderr-ws-32 @@ -0,0 +1,133 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 124, types: 172, coercions: 0, joins: 0/0} + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +$trModule4 = "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$trModule3 = TrNameS $trModule4 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +$trModule2 = "T16402"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$trModule1 = TrNameS $trModule2 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$trModule = Module $trModule3 $trModule1 + +-- RHS size: {terms: 18, types: 25, coercions: 0, joins: 0/0} +smallWord_bar + = \ x -> + case x of { W64# x# -> + case {__pkg_ccall ghc-prim Word64# + -> State# RealWorld -> (# State# RealWorld, Word# #)} + x# realWorld# + of + { (# ds1, ds2 #) -> + case {__pkg_ccall ghc-prim Word# + -> State# RealWorld -> (# State# RealWorld, Word64# #)} + (and# ds2 0xffff##) realWorld# + of + { (# ds4, ds5 #) -> + W64# ds5 + } + } + } + +-- RHS size: {terms: 24, types: 36, coercions: 0, joins: 0/0} +smallWord_foo + = \ x -> + case x of { W64# x# -> + case {__pkg_ccall ghc-prim Word64# + -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #)} + x# 0xffff##64 realWorld# + of + { (# ds2, ds3 #) -> + case {__pkg_ccall ghc-prim Word64# + -> State# RealWorld -> (# State# RealWorld, Word# #)} + ds3 realWorld# + of + { (# ds1, ds4 #) -> + case {__pkg_ccall ghc-prim Word# + -> State# RealWorld -> (# State# RealWorld, Word64# #)} + (and# ds4 0xffff##) realWorld# + of + { (# ds5, ds6 #) -> + W64# ds6 + } + } + } + } + +-- RHS size: {terms: 18, types: 25, coercions: 0, joins: 0/0} +smallInt_bar + = \ x -> + case x of { I64# x# -> + case {__pkg_ccall ghc-prim Int64# + -> State# RealWorld -> (# State# RealWorld, Int# #)} + x# realWorld# + of + { (# ds1, ds2 #) -> + case {__pkg_ccall ghc-prim Int# + -> State# RealWorld -> (# State# RealWorld, Int64# #)} + (extendInt16# (narrowInt16# ds2)) realWorld# + of + { (# ds4, ds5 #) -> + I64# ds5 + } + } + } + +-- RHS size: {terms: 35, types: 67, coercions: 0, joins: 0/0} +$wsmallInt_foo + = \ ww -> + case {__pkg_ccall ghc-prim Int64# + -> State# RealWorld -> (# State# RealWorld, Word64# #)} + 1245183#64 realWorld# + of + { (# ds2, ds3 #) -> + case {__pkg_ccall ghc-prim Int64# + -> State# RealWorld -> (# State# RealWorld, Word64# #)} + ww realWorld# + of + { (# ds4, ds5 #) -> + case {__pkg_ccall ghc-prim Word64# + -> Word64# -> State# RealWorld -> (# State# RealWorld, Word64# #)} + ds5 ds3 realWorld# + of + { (# ds6, ds7 #) -> + case {__pkg_ccall ghc-prim Word64# + -> State# RealWorld -> (# State# RealWorld, Int64# #)} + ds7 realWorld# + of + { (# ds8, ds9 #) -> + case {__pkg_ccall ghc-prim Int64# + -> State# RealWorld -> (# State# RealWorld, Int# #)} + ds9 realWorld# + of + { (# ds1, ds11 #) -> + case {__pkg_ccall ghc-prim Int# + -> State# RealWorld -> (# State# RealWorld, Int64# #)} + (extendInt16# (narrowInt16# ds11)) realWorld# + of + { (# ds12, ds13 #) -> + ds13 + } + } + } + } + } + } + +-- RHS size: {terms: 10, types: 4, coercions: 0, joins: 0/0} +smallInt_foo + = \ w -> + case w of { I64# ww1 -> + case $wsmallInt_foo ww1 of ww2 { __DEFAULT -> I64# ww2 } + } + + + diff --git a/testsuite/tests/numeric/should_compile/T16402.stderr b/testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 index 75db843376..d81adaaa7b 100644 --- a/testsuite/tests/numeric/should_compile/T16402.stderr +++ b/testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 @@ -1,7 +1,7 @@ ==================== Tidy Core ==================== Result size of Tidy Core - = {terms: 34, types: 19, coercions: 0, joins: 0/0} + = {terms: 36, types: 19, coercions: 0, joins: 0/0} -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $trModule4 = "main"# @@ -18,16 +18,17 @@ $trModule1 = TrNameS $trModule2 -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} $trModule = Module $trModule3 $trModule1 --- RHS size: {terms: 7, types: 3, coercions: 0, joins: 0/0} +-- RHS size: {terms: 8, types: 3, coercions: 0, joins: 0/0} smallWord_bar - = \ x -> case x of { W64# x# -> W64# (narrow16Word# x#) } + = \ x -> case x of { W64# x# -> W64# (and# x# 0xffff##) } -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} smallWord_foo = smallWord_bar --- RHS size: {terms: 7, types: 3, coercions: 0, joins: 0/0} +-- RHS size: {terms: 8, types: 3, coercions: 0, joins: 0/0} smallInt_bar - = \ x -> case x of { I64# x# -> I64# (narrow16Int# x#) } + = \ x -> + case x of { I64# x# -> I64# (extendInt16# (narrowInt16# x#)) } -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} smallInt_foo = smallInt_bar |