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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/c-target/c-target.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/c-target/c-target.sml

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

revision 3168, Sun Mar 29 20:46:53 2015 UTC revision 3169, Sun Mar 29 22:17:50 2015 UTC
# Line 99  Line 99 
99      (*isHwVec: int->bool      (*isHwVec: int->bool
100      * Can this vector size be supported with one piece,      * Can this vector size be supported with one piece,
101      *)      *)
102      fun isHwVec width=  if(width>4) then false else true      fun isHwVec width = (width <= 4)
103    
104      (*isVectTy:int-> bool      (*isVectTy:int-> bool
105      *is vector int supported with Diderot_Vec      *is vector int supported with Diderot_Vec
# Line 156  Line 156 
156  *)  *)
157      (* getPieces:int->int list      (* getPieces:int->int list
158      * Breaks vector operation of  size n into HW supported pieces      * Breaks vector operation of  size n into HW supported pieces
159      * 6->[4,2]      * E.g., 6->[4,2]
160      *)      *)
161      fun getPieces n=let      fun getPieces n=let
162          fun F(0,vecSize,track)=track          fun F(0,vecSize,track)=track
163          | F(c,vecSize,track)=          | F(c,vecSize,track)=
164              if (c>=vecSize) then F(c-vecSize, vecSize,track@[vecSize])                  if (c>=vecSize)
165                      then F(c-vecSize, vecSize, track@[vecSize])
166              else F(c, getSmallest vecSize,track)              else F(c, getSmallest vecSize,track)
167          in          in
168              F(n,getLargest n,[])              F(n,getLargest n,[])
# Line 174  Line 175 
175      *Pieces-vector operation broken up into piece sizes      *Pieces-vector operation broken up into piece sizes
176      *)      *)
177      fun getVecTy n= let      fun getVecTy n= let
         (*val _ =print ("\n\n  getVecTy-"^Int.toString(n))*)  
178          (*Looks for next largest length supported*)          (*Looks for next largest length supported*)
179          fun fillVec vn =(case (isVecTy vn)            fun fillVec vn = if isVecTy vn
180              of true => (true,vn,[vn])                  then (true, vn, [vn])
181              | false => fillVec(vn+1)                  else fillVec (vn+1)
             (*end case*))  
         val (isFill,newSize,Pieces)= (case (isVecTy n)  
             of true=> (false,n,[n])  
             | false=> (case isHwVec n  
                 of false=>  (false,n,(getPieces n))  
                 | true=>  fillVec (n+1)  
                 (*end case*))  
             (*end case*))  
182          in          in
183              (isFill,newSize,Pieces)              if isVecTy n
184                  then (false, n, [n])
185                else if isHwVec n
186                  then fillVec (n+1)
187                  else (false, n, getPieces n)
188          end          end
189    
190      (*Program , Opr-> Program with new CLang declations *)      (*Program , Opr-> Program with new CLang declations *)

Legend:
Removed from v.3168  
changed lines
  Added in v.3169

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