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/branches/idlbasis-devel/src/MLRISC/ppc/emit/ppcMC.sml
ViewVC logotype

Diff of /sml/branches/idlbasis-devel/src/MLRISC/ppc/emit/ppcMC.sml

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

revision 651, Thu Jun 1 18:34:03 2000 UTC revision 744, Fri Dec 8 04:11:42 2000 UTC
# Line 1  Line 1 
1  (*  (*
2   * This file was automatically generated by MDGen (v2.0)   * WARNING: This file was automatically generated by MDLGen (v3.0)
3   * from the machine description file "ppc/ppc.md".   * from the machine description file "ppc/ppc.mdl".
4     * DO NOT EDIT this file directly
5   *)   *)
6    
7    
# Line 54  Line 55 
55         fun init n = (CodeString.init n; loc := 0)         fun init n = (CodeString.init n; loc := 0)
56    
57    
58         fun emitter regmap =     fun eWord32 w =
59         let         let val b8 = w
    fun eWord32 w = let  
           val b8 = w  
60            val w = w >> 0wx8            val w = w >> 0wx8
61            val b16 = w            val b16 = w
62            val w = w >> 0wx8            val w = w >> 0wx8
# Line 70  Line 69 
69            eByteW b16;            eByteW b16;
70            eByteW b8 )            eByteW b8 )
71         end         end
72       fun emit_GP r = itow (C.physicalRegisterNum r)
73     fun emit_GP r = itow (regmap r)     and emit_FP r = itow (C.physicalRegisterNum r)
74     and emit_FP r = itow ((regmap r) - 32)     and emit_CC r = itow (C.physicalRegisterNum r)
75     and emit_CC r = itow ((regmap r) - 64)     and emit_SPR r = itow (C.physicalRegisterNum r)
76     and emit_SPR r = itow ((regmap r) - 72)     and emit_MEM r = itow (C.physicalRegisterNum r)
77     and emit_MEM r = itow ((regmap r) - 104)     and emit_CTRL r = itow (C.physicalRegisterNum r)
78     and emit_CTRL r = itow ((regmap r) - 104)     and emit_CELLSET r = itow (C.physicalRegisterNum r)
79     fun emit_operand (I.RegOp GP) = emit_GP GP     fun emit_operand (I.RegOp GP) = emit_GP GP
80       | emit_operand (I.ImmedOp int) = itow int       | emit_operand (I.ImmedOp int) = itow int
81       | emit_operand (I.LabelOp labexp) = itow (LabelExp.valueOf labexp)       | emit_operand (I.LabelOp labexp) = itow (LabelExp.valueOf labexp)
# Line 121  Line 120 
120       | emit_bo (I.FALSE) = (0wx4 : Word32.word)       | emit_bo (I.FALSE) = (0wx4 : Word32.word)
121       | emit_bo (I.ALWAYS) = (0wx14 : Word32.word)       | emit_bo (I.ALWAYS) = (0wx14 : Word32.word)
122       | emit_bo (I.COUNTER{eqZero, cond}) =       | emit_bo (I.COUNTER{eqZero, cond}) =
123         (         (case cond of
         case cond of  
124          NONE => (if eqZero          NONE => (if eqZero
125             then 0wx12             then 0wx12
126             else 0wx10)             else 0wx10)
127        | SOME cc =>        | SOME cc =>
128          (           (case (eqZero, cc) of
          case (eqZero, cc) of  
129           (false, false) => 0wx0           (false, false) => 0wx0
130         | (false, true) => 0wx8         | (false, true) => 0wx8
131         | (true, false) => 0wx2         | (true, false) => 0wx2
# Line 179  Line 176 
176       | emit_ccarith (I.CREQV) = (0wx121 : Word32.word)       | emit_ccarith (I.CREQV) = (0wx121 : Word32.word)
177       | emit_ccarith (I.CRANDC) = (0wx81 : Word32.word)       | emit_ccarith (I.CRANDC) = (0wx81 : Word32.word)
178       | emit_ccarith (I.CRORC) = (0wx1a1 : Word32.word)       | emit_ccarith (I.CRORC) = (0wx1a1 : Word32.word)
179     fun x_form {opcd, rt, ra, rb, xo, rc} = let     fun x_form {opcd, rt, ra, rb, xo, rc} =
180            val rc = emit_bool rc         let val rc = emit_bool rc
181         in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xo << 0wx1) + rc)))))         in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xo << 0wx1) + rc)))))
182         end         end
183       and xl_form {opcd, bt, ba, bb, xo, lk} =
184     and xl_form {opcd, bt, ba, bb, xo, lk} = let         let val lk = emit_bool lk
           val lk = emit_bool lk  
185         in eWord32 ((opcd << 0wx1a) + ((bt << 0wx15) + ((ba << 0wx10) + ((bb << 0wxb) + ((xo << 0wx1) + lk)))))         in eWord32 ((opcd << 0wx1a) + ((bt << 0wx15) + ((ba << 0wx10) + ((bb << 0wxb) + ((xo << 0wx1) + lk)))))
186         end         end
187       and m_form {opcd, rs, ra, rb, mb, me, rc} =
188     and m_form {opcd, rs, ra, rb, mb, me, rc} = let         let val rc = emit_bool rc
           val rc = emit_bool rc  
189         in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + rc))))))         in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + rc))))))
190         end         end
191       and a_form {opcd, frt, fra, frb, frc, xo, rc} =
192     and a_form {opcd, frt, fra, frb, frc, xo, rc} = let         let val rc = emit_bool rc
           val rc = emit_bool rc  
193         in eWord32 ((opcd << 0wx1a) + ((frt << 0wx15) + ((fra << 0wx10) + ((frb << 0wxb) + ((frc << 0wx6) + ((xo << 0wx1) + rc))))))         in eWord32 ((opcd << 0wx1a) + ((frt << 0wx15) + ((fra << 0wx10) + ((frb << 0wxb) + ((frc << 0wx6) + ((xo << 0wx1) + rc))))))
194         end         end
195       and loadx {rt, ra, rb, xop} =
196     and loadx {rt, ra, rb, xop} = let         let val rt = emit_GP rt
           val rt = emit_GP rt  
197            val ra = emit_GP ra            val ra = emit_GP ra
198            val rb = emit_GP rb            val rb = emit_GP rb
199         in eWord32 ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))         in eWord32 ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
200         end         end
201       and loadd {opcd, rt, ra, d} =
202     and loadd {opcd, rt, ra, d} = let         let val rt = emit_GP rt
           val rt = emit_GP rt  
203            val ra = emit_GP ra            val ra = emit_GP ra
204            val d = emit_operand d            val d = emit_operand d
205         in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))         in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
206         end         end
207       and loadde {opcd, rt, ra, de, xop} =
208     and loadde {opcd, rt, ra, de, xop} = let         let val rt = emit_GP rt
           val rt = emit_GP rt  
209            val ra = emit_GP ra            val ra = emit_GP ra
210            val de = emit_operand de            val de = emit_operand de
211         in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))         in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
212         end         end
   
213     and load {ld, rt, ra, d} =     and load {ld, rt, ra, d} =
214         (         (case (d, ld) of
         case (d, ld) of  
215          (I.RegOp rb, I.LBZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx57}          (I.RegOp rb, I.LBZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx57}
216        | (I.RegOp rb, I.LBZE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx5f}        | (I.RegOp rb, I.LBZE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx5f}
217        | (I.RegOp rb, I.LHZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx117}        | (I.RegOp rb, I.LHZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx117}
# Line 242  Line 231 
231        | (de, I.LWZE) => loadde {opcd=0wx3a, rt=rt, ra=ra, de=de, xop=0wx6}        | (de, I.LWZE) => loadde {opcd=0wx3a, rt=rt, ra=ra, de=de, xop=0wx6}
232        | (de, I.LDE) => loadde {opcd=0wx3e, rt=rt, ra=ra, de=de, xop=0wx0}        | (de, I.LDE) => loadde {opcd=0wx3e, rt=rt, ra=ra, de=de, xop=0wx0}
233         )         )
234     and floadx {ft, ra, rb, xop} = let     and floadx {ft, ra, rb, xop} =
235            val ft = emit_FP ft         let val ft = emit_FP ft
236            val ra = emit_GP ra            val ra = emit_GP ra
237            val rb = emit_GP rb            val rb = emit_GP rb
238         in eWord32 ((ft << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))         in eWord32 ((ft << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
239         end         end
240       and floadd {opcd, ft, ra, d} =
241     and floadd {opcd, ft, ra, d} = let         let val ft = emit_FP ft
           val ft = emit_FP ft  
242            val ra = emit_GP ra            val ra = emit_GP ra
243            val d = emit_operand d            val d = emit_operand d
244         in eWord32 ((opcd << 0wx1a) + ((ft << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))         in eWord32 ((opcd << 0wx1a) + ((ft << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
245         end         end
246       and floadde {opcd, ft, ra, de, xop} =
247     and floadde {opcd, ft, ra, de, xop} = let         let val ft = emit_FP ft
           val ft = emit_FP ft  
248            val ra = emit_GP ra            val ra = emit_GP ra
249            val de = emit_operand de            val de = emit_operand de
250         in eWord32 ((opcd << 0wx1a) + ((ft << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))         in eWord32 ((opcd << 0wx1a) + ((ft << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
251         end         end
   
252     and fload {ld, ft, ra, d} =     and fload {ld, ft, ra, d} =
253         (         (case (d, ld) of
         case (d, ld) of  
254          (I.RegOp rb, I.LFS) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx217}          (I.RegOp rb, I.LFS) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx217}
255        | (I.RegOp rb, I.LFSE) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx21f}        | (I.RegOp rb, I.LFSE) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx21f}
256        | (I.RegOp rb, I.LFD) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx257}        | (I.RegOp rb, I.LFD) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx257}
# Line 275  Line 260 
260        | (d, I.LFD) => floadd {ft=ft, ra=ra, d=d, opcd=0wx32}        | (d, I.LFD) => floadd {ft=ft, ra=ra, d=d, opcd=0wx32}
261        | (de, I.LFDE) => floadde {ft=ft, ra=ra, de=de, opcd=0wx3e, xop=0wx6}        | (de, I.LFDE) => floadde {ft=ft, ra=ra, de=de, opcd=0wx3e, xop=0wx6}
262         )         )
263     and storex {rs, ra, rb, xop} = let     and storex {rs, ra, rb, xop} =
264            val rs = emit_GP rs         let val rs = emit_GP rs
265            val ra = emit_GP ra            val ra = emit_GP ra
266            val rb = emit_GP rb            val rb = emit_GP rb
267         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
268         end         end
269       and stored {opcd, rs, ra, d} =
270     and stored {opcd, rs, ra, d} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
271            val ra = emit_GP ra            val ra = emit_GP ra
272            val d = emit_operand d            val d = emit_operand d
273         in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))         in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
274         end         end
275       and storede {opcd, rs, ra, de, xop} =
276     and storede {opcd, rs, ra, de, xop} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
277            val ra = emit_GP ra            val ra = emit_GP ra
278            val de = emit_operand de            val de = emit_operand de
279         in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))         in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
280         end         end
   
281     and store {st, rs, ra, d} =     and store {st, rs, ra, d} =
282         (         (case (d, st) of
         case (d, st) of  
283          (I.RegOp rb, I.STB) => storex {rs=rs, ra=ra, rb=rb, xop=0wxd7}          (I.RegOp rb, I.STB) => storex {rs=rs, ra=ra, rb=rb, xop=0wxd7}
284        | (I.RegOp rb, I.STBE) => storex {rs=rs, ra=ra, rb=rb, xop=0wxdf}        | (I.RegOp rb, I.STBE) => storex {rs=rs, ra=ra, rb=rb, xop=0wxdf}
285        | (I.RegOp rb, I.STH) => storex {rs=rs, ra=ra, rb=rb, xop=0wx197}        | (I.RegOp rb, I.STH) => storex {rs=rs, ra=ra, rb=rb, xop=0wx197}
# Line 314  Line 295 
295        | (de, I.STWE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3a, xop=0wxe}        | (de, I.STWE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3a, xop=0wxe}
296        | (de, I.STDE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3e, xop=0wx8}        | (de, I.STDE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3e, xop=0wx8}
297         )         )
298     and fstorex {fs, ra, rb, xop} = let     and fstorex {fs, ra, rb, xop} =
299            val fs = emit_FP fs         let val fs = emit_FP fs
300            val ra = emit_GP ra            val ra = emit_GP ra
301            val rb = emit_GP rb            val rb = emit_GP rb
302         in eWord32 ((fs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))         in eWord32 ((fs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
303         end         end
304       and fstored {opcd, fs, ra, d} =
305     and fstored {opcd, fs, ra, d} = let         let val fs = emit_FP fs
           val fs = emit_FP fs  
306            val ra = emit_GP ra            val ra = emit_GP ra
307            val d = emit_operand d            val d = emit_operand d
308         in eWord32 ((opcd << 0wx1a) + ((fs << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))         in eWord32 ((opcd << 0wx1a) + ((fs << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
309         end         end
310       and fstorede {opcd, fs, ra, de, xop} =
311     and fstorede {opcd, fs, ra, de, xop} = let         let val fs = emit_FP fs
           val fs = emit_FP fs  
312            val ra = emit_GP ra            val ra = emit_GP ra
313            val de = emit_operand de            val de = emit_operand de
314         in eWord32 ((opcd << 0wx1a) + ((fs << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))         in eWord32 ((opcd << 0wx1a) + ((fs << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
315         end         end
   
316     and fstore {st, fs, ra, d} =     and fstore {st, fs, ra, d} =
317         (         (case (d, st) of
         case (d, st) of  
318          (I.RegOp rb, I.STFS) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx297}          (I.RegOp rb, I.STFS) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx297}
319        | (I.RegOp rb, I.STFSE) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx29f}        | (I.RegOp rb, I.STFSE) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx29f}
320        | (I.RegOp rb, I.STFD) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx2d7}        | (I.RegOp rb, I.STFD) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx2d7}
# Line 347  Line 324 
324        | (d, I.STFD) => fstored {fs=fs, ra=ra, d=d, opcd=0wx36}        | (d, I.STFD) => fstored {fs=fs, ra=ra, d=d, opcd=0wx36}
325        | (de, I.STFDE) => fstorede {fs=fs, ra=ra, de=de, opcd=0wx3e, xop=0wxe}        | (de, I.STFDE) => fstorede {fs=fs, ra=ra, de=de, opcd=0wx3e, xop=0wxe}
326         )         )
327     and unary' {ra, rt, OE, oper, Rc} = let     and unary' {ra, rt, OE, oper, Rc} =
328            val ra = emit_GP ra         let val ra = emit_GP ra
329            val rt = emit_GP rt            val rt = emit_GP rt
330            val OE = emit_bool OE            val OE = emit_bool OE
331            val oper = emit_unary oper            val oper = emit_unary oper
332            val Rc = emit_bool Rc            val Rc = emit_bool Rc
333         in eWord32 ((ra << 0wx15) + ((rt << 0wx10) + ((OE << 0wxa) + ((oper << 0wx1) + (Rc + 0wx7c000000)))))         in eWord32 ((ra << 0wx15) + ((rt << 0wx10) + ((OE << 0wxa) + ((oper << 0wx1) + (Rc + 0wx7c000000)))))
334         end         end
   
335     and unary {ra, rt, oper, OE, Rc} =     and unary {ra, rt, oper, OE, Rc} =
336         (         (case oper of
         case oper of  
337          I.NEG => unary' {ra=rt, rt=ra, oper=oper, OE=OE, Rc=Rc}          I.NEG => unary' {ra=rt, rt=ra, oper=oper, OE=OE, Rc=Rc}
338        | _ => unary' {ra=ra, rt=rt, oper=oper, OE=OE, Rc=Rc}        | _ => unary' {ra=ra, rt=rt, oper=oper, OE=OE, Rc=Rc}
339         )         )
340     and arith' {rt, ra, rb, OE, oper, Rc} = let     and arith' {rt, ra, rb, OE, oper, Rc} =
341            val rt = emit_GP rt         let val rt = emit_GP rt
342            val ra = emit_GP ra            val ra = emit_GP ra
343            val rb = emit_GP rb            val rb = emit_GP rb
344            val OE = emit_bool OE            val OE = emit_bool OE
# Line 371  Line 346 
346            val Rc = emit_bool Rc            val Rc = emit_bool Rc
347         in eWord32 ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((OE << 0wxa) + ((oper << 0wx1) + (Rc + 0wx7c000000))))))         in eWord32 ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((OE << 0wxa) + ((oper << 0wx1) + (Rc + 0wx7c000000))))))
348         end         end
349       and arithi' {oper, rt, ra, im} =
350     and arithi' {oper, rt, ra, im} = let         let val oper = emit_arithi oper
           val oper = emit_arithi oper  
351            val rt = emit_GP rt            val rt = emit_GP rt
352            val ra = emit_GP ra            val ra = emit_GP ra
353            val im = emit_operand im            val im = emit_operand im
354         in eWord32 ((oper << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (im && 0wxffff))))         in eWord32 ((oper << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (im && 0wxffff))))
355         end         end
356       and srawi {rs, ra, sh} =
357     and srawi {rs, ra, sh} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
358            val ra = emit_GP ra            val ra = emit_GP ra
359            val sh = emit_operand sh            val sh = emit_operand sh
360         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + (((sh && 0wx1f) << 0wxb) + 0wx7c000670)))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + (((sh && 0wx1f) << 0wxb) + 0wx7c000670)))
361         end         end
362       and sradi' {rs, ra, sh, sh2} =
363     and sradi' {rs, ra, sh, sh2} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
364            val ra = emit_GP ra            val ra = emit_GP ra
365         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((sh2 << 0wx1) + 0wx7c000674))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((sh2 << 0wx1) + 0wx7c000674))))
366         end         end
367       and sradi {rs, ra, sh} =
368     and sradi {rs, ra, sh} = let         let val sh = emit_operand sh
           val sh = emit_operand sh  
369         in sradi' {rs=rs, ra=ra, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1)}         in sradi' {rs=rs, ra=ra, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1)}
370         end         end
   
371     and arith {oper, rt, ra, rb, OE, Rc} =     and arith {oper, rt, ra, rb, OE, Rc} =
372         (         (case oper of
373          case oper of           (I.ADD | I.SUBF | I.MULLW | I.MULLD | I.MULHW | I.MULHWU | I.DIVW | I.DIVD | I.DIVWU | I.DIVDU) =>
374          (I.ADD | I.SUBF | I.MULLW | I.MULLD | I.MULHW | I.MULHWU | I.DIVW | I.DIVD | I.DIVWU | I.DIVDU) => arith' {oper=oper, rt=rt, ra=ra, rb=rb, OE=OE, Rc=Rc}              arith' {oper=oper, rt=rt, ra=ra, rb=rb, OE=OE, Rc=Rc}
375        | _ => arith' {oper=oper, rt=ra, ra=rt, rb=rb, OE=OE, Rc=Rc}        | _ => arith' {oper=oper, rt=ra, ra=rt, rb=rb, OE=OE, Rc=Rc}
376         )         )
377     and arithi {oper, rt, ra, im} =     and arithi {oper, rt, ra, im} =
378         (         (case oper of
379          case oper of           (I.ADDI | I.ADDIS | I.SUBFIC | I.MULLI) => arithi' {oper=oper, rt=rt,
380          (I.ADDI | I.ADDIS | I.SUBFIC | I.MULLI) => arithi' {oper=oper, rt=rt, ra=ra, im=im}              ra=ra, im=im}
381        | I.SRAWI => srawi {rs=ra, ra=rt, sh=im}        | I.SRAWI => srawi {rs=ra, ra=rt, sh=im}
382        | I.SRADI => sradi {rs=ra, ra=rt, sh=im}        | I.SRADI => sradi {rs=ra, ra=rt, sh=im}
383        | _ => arithi' {oper=oper, rt=ra, ra=rt, im=im}        | _ => arithi' {oper=oper, rt=ra, ra=rt, im=im}
384         )         )
385     and Cmpl {bf, l, ra, rb} = let     and Cmpl {bf, l, ra, rb} =
386            val bf = emit_CC bf         let val bf = emit_CC bf
387            val l = emit_bool l            val l = emit_bool l
388            val ra = emit_GP ra            val ra = emit_GP ra
389            val rb = emit_GP rb            val rb = emit_GP rb
390         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000040))))         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000040))))
391         end         end
392       and Cmpli {bf, l, ra, ui} =
393     and Cmpli {bf, l, ra, ui} = let         let val bf = emit_CC bf
           val bf = emit_CC bf  
394            val l = emit_bool l            val l = emit_bool l
395            val ra = emit_GP ra            val ra = emit_GP ra
396            val ui = emit_operand ui            val ui = emit_operand ui
397         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((ui && 0wxffff) + 0wx28000000))))         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((ui && 0wxffff) + 0wx28000000))))
398         end         end
399       and Cmp {bf, l, ra, rb} =
400     and Cmp {bf, l, ra, rb} = let         let val bf = emit_CC bf
           val bf = emit_CC bf  
401            val l = emit_bool l            val l = emit_bool l
402            val ra = emit_GP ra            val ra = emit_GP ra
403            val rb = emit_GP rb            val rb = emit_GP rb
404         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000000))))         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000000))))
405         end         end
406       and Cmpi {bf, l, ra, si} =
407     and Cmpi {bf, l, ra, si} = let         let val bf = emit_CC bf
           val bf = emit_CC bf  
408            val l = emit_bool l            val l = emit_bool l
409            val ra = emit_GP ra            val ra = emit_GP ra
410            val si = emit_operand si            val si = emit_operand si
411         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wx2c000000))))         in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wx2c000000))))
412         end         end
   
413     and compare {cmp, bf, l, ra, rb} =     and compare {cmp, bf, l, ra, rb} =
414         (         (case (cmp, rb) of
         case (cmp, rb) of  
415          (I.CMP, I.RegOp rb) => Cmp {bf=bf, l=l, ra=ra, rb=rb}          (I.CMP, I.RegOp rb) => Cmp {bf=bf, l=l, ra=ra, rb=rb}
416        | (I.CMPL, I.RegOp rb) => Cmpl {bf=bf, l=l, ra=ra, rb=rb}        | (I.CMPL, I.RegOp rb) => Cmpl {bf=bf, l=l, ra=ra, rb=rb}
417        | (I.CMP, si) => Cmpi {bf=bf, l=l, ra=ra, si=si}        | (I.CMP, si) => Cmpi {bf=bf, l=l, ra=ra, si=si}
418        | (I.CMPL, ui) => Cmpli {bf=bf, l=l, ra=ra, ui=ui}        | (I.CMPL, ui) => Cmpli {bf=bf, l=l, ra=ra, ui=ui}
419         )         )
420     and fcmp {bf, fa, fb, cmp} = let     and fcmp {bf, fa, fb, cmp} =
421            val bf = emit_CC bf         let val bf = emit_CC bf
422            val fa = emit_FP fa            val fa = emit_FP fa
423            val fb = emit_FP fb            val fb = emit_FP fb
424            val cmp = emit_fcmp cmp            val cmp = emit_fcmp cmp
425         in eWord32 ((bf << 0wx17) + ((fa << 0wx10) + ((fb << 0wxb) + ((cmp << 0wx1) + 0wxfc000000))))         in eWord32 ((bf << 0wx17) + ((fa << 0wx10) + ((fb << 0wxb) + ((cmp << 0wx1) + 0wxfc000000))))
426         end         end
427       and funary {oper, ft, fb, Rc} =
428     and funary {oper, ft, fb, Rc} = let         let val oper = emit_funary oper
           val oper = emit_funary oper  
429            val ft = emit_FP ft            val ft = emit_FP ft
430            val fb = emit_FP fb            val fb = emit_FP fb
431         in let         in
432              let
433  (*#line 431.12 "ppc/ppc.md"*)  (*#line 423.12 "ppc/ppc.mdl"*)
434               val (opcd, xo) = oper               val (opcd, xo) = oper
435            in x_form {opcd=opcd, rt=ft, ra=0wx0, rb=fb, xo=xo, rc=Rc}            in x_form {opcd=opcd, rt=ft, ra=0wx0, rb=fb, xo=xo, rc=Rc}
436            end            end
   
437         end         end
438       and farith {oper, ft, fa, fb, Rc} =
439     and farith {oper, ft, fa, fb, Rc} = let         let val ft = emit_FP ft
           val ft = emit_FP ft  
440            val fa = emit_FP fa            val fa = emit_FP fa
441            val fb = emit_FP fb            val fb = emit_FP fb
442         in let         in
443              let
444  (*#line 437.12 "ppc/ppc.md"*)  (*#line 429.12 "ppc/ppc.mdl"*)
445               val (opcd, xo) = emit_farith oper               val (opcd, xo) = emit_farith oper
446            in            in
447               (               (case oper of
448                case oper of                 (I.FMUL | I.FMULS) => a_form {opcd=opcd, frt=ft, fra=fa, frb=0wx0,
449                (I.FMUL | I.FMULS) => a_form {opcd=opcd, frt=ft, fra=fa, frb=0wx0, frc=fb, xo=xo, rc=Rc}                    frc=fb, xo=xo, rc=Rc}
450              | _ => a_form {opcd=opcd, frt=ft, fra=fa, frb=fb, frc=0wx0, xo=xo, rc=Rc}               | _ => a_form {opcd=opcd, frt=ft, fra=fa, frb=fb, frc=0wx0, xo=xo,
451                      rc=Rc}
452               )               )
453            end            end
   
454         end         end
455       and farith3 {oper, ft, fa, fc, fb, Rc} =
456     and farith3 {oper, ft, fa, fc, fb, Rc} = let         let val oper = emit_farith3 oper
           val oper = emit_farith3 oper  
457            val ft = emit_FP ft            val ft = emit_FP ft
458            val fa = emit_FP fa            val fa = emit_FP fa
459            val fc = emit_FP fc            val fc = emit_FP fc
460            val fb = emit_FP fb            val fb = emit_FP fb
461         in let         in
462              let
463  (*#line 446.12 "ppc/ppc.md"*)  (*#line 438.12 "ppc/ppc.mdl"*)
464               val (opcd, xo) = oper               val (opcd, xo) = oper
465            in a_form {opcd=opcd, frt=ft, fra=fa, frb=fb, frc=fc, xo=xo, rc=Rc}            in a_form {opcd=opcd, frt=ft, fra=fa, frb=fb, frc=fc, xo=xo, rc=Rc}
466            end            end
   
467         end         end
468       and cr_bit {cc} =
469     and cr_bit {cc} = let         let
470    (*#line 443.12 "ppc/ppc.mdl"*)
 (*#line 451.12 "ppc/ppc.md"*)  
471            val (cr, bit) = cc            val (cr, bit) = cc
472         in ((emit_CC cr) << 0wx2) + (itow         in ((emit_CC cr) << 0wx2) + (itow
473            (            (case bit of
            case bit of  
474             I.LT => 0             I.LT => 0
475           | I.GT => 1           | I.GT => 1
476           | I.EQ => 2           | I.EQ => 2
# Line 527  Line 485 
485           | I.OX => 3           | I.OX => 3
486            ))            ))
487         end         end
488       and ccarith {oper, bt, ba, bb} =
489     and ccarith {oper, bt, ba, bb} = let         let val oper = emit_ccarith oper
490            val oper = emit_ccarith oper         in xl_form {opcd=0wx13, bt=cr_bit {cc=bt}, ba=cr_bit {cc=ba}, bb=cr_bit {cc=bb},
491         in xl_form {opcd=0wx13, bt=cr_bit {cc=bt}, ba=cr_bit {cc=ba}, bb=cr_bit {cc=bb}, xo=oper, lk=false}               xo=oper, lk=false}
492         end         end
493       and twr {to, ra, rb} =
494     and twr {to, ra, rb} = let         let val to = emit_int to
           val to = emit_int to  
495            val ra = emit_GP ra            val ra = emit_GP ra
496            val rb = emit_GP rb            val rb = emit_GP rb
497         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000008)))         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000008)))
498         end         end
499       and twi {to, ra, si} =
500     and twi {to, ra, si} = let         let val to = emit_int to
           val to = emit_int to  
501            val ra = emit_GP ra            val ra = emit_GP ra
502            val si = emit_operand si            val si = emit_operand si
503         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wxc000000)))         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wxc000000)))
504         end         end
   
505     and tw {to, ra, si} =     and tw {to, ra, si} =
506         (         (case si of
         case si of  
507          I.RegOp rb => twr {to=to, ra=ra, rb=rb}          I.RegOp rb => twr {to=to, ra=ra, rb=rb}
508        | _ => twi {to=to, ra=ra, si=si}        | _ => twi {to=to, ra=ra, si=si}
509         )         )
510     and tdr {to, ra, rb} = let     and tdr {to, ra, rb} =
511            val to = emit_int to         let val to = emit_int to
512            val ra = emit_GP ra            val ra = emit_GP ra
513            val rb = emit_GP rb            val rb = emit_GP rb
514         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000088)))         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000088)))
515         end         end
516       and tdi {to, ra, si} =
517     and tdi {to, ra, si} = let         let val to = emit_int to
           val to = emit_int to  
518            val ra = emit_GP ra            val ra = emit_GP ra
519            val si = emit_operand si            val si = emit_operand si
520         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wx8000000)))         in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wx8000000)))
521         end         end
   
522     and td {to, ra, si} =     and td {to, ra, si} =
523         (         (case si of
         case si of  
524          I.RegOp rb => tdr {to=to, ra=ra, rb=rb}          I.RegOp rb => tdr {to=to, ra=ra, rb=rb}
525        | _ => tdi {to=to, ra=ra, si=si}        | _ => tdi {to=to, ra=ra, si=si}
526         )         )
527     and mcrf {bf, bfa} = let     and mcrf {bf, bfa} =
528            val bf = emit_CC bf         let val bf = emit_CC bf
529            val bfa = emit_CC bfa            val bfa = emit_CC bfa
530         in eWord32 ((bf << 0wx17) + ((bfa << 0wx12) + 0wx4c000000))         in eWord32 ((bf << 0wx17) + ((bfa << 0wx12) + 0wx4c000000))
531         end         end
532       and mtspr' {rs, spr} =
533     and mtspr' {rs, spr} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
534         in eWord32 ((rs << 0wx15) + ((spr << 0wxb) + 0wx7c0003a6))         in eWord32 ((rs << 0wx15) + ((spr << 0wxb) + 0wx7c0003a6))
535         end         end
536       and mtspr {rs, spr} =
537     and mtspr {rs, spr} = let         let val spr = emit_SPR spr
           val spr = emit_SPR spr  
538         in mtspr' {rs=rs, spr=((spr && 0wx1f) << 0wx5) + ((spr << 0wx5) && 0wx1f)}         in mtspr' {rs=rs, spr=((spr && 0wx1f) << 0wx5) + ((spr << 0wx5) && 0wx1f)}
539         end         end
540       and mfspr' {rt, spr} =
541     and mfspr' {rt, spr} = let         let val rt = emit_GP rt
           val rt = emit_GP rt  
542         in eWord32 ((rt << 0wx15) + ((spr << 0wxb) + 0wx7c0002a6))         in eWord32 ((rt << 0wx15) + ((spr << 0wxb) + 0wx7c0002a6))
543         end         end
544       and mfspr {rt, spr} =
545     and mfspr {rt, spr} = let         let val spr = emit_SPR spr
           val spr = emit_SPR spr  
546         in mfspr' {rt=rt, spr=((spr && 0wx1f) << 0wx5) + ((spr << 0wx5) && 0wx1f)}         in mfspr' {rt=rt, spr=((spr && 0wx1f) << 0wx5) + ((spr << 0wx5) && 0wx1f)}
547         end         end
548       and b {li, aa, lk} =
549     and b {li, aa, lk} = let         let val aa = emit_bool aa
           val aa = emit_bool aa  
550            val lk = emit_bool lk            val lk = emit_bool lk
551         in eWord32 (((li && 0wxffffff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx48000000)))         in eWord32 (((li && 0wxffffff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx48000000)))
552         end         end
553       and be {li, aa, lk} =
554     and be {li, aa, lk} = let         let val aa = emit_bool aa
           val aa = emit_bool aa  
555            val lk = emit_bool lk            val lk = emit_bool lk
556         in eWord32 (((li && 0wxffffff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx58000000)))         in eWord32 (((li && 0wxffffff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx58000000)))
557         end         end
558       and bc {bo, bi, bd, aa, lk} =
559     and bc {bo, bi, bd, aa, lk} = let         let val bo = emit_bo bo
           val bo = emit_bo bo  
560            val aa = emit_bool aa            val aa = emit_bool aa
561            val lk = emit_bool lk            val lk = emit_bool lk
562         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (((bd && 0wx3fff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx40000000)))))         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (((bd && 0wx3fff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx40000000)))))
563         end         end
564       and bce {bo, bi, bd, aa, lk} =
565     and bce {bo, bi, bd, aa, lk} = let         let val bo = emit_bo bo
           val bo = emit_bo bo  
566            val aa = emit_bool aa            val aa = emit_bool aa
567            val lk = emit_bool lk            val lk = emit_bool lk
568         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (((bd && 0wx3fff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx40000000)))))         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (((bd && 0wx3fff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx40000000)))))
569         end         end
570       and bclr {bo, bi, lk} =
571     and bclr {bo, bi, lk} = let         let val bo = emit_bo bo
           val bo = emit_bo bo  
572            val lk = emit_bool lk            val lk = emit_bool lk
573         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000020)))         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000020)))
574         end         end
575       and bclre {bo, bi, lk} =
576     and bclre {bo, bi, lk} = let         let val bo = emit_bo bo
           val bo = emit_bo bo  
577            val lk = emit_bool lk            val lk = emit_bool lk
578         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000022)))         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000022)))
579         end         end
580       and bcctr {bo, bi, lk} =
581     and bcctr {bo, bi, lk} = let         let val bo = emit_bo bo
           val bo = emit_bo bo  
582            val lk = emit_bool lk            val lk = emit_bool lk
583         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000420)))         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000420)))
584         end         end
585       and bcctre {bo, bi, lk} =
586     and bcctre {bo, bi, lk} = let         let val bo = emit_bo bo
           val bo = emit_bo bo  
587            val lk = emit_bool lk            val lk = emit_bool lk
588         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000422)))         in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000422)))
589         end         end
590       and rlwnm {rs, ra, sh, mb, me} =
591     and rlwnm {rs, ra, sh, mb, me} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
592            val ra = emit_GP ra            val ra = emit_GP ra
593            val sh = emit_GP sh            val sh = emit_GP sh
594            val mb = emit_int mb            val mb = emit_int mb
595            val me = emit_int me            val me = emit_int me
596         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx5c000000)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx5c000000)))))
597         end         end
598       and rlwinm {rs, ra, sh, mb, me} =
599     and rlwinm {rs, ra, sh, mb, me} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
600            val ra = emit_GP ra            val ra = emit_GP ra
601            val mb = emit_int mb            val mb = emit_int mb
602            val me = emit_int me            val me = emit_int me
603         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx54000000)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx54000000)))))
604         end         end
605       and rldcl {rs, ra, sh, mb} =
606     and rldcl {rs, ra, sh, mb} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
607            val ra = emit_GP ra            val ra = emit_GP ra
608            val sh = emit_GP sh            val sh = emit_GP sh
609            val mb = emit_int mb            val mb = emit_int mb
610         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + 0wx78000010))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + 0wx78000010))))
611         end         end
612       and rldicl {rs, ra, sh, mb, sh2} =
613     and rldicl {rs, ra, sh, mb, sh2} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
614            val ra = emit_GP ra            val ra = emit_GP ra
615            val mb = emit_int mb            val mb = emit_int mb
616         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000000)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000000)))))
617         end         end
618       and rldcr {rs, ra, sh, mb} =
619     and rldcr {rs, ra, sh, mb} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
620            val ra = emit_GP ra            val ra = emit_GP ra
621            val sh = emit_GP sh            val sh = emit_GP sh
622            val mb = emit_int mb            val mb = emit_int mb
623         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + 0wx78000012))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + 0wx78000012))))
624         end         end
625       and rldicr {rs, ra, sh, mb, sh2} =
626     and rldicr {rs, ra, sh, mb, sh2} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
627            val ra = emit_GP ra            val ra = emit_GP ra
628            val mb = emit_int mb            val mb = emit_int mb
629         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000004)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000004)))))
630         end         end
631       and rldic {rs, ra, sh, mb, sh2} =
632     and rldic {rs, ra, sh, mb, sh2} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
633            val ra = emit_GP ra            val ra = emit_GP ra
634            val mb = emit_int mb            val mb = emit_int mb
635         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000008)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000008)))))
636         end         end
637       and rlwimi {rs, ra, sh, mb, me} =
638     and rlwimi {rs, ra, sh, mb, me} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
639            val ra = emit_GP ra            val ra = emit_GP ra
640            val mb = emit_int mb            val mb = emit_int mb
641            val me = emit_int me            val me = emit_int me
642         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx50000000)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx50000000)))))
643         end         end
644       and rldimi {rs, ra, sh, mb, sh2} =
645     and rldimi {rs, ra, sh, mb, sh2} = let         let val rs = emit_GP rs
           val rs = emit_GP rs  
646            val ra = emit_GP ra            val ra = emit_GP ra
647            val mb = emit_int mb            val mb = emit_int mb
648         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx7800000c)))))         in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx7800000c)))))
649         end         end
   
650     and rotate {oper, ra, rs, sh, mb, me} =     and rotate {oper, ra, rs, sh, mb, me} =
651         (         (case (oper, me) of
         case (oper, me) of  
652          (I.RLWNM, SOME me) => rlwnm {ra=ra, rs=rs, sh=sh, mb=mb, me=me}          (I.RLWNM, SOME me) => rlwnm {ra=ra, rs=rs, sh=sh, mb=mb, me=me}
653        | (I.RLDCL, _) => rldcl {ra=ra, rs=rs, sh=sh, mb=mb}        | (I.RLDCL, _) => rldcl {ra=ra, rs=rs, sh=sh, mb=mb}
654        | (I.RLDCR, _) => rldcr {ra=ra, rs=rs, sh=sh, mb=mb}        | (I.RLDCR, _) => rldcr {ra=ra, rs=rs, sh=sh, mb=mb}
655         )         )
656     and rotatei {oper, ra, rs, sh, mb, me} = let     and rotatei {oper, ra, rs, sh, mb, me} =
657            val sh = emit_operand sh         let val sh = emit_operand sh
658         in         in
659            (            (case (oper, me) of
            case (oper, me) of  
660             (I.RLWINM, SOME me) => rlwinm {ra=ra, rs=rs, sh=sh, mb=mb, me=me}             (I.RLWINM, SOME me) => rlwinm {ra=ra, rs=rs, sh=sh, mb=mb, me=me}
661           | (I.RLWIMI, SOME me) => rlwimi {ra=ra, rs=rs, sh=sh, mb=mb, me=me}           | (I.RLWIMI, SOME me) => rlwimi {ra=ra, rs=rs, sh=sh, mb=mb, me=me}
662           | (I.RLDICL, _) => rldicl {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1), mb=mb}            | (I.RLDICL, _) => rldicl {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
663           | (I.RLDICR, _) => rldicr {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1), mb=mb}                 mb=mb}
664           | (I.RLDIC, _) => rldic {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1), mb=mb}            | (I.RLDICR, _) => rldicr {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
665           | (I.RLDIMI, _) => rldimi {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1), mb=mb}                 mb=mb}
666              | (I.RLDIC, _) => rldic {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
667                   mb=mb}
668              | (I.RLDIMI, _) => rldimi {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
669                   mb=mb}
670            )            )
671         end         end
672    
673    (*#line 533.7 "ppc/ppc.mdl"*)
 (*#line 541.7 "ppc/ppc.md"*)  
674     fun relative (I.LabelOp lexp) = (itow ((LabelExp.valueOf lexp) - ( ! loc))) ~>> 0wx2     fun relative (I.LabelOp lexp) = (itow ((LabelExp.valueOf lexp) - ( ! loc))) ~>> 0wx2
675       | relative _ = error "relative"       | relative _ = error "relative"
676           fun emitter instr =
677           let
678     fun emitInstr (I.L{ld, rt, ra, d, mem}) = load {ld=ld, rt=rt, ra=ra, d=d}     fun emitInstr (I.L{ld, rt, ra, d, mem}) = load {ld=ld, rt=rt, ra=ra, d=d}
679       | emitInstr (I.LF{ld, ft, ra, d, mem}) = fload {ld=ld, ft=ft, ra=ra, d=d}       | emitInstr (I.LF{ld, ft, ra, d, mem}) = fload {ld=ld, ft=ft, ra=ra, d=d}
680       | emitInstr (I.ST{st, rs, ra, d, mem}) = store {st=st, rs=rs, ra=ra, d=d}       | emitInstr (I.ST{st, rs, ra, d, mem}) = store {st=st, rs=rs, ra=ra, d=d}
681       | emitInstr (I.STF{st, fs, ra, d, mem}) = fstore {st=st, fs=fs, ra=ra, d=d}       | emitInstr (I.STF{st, fs, ra, d, mem}) = fstore {st=st, fs=fs, ra=ra,
682       | emitInstr (I.UNARY{oper, rt, ra, Rc, OE}) = unary {oper=oper, rt=rt, ra=ra, OE=OE, Rc=Rc}            d=d}
683       | emitInstr (I.ARITH{oper, rt, ra, rb, Rc, OE}) = arith {oper=oper, rt=rt, ra=ra, rb=rb, OE=OE, Rc=Rc}       | emitInstr (I.UNARY{oper, rt, ra, Rc, OE}) = unary {oper=oper, rt=rt,
684       | emitInstr (I.ARITHI{oper, rt, ra, im}) = arithi {oper=oper, rt=rt, ra=ra, im=im}            ra=ra, OE=OE, Rc=Rc}
685       | emitInstr (I.ROTATE{oper, ra, rs, sh, mb, me}) = rotate {oper=oper, ra=ra, rs=rs, sh=sh, mb=mb, me=me}       | emitInstr (I.ARITH{oper, rt, ra, rb, Rc, OE}) = arith {oper=oper, rt=rt,
686       | emitInstr (I.ROTATEI{oper, ra, rs, sh, mb, me}) = rotatei {oper=oper, ra=ra, rs=rs, sh=sh, mb=mb, me=me}            ra=ra, rb=rb, OE=OE, Rc=Rc}
687       | emitInstr (I.COMPARE{cmp, l, bf, ra, rb}) = compare {cmp=cmp, bf=bf, l=l, ra=ra, rb=rb}       | emitInstr (I.ARITHI{oper, rt, ra, im}) = arithi {oper=oper, rt=rt, ra=ra,
688       | emitInstr (I.FCOMPARE{cmp, bf, fa, fb}) = fcmp {cmp=cmp, bf=bf, fa=fa, fb=fb}            im=im}
689       | emitInstr (I.FUNARY{oper, ft, fb, Rc}) = funary {oper=oper, ft=ft, fb=fb, Rc=Rc}       | emitInstr (I.ROTATE{oper, ra, rs, sh, mb, me}) = rotate {oper=oper,
690       | emitInstr (I.FARITH{oper, ft, fa, fb, Rc}) = farith {oper=oper, ft=ft, fa=fa, fb=fb, Rc=Rc}            ra=ra, rs=rs, sh=sh, mb=mb, me=me}
691       | emitInstr (I.FARITH3{oper, ft, fa, fb, fc, Rc}) = farith3 {oper=oper, ft=ft, fa=fa, fb=fb, fc=fc, Rc=Rc}       | emitInstr (I.ROTATEI{oper, ra, rs, sh, mb, me}) = rotatei {oper=oper,
692       | emitInstr (I.CCARITH{oper, bt, ba, bb}) = ccarith {oper=oper, bt=bt, ba=ba, bb=bb}            ra=ra, rs=rs, sh=sh, mb=mb, me=me}
693         | emitInstr (I.COMPARE{cmp, l, bf, ra, rb}) = compare {cmp=cmp, bf=bf,
694              l=l, ra=ra, rb=rb}
695         | emitInstr (I.FCOMPARE{cmp, bf, fa, fb}) = fcmp {cmp=cmp, bf=bf, fa=fa,
696              fb=fb}
697         | emitInstr (I.FUNARY{oper, ft, fb, Rc}) = funary {oper=oper, ft=ft, fb=fb,
698              Rc=Rc}
699         | emitInstr (I.FARITH{oper, ft, fa, fb, Rc}) = farith {oper=oper, ft=ft,
700              fa=fa, fb=fb, Rc=Rc}
701         | emitInstr (I.FARITH3{oper, ft, fa, fb, fc, Rc}) = farith3 {oper=oper,
702              ft=ft, fa=fa, fb=fb, fc=fc, Rc=Rc}
703         | emitInstr (I.CCARITH{oper, bt, ba, bb}) = ccarith {oper=oper, bt=bt,
704              ba=ba, bb=bb}
705       | emitInstr (I.MCRF{bf, bfa}) = mcrf {bf=bf, bfa=bfa}       | emitInstr (I.MCRF{bf, bfa}) = mcrf {bf=bf, bfa=bfa}
706       | emitInstr (I.MTSPR{rs, spr}) = mtspr {rs=rs, spr=spr}       | emitInstr (I.MTSPR{rs, spr}) = mtspr {rs=rs, spr=spr}
707       | emitInstr (I.MFSPR{rt, spr}) = mfspr {rt=rt, spr=spr}       | emitInstr (I.MFSPR{rt, spr}) = mfspr {rt=rt, spr=spr}
708       | emitInstr (I.TW{to, ra, si}) = tw {to=to, ra=ra, si=si}       | emitInstr (I.TW{to, ra, si}) = tw {to=to, ra=ra, si=si}
709       | emitInstr (I.TD{to, ra, si}) = td {to=to, ra=ra, si=si}       | emitInstr (I.TD{to, ra, si}) = td {to=to, ra=ra, si=si}
710       | emitInstr (I.BC{bo, bf, bit, addr, LK, fall}) = bc {bo=bo, bi=cr_bit {cc=(bf, bit)}, bd=relative addr, aa=false, lk=LK}       | emitInstr (I.BC{bo, bf, bit, addr, LK, fall}) = bc {bo=bo, bi=cr_bit {cc=(bf,
711       | emitInstr (I.BCLR{bo, bf, bit, LK, labels}) = bclr {bo=bo, bi=cr_bit {cc=(bf, bit)}, lk=LK}            bit)}, bd=relative addr, aa=false, lk=LK}
712         | emitInstr (I.BCLR{bo, bf, bit, LK, labels}) = bclr {bo=bo, bi=cr_bit {cc=(bf,
713              bit)}, lk=LK}
714       | emitInstr (I.B{addr, LK}) = b {li=relative addr, aa=false, lk=LK}       | emitInstr (I.B{addr, LK}) = b {li=relative addr, aa=false, lk=LK}
715       | emitInstr (I.CALL{def, use, mem}) = bclr {bo=I.ALWAYS, bi=0wx0, lk=true}       | emitInstr (I.CALL{def, use, mem}) = bclr {bo=I.ALWAYS, bi=0wx0, lk=true}
716       | emitInstr (I.COPY{dst, src, impl, tmp}) = error "COPY"       | emitInstr (I.COPY{dst, src, impl, tmp}) = error "COPY"
# Line 774  Line 720 
720       | emitInstr (I.SINK{}) = ()       | emitInstr (I.SINK{}) = ()
721       | emitInstr (I.PHI{}) = ()       | emitInstr (I.PHI{}) = ()
722         in         in
723             emitInstr             emitInstr instr
724         end         end
725    
726     in  S.STREAM{beginCluster=init,     in  S.STREAM{beginCluster=init,
# Line 785  Line 731 
731                  entryLabel=doNothing,                  entryLabel=doNothing,
732                  comment=doNothing,                  comment=doNothing,
733                  exitBlock=doNothing,                  exitBlock=doNothing,
734                  annotation=doNothing,                  annotation=doNothing
                 phi=doNothing,  
                 alias=doNothing  
735                 }                 }
736     end     end
737  end  end

Legend:
Removed from v.651  
changed lines
  Added in v.744

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