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/sparc/sparcPseudoInstrs.sml
 [smlnj] / sml / trunk / src / compiler / CodeGen / sparc / sparcPseudoInstrs.sml

Diff of /sml/trunk/src/compiler/CodeGen/sparc/sparcPseudoInstrs.sml

revision 1002, Fri Nov 30 17:11:33 2001 UTC revision 1003, Fri Dec 7 02:45:32 2001 UTC
# Line 29  Line 29
29    val native = true  (* use native versions of the instructions? *)    val native = true  (* use native versions of the instructions? *)
30
31    fun umul_native({r, i, d}, reduceOpnd) =    fun umul_native({r, i, d}, reduceOpnd) =
32        [I.ARITH{a=I.UMUL,r=r,i=i,d=d}]        [I.arith{a=I.UMUL,r=r,i=i,d=d}]
33
34    val TNE = I.Ticc{t=I.BNE,cc=I.ICC,r=C.r0,i=I.IMMED 7}    val TNE = I.ticc{t=I.BNE,cc=I.ICC,r=C.r0,i=I.IMMED 7}
35    val TVS = I.Ticc{t=I.BVS,cc=I.ICC,r=C.r0,i=I.IMMED 7}    val TVS = I.ticc{t=I.BVS,cc=I.ICC,r=C.r0,i=I.IMMED 7}
36
37        (* overflows iff Y != (d ~>> 31) *)        (* overflows iff Y != (d ~>> 31) *)
38    fun smul_native({r, i, d}, reduceOpnd) =    fun smul_native({r, i, d}, reduceOpnd) =
39        let val t1 = C.newReg()        let val t1 = C.newReg()
40            val t2 = C.newReg()            val t2 = C.newReg()
41        in  [I.ARITH{a=I.SMUL,r=r,i=i,d=d},        in  [I.arith{a=I.SMUL,r=r,i=i,d=d},
42             I.SHIFT{s=I.SRA,r=d,i=I.IMMED 31,d=t1},             I.shift{s=I.SRA,r=d,i=I.IMMED 31,d=t1},
43             I.RDY{d=t2},             I.rdy{d=t2},
44             I.ARITH{a=I.SUBCC,r=t1,i=I.REG t2,d=C.r0},             I.arith{a=I.SUBCC,r=t1,i=I.REG t2,d=C.r0},
45             TNE             TNE
46            ]            ]
47        end        end
48    fun udiv_native({r,i,d},reduceOpnd) =    fun udiv_native({r,i,d},reduceOpnd) =
49        [I.WRY{r=C.r0,i=I.REG C.r0},        [I.wry{r=C.r0,i=I.REG C.r0},
50         I.ARITH{a=I.UDIV,r=r,i=i,d=d}]         I.arith{a=I.UDIV,r=r,i=i,d=d}]
51
52     (* May overflow if MININT div -1 *)     (* May overflow if MININT div -1 *)
53    fun sdiv_native({r,i,d},reduceOpnd) =    fun sdiv_native({r,i,d},reduceOpnd) =
54        let val t1 = C.newReg()        let val t1 = C.newReg()
55        in  [I.SHIFT{s=I.SRA,r=r,i=I.IMMED 31,d=t1},        in  [I.shift{s=I.SRA,r=r,i=I.IMMED 31,d=t1},
56             I.WRY{r=t1,i=I.REG C.r0},             I.wry{r=t1,i=I.REG C.r0},
57             I.ARITH{a=I.SDIVCC,r=r,i=i,d=d},             I.arith{a=I.SDIVCC,r=r,i=i,d=d},
58             TVS             TVS
59            ]            ]
60        end        end
# Line 71  Line 71
73    in    in
74        [I.COPY{src=[r,reduceOpnd i],dst=[r10,r11],        [I.copy{src=[r,reduceOpnd i],dst=[r10,r11],
75                     tmp=SOME(I.Direct(C.newReg())),impl=ref NONE},                     tmp=SOME(I.Direct(C.newReg())),impl=ref NONE},
78                cutsTo=[],nop=true,mem=stack},                cutsTo=[],nop=true,mem=stack},
79         I.COPY{src=[r10],dst=[d],tmp=NONE,impl=ref NONE}         I.copy{src=[r10],dst=[d],tmp=NONE,impl=ref NONE}
80        ]        ]
81    end    end
82
# Line 86  Line 86
86    fun sdivtrap({r, i, d}, reduceOpnd) = callRoutine(sdivOffset,reduceOpnd,r,i,d)    fun sdivtrap({r, i, d}, reduceOpnd) = callRoutine(sdivOffset,reduceOpnd,r,i,d)
87
88    fun cvti2d({i, d}, reduceOpnd) =    fun cvti2d({i, d}, reduceOpnd) =
89        [I.STORE{s=I.ST,r=C.frameptrR,i=floatTmpOffset,d=reduceOpnd i,mem=stack},        [I.store{s=I.ST,r=C.frameptrR,i=floatTmpOffset,d=reduceOpnd i,mem=stack},
91         I.FPop1{a=I.FiTOd,r=d,d=d}         I.fpop1{a=I.FiTOd,r=d,d=d}
92        ]        ]
93    fun cvti2s _ = error "cvti2s"    fun cvti2s _ = error "cvti2s"
94    fun cvti2q _ = error "cvti2q"    fun cvti2q _ = error "cvti2q"
# Line 102  Line 102
102    val sdiv32trap = if native then sdiv_native else sdivtrap    val sdiv32trap = if native then sdiv_native else sdivtrap
103
104    val overflowtrap32 = (* tvs 0x7 *)    val overflowtrap32 = (* tvs 0x7 *)
105                         [I.Ticc{t=I.BVS,cc=I.ICC,r=C.r0,i=I.IMMED 7}]                         [I.ticc{t=I.BVS,cc=I.ICC,r=C.r0,i=I.IMMED 7}]
106    val overflowtrap64 = [] (* not needed *)    val overflowtrap64 = [] (* not needed *)
107
108

Legend:
 Removed from v.1002 changed lines Added in v.1003