Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/x86/instructions/x86Shuffle.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/x86/instructions/x86Shuffle.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 731 - (view) (download)

1 : monnier 247 functor X86Shuffle(I : X86INSTR) : X86SHUFFLE =
2 :     struct
3 :     structure I = I
4 :     structure Shuffle = Shuffle(I)
5 :    
6 : monnier 411 type t = {regmap:int->int, tmp:I.ea option, dst:int list, src:int list}
7 : monnier 247
8 :     exception foo
9 :     val shuffle =
10 :     Shuffle.shuffle
11 :     {mvInstr=fn{dst, src} => [I.MOVE{mvOp=I.MOVL, src=src, dst=dst}],
12 :     ea=I.Direct}
13 :    
14 : leunga 731 (*
15 :     * These assume that the ''registers'' are mapped onto the memory
16 :     *)
17 :    
18 : leunga 585 (* Note, this only works with double precision floating point *)
19 : leunga 731 val shufflefpNormalAndSlow =
20 : monnier 247 Shuffle.shuffle
21 : george 545 {mvInstr=fn{dst, src} => [I.FLDL src, I.FSTPL dst],
22 : monnier 247 ea = I.FDirect}
23 : leunga 585
24 :     (*
25 :     * This version makes use of the x86 floating point stack for hardware
26 :     * renaming!
27 :     *)
28 : leunga 731 fun shufflefpNormal{regmap, tmp, src, dst} =
29 : leunga 585 let val n = length src
30 :     in if n <= 7 then
31 :     let fun gen(s::ss, d::ds, pushes, pops) =
32 :     let val s = regmap s and d = regmap d
33 :     in if s = d then gen(ss, ds, pushes, pops)
34 :     else gen(ss, ds, I.FLDL(I.FDirect s)::pushes,
35 :     I.FSTPL(I.FDirect d)::pops)
36 :     end
37 :     | gen(_, _, pushes, pops) = List.revAppend(pushes, pops)
38 :     in gen(src, dst, [], []) end
39 : leunga 731 else shufflefpNormalAndSlow{regmap=regmap, tmp=tmp, src=src, dst=dst}
40 : leunga 585 end
41 :    
42 : leunga 731 (*
43 :     * These assume that the ''registers'' are mapped onto the pseudo
44 :     * %fpr register. Only works with double precision floating point for
45 :     * now...
46 :     *)
47 :     val shufflefpFast =
48 :     Shuffle.shuffle
49 :     {mvInstr=fn{dst, src} => [I.FMOVE{fsize=I.FP64,src=src, dst=dst}],
50 :     ea = I.FPR}
51 :    
52 :     fun shufflefp(x as {tmp=SOME(I.FPR _), dst, src, regmap}) = shufflefpFast x
53 :     | shufflefp x = shufflefpNormal x
54 :    
55 : monnier 247 end
56 :    

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