[project @ 2001-12-13 12:33:49 by sewardj]
authorsewardj <unknown>
Thu, 13 Dec 2001 12:33:50 +0000 (12:33 +0000)
committersewardj <unknown>
Thu, 13 Dec 2001 12:33:50 +0000 (12:33 +0000)
Sparc NCG fixes for 16 bit loads/stores.

ghc/compiler/nativeGen/MachMisc.lhs
ghc/compiler/nativeGen/PprMach.lhs

index 6c5e317..4229595 100644 (file)
@@ -176,14 +176,8 @@ exactLog2 x
          Just (toInteger (iBox (pow2 x#)))
        }
   where
-#if __GLASGOW_HASKELL__ >= 503
-    shiftr x y = uncheckedShiftRL# x y
-#else
-    shiftr x y = shiftRL# x y
-#endif
-
     pow2 x# | x# ==# 1# = 0#
-            | otherwise = 1# +# pow2 (w2i (i2w x# `shiftr` 1#))
+            | otherwise = 1# +# pow2 (w2i (i2w x# `shiftRL#` 1#))
 \end{code}
 
 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -268,6 +262,8 @@ data Size
 #if sparc_TARGET_ARCH
     = B     -- byte (signed)
     | Bu    -- byte (unsigned)
+    | H     -- halfword (signed, 2 bytes)
+    | Hu    -- halfword (unsigned, 2 bytes)
     | W            -- word (4 bytes)
     | F            -- IEEE single-precision floating pt
     | DF    -- IEEE single-precision floating pt
@@ -283,11 +279,11 @@ primRepToSize CostCentreRep = IF_ARCH_alpha(Q,  IF_ARCH_i386(L,  IF_ARCH_sparc(W
 primRepToSize CharRep      = IF_ARCH_alpha(L,  IF_ARCH_i386(L,  IF_ARCH_sparc(W,  )))
 
 primRepToSize Int8Rep      = IF_ARCH_alpha(B,  IF_ARCH_i386(B,  IF_ARCH_sparc(B,  )))
-primRepToSize Int16Rep     = IF_ARCH_alpha(err,IF_ARCH_i386(W,  IF_ARCH_sparc(err,)))
+primRepToSize Int16Rep     = IF_ARCH_alpha(err,IF_ARCH_i386(W,  IF_ARCH_sparc(H,  )))
     where err = primRepToSize_fail "Int16Rep"
 primRepToSize Int32Rep     = IF_ARCH_alpha(L,  IF_ARCH_i386(L,  IF_ARCH_sparc(W,  )))
 primRepToSize Word8Rep     = IF_ARCH_alpha(Bu, IF_ARCH_i386(Bu, IF_ARCH_sparc(Bu, )))
-primRepToSize Word16Rep            = IF_ARCH_alpha(err,IF_ARCH_i386(Wu, IF_ARCH_sparc(err,)))
+primRepToSize Word16Rep            = IF_ARCH_alpha(err,IF_ARCH_i386(Wu, IF_ARCH_sparc(Hu, )))
     where err = primRepToSize_fail "Word16Rep"
 primRepToSize Word32Rep            = IF_ARCH_alpha(L,  IF_ARCH_i386(Lu, IF_ARCH_sparc(W,  )))
 
index 597bc37..fd11258 100644 (file)
@@ -207,6 +207,8 @@ pprSize x = ptext (case x of
 #if sparc_TARGET_ARCH
        B   -> SLIT("sb")
        Bu  -> SLIT("ub")
+        H   -> SLIT("sh")
+        Hu  -> SLIT("uh")
        W   -> SLIT("")
        F   -> SLIT("")
        DF  -> SLIT("d")
@@ -215,6 +217,8 @@ pprStSize :: Size -> Doc
 pprStSize x = ptext (case x of
        B   -> SLIT("b")
        Bu  -> SLIT("b")
+       H   -> SLIT("h")
+       Hu  -> SLIT("h")
        W   -> SLIT("")
        F   -> SLIT("")
        DF  -> SLIT("d")