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/compiler/CodeGen/x86/x86MLTreeExtComp.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/CodeGen/x86/x86MLTreeExtComp.sml

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

revision 730, Fri Nov 10 14:04:49 2000 UTC revision 731, Fri Nov 10 22:57:45 2000 UTC
# Line 11  Line 11 
11     type reducer =     type reducer =
12       (I.instruction,C.regmap,C.cellset,I.operand,I.addressing_mode) T.reducer       (I.instruction,C.regmap,C.cellset,I.operand,I.addressing_mode) T.reducer
13    
14       val fast_fp = MLRiscControl.getFlag "x86-fast-fp"
15    
16     fun unimplemented _ = MLRiscErrorMsg.impossible "X86MLTreeExtComp"     fun unimplemented _ = MLRiscErrorMsg.impossible "X86MLTreeExtComp"
17    
18     val compileSext  = unimplemented     val compileSext  = unimplemented
# Line 18  Line 20 
20     val compileCCext = unimplemented     val compileCCext = unimplemented
21     fun compileFext (T.REDUCER{reduceFexp, emit, ...}:reducer) = let     fun compileFext (T.REDUCER{reduceFexp, emit, ...}:reducer) = let
22       fun comp{e=(64, fexp), fd:C.cell, an:T.an list} = let       fun comp{e=(64, fexp), fd:C.cell, an:T.an list} = let
            val fpTmpMem  =  X86Runtime.fpTempMemOff  
23             fun trig(f, foper) =             fun trig(f, foper) =
24               (reduceFexp f; emit(I.FUNARY foper, an))               (reduceFexp f; emit(I.FUNARY foper, an))
25           in           in
# Line 26  Line 27 
27             of Ext.FSINE f => trig(f, I.FSIN)             of Ext.FSINE f => trig(f, I.FSIN)
28              | Ext.FCOSINE f => trig(f, I.FCOS)              | Ext.FCOSINE f => trig(f, I.FCOS)
29              | Ext.FTANGENT f =>              | Ext.FTANGENT f =>
30                 (trig(f, I.FTAN);                 (trig(f, I.FPTAN);
31                  emit(I.FSTPL(I.Displace{base=C.esp,                  emit(I.FSTPL(I.ST(C.ST 0)), [])
32                                          disp=I.Immed(fpTmpMem),                 )
                                         mem=I.Region.stack}),  
                      []))  
   
33           end           end
34         | comp _ = MLRiscErrorMsg.impossible "compileFext"         | comp _ = MLRiscErrorMsg.impossible "compileFext"
35     in comp  
36         fun fastComp{e=(64, fexp), fd:C.cell, an:T.an list} =
37             let fun Freg f = if f >= 32+8 andalso f < 32+32 (* hardwired! *)
38                              then I.FDirect f else I.FPR f
39                 val (unOp, f) =
40                         case fexp of
41                           Ext.FSINE f => (I.FSIN, f)
42                         | Ext.FCOSINE f => (I.FCOS, f)
43                         | Ext.FTANGENT f => (I.FPTAN, f)
44             in  emit(I.FUNOP{fsize=I.FP64,
45                              unOp=unOp,src=Freg(reduceFexp f),dst=Freg fd}, an)
46             end
47           | fastComp _ = MLRiscErrorMsg.impossible "compileFext"
48    
49       in if !fast_fp then fastComp else comp
50     end     end
51  end  end

Legend:
Removed from v.730  
changed lines
  Added in v.731

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