Home My Page Projects Code Snippets Project Openings SML/NJ
 Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

# SCM Repository

[smlnj] Diff of /sml/branches/num64/compiler/CPS/opt/num64cnv.sml
 [smlnj] / sml / branches / num64 / compiler / CPS / opt / num64cnv.sml

# Diff of /sml/branches/num64/compiler/CPS/opt/num64cnv.sml

revision 5163, Fri May 10 22:24:03 2019 UTC revision 5164, Sat May 11 11:58:49 2019 UTC
# Line 359  Line 359
359
360    (* the basic pattern for comparisons is    (* the basic pattern for comparisons is
361     *   fun cmp ((hi1, lo1), (hi2, lo2)) =     *   fun cmp ((hi1, lo1), (hi2, lo2)) =
362     *         OP(hi1, hi2) orelse ((hi1 = hi2) andalso OP(lo1, lo2))     *         cmpHi(hi1, hi2) orelse ((hi1 = hi2) andalso cmpLo(lo1, lo2))
363     *)     *)
364      local      local
365        fun w64Cmp oper (n1, n2, tr, fl) = let        fun w64Cmp (cmpHi, cmpLo) (n1, n2, tr, fl) = let
366            (* continuations for the branches so that we can avoid code duplication *)            (* continuations for the branches so that we can avoid code duplication *)
367              val trFnId = LV.mkLvar()              val trFnId = LV.mkLvar()
368              val tr' = C.APP(C.VAR trFnId, [])              val tr' = C.APP(C.VAR trFnId, [])
# Line 377  Line 377
377                (* (hi1 < hi2) orelse ((hi1 = hi2) andalso (lo1 < lo2)) *)                (* (hi1 < hi2) orelse ((hi1 = hi2) andalso (lo1 < lo2)) *)
378                  getHi32(n1, fn hi1 =>                  getHi32(n1, fn hi1 =>
379                  getHi32(n2, fn hi2 =>                  getHi32(n2, fn hi2 =>
380                    uIf(oper, hi1, hi2,                    uIf(cmpHi, hi1, hi2,
381                      tr',                      tr',
382                      uIf(P.EQL, hi1, hi2,                      uIf(P.EQL, hi1, hi2,
383                        getLo32(n1, fn lo1 =>                        getLo32(n1, fn lo1 =>
384                        getLo32(n2, fn lo2 =>                        getLo32(n2, fn lo2 =>
385                          uIf(oper, lo1, lo2, tr', fl'))),                          uIf(cmpLo, lo1, lo2, tr', fl'))),
386                        fl'))))))                        fl'))))))
387              end              end
388      in      in
389      val w64Less = w64Cmp P.LT      val w64Less = w64Cmp (P.LT, P.LT)
390      val w64LessEq = w64Cmp P.LTE      val w64LessEq = w64Cmp (P.LT, P.LTE)
391      val w64Greater = w64Cmp P.GT      val w64Greater = w64Cmp (P.GT, P.GT)
392      val w64GreaterEq = w64Cmp P.GTE      val w64GreaterEq = w64Cmp (P.GT, P.GTE)
393      end (* local *)      end (* local *)
394
395    (***** Int64 primitive operations *****)    (***** Int64 primitive operations *****)
# Line 487  Line 487
487
488    (* the basic pattern for comparisons is    (* the basic pattern for comparisons is
489     *   fun cmp ((hi1, lo1), (hi2, lo2)) =     *   fun cmp ((hi1, lo1), (hi2, lo2)) =
490     *         OP(hi1, hi2) orelse ((hi1 = hi2) andalso OP(lo1, lo2))     *         cmpHi(hi1, hi2) orelse ((hi1 = hi2) andalso cmpLo(lo1, lo2))
491     *)     *)
492      local      local
493        fun i64Cmp oper (n1, n2, tr, fl) = let        fun i64Cmp (cmpHi, cmpLo) (n1, n2, tr, fl) = let
494            (* continuations for the branches so that we can avoid code duplication *)            (* continuations for the branches so that we can avoid code duplication *)
495              val trFnId = LV.mkLvar()              val trFnId = LV.mkLvar()
496              val tr' = C.APP(C.VAR trFnId, [])              val tr' = C.APP(C.VAR trFnId, [])
# Line 505  Line 505
505                (* (hi1 < hi2) orelse ((hi1 = hi2) andalso (lo1 < lo2)) *)                (* (hi1 < hi2) orelse ((hi1 = hi2) andalso (lo1 < lo2)) *)
506                  getHi32(n1, fn hi1 =>                  getHi32(n1, fn hi1 =>
507                  getHi32(n2, fn hi2 =>                  getHi32(n2, fn hi2 =>
508                    uIf(oper, hi1, hi2,                    sIf(cmpHi, hi1, hi2,
509                      tr',                      tr',
510                      uIf(P.EQL, hi1, hi2,                      sIf(P.EQL, hi1, hi2,
511                        getLo32(n1, fn lo1 =>                        getLo32(n1, fn lo1 =>
512                        getLo32(n2, fn lo2 =>                        getLo32(n2, fn lo2 =>
513                          uIf(oper, lo1, lo2, tr', fl'))),                          sIf(cmpLo, lo1, lo2, tr', fl'))),
514                        fl'))))))                        fl'))))))
515              end              end
516      in      in
517      val i64Less = i64Cmp P.LT      val i64Less = i64Cmp (P.LT, P.LT)
518      val i64LessEq = i64Cmp P.LTE      val i64LessEq = i64Cmp (P.LT, P.LTE)
519      val i64Greater = i64Cmp P.GT      val i64Greater = i64Cmp (P.GT, P.GT)
520      val i64GreaterEq = i64Cmp P.GTE      val i64GreaterEq = i64Cmp (P.GT, P.GTE)
521      end (* local *)      end (* local *)
522
523    (***** conversions *****)    (***** conversions *****)

Legend:
 Removed from v.5163 changed lines Added in v.5164