powerpc32: fix stack allocation code generation
authorSergei Trofimovich <slyfox@gentoo.org>
Wed, 20 Mar 2019 22:46:33 +0000 (22:46 +0000)
committerBen Gamari <ben@smart-cactus.org>
Mon, 24 Jun 2019 22:35:12 +0000 (18:35 -0400)
When ghc was built for powerpc32 built failed as:

It's a fallout of commit 3f46cffcc2850e68405a1
("PPC NCG: Refactor stack allocation code") where
word size used to be
    II32/II64
and changed to
    II8/panic "no width for given number of bytes"
    widthFromBytes ((platformWordSize platform) `quot` 8)

The change restores initial behaviour by removing extra division.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
(cherry picked from commit bb2ee86a4cf47eb56d4b8b4a552537449d492f88)

compiler/nativeGen/PPC/Instr.hs

index e618e18..c0c5548 100644 (file)
@@ -98,7 +98,7 @@ ppc_mkStackAllocInstr' platform amount
     , STU fmt r0 (AddrRegReg sp tmp)
     ]
   where
-    fmt = intFormat $ widthFromBytes ((platformWordSize platform) `quot` 8)
+    fmt = intFormat $ widthFromBytes (platformWordSize platform)
     zero = ImmInt 0
     tmp = tmpReg platform
     immAmount = ImmInt amount