fpu64-ps.s 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. # mips test sanity, expected to pass.
  2. # mach: mips64 sb1
  3. # as: -mabi=eabi
  4. # ld: -N -Ttext=0x80010000
  5. # output: *\\npass\\n
  6. .include "testutils.inc"
  7. .macro check_ps psval, upperval, lowerval
  8. .set push
  9. .set noreorder
  10. cvt.s.pu $f0, \psval # upper
  11. cvt.s.pl $f2, \psval # lower
  12. li.s $f4, \upperval
  13. li.s $f6, \lowerval
  14. c.eq.s $fcc0, $f0, $f4
  15. bc1f $fcc0, _fail
  16. c.eq.s $fcc0, $f2, $f6
  17. bc1f $fcc0, _fail
  18. nop
  19. .set pop
  20. .endm
  21. setup
  22. .set noreorder
  23. .ent DIAG
  24. DIAG:
  25. # make sure that Status.FR and .CU1 are set.
  26. mfc0 $2, $12
  27. or $2, $2, (1 << 26) | (1 << 29)
  28. mtc0 $2, $12
  29. writemsg "ldc1"
  30. .data
  31. 1: .dword 0xc1a8000042200000 # -21.0, 40.0
  32. .text
  33. la $2, 1b
  34. ldc1 $f8, 0($2)
  35. check_ps $f8, -21.0, 40.0
  36. writemsg "cvt.ps.s"
  37. li.s $f10, 1.0
  38. li.s $f12, 3.0
  39. cvt.ps.s $f8, $f10, $f12 # upper, lower
  40. check_ps $f8, 1.0, 3.0
  41. writemsg "cvt.ps.s, sdc1, copy, ldc1"
  42. .data
  43. 1: .dword 0
  44. .dword 0
  45. .text
  46. la $2, 1b
  47. li.s $f12, -4.0
  48. li.s $f14, 32.0
  49. cvt.ps.s $f10, $f12, $f14 # upper, lower
  50. sdc1 $f10, 8($2)
  51. lw $3, 8($2)
  52. lw $4, 12($2)
  53. sw $3, 0($2)
  54. sw $4, 4($2)
  55. ldc1 $f8, 0($2)
  56. check_ps $f8, -4.0, 32.0
  57. # Load some constants for later use
  58. li.s $f10, 4.0
  59. li.s $f12, 16.0
  60. cvt.ps.s $f20, $f10, $f12 # $f20: u=4.0, l=16.0
  61. li.s $f10, -1.0
  62. li.s $f12, 2.0
  63. cvt.ps.s $f22, $f10, $f12 # $f22: u=-1.0, l=2.0
  64. li.s $f10, 17.0
  65. li.s $f12, -8.0
  66. cvt.ps.s $f24, $f10, $f12 # $f24: u=17.0, l=-8.0
  67. writemsg "pll.ps"
  68. pll.ps $f8, $f20, $f22
  69. check_ps $f8, 16.0, 2.0
  70. writemsg "plu.ps"
  71. plu.ps $f8, $f20, $f22
  72. check_ps $f8, 16.0, -1.0
  73. writemsg "pul.ps"
  74. pul.ps $f8, $f20, $f22
  75. check_ps $f8, 4.0, 2.0
  76. writemsg "puu.ps"
  77. puu.ps $f8, $f20, $f22
  78. check_ps $f8, 4.0, -1.0
  79. writemsg "abs.ps"
  80. abs.ps $f8, $f22
  81. check_ps $f8, 1.0, 2.0
  82. writemsg "mov.ps"
  83. mov.ps $f8, $f22
  84. check_ps $f8, -1.0, 2.0
  85. writemsg "neg.ps"
  86. neg.ps $f8, $f22
  87. check_ps $f8, 1.0, -2.0
  88. writemsg "add.ps"
  89. add.ps $f8, $f20, $f22
  90. check_ps $f8, 3.0, 18.0
  91. writemsg "mul.ps"
  92. mul.ps $f8, $f20, $f22
  93. check_ps $f8, -4.0, 32.0
  94. writemsg "sub.ps"
  95. sub.ps $f8, $f20, $f22
  96. check_ps $f8, 5.0, 14.0
  97. writemsg "madd.ps"
  98. madd.ps $f8, $f24, $f20, $f22
  99. check_ps $f8, 13.0, 24.0
  100. writemsg "msub.ps"
  101. msub.ps $f8, $f24, $f20, $f22
  102. check_ps $f8, -21.0, 40.0
  103. writemsg "nmadd.ps"
  104. nmadd.ps $f8, $f24, $f20, $f22
  105. check_ps $f8, -13.0, -24.0
  106. writemsg "nmsub.ps"
  107. nmsub.ps $f8, $f24, $f20, $f22
  108. check_ps $f8, 21.0, -40.0
  109. writemsg "movn.ps (n)"
  110. li $2, 0
  111. mov.ps $f8, $f20
  112. movn.ps $f8, $f22, $2 # doesn't move
  113. check_ps $f8, 4.0, 16.0
  114. writemsg "movn.ps (y)"
  115. li $2, 1
  116. mov.ps $f8, $f20
  117. movn.ps $f8, $f22, $2 # does move
  118. check_ps $f8, -1.0, 2.0
  119. writemsg "movz.ps (y)"
  120. li $2, 0
  121. mov.ps $f8, $f20
  122. movz.ps $f8, $f22, $2 # does move
  123. check_ps $f8, -1.0, 2.0
  124. writemsg "movz.ps (n)"
  125. li $2, 1
  126. mov.ps $f8, $f20
  127. movz.ps $f8, $f22, $2 # doesn't move
  128. check_ps $f8, 4.0, 16.0
  129. writemsg "movf.ps (y,y)"
  130. cfc1 $2, $31
  131. or $2, $2, (1 << 23) | (1 << 25)
  132. xor $2, $2, (1 << 23) | (1 << 25)
  133. ctc1 $2, $31 # clear fcc0, clear fcc1
  134. mov.ps $f8, $f20
  135. movf.ps $f8, $f22, $fcc0 # moves both halves
  136. check_ps $f8, -1.0, 2.0
  137. writemsg "movf.ps (y,n)"
  138. cfc1 $2, $31
  139. or $2, $2, (1 << 23) | (1 << 25)
  140. xor $2, $2, (0 << 23) | (1 << 25)
  141. ctc1 $2, $31 # set fcc0, clear fcc1
  142. mov.ps $f8, $f20
  143. movf.ps $f8, $f22, $fcc0 # moves upper half only
  144. check_ps $f8, -1.0, 16.0
  145. writemsg "movf.ps (n,y)"
  146. cfc1 $2, $31
  147. or $2, $2, (1 << 23) | (1 << 25)
  148. xor $2, $2, (1 << 23) | (0 << 25)
  149. ctc1 $2, $31 # clear fcc0, set fcc1
  150. mov.ps $f8, $f20
  151. movf.ps $f8, $f22, $fcc0 # moves lower half only
  152. check_ps $f8, 4.0, 2.0
  153. writemsg "movf.ps (n,n)"
  154. cfc1 $2, $31
  155. or $2, $2, (1 << 23) | (1 << 25)
  156. xor $2, $2, (0 << 23) | (0 << 25)
  157. ctc1 $2, $31 # set fcc0, set fcc1
  158. mov.ps $f8, $f20
  159. movf.ps $f8, $f22, $fcc0 # doesn't move either half
  160. check_ps $f8, 4.0, 16.0
  161. writemsg "movt.ps (n,n)"
  162. cfc1 $2, $31
  163. or $2, $2, (1 << 23) | (1 << 25)
  164. xor $2, $2, (1 << 23) | (1 << 25)
  165. ctc1 $2, $31 # clear fcc0, clear fcc1
  166. mov.ps $f8, $f20
  167. movt.ps $f8, $f22, $fcc0 # doesn't move either half
  168. check_ps $f8, 4.0, 16.0
  169. writemsg "movt.ps (n,y)"
  170. cfc1 $2, $31
  171. or $2, $2, (1 << 23) | (1 << 25)
  172. xor $2, $2, (0 << 23) | (1 << 25)
  173. ctc1 $2, $31 # set fcc0, clear fcc1
  174. mov.ps $f8, $f20
  175. movt.ps $f8, $f22, $fcc0 # moves lower half only
  176. check_ps $f8, 4.0, 2.0
  177. writemsg "movt.ps (y,n)"
  178. cfc1 $2, $31
  179. or $2, $2, (1 << 23) | (1 << 25)
  180. xor $2, $2, (1 << 23) | (0 << 25)
  181. ctc1 $2, $31 # clear fcc0, set fcc1
  182. mov.ps $f8, $f20
  183. movt.ps $f8, $f22, $fcc0 # moves upper half only
  184. check_ps $f8, -1.0, 16.0
  185. writemsg "movt.ps (y,y)"
  186. cfc1 $2, $31
  187. or $2, $2, (1 << 23) | (1 << 25)
  188. xor $2, $2, (0 << 23) | (0 << 25)
  189. ctc1 $2, $31 # set fcc0, set fcc1
  190. mov.ps $f8, $f20
  191. movt.ps $f8, $f22, $fcc0 # moves both halves
  192. check_ps $f8, -1.0, 2.0
  193. writemsg "alnv.ps (aligned)"
  194. .data
  195. 1: .dword 0xc1a8000042200000 # -21.0, 40.0
  196. .dword 0xc228000041a00000 # -42.0, 20.0
  197. .text
  198. la $2, 1b
  199. li $3, 0
  200. addu $4, $3, 8
  201. luxc1 $f10, $3($2)
  202. luxc1 $f12, $4($2)
  203. alnv.ps $f8, $f10, $f12, $3
  204. check_ps $f8, -21.0, 40.0
  205. writemsg "alnv.ps (unaligned)"
  206. .data
  207. 1: .dword 0xc1a8000042200000 # -21.0, 40.0
  208. .dword 0xc228000041a00000 # -42.0, 20.0
  209. .hword 0x0001
  210. .text
  211. la $2, 1b
  212. li $3, 4
  213. addu $4, $3, 8
  214. luxc1 $f10, $3($2)
  215. luxc1 $f12, $4($2)
  216. alnv.ps $f8, $f10, $f12, $3
  217. lb $5, 16($2)
  218. bnez $5, 2f # little endian
  219. nop
  220. # big endian
  221. check_ps $f8, 40.0, -42.0
  222. b 3f
  223. nop
  224. 2:
  225. # little endian
  226. check_ps $f8, 20.0, -21.0
  227. 3:
  228. # We test c.cond.ps only lightly, just to make sure it modifies
  229. # two bits and compares the halves separately. Perhaps it should
  230. # be tested more thoroughly.
  231. writemsg "c.f.ps"
  232. cfc1 $2, $31
  233. or $2, $2, (1 << 23) | (0x7f << 25)
  234. ctc1 $2, $31 # set all fcc bits
  235. c.f.ps $fcc0, $f8, $f8 # -> f, f
  236. bc1t $fcc0, _fail
  237. nop
  238. bc1t $fcc1, _fail
  239. nop
  240. writemsg "c.olt.ps"
  241. cfc1 $2, $31
  242. or $2, $2, (1 << 23) | (0x7f << 25)
  243. xor $2, $2, (1 << 23) | (0x7f << 25)
  244. ctc1 $2, $31 # clear all fcc bits
  245. c.lt.ps $fcc0, $f22, $f24 # -> f, t
  246. bc1t $fcc0, _fail
  247. nop
  248. bc1f $fcc1, _fail
  249. nop
  250. pass
  251. .end DIAG