sfp-util.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:3k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. #include <linux/kernel.h>
  2. #include <linux/sched.h>
  3. #include <linux/types.h>
  4. #include <asm/byteorder.h>
  5. #define add_ssaaaa(sh, sl, ah, al, bh, bl) 
  6.   __asm__ ("addcc %r4,%5,%1
  7. addx %r2,%3,%0"
  8.    : "=r" ((USItype)(sh)),
  9.      "=&r" ((USItype)(sl))
  10.    : "%rJ" ((USItype)(ah)),
  11.      "rI" ((USItype)(bh)),
  12.      "%rJ" ((USItype)(al)),
  13.      "rI" ((USItype)(bl))
  14.    : "cc")
  15. #define sub_ddmmss(sh, sl, ah, al, bh, bl) 
  16.   __asm__ ("subcc %r4,%5,%1
  17. subx %r2,%3,%0"
  18.    : "=r" ((USItype)(sh)),
  19.      "=&r" ((USItype)(sl))
  20.    : "rJ" ((USItype)(ah)),
  21.      "rI" ((USItype)(bh)),
  22.      "rJ" ((USItype)(al)),
  23.      "rI" ((USItype)(bl))
  24.    : "cc")
  25. #define umul_ppmm(w1, w0, u, v) 
  26.   __asm__ ("! Inlined umul_ppmm
  27. wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr
  28. sra %3,31,%%g2 ! Don't move this insn
  29. and %2,%%g2,%%g2 ! Don't move this insn
  30. andcc %%g0,0,%%g1 ! Don't move this insn
  31. mulscc %%g1,%3,%%g1
  32. mulscc %%g1,%3,%%g1
  33. mulscc %%g1,%3,%%g1
  34. mulscc %%g1,%3,%%g1
  35. mulscc %%g1,%3,%%g1
  36. mulscc %%g1,%3,%%g1
  37. mulscc %%g1,%3,%%g1
  38. mulscc %%g1,%3,%%g1
  39. mulscc %%g1,%3,%%g1
  40. mulscc %%g1,%3,%%g1
  41. mulscc %%g1,%3,%%g1
  42. mulscc %%g1,%3,%%g1
  43. mulscc %%g1,%3,%%g1
  44. mulscc %%g1,%3,%%g1
  45. mulscc %%g1,%3,%%g1
  46. mulscc %%g1,%3,%%g1
  47. mulscc %%g1,%3,%%g1
  48. mulscc %%g1,%3,%%g1
  49. mulscc %%g1,%3,%%g1
  50. mulscc %%g1,%3,%%g1
  51. mulscc %%g1,%3,%%g1
  52. mulscc %%g1,%3,%%g1
  53. mulscc %%g1,%3,%%g1
  54. mulscc %%g1,%3,%%g1
  55. mulscc %%g1,%3,%%g1
  56. mulscc %%g1,%3,%%g1
  57. mulscc %%g1,%3,%%g1
  58. mulscc %%g1,%3,%%g1
  59. mulscc %%g1,%3,%%g1
  60. mulscc %%g1,%3,%%g1
  61. mulscc %%g1,%3,%%g1
  62. mulscc %%g1,%3,%%g1
  63. mulscc %%g1,0,%%g1
  64. add %%g1,%%g2,%0
  65. rd %%y,%1"
  66.    : "=r" ((USItype)(w1)),
  67.      "=r" ((USItype)(w0))
  68.    : "%rI" ((USItype)(u)),
  69.      "r" ((USItype)(v))
  70.    : "%g1", "%g2", "cc")
  71. /* It's quite necessary to add this much assembler for the sparc.
  72.    The default udiv_qrnnd (in C) is more than 10 times slower!  */
  73. #define udiv_qrnnd(q, r, n1, n0, d) 
  74.   __asm__ ("! Inlined udiv_qrnnd
  75. mov 32,%%g1
  76. subcc %1,%2,%%g0
  77. 1: bcs 5f
  78.  addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb
  79. sub %1,%2,%1 ! this kills msb of n
  80. addx %1,%1,%1 ! so this can't give carry
  81. subcc %%g1,1,%%g1
  82. 2: bne 1b
  83.  subcc %1,%2,%%g0
  84. bcs 3f
  85.  addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb
  86. b 3f
  87.  sub %1,%2,%1 ! this kills msb of n
  88. 4: sub %1,%2,%1
  89. 5: addxcc %1,%1,%1
  90. bcc 2b
  91.  subcc %%g1,1,%%g1
  92. ! Got carry from n.  Subtract next step to cancel this carry.
  93. bne 4b
  94.  addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb
  95. sub %1,%2,%1
  96. 3: xnor %0,0,%0
  97. ! End of inline udiv_qrnnd"
  98.    : "=&r" ((USItype)(q)),
  99.      "=&r" ((USItype)(r))
  100.    : "r" ((USItype)(d)),
  101.      "1" ((USItype)(n1)),
  102.      "0" ((USItype)(n0)) : "%g1", "cc")
  103. #define UDIV_NEEDS_NORMALIZATION 0
  104. #define abort()
  105. return 0
  106. #ifdef __BIG_ENDIAN
  107. #define __BYTE_ORDER __BIG_ENDIAN
  108. #else
  109. #define __BYTE_ORDER __LITTLE_ENDIAN
  110. #endif