[Git][ghc/ghc][wip/supersven/riscv64-ncg] MO_SS_Conv: Don't give up the highest bit for sign

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Sat Jul 15 11:24:52 UTC 2023



Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC


Commits:
eb35fd83 by Sven Tennie at 2023-07-15T13:22:31+02:00
MO_SS_Conv: Don't give up the highest bit for sign

According to this test, reducing the value for the sign is not correct.

narrow[W32→W8](sext[W16→W32](load[W16](0x223972::W64)))
test ( bits64 buffer ) {
    bits64 ret;
    (ret) = prim %popcnt8(%lobits8(%sx32(bits16[buffer + (2242930 :: bits64)])));
    return (ret);
}

4 /= 5

- - - - -


1 changed file:

- compiler/GHC/CmmToAsm/RV64/CodeGen.hs


Changes:

=====================================
compiler/GHC/CmmToAsm/RV64/CodeGen.hs
=====================================
@@ -675,8 +675,7 @@ getRegister' config plat expr =
                 ]
               `appOL` truncateReg from to dst
                   where
-                    -- Why -1? We need to shift out one more bit for the sign.
-                    shift = 64 - (widthInBits from - widthInBits to - 1)
+                    shift = 64 - (widthInBits from - widthInBits to)
 
     -- Dyadic machops:
     --



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eb35fd83839448236d5f4f94f674aa38939d40cb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eb35fd83839448236d5f4f94f674aa38939d40cb
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230715/e9affdf2/attachment.html>


More information about the ghc-commits mailing list