wk MIPS list find blog view edit

Loongson2F




memset0:
  dmtc1 $0, $f0 // load 64 bit zero in f0 register
  memset0_loop:
  sdc1 $f0, 0($a0)
  add $a1, $a1, -8
  bgez $a1, memset0_loop
  add $a0, $a0, 8
  jr $ra


todo




  punpckldq %%mm7, %%mm1
  punpckhdq %%mm7, %%mm1
  packuswb %f10, %f10
  packssdw %%mm3, %%mm0 /* mm0 = x7 = SRC[ROW3,0+1+2+3W] */
  movl %[dst], %esi
  movl %[src], %esi /* edi = src */
  movl %[dst], %edi /* esi = dst */
  leal 64(%%edi), %%edi /* 2*4*8(%%edi) */
  leal (%%edx,%%eax,2), %%edi /* for row 5 */



Loongson2F multimedia instruction set



punpckl[bh/hw/wd] dst, src2, src - unpack low data byte->half, half->word, word->dword

  [x1,y1,x0,y0] = [0, 0, y1, y0] , [0, 0, x1, x0]

punpckh[bh/wd/hw] dst, src2, src - unpack high data

  [x3,y3,x2,y2] = [y3, y2, 0, 0] , [x3, x2, 0, 0] ex: punpckhbh $f2, $f2, $f0

packss[hb/wh] dst, src2, src - pack with signed saturation (if (G>255)G=255) else if (G<0) G=0)

  [x1,x0,y1,y0] = [y1, y0] , [x1, x0]

packushb dst, src2, src - pack with unsigned signed saturation

  [x1,x0,y1,y0] = [y1, y0] , [x1, x0]

pcmpeq[b/h/w] - compare packed data for equal (0 =not equal, -1 = equal)

  [ffff, 0000, 0000, ffff] = [fe00,a0a0,8000,55aa], [fe00,aa55,0000,55aa]

pcmpgt[b/h/w] - compare packed signed integers for greater than

  [0000,ffff,ffff,0000] = [fe00,aa55,0000,55aa], [fe00,a0a0,8000,55aa]

padd[b/h/w/d] - add packed integers

  [x1+y1,x0+y0] = [y1,y0], [x1,x0]

padds[b/h] - add packed signed integers with signed saturation (-2N ~ 2N-1)

  [x1+y1,x0+y0] = [y1,y0], [x1,x0]

paddus[b/h] - add packed unsigned integers with unsigned saturation (0 ~ 2N-1)

  [x1+y1,x0+y0] = [y1,y0], [x1,x0]

psub[b/h/w/d] - substract packed integers

  [x1-y1,x0-y0] = [y1,y0], [x1,x0]

psubs[b/h/w/d] - substract packed integers with signed saturation (-2N ~ 2N-1)

psubus[b/h] - substract packed unsigned integers with unsigned saturation (0 ~ 2N-1)

pmullh dst, src2, rc - multiply packed signed integers and store low result

  [(x1*y1)[15:0],(x0*y0)[15:0]] = [y1,y0] , [x1,x0]

pmulhh dst, src2, rc - multiply packed signed integers and store high result

  [(x1*y1)[31:16],(x0*y0)[31:16]] = [y1,y0] , [x1,x0]

pmulhuh - multiply packed unsigned integers and store high result

pmuluw - multiply packed unsigned word integers

  [x0*y0] = [x1,x0], [y1,y0]

pmaddhw - muyltiply and added packed integers

  [(x3*y3)+(x2*y2), (x1*y1)+(x0*y0)] = [y3,y2,y1,y0], [x3,x2,x1,x0]

pandn dst, src2, src - dst = ((!src2) & src)

psrl[h/w] dst, src, shift - shift packed data right logical

  [y1>>shift, y0>>shift] = [y1,y0], shift

psra[h/w] - shift packed data right arithmetic

psll[h/w] - shift packed data left logical

pmaxsh - maximum of packed signed half word integers

  [max(y1,x1),max(y0,x0)] = [y1,y0], [x1,x0]

pmaxub - maximum of packed unsigned byte integers

pminsh - minimum of packed signed half word integers

  [min(y1,x1),min(y0,x0)] = [y1,y0], [x1,x0]

pminub - minimum of packed unsigned byte integers

pavgb[b/h] dst = src2, src - average packed integers

  [(y1+x1)>>1,(y0+x0)>>1] = [y1,y0], [x1,x0]

pshufh - shuffle packed half-words (TODO)

pmovmskb dst, src - move byte mask

  dst = src[(i+1)*8]

pextrh dst,src2,src - extract half-word (TODO)

  dst = 0 dst[15:0] = (src2 >> src[1:0]*16)[15:0]

pinsrh_[0/1/2/3] dst,src2,src - set src[0] over src2 at position N (0,1,2,3)

  [y3,y2,x0,y0] = [y3,y2,y1,y0], [0,0,0,x0] (pinsrh_0)

pasubub dst,src2,src - substract with absolute value for each packed byte on 64 bit value

  dst[7:0] = abs(src2[7:0]-src[7:0])

biadd dst, src - add packed bytes on 64 bit register as a 16 bit value

  TEMP = SRC[63:56] + .. + SRC[23:16] + SRC[15:8] + SRC[7:0] DEST[15:0] = TEMP DEST[63:16] = 0x0000 0000 0000 00

for dst,src2,src fxor ;--- logic operations for 64 bit registers fnor fand

fsrl dst, amount, src - Data logic shifted to right word, filled with high character 0

  [0000,0000,0085,ffff] = 8, [0100,ffff,85ff,ff01]

fdsrl - Two-word logic shifted to right

  [0081,020f,f000,fdff] = 8, [8102,0ff0,00fd,ff04]

fsra - Low data arithmetic shifted to right word, the word-filled high low word highest (at symbol)

  [ffff ffff ff85 ffff] = 8, [0100,ffff,85ff,ff01]

fdsra - Two-word arithmetic shifted to right

  [ff81 020f f000 fdff] = 8, [0100 ffff 85ff ff01]

fsll - Logic of the left lower data word, the word-filled high low after the word shift highest

  src1 : 0x0100 ffff 754f ff01 src2 : 0x8102 0ff0 00a7 ff04 src3 : 0x8 fsll dest, src1, src3 : 0x0000 0000 4fff 0100 fsll dest, src2, src3 : 0xffff ffff a7ff 0400 若 src3 : 0xc, 则: fsll dest, src1, src3 : 0xffff ffff fff0 1000 fsll dest, src2, src3 : 0x0000 0000 7ff0 4000

fdsll dst, src2,src (TODO) - Two-word logic backspace

  src1 : 0x0100 ffff 75af ff01 src2 : 0x8102 0ff0 00ad ff04 src3 : 0x8 fdsll dest, src1, src3 : 0x00ff ff75 afff 0100 fdsll dest, src2, src3 : 0x020f f000 adff 0400

fadd dst,src2,src faddu dst,src2,src fdadd dst, src2, src

  src1 : 0x0000 00ff ffff fffe src2 : 0x0000 0001 0000 0004 fadd dest, src2, src1 : 0x0000 0000 0000 0002 faddu dest, src2, src1 : 0x0000 0000 0000 0002 fdadd dest, src2, src1 : 0x0000 0101 0000 0002 <- TODO WTF?!

fsub fsubu fdsub - the same as the previous foo

fseq dst,src - Equal to the floating-point control register home of the conditions (CC0, FCR31 [23]) 1, or the conditions of home 0

  Operation:

  IF DEST [63:0] == THEN SRC [63:0]

  FCR31 [23] = 1

  ELSE

  FCR31 [23] = 0

  FI

fseq1 dst,src - Simple test to the command and fseq no significant differences found the brothers remind me.

fsltu fslt (TODO)

  IF DEST[63:0] < SRC[63:0]

  FCR31[23] = 1;

  ELSE

  FCR31[23] = 0;

  [8000 0000 0000 8040] = [0000 0000 0000 8042] fslt dest, src FCR31 is: 0x0080 0000 ; 1 fsltu dest, src FCR31 is: 0x0000 0000 ; 0

fsleu fsle - Unsigned data comparison, less than or equal to the floating-point control register home of the conditions (CC0, FCR31 [23]) 1, or in home conditions 0