FIX rts build failure for powerPC build
authorandy@galois.com <unknown>
Tue, 10 Jul 2007 07:17:13 +0000 (07:17 +0000)
committerandy@galois.com <unknown>
Tue, 10 Jul 2007 07:17:13 +0000 (07:17 +0000)
The rts was failing with

../compiler/ghc-inplace -H64m -Onot -fasm -optc-O2 -static -I../gmp/gmpbuild -I. -#include HCIncludes.h -dcmm-lint  -hisuf thr_p_hi -hcsuf thr_p_hc -osuf thr_p_o -optc-DTHREADED_RTS -prof -#include posix/Itimer.h  -c PrimOps.cmm -o PrimOps.thr_p_o
ghc-6.7.20070709: panic! (the 'impossible' happened)
  (GHC version 6.7.20070709 for powerpc-apple-darwin):
        iselExpr64(powerpc) %MO_U_Conv_I32_I64(16 / 4 - 2)

There was a special case for x86; so it has been transliterated to the PPC, and the output code looks plausable.

compiler/nativeGen/MachCodeGen.hs

index b29b59e..2c07016 100644 (file)
@@ -433,6 +433,13 @@ iselExpr64 (CmmMachOp (MO_Add _) [e1,e2]) = do
    -- in
    return (ChildCode64 code rlo)
 
+iselExpr64 (CmmMachOp (MO_U_Conv I32 I64) [expr]) = do
+    (expr_reg,expr_code) <- getSomeReg expr
+    (rlo, rhi) <- getNewRegPairNat I32
+    let mov_hi = LI rhi (ImmInt 0)
+        mov_lo = MR rlo expr_reg
+    return $ ChildCode64 (expr_code `snocOL` mov_lo `snocOL` mov_hi)
+                         rlo
 iselExpr64 expr
    = pprPanic "iselExpr64(powerpc)" (ppr expr)