Skip to content

Commit

Permalink
add I
Browse files Browse the repository at this point in the history
  • Loading branch information
vmchale committed Jun 21, 2024
1 parent ec85858 commit 4f4f6e9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/C/Trans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ aeval (EApp ty (EApp _ (Builtin _ A.R) e0) e1) t | (F, ixs) <- tRnd ty = do
plRnd = [Rnd iR, MX xR (IE (Tmp iR)), MX xR ((FTmp e1R - FTmp e0R) * (FTmp xR / (2*9223372036854775807) + 0.5) + FTmp e0R), WrF (AElem t rnk (Tmp k) (Just a) 8) (FTmp xR)]
loop=For k 0 ILt (ConstI n) plRnd
pure (Just a, plE0++plE1++Ma a t rnk (ConstI n) 8:diml (t, Just a) (ConstI<$>ixs)++[loop])
aeval (EApp ty (EApp _ (Builtin _ A.R) e0) e1) t | (I, ixs) <- tRnd ty = do
a <- nextArr t
e0R <- newITemp; e1R <- newITemp; iR <- newITemp; k <- newITemp
plE0 <- eval e0 e0R; plE1 <- eval e1 e1R
let rnk=fromIntegral$length ixs; n=product ixs
plRnd = [Rnd iR, iR := (Bin IRem (Tmp iR) (Tmp e1R - Tmp e0R + 1) + Tmp e0R), Wr (AElem t rnk (Tmp k) (Just a) 8) (Tmp iR)]
loop=For k 0 ILt (ConstI n) plRnd
pure (Just a, plE0++plE1++Ma a t rnk (ConstI n) 8:diml (t, Just a) (ConstI<$>ixs)++[loop])
aeval (EApp _ (EApp _ (Builtin _ Map) op) e) t | (Arrow tD tC) <- eAnn op, isIF tD && isIF tC= do
arrT <- newITemp
(l, plE) <- aeval e arrT
Expand Down

0 comments on commit 4f4f6e9

Please sign in to comment.