qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests/tcg/xtensa: add FP0 group conversion tests

Test conversions for normal, NaN and Inf arguments.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+305
+1
tests/tcg/xtensa/Makefile
··· 40 40 TESTCASES += test_fail.tst 41 41 TESTCASES += test_flix.tst 42 42 TESTCASES += test_fp0_arith.tst 43 + TESTCASES += test_fp0_conv.tst 43 44 TESTCASES += test_interrupt.tst 44 45 TESTCASES += test_loop.tst 45 46 TESTCASES += test_lsc.tst
+304
tests/tcg/xtensa/test_fp0_conv.S
··· 1 + #include "macros.inc" 2 + 3 + test_suite fp0_conv 4 + 5 + #if XCHAL_HAVE_FP 6 + 7 + .macro movfp fr, v 8 + movi a2, \v 9 + wfr \fr, a2 10 + .endm 11 + 12 + .macro test_ftoi_ex op, r0, fr0, v, c, r 13 + movi a2, 0 14 + wur a2, fsr 15 + movfp \fr0, \v 16 + \op \r0, \fr0, \c 17 + dump \r0 18 + movi a3, \r 19 + assert eq, \r0, a3 20 + rur a2, fsr 21 + assert eqi, a2, 0 22 + .endm 23 + 24 + .macro test_ftoi op, r0, fr0, v, c, r 25 + movi a2, 0 26 + wur a2, fcr 27 + test_ftoi_ex \op, \r0, \fr0, \v, \c, \r 28 + movi a2, 0x7c 29 + wur a2, fcr 30 + test_ftoi_ex \op, \r0, \fr0, \v, \c, \r 31 + .endm 32 + 33 + 34 + .macro test_itof_ex op, fr0, ar0, v, c, r 35 + movi a2, 0 36 + wur a2, fsr 37 + movi \ar0, \v 38 + \op \fr0, \ar0, \c 39 + 40 + rfr a2, \fr0 41 + dump a2 42 + movi a3, \r 43 + assert eq, a2, a3 44 + rur a2, fsr 45 + assert eqi, a2, 0 46 + .endm 47 + 48 + .macro test_itof_rm op, fr0, ar0, v, c, rm, r 49 + movi a2, \rm 50 + wur a2, fcr 51 + test_itof_ex \op, \fr0, \ar0, \v, \c, \r 52 + movi a2, (\rm) | 0x7c 53 + wur a2, fcr 54 + test_itof_ex \op, \fr0, \ar0, \v, \c, \r 55 + .endm 56 + 57 + .macro test_itof op, fr0, ar0, v, c, r0, r1, r2, r3 58 + test_itof_rm \op, \fr0, \ar0, \v, \c, 0, \r0 59 + test_itof_rm \op, \fr0, \ar0, \v, \c, 1, \r1 60 + test_itof_rm \op, \fr0, \ar0, \v, \c, 2, \r2 61 + test_itof_rm \op, \fr0, \ar0, \v, \c, 3, \r3 62 + .endm 63 + 64 + test round_s 65 + movi a2, 1 66 + wsr a2, cpenable 67 + 68 + /* NaN */ 69 + test_ftoi round.s, a2, f0, 0xffc00001, 0, 0x7fffffff 70 + test_ftoi round.s, a2, f0, 0xff800001, 0, 0x7fffffff 71 + 72 + /* -inf */ 73 + test_ftoi round.s, a2, f0, 0xff800000, 0, 0x80000000 74 + 75 + /* negative overflow */ 76 + test_ftoi round.s, a2, f0, 0xceffffff, 1, 0x80000000 77 + test_ftoi round.s, a2, f0, 0xcf000000, 0, 0x80000000 78 + test_ftoi round.s, a2, f0, 0xceffffff, 0, 0x80000080 79 + 80 + /* negative */ 81 + test_ftoi round.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ 82 + test_ftoi round.s, a2, f0, 0xbfc00000, 0, -2 /* -1.5 */ 83 + test_ftoi round.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ 84 + test_ftoi round.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ 85 + test_ftoi round.s, a2, f0, 0xbf400000, 0, -1 /* -0.75 */ 86 + test_ftoi round.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ 87 + 88 + /* positive */ 89 + test_ftoi round.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ 90 + test_ftoi round.s, a2, f0, 0x3f400000, 0, 1 /* 0.75 */ 91 + test_ftoi round.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ 92 + test_ftoi round.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ 93 + test_ftoi round.s, a2, f0, 0x3fc00000, 0, 2 /* 1.5 */ 94 + test_ftoi round.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ 95 + 96 + /* positive overflow */ 97 + test_ftoi round.s, a2, f0, 0x4effffff, 0, 0x7fffff80 98 + test_ftoi round.s, a2, f0, 0x4f000000, 0, 0x7fffffff 99 + test_ftoi round.s, a2, f0, 0x4effffff, 1, 0x7fffffff 100 + 101 + /* +inf */ 102 + test_ftoi round.s, a2, f0, 0x7f800000, 0, 0x7fffffff 103 + 104 + /* NaN */ 105 + test_ftoi round.s, a2, f0, 0x7f800001, 0, 0x7fffffff 106 + test_ftoi round.s, a2, f0, 0x7fc00000, 0, 0x7fffffff 107 + test_end 108 + 109 + test trunc_s 110 + /* NaN */ 111 + test_ftoi trunc.s, a2, f0, 0xffc00001, 0, 0x7fffffff 112 + test_ftoi trunc.s, a2, f0, 0xff800001, 0, 0x7fffffff 113 + 114 + /* -inf */ 115 + test_ftoi trunc.s, a2, f0, 0xff800000, 0, 0x80000000 116 + 117 + /* negative overflow */ 118 + test_ftoi trunc.s, a2, f0, 0xceffffff, 1, 0x80000000 119 + test_ftoi trunc.s, a2, f0, 0xcf000000, 0, 0x80000000 120 + test_ftoi trunc.s, a2, f0, 0xceffffff, 0, 0x80000080 121 + 122 + /* negative */ 123 + test_ftoi trunc.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ 124 + test_ftoi trunc.s, a2, f0, 0xbfc00000, 0, -1 /* -1.5 */ 125 + test_ftoi trunc.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ 126 + test_ftoi trunc.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ 127 + test_ftoi trunc.s, a2, f0, 0xbf400000, 0, 0 /* -0.75 */ 128 + test_ftoi trunc.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ 129 + 130 + /* positive */ 131 + test_ftoi trunc.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ 132 + test_ftoi trunc.s, a2, f0, 0x3f400000, 0, 0 /* 0.75 */ 133 + test_ftoi trunc.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ 134 + test_ftoi trunc.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ 135 + test_ftoi trunc.s, a2, f0, 0x3fc00000, 0, 1 /* 1.5 */ 136 + test_ftoi trunc.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ 137 + 138 + /* positive overflow */ 139 + test_ftoi trunc.s, a2, f0, 0x4effffff, 0, 0x7fffff80 140 + test_ftoi trunc.s, a2, f0, 0x4f000000, 0, 0x7fffffff 141 + test_ftoi trunc.s, a2, f0, 0x4effffff, 1, 0x7fffffff 142 + 143 + /* +inf */ 144 + test_ftoi trunc.s, a2, f0, 0x7f800000, 0, 0x7fffffff 145 + 146 + /* NaN */ 147 + test_ftoi trunc.s, a2, f0, 0x7f800001, 0, 0x7fffffff 148 + test_ftoi trunc.s, a2, f0, 0x7fc00000, 0, 0x7fffffff 149 + test_end 150 + 151 + test floor_s 152 + /* NaN */ 153 + test_ftoi floor.s, a2, f0, 0xffc00001, 0, 0x7fffffff 154 + test_ftoi floor.s, a2, f0, 0xff800001, 0, 0x7fffffff 155 + 156 + /* -inf */ 157 + test_ftoi floor.s, a2, f0, 0xff800000, 0, 0x80000000 158 + 159 + /* negative overflow */ 160 + test_ftoi floor.s, a2, f0, 0xceffffff, 1, 0x80000000 161 + test_ftoi floor.s, a2, f0, 0xcf000000, 0, 0x80000000 162 + test_ftoi floor.s, a2, f0, 0xceffffff, 0, 0x80000080 163 + 164 + /* negative */ 165 + test_ftoi floor.s, a2, f0, 0xbfa00000, 1, -3 /* -1.25 * 2 */ 166 + test_ftoi floor.s, a2, f0, 0xbfc00000, 0, -2 /* -1.5 */ 167 + test_ftoi floor.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ 168 + test_ftoi floor.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ 169 + test_ftoi floor.s, a2, f0, 0xbf400000, 0, -1 /* -0.75 */ 170 + test_ftoi floor.s, a2, f0, 0xbf000000, 0, -1 /* -0.5 */ 171 + 172 + /* positive */ 173 + test_ftoi floor.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ 174 + test_ftoi floor.s, a2, f0, 0x3f400000, 0, 0 /* 0.75 */ 175 + test_ftoi floor.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ 176 + test_ftoi floor.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ 177 + test_ftoi floor.s, a2, f0, 0x3fc00000, 0, 1 /* 1.5 */ 178 + test_ftoi floor.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ 179 + 180 + /* positive overflow */ 181 + test_ftoi floor.s, a2, f0, 0x4effffff, 0, 0x7fffff80 182 + test_ftoi floor.s, a2, f0, 0x4f000000, 0, 0x7fffffff 183 + test_ftoi floor.s, a2, f0, 0x4effffff, 1, 0x7fffffff 184 + 185 + /* +inf */ 186 + test_ftoi floor.s, a2, f0, 0x7f800000, 0, 0x7fffffff 187 + 188 + /* NaN */ 189 + test_ftoi floor.s, a2, f0, 0x7f800001, 0, 0x7fffffff 190 + test_ftoi floor.s, a2, f0, 0x7fc00000, 0, 0x7fffffff 191 + test_end 192 + 193 + test ceil_s 194 + /* NaN */ 195 + test_ftoi ceil.s, a2, f0, 0xffc00001, 0, 0x7fffffff 196 + test_ftoi ceil.s, a2, f0, 0xff800001, 0, 0x7fffffff 197 + 198 + /* -inf */ 199 + test_ftoi ceil.s, a2, f0, 0xff800000, 0, 0x80000000 200 + 201 + /* negative overflow */ 202 + test_ftoi ceil.s, a2, f0, 0xceffffff, 1, 0x80000000 203 + test_ftoi ceil.s, a2, f0, 0xcf000000, 0, 0x80000000 204 + test_ftoi ceil.s, a2, f0, 0xceffffff, 0, 0x80000080 205 + 206 + /* negative */ 207 + test_ftoi ceil.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ 208 + test_ftoi ceil.s, a2, f0, 0xbfc00000, 0, -1 /* -1.5 */ 209 + test_ftoi ceil.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ 210 + test_ftoi ceil.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ 211 + test_ftoi ceil.s, a2, f0, 0xbf400000, 0, 0 /* -0.75 */ 212 + test_ftoi ceil.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ 213 + 214 + /* positive */ 215 + test_ftoi ceil.s, a2, f0, 0x3f000000, 0, 1 /* 0.5 */ 216 + test_ftoi ceil.s, a2, f0, 0x3f400000, 0, 1 /* 0.75 */ 217 + test_ftoi ceil.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ 218 + test_ftoi ceil.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ 219 + test_ftoi ceil.s, a2, f0, 0x3fc00000, 0, 2 /* 1.5 */ 220 + test_ftoi ceil.s, a2, f0, 0x3fa00000, 1, 3 /* 1.25 * 2 */ 221 + 222 + /* positive overflow */ 223 + test_ftoi ceil.s, a2, f0, 0x4effffff, 0, 0x7fffff80 224 + test_ftoi ceil.s, a2, f0, 0x4f000000, 0, 0x7fffffff 225 + test_ftoi ceil.s, a2, f0, 0x4effffff, 1, 0x7fffffff 226 + 227 + /* +inf */ 228 + test_ftoi ceil.s, a2, f0, 0x7f800000, 0, 0x7fffffff 229 + 230 + /* NaN */ 231 + test_ftoi ceil.s, a2, f0, 0x7f800001, 0, 0x7fffffff 232 + test_ftoi ceil.s, a2, f0, 0x7fc00000, 0, 0x7fffffff 233 + test_end 234 + 235 + test utrunc_s 236 + /* NaN */ 237 + test_ftoi utrunc.s, a2, f0, 0xffc00001, 0, 0xffffffff 238 + test_ftoi utrunc.s, a2, f0, 0xff800001, 0, 0xffffffff 239 + 240 + /* -inf */ 241 + test_ftoi utrunc.s, a2, f0, 0xff800000, 0, 0x80000000 242 + 243 + /* negative overflow */ 244 + test_ftoi utrunc.s, a2, f0, 0xceffffff, 1, 0x80000000 245 + test_ftoi utrunc.s, a2, f0, 0xcf000000, 0, 0x80000000 246 + test_ftoi utrunc.s, a2, f0, 0xceffffff, 0, 0x80000080 247 + 248 + /* negative */ 249 + test_ftoi utrunc.s, a2, f0, 0xbfa00000, 1, -2 /* -1.25 * 2 */ 250 + test_ftoi utrunc.s, a2, f0, 0xbfc00000, 0, -1 /* -1.5 */ 251 + test_ftoi utrunc.s, a2, f0, 0xbf800000, 1, -2 /* -1 * 2 */ 252 + test_ftoi utrunc.s, a2, f0, 0xbf800000, 0, -1 /* -1 */ 253 + test_ftoi utrunc.s, a2, f0, 0xbf400000, 0, 0 /* -0.75 */ 254 + test_ftoi utrunc.s, a2, f0, 0xbf000000, 0, 0 /* -0.5 */ 255 + 256 + /* positive */ 257 + test_ftoi utrunc.s, a2, f0, 0x3f000000, 0, 0 /* 0.5 */ 258 + test_ftoi utrunc.s, a2, f0, 0x3f400000, 0, 0 /* 0.75 */ 259 + test_ftoi utrunc.s, a2, f0, 0x3f800000, 0, 1 /* 1 */ 260 + test_ftoi utrunc.s, a2, f0, 0x3f800000, 1, 2 /* 1 * 2 */ 261 + test_ftoi utrunc.s, a2, f0, 0x3fc00000, 0, 1 /* 1.5 */ 262 + test_ftoi utrunc.s, a2, f0, 0x3fa00000, 1, 2 /* 1.25 * 2 */ 263 + 264 + /* positive overflow */ 265 + test_ftoi utrunc.s, a2, f0, 0x4effffff, 0, 0x7fffff80 266 + test_ftoi utrunc.s, a2, f0, 0x4f000000, 0, 0x80000000 267 + test_ftoi utrunc.s, a2, f0, 0x4effffff, 1, 0xffffff00 268 + test_ftoi utrunc.s, a2, f0, 0x4f800000, 1, 0xffffffff 269 + 270 + /* +inf */ 271 + test_ftoi utrunc.s, a2, f0, 0x7f800000, 0, 0xffffffff 272 + 273 + /* NaN */ 274 + test_ftoi utrunc.s, a2, f0, 0x7f800001, 0, 0xffffffff 275 + test_ftoi utrunc.s, a2, f0, 0x7fc00000, 0, 0xffffffff 276 + test_end 277 + 278 + test float_s 279 + test_itof float.s, f0, a2, -1, 0, \ 280 + 0xbf800000, 0xbf800000, 0xbf800000, 0xbf800000 281 + test_itof float.s, f0, a2, 0, 0, 0, 0, 0, 0 282 + test_itof float.s, f0, a2, 1, 1, \ 283 + 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000 284 + test_itof float.s, f0, a2, 1, 0, \ 285 + 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 286 + test_itof float.s, f0, a2, 0x7fffffff, 0, \ 287 + 0x4f000000, 0x4effffff, 0x4f000000, 0x4effffff 288 + test_end 289 + 290 + test ufloat_s 291 + test_itof ufloat.s, f0, a2, 0, 0, 0, 0, 0, 0 292 + test_itof ufloat.s, f0, a2, 1, 1, \ 293 + 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000 294 + test_itof ufloat.s, f0, a2, 1, 0, \ 295 + 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 296 + test_itof ufloat.s, f0, a2, 0x7fffffff, 0, \ 297 + 0x4f000000, 0x4effffff, 0x4f000000, 0x4effffff 298 + test_itof ufloat.s, f0, a2, 0xffffffff, 0, \ 299 + 0x4f800000, 0x4f7fffff, 0x4f800000, 0x4f7fffff 300 + test_end 301 + 302 + #endif 303 + 304 + test_suite_end