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/trunk/src/MLRISC/hppa/mltree/hppa.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/hppa/mltree/hppa.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1182, Thu Mar 28 16:41:29 2002 UTC revision 1183, Fri Mar 29 19:09:48 2002 UTC
# Line 83  Line 83 
83     (* unsigned, non-trapping version of multiply and divide *)     (* unsigned, non-trapping version of multiply and divide *)
84     structure Mulu32 = Multiply32     structure Mulu32 = Multiply32
85      (val trapping = false      (val trapping = false
      val signed   = false  
86       val multCost = costOfMultiply       val multCost = costOfMultiply
87       val divCost  = costOfDivision       val divCost  = costOfDivision
88       fun addv{r1,r2,d} = [I.arith{a=I.ADD,r1=r1,r2=r2,t=d}]       fun addv{r1,r2,d} = [I.arith{a=I.ADD,r1=r1,r2=r2,t=d}]
# Line 94  Line 93 
93      )      )
94      (val signed   = false)      (val signed   = false)
95    
96       (* signed, non-trapping version of multiply and divide *)
97       structure Muls32 = Multiply32
98        (val trapping = false
99         val multCost = costOfMultiply
100         val divCost  = costOfDivision
101         fun addv{r1,r2,d} = [I.arith{a=I.ADD,r1=r1,r2=r2,t=d}]
102         fun subv{r1,r2,d} = [I.arith{a=I.SUB,r1=r1,r2=r2,t=d}]
103         val sh1addv = SOME(fn{r1,r2,d} => [I.arith{a=I.SH1ADDL,r1=r1,r2=r2,t=d}])
104         val sh2addv = SOME(fn{r1,r2,d} => [I.arith{a=I.SH2ADDL,r1=r1,r2=r2,t=d}])
105         val sh3addv = SOME(fn{r1,r2,d} => [I.arith{a=I.SH3ADDL,r1=r1,r2=r2,t=d}])
106        )
107        (val signed   = true)
108    
109     fun error msg = MLRiscErrorMsg.error("Hppa",msg)     fun error msg = MLRiscErrorMsg.error("Hppa",msg)
110    
111     datatype ea = datatype I.addressing_mode     datatype ea = datatype I.addressing_mode
# Line 593  Line 605 
605              * d <- if r >= 0 then r else d              * d <- if r >= 0 then r else d
606              *)              *)
607         and divu32 x = Mulu32.divide{mode=T.TO_ZERO,stm=doStmt} x         and divu32 x = Mulu32.divide{mode=T.TO_ZERO,stm=doStmt} x
608           and divs32 x = Muls32.divide{mode=T.TO_ZERO,stm=doStmt} x
609         and divt32 x = Mult32.divide{mode=T.TO_ZERO,stm=doStmt} x         and divt32 x = Mult32.divide{mode=T.TO_ZERO,stm=doStmt} x
610    
611         and muldiv(ty,genConst,milliFn,a,b,t,commute,an) =         and muldiv(ty,genConst,milliFn,a,b,t,commute,an) =
# Line 739  Line 752 
752             | T.SRL(_,a,b)  => shift(I.EXTRU,I.VEXTRU,a,b,t,an)             | T.SRL(_,a,b)  => shift(I.EXTRU,I.VEXTRU,a,b,t,an)
753             | T.SRA(_,a,b)  => shift(I.EXTRS,I.VEXTRS,a,b,t,an)             | T.SRA(_,a,b)  => shift(I.EXTRS,I.VEXTRS,a,b,t,an)
754             | T.MULU(32,a,b) => muldiv(32,Mulu32.multiply,MC.mulu,a,b,t,true,an)             | T.MULU(32,a,b) => muldiv(32,Mulu32.multiply,MC.mulu,a,b,t,true,an)
755               | T.MULS(32,a,b) => muldiv(32,Muls32.multiply,MC.mulu,a,b,t,true,an)
756             | T.MULT(32,a,b) => muldiv(32,Mult32.multiply,MC.mulo,a,b,t,true,an)             | T.MULT(32,a,b) => muldiv(32,Mult32.multiply,MC.mulo,a,b,t,true,an)
757             | T.DIVU(32,a,b)  => muldiv(32,divu32,MC.divu,a,b,t,false,an)             | T.DIVU(32,a,b)  => muldiv(32,divu32,MC.divu,a,b,t,false,an)
758    (* FIXME: The following is a hack:  We use the trapping div in place of
759     *        the non-trapping since we currently expect that the non-trapping
760     *        div will only be used where there is some high-level reasoning
761     *        that the trapping div would in fact not trap.  *)
762               | T.DIVS(T.DIV_TO_ZERO,32,a,b) =>
763                                    muldiv(32,divs32,MC.divo,a,b,t,false,an)
764             | T.DIVT(T.DIV_TO_ZERO,32,a,b) =>             | T.DIVT(T.DIV_TO_ZERO,32,a,b) =>
765                                  muldiv(32,divt32,MC.divo,a,b,t,false,an)                                  muldiv(32,divt32,MC.divo,a,b,t,false,an)
766    

Legend:
Removed from v.1182  
changed lines
  Added in v.1183

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0