Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/mid-to-low/mk-low-ir.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/mid-to-low/mk-low-ir.sml

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

revision 3968, Tue Jun 14 19:49:02 2016 UTC revision 3969, Wed Jun 15 01:37:57 2016 UTC
# Line 47  Line 47 
47      val realArcSin : AvailRHS.t * LowIR.var -> LowIR.var      val realArcSin : AvailRHS.t * LowIR.var -> LowIR.var
48      val realTan    : AvailRHS.t * LowIR.var -> LowIR.var      val realTan    : AvailRHS.t * LowIR.var -> LowIR.var
49      val realArcTan : AvailRHS.t * LowIR.var -> LowIR.var      val realArcTan : AvailRHS.t * LowIR.var -> LowIR.var
50        val realExp   : AvailRHS.t * LowIR.var -> LowIR.var
51        val intPow   : AvailRHS.t * LowIR.var * int -> LowIR.var
52    
53    (* vector arithmetic *)    (* vector arithmetic *)
54      val vecAdd   : AvailRHS.t * int * LowIR.var * LowIR.var -> LowIR.var      val vecAdd   : AvailRHS.t * int * LowIR.var * LowIR.var -> LowIR.var
# Line 128  Line 130 
130      val realDiv = scalarOp2 Op.RDiv      val realDiv = scalarOp2 Op.RDiv
131      val realNeg = scalarOp1 Op.RNeg      val realNeg = scalarOp1 Op.RNeg
132      val realSqrt = scalarOp1 Op.Sqrt      val realSqrt = scalarOp1 Op.Sqrt
133        val realExp = scalarOp1 Op.Exp
134      val realCos = scalarOp1 Op.Cos      val realCos = scalarOp1 Op.Cos
135      val realArcCos = scalarOp1 Op.ArcCos      val realArcCos = scalarOp1 Op.ArcCos
136      val realSin = scalarOp1 Op.Sin      val realSin = scalarOp1 Op.Sin
137      val realArcSin = scalarOp1 Op.ArcSin      val realArcSin = scalarOp1 Op.ArcSin
138      val realTan = scalarOp1 Op.Tan      val realTan = scalarOp1 Op.Tan
139      val realArcTan = scalarOp1 Op.ArcTan      val realArcTan = scalarOp1 Op.ArcTan
140    
141      end (* local *)      end (* local *)
142    
143    (* vector arithmetic *)    (* vector arithmetic *)
# Line 211  Line 215 
215                then intToRealLit (avail, 1)                then intToRealLit (avail, 1)
216                else intToRealLit (avail, ~1)                else intToRealLit (avail, ~1)
217            end            end
218        fun intPow(avail, x, pow_n) = let
219          fun pow (1, avail) = x
220          | pow (2, avail) =  add (avail, "_Pow_2", Ty.realTy, IR.OP(Op.RMul, [x, x]))
221          | pow (n, avail) = let
222            fun half m = let
223                val y = pow (m div 2, avail)
224                val name = String.concat["_Pow", Int.toString (m), "_"]
225                in add (avail, name, Ty.realTy, IR.OP(Op.RMul, [y, y])) end
226            in if ((n mod 2) = 0)
227                then half n
228                else let
229                    val y = half (n-1)
230                    val name = String.concat["_Pow", Int.toString (n), "_"]
231                    in add (avail, name, Ty.realTy, IR.OP(Op.RMul, [x, y])) end
232          end
233          in
234            pow (pow_n, avail)
235          end
236    
237    end    end

Legend:
Removed from v.3968  
changed lines
  Added in v.3969

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