diff options
author | Abhiroop Sarkar <asiamgenius@gmail.com> | 2018-11-05 12:06:58 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-17 10:03:17 -0500 |
commit | 36fcf9edee31513db2ddbf716ee0aa79766cbe69 (patch) | |
tree | 76d3bf5734d852b53caea24c70b024f1b24204d5 /compiler/codeGen | |
parent | 0e7790abf7d19d19f84c86dc95e50beb65462d12 (diff) | |
download | haskell-36fcf9edee31513db2ddbf716ee0aa79766cbe69.tar.gz |
Introduce Int16# and Word16#
This builds off of D4475.
Bumps binary submodule.
Reviewers: carter, AndreasK, hvr, goldfire, bgamari, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D5006
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmArgRep.hs | 2 | ||||
-rw-r--r-- | compiler/codeGen/StgCmmPrim.hs | 45 |
2 files changed, 47 insertions, 0 deletions
diff --git a/compiler/codeGen/StgCmmArgRep.hs b/compiler/codeGen/StgCmmArgRep.hs index 95f96dc16f..7d1962fd09 100644 --- a/compiler/codeGen/StgCmmArgRep.hs +++ b/compiler/codeGen/StgCmmArgRep.hs @@ -72,6 +72,8 @@ toArgRep IntRep = N toArgRep WordRep = N toArgRep Int8Rep = N -- Gets widened to native word width for calls toArgRep Word8Rep = N -- Gets widened to native word width for calls +toArgRep Int16Rep = N -- Gets widened to native word width for calls +toArgRep Word16Rep = N -- Gets widened to native word width for calls toArgRep AddrRep = N toArgRep Int64Rep = L toArgRep Word64Rep = L diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs index 75d46b5b3a..eb4d681923 100644 --- a/compiler/codeGen/StgCmmPrim.hs +++ b/compiler/codeGen/StgCmmPrim.hs @@ -884,6 +884,11 @@ callishPrimOpSupported dflags op -> Left (MO_S_QuotRem W8) | otherwise -> Right (genericIntQuotRemOp W8) + Int16QuotRemOp | (ncg && x86ish) + || llvm -> Left (MO_S_QuotRem W16) + | otherwise -> Right (genericIntQuotRemOp W16) + + WordQuotRemOp | ncg && (x86ish || ppc) -> Left (MO_U_QuotRem (wordWidth dflags)) | otherwise -> @@ -898,6 +903,10 @@ callishPrimOpSupported dflags op -> Left (MO_U_QuotRem W8) | otherwise -> Right (genericWordQuotRemOp W8) + Word16QuotRemOp| (ncg && x86ish) + || llvm -> Left (MO_U_QuotRem W16) + | otherwise -> Right (genericWordQuotRemOp W16) + WordAdd2Op | (ncg && (x86ish || ppc)) || llvm -> Left (MO_Add2 (wordWidth dflags)) @@ -1356,6 +1365,42 @@ translateOp _ Word8LeOp = Just (MO_U_Le W8) translateOp _ Word8LtOp = Just (MO_U_Lt W8) translateOp _ Word8NeOp = Just (MO_Ne W8) +-- Int16# signed ops + +translateOp dflags Int16Extend = Just (MO_SS_Conv W16 (wordWidth dflags)) +translateOp dflags Int16Narrow = Just (MO_SS_Conv (wordWidth dflags) W16) +translateOp _ Int16NegOp = Just (MO_S_Neg W16) +translateOp _ Int16AddOp = Just (MO_Add W16) +translateOp _ Int16SubOp = Just (MO_Sub W16) +translateOp _ Int16MulOp = Just (MO_Mul W16) +translateOp _ Int16QuotOp = Just (MO_S_Quot W16) +translateOp _ Int16RemOp = Just (MO_S_Rem W16) + +translateOp _ Int16EqOp = Just (MO_Eq W16) +translateOp _ Int16GeOp = Just (MO_S_Ge W16) +translateOp _ Int16GtOp = Just (MO_S_Gt W16) +translateOp _ Int16LeOp = Just (MO_S_Le W16) +translateOp _ Int16LtOp = Just (MO_S_Lt W16) +translateOp _ Int16NeOp = Just (MO_Ne W16) + +-- Word16# unsigned ops + +translateOp dflags Word16Extend = Just (MO_UU_Conv W16 (wordWidth dflags)) +translateOp dflags Word16Narrow = Just (MO_UU_Conv (wordWidth dflags) W16) +translateOp _ Word16NotOp = Just (MO_Not W16) +translateOp _ Word16AddOp = Just (MO_Add W16) +translateOp _ Word16SubOp = Just (MO_Sub W16) +translateOp _ Word16MulOp = Just (MO_Mul W16) +translateOp _ Word16QuotOp = Just (MO_U_Quot W16) +translateOp _ Word16RemOp = Just (MO_U_Rem W16) + +translateOp _ Word16EqOp = Just (MO_Eq W16) +translateOp _ Word16GeOp = Just (MO_U_Ge W16) +translateOp _ Word16GtOp = Just (MO_U_Gt W16) +translateOp _ Word16LeOp = Just (MO_U_Le W16) +translateOp _ Word16LtOp = Just (MO_U_Lt W16) +translateOp _ Word16NeOp = Just (MO_Ne W16) + -- Char# ops translateOp dflags CharEqOp = Just (MO_Eq (wordWidth dflags)) |