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

Diff of /MLRISC/trunk/amd64/mltree/amd64-gen.sml

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

revision 2928, Fri Jan 18 00:50:49 2008 UTC revision 2929, Fri Jan 18 20:40:28 2008 UTC
# Line 17  Line 17 
17      val signBit : int -> Label.label      val signBit : int -> Label.label
18      (* Same as signBit, except the high bit is zero and the low bits are 1s. *)      (* Same as signBit, except the high bit is zero and the low bits are 1s. *)
19      val negateSignBit : int -> Label.label      val negateSignBit : int -> Label.label
20    
21       (* guaranteeing that floats are stored at 16-byte aligned addresses reduces the number of instructions *)
22        val floats16ByteAligned : bool
23     ) : MLTREECOMP = struct     ) : MLTREECOMP = struct
24    
25      structure TS = ExtensionComp.TS      structure TS = ExtensionComp.TS
# Line 899  Line 902 
902               | e => I.FDirect (fexpToReg (fty, e))               | e => I.FDirect (fexpToReg (fty, e))
903              (* end case *))              (* end case *))
904    
905            and falignedOperand (fty, e) = if floats16ByteAligned
906                then foperand (fty, e)
907                else I.FDirect (fexpToReg (fty, e))
908    
909         (* SSE binary ops         (* SSE binary ops
910          *         (src)      (dst)          *         (src)      (dst)
911          * binOp   freg/m64, freg          * binOp   freg/m64, freg
# Line 918  Line 925 
925              end              end
926    
927          and fsqrt (fty, d, a, an) = let          and fsqrt (fty, d, a, an) = let
928              val s = fexpToReg (fty, a)              val s = falignedOperand (fty, a)
929              (* TODO: allow the source operand to be a memory location              (* TODO: allow the source operand to be a memory location
930               * val aOpnd = foperand (fty, a)               * val aOpnd = foperand (fty, a)
931               *)               *)
# Line 928  Line 935 
935                     | _ => error "fsqrt"                     | _ => error "fsqrt"
936                    (* end case *))                    (* end case *))
937              in              in
938                mark (oper {src=I.FDirect s, dst=I.FDirect d}, an)                mark (oper {src=s, dst=I.FDirect d}, an)
939              end              end
940    
941          and convertf2f (fromTy, toTy, e, d, an) = let          and convertf2f (fromTy, toTy, e, d, an) = let
# Line 971  Line 978 
978                        | 64 => I.XORPD                        | 64 => I.XORPD
979                       (* end case *))                       (* end case *))
980                   val r = newFreg ()                   val r = newFreg ()
981                   val s = fexpToReg (fty, a)                   val s = falignedOperand (fty, a)
                  (* TODO: allow the source operand to be a memory location or register  
                   * val src = foperand (fty, a)  
                   *)  
982                   in                   in
983                       fload (fty, T.LABEL l, I.Region.memory, r, an);                       fload (fty, T.LABEL l, I.Region.memory, r, an);
984                       mark (I.FBINOP {binOp=fop, dst=s, src=I.FDirect r}, an);                       mark (I.FBINOP {binOp=fop, dst=r, src=s}, an);
985                       fcopy (fty, [d], [r], an)                       fcopy (fty, [d], [r], an)
986                   end                   end
987                 | T.FABS (_, a) => let                 | T.FABS (_, a) => let
# Line 987  Line 991 
991                        | 64 => I.ANDPD                        | 64 => I.ANDPD
992                       (* end case *))                       (* end case *))
993                   val r = newFreg ()                   val r = newFreg ()
994                   val s = fexpToReg (fty, a)                   val s = falignedOperand (fty, a)
                  (* TODO: allow the source operand to be a memory location or register  
                   * val src = foperand (fty, a)  
                   *)  
995                   in                   in
996                       fload (fty, T.LABEL l, I.Region.memory, r, an);                       fload (fty, T.LABEL l, I.Region.memory, r, an);
997                       mark (I.FBINOP {binOp=fop, dst=r, src=I.FDirect s}, an);                       mark (I.FBINOP {binOp=fop, dst=r, src=s}, an);
998                       fcopy (fty, [d], [r], an)                       fcopy (fty, [d], [r], an)
999                   end                   end
1000                 | T.FSQRT (fty, a) => fsqrt (fty, d, a, an)                 | T.FSQRT (fty, a) => fsqrt (fty, d, a, an)

Legend:
Removed from v.2928  
changed lines
  Added in v.2929

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