github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/engine/wazevo/backend/isa/amd64/instr_encoding_test.go (about) 1 package amd64 2 3 import ( 4 "encoding/hex" 5 "runtime" 6 "testing" 7 8 "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" 9 "github.com/tetratelabs/wazero/internal/testing/require" 10 ) 11 12 func TestInstruction_format_encode(t *testing.T) { 13 _, _, m := newSetupWithMockContext() 14 defer func() { runtime.KeepAlive(m) }() 15 newAmodeImmReg := m.newAmodeImmReg 16 newAmodeRegRegShift := m.newAmodeRegRegShift 17 allocateExitSeq := m.allocateExitSeq 18 19 for _, tc := range []struct { 20 setup func(*instruction) 21 want string 22 wantFormat string 23 }{ 24 { 25 setup: func(i *instruction) { i.asRet() }, 26 wantFormat: "ret", 27 want: "c3", 28 }, 29 { 30 setup: func(i *instruction) { i.asImm(r14VReg, 1234567, false) }, 31 wantFormat: "movl $1234567, %r14d", 32 want: "41be87d61200", 33 }, 34 { 35 setup: func(i *instruction) { 36 v := -126 37 i.asImm(r14VReg, uint64(int64(v)), false) 38 }, 39 wantFormat: "movl $-126, %r14d", 40 want: "41be82ffffff", 41 }, 42 { 43 setup: func(i *instruction) { i.asImm(r14VReg, 0x200000000, true) }, 44 want: "49be0000000002000000", 45 wantFormat: "movabsq $8589934592, %r14", 46 }, 47 { 48 setup: func(i *instruction) { 49 v := -126 50 i.asImm(r14VReg, uint64(int64(v)), true) 51 }, 52 want: "49c7c682ffffff", 53 wantFormat: "movabsq $-126, %r14", 54 }, 55 { 56 setup: func(i *instruction) { i.asImm(rcxVReg, 1234567, false) }, 57 wantFormat: "movl $1234567, %ecx", 58 want: "b987d61200", 59 }, 60 { 61 setup: func(i *instruction) { 62 v := -126 63 i.asImm(rcxVReg, uint64(int64(v)), false) 64 }, 65 wantFormat: "movl $-126, %ecx", 66 want: "b982ffffff", 67 }, 68 { 69 setup: func(i *instruction) { i.asImm(rcxVReg, 0x200000000, true) }, 70 want: "48b90000000002000000", 71 wantFormat: "movabsq $8589934592, %rcx", 72 }, 73 { 74 setup: func(i *instruction) { 75 v := -126 76 i.asImm(rcxVReg, uint64(int64(v)), true) 77 }, 78 want: "48c7c182ffffff", 79 wantFormat: "movabsq $-126, %rcx", 80 }, 81 { 82 setup: func(i *instruction) { i.asSignExtendData(false) }, 83 want: "99", 84 wantFormat: "cdq", 85 }, 86 { 87 setup: func(i *instruction) { i.asSignExtendData(true) }, 88 want: "4899", 89 wantFormat: "cqo", 90 }, 91 { 92 setup: func(i *instruction) { i.asDiv(newOperandReg(raxVReg), true, true) }, 93 want: "48f7f8", 94 wantFormat: "idivq %rax", 95 }, 96 { 97 setup: func(i *instruction) { i.asDiv(newOperandReg(raxVReg), false, true) }, 98 want: "48f7f0", 99 wantFormat: "divq %rax", 100 }, 101 { 102 setup: func(i *instruction) { i.asDiv(newOperandReg(raxVReg), true, false) }, 103 want: "f7f8", 104 wantFormat: "idivl %eax", 105 }, 106 { 107 setup: func(i *instruction) { i.asDiv(newOperandReg(raxVReg), false, false) }, 108 want: "f7f0", 109 wantFormat: "divl %eax", 110 }, 111 { 112 setup: func(i *instruction) { i.asDiv(newOperandMem(newAmodeImmReg(123, raxVReg)), true, true) }, 113 want: "48f7787b", 114 wantFormat: "idivq 123(%rax)", 115 }, 116 { 117 setup: func(i *instruction) { i.asDiv(newOperandMem(newAmodeImmReg(123, raxVReg)), false, true) }, 118 want: "48f7707b", 119 wantFormat: "divq 123(%rax)", 120 }, 121 { 122 setup: func(i *instruction) { i.asDiv(newOperandMem(newAmodeImmReg(123, raxVReg)), true, false) }, 123 want: "f7787b", 124 wantFormat: "idivl 123(%rax)", 125 }, 126 { 127 setup: func(i *instruction) { i.asDiv(newOperandMem(newAmodeImmReg(123, raxVReg)), false, false) }, 128 want: "f7707b", 129 wantFormat: "divl 123(%rax)", 130 }, 131 { 132 setup: func(i *instruction) { i.asMovRR(raxVReg, rdiVReg, false) }, 133 want: "89c7", 134 wantFormat: "movl %eax, %edi", 135 }, 136 { 137 setup: func(i *instruction) { i.asMovRR(raxVReg, r15VReg, false) }, 138 want: "4189c7", 139 wantFormat: "movl %eax, %r15d", 140 }, 141 { 142 setup: func(i *instruction) { i.asMovRR(r14VReg, r15VReg, false) }, 143 want: "4589f7", 144 wantFormat: "movl %r14d, %r15d", 145 }, 146 { 147 setup: func(i *instruction) { i.asMovRR(raxVReg, rcxVReg, true) }, 148 want: "4889c1", 149 wantFormat: "movq %rax, %rcx", 150 }, 151 { 152 setup: func(i *instruction) { i.asMovRR(raxVReg, r15VReg, true) }, 153 want: "4989c7", 154 wantFormat: "movq %rax, %r15", 155 }, 156 { 157 setup: func(i *instruction) { i.asMovRR(r11VReg, r12VReg, true) }, 158 want: "4d89dc", 159 wantFormat: "movq %r11, %r12", 160 }, 161 { 162 setup: func(i *instruction) { i.asNot(newOperandReg(raxVReg), false) }, 163 want: "f7d0", 164 wantFormat: "notl %eax", 165 }, 166 { 167 setup: func(i *instruction) { i.asNot(newOperandReg(raxVReg), true) }, 168 want: "48f7d0", 169 wantFormat: "notq %rax", 170 }, 171 { 172 setup: func(i *instruction) { i.asNeg(newOperandReg(raxVReg), false) }, 173 want: "f7d8", 174 wantFormat: "negl %eax", 175 }, 176 { 177 setup: func(i *instruction) { i.asNeg(newOperandReg(raxVReg), true) }, 178 want: "48f7d8", 179 wantFormat: "negq %rax", 180 }, 181 { 182 setup: func(i *instruction) { i.asMulHi(newOperandReg(rsiVReg), true, false) }, 183 want: "f7ee", 184 wantFormat: "imull %esi", 185 }, 186 { 187 setup: func(i *instruction) { i.asMulHi(newOperandReg(r14VReg), false, false) }, 188 want: "41f7e6", 189 wantFormat: "mull %r14d", 190 }, 191 { 192 setup: func(i *instruction) { i.asMulHi(newOperandReg(r15VReg), true, true) }, 193 want: "49f7ef", 194 wantFormat: "imulq %r15", 195 }, 196 { 197 setup: func(i *instruction) { i.asMulHi(newOperandReg(rdiVReg), false, true) }, 198 want: "48f7e7", 199 wantFormat: "mulq %rdi", 200 }, 201 { 202 setup: func(i *instruction) { i.asMulHi(newOperandMem(newAmodeImmReg(123, raxVReg)), true, false) }, 203 want: "f7687b", 204 wantFormat: "imull 123(%rax)", 205 }, 206 { 207 setup: func(i *instruction) { i.asMulHi(newOperandMem(newAmodeImmReg(123, raxVReg)), false, false) }, 208 want: "f7607b", 209 wantFormat: "mull 123(%rax)", 210 }, 211 { 212 setup: func(i *instruction) { i.asMulHi(newOperandMem(newAmodeImmReg(123, raxVReg)), true, true) }, 213 want: "48f7687b", 214 wantFormat: "imulq 123(%rax)", 215 }, 216 { 217 setup: func(i *instruction) { i.asMulHi(newOperandMem(newAmodeImmReg(123, raxVReg)), false, true) }, 218 want: "48f7607b", 219 wantFormat: "mulq 123(%rax)", 220 }, 221 // bsr 222 { 223 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeBsr, newOperandReg(raxVReg), rdiVReg, false) }, 224 want: "0fbdf8", 225 wantFormat: "bsrl %eax, %edi", 226 }, 227 { 228 setup: func(i *instruction) { 229 i.asUnaryRmR(unaryRmROpcodeBsr, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, false) 230 }, 231 want: "0fbd787b", 232 wantFormat: "bsrl 123(%rax), %edi", 233 }, 234 // bsf 235 { 236 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeBsf, newOperandReg(raxVReg), rdiVReg, false) }, 237 want: "0fbcf8", 238 wantFormat: "bsfl %eax, %edi", 239 }, 240 { 241 setup: func(i *instruction) { 242 i.asUnaryRmR(unaryRmROpcodeBsf, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, false) 243 }, 244 want: "0fbc787b", 245 wantFormat: "bsfl 123(%rax), %edi", 246 }, 247 // tzcnt 248 { 249 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeTzcnt, newOperandReg(raxVReg), rdiVReg, false) }, 250 want: "f30fbcf8", 251 wantFormat: "tzcntl %eax, %edi", 252 }, 253 { 254 setup: func(i *instruction) { 255 i.asUnaryRmR(unaryRmROpcodeTzcnt, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, false) 256 }, 257 want: "f30fbc787b", 258 wantFormat: "tzcntl 123(%rax), %edi", 259 }, 260 // lzcnt 261 { 262 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeLzcnt, newOperandReg(raxVReg), rdiVReg, false) }, 263 want: "f30fbdf8", 264 wantFormat: "lzcntl %eax, %edi", 265 }, 266 { 267 setup: func(i *instruction) { 268 i.asUnaryRmR(unaryRmROpcodeLzcnt, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, false) 269 }, 270 want: "f30fbd787b", 271 wantFormat: "lzcntl 123(%rax), %edi", 272 }, 273 // popcnt 274 { 275 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodePopcnt, newOperandReg(raxVReg), rdiVReg, false) }, 276 want: "f30fb8f8", 277 wantFormat: "popcntl %eax, %edi", 278 }, 279 { 280 setup: func(i *instruction) { 281 i.asUnaryRmR(unaryRmROpcodePopcnt, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, false) 282 }, 283 want: "f30fb8787b", 284 wantFormat: "popcntl 123(%rax), %edi", 285 }, 286 // bsr 287 { 288 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeBsr, newOperandReg(raxVReg), rdiVReg, true) }, 289 want: "480fbdf8", 290 wantFormat: "bsrq %rax, %rdi", 291 }, 292 { 293 setup: func(i *instruction) { 294 i.asUnaryRmR(unaryRmROpcodeBsr, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, true) 295 }, 296 want: "480fbd787b", 297 wantFormat: "bsrq 123(%rax), %rdi", 298 }, 299 // bsf 300 { 301 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeBsf, newOperandReg(raxVReg), rdiVReg, true) }, 302 want: "480fbcf8", 303 wantFormat: "bsfq %rax, %rdi", 304 }, 305 { 306 setup: func(i *instruction) { 307 i.asUnaryRmR(unaryRmROpcodeBsf, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, true) 308 }, 309 want: "480fbc787b", 310 wantFormat: "bsfq 123(%rax), %rdi", 311 }, 312 // tzcnt 313 { 314 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeTzcnt, newOperandReg(raxVReg), rdiVReg, true) }, 315 want: "f3480fbcf8", 316 wantFormat: "tzcntq %rax, %rdi", 317 }, 318 { 319 setup: func(i *instruction) { 320 i.asUnaryRmR(unaryRmROpcodeTzcnt, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, true) 321 }, 322 want: "f3480fbc787b", 323 wantFormat: "tzcntq 123(%rax), %rdi", 324 }, 325 // lzcnt 326 { 327 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodeLzcnt, newOperandReg(raxVReg), rdiVReg, true) }, 328 want: "f3480fbdf8", 329 wantFormat: "lzcntq %rax, %rdi", 330 }, 331 { 332 setup: func(i *instruction) { 333 i.asUnaryRmR(unaryRmROpcodeLzcnt, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, true) 334 }, 335 want: "f3480fbd787b", 336 wantFormat: "lzcntq 123(%rax), %rdi", 337 }, 338 // popcnt 339 { 340 setup: func(i *instruction) { i.asUnaryRmR(unaryRmROpcodePopcnt, newOperandReg(raxVReg), rdiVReg, true) }, 341 want: "f3480fb8f8", 342 wantFormat: "popcntq %rax, %rdi", 343 }, 344 { 345 setup: func(i *instruction) { 346 i.asUnaryRmR(unaryRmROpcodePopcnt, newOperandMem(newAmodeImmReg(123, raxVReg)), rdiVReg, true) 347 }, 348 want: "f3480fb8787b", 349 wantFormat: "popcntq 123(%rax), %rdi", 350 }, 351 // addss 352 { 353 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddss, newOperandReg(xmm1VReg), xmm0VReg) }, 354 want: "f30f58c1", 355 wantFormat: "addss %xmm1, %xmm0", 356 }, 357 { 358 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddss, newOperandReg(xmm13VReg), xmm11VReg) }, 359 want: "f3450f58dd", 360 wantFormat: "addss %xmm13, %xmm11", 361 }, 362 { 363 setup: func(i *instruction) { 364 i.asXmmRmR(sseOpcodeAddss, newOperandMem(newAmodeImmReg(0, r13VReg)), xmm11VReg) 365 }, 366 want: "f3450f585d00", 367 wantFormat: "addss (%r13), %xmm11", 368 }, 369 { 370 setup: func(i *instruction) { 371 i.asXmmRmR(sseOpcodeAddss, newOperandMem(newAmodeImmReg(123, r13VReg)), xmm11VReg) 372 }, 373 want: "f3450f585d7b", 374 wantFormat: "addss 123(%r13), %xmm11", 375 }, 376 { 377 setup: func(i *instruction) { 378 i.asXmmRmR(sseOpcodeAddss, newOperandMem(newAmodeImmReg(1<<25, r13VReg)), xmm11VReg) 379 }, 380 want: "f3450f589d00000002", 381 wantFormat: "addss 33554432(%r13), %xmm11", 382 }, 383 { 384 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddsd, newOperandReg(xmm1VReg), xmm0VReg) }, 385 want: "f20f58c1", 386 wantFormat: "addsd %xmm1, %xmm0", 387 }, 388 { 389 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddsd, newOperandReg(xmm13VReg), xmm11VReg) }, 390 want: "f2450f58dd", 391 wantFormat: "addsd %xmm13, %xmm11", 392 }, 393 { 394 setup: func(i *instruction) { 395 i.asXmmRmR(sseOpcodeAddsd, newOperandMem(newAmodeImmReg(0, rbpVReg)), xmm11VReg) 396 }, 397 want: "f2440f585d00", 398 wantFormat: "addsd (%rbp), %xmm11", 399 }, 400 { 401 setup: func(i *instruction) { 402 i.asXmmRmR(sseOpcodeAddsd, newOperandMem(newAmodeImmReg(123, rbpVReg)), xmm11VReg) 403 }, 404 want: "f2440f585d7b", 405 wantFormat: "addsd 123(%rbp), %xmm11", 406 }, 407 { 408 setup: func(i *instruction) { 409 i.asXmmRmR(sseOpcodeAddsd, newOperandMem(newAmodeImmReg(1<<25, rbpVReg)), xmm11VReg) 410 }, 411 want: "f2440f589d00000002", 412 wantFormat: "addsd 33554432(%rbp), %xmm11", 413 }, 414 { 415 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddps, newOperandReg(xmm1VReg), xmm0VReg) }, 416 want: "0f58c1", 417 wantFormat: "addps %xmm1, %xmm0", 418 }, 419 { 420 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddpd, newOperandReg(xmm1VReg), xmm0VReg) }, 421 want: "660f58c1", 422 wantFormat: "addpd %xmm1, %xmm0", 423 }, 424 { 425 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddss, newOperandReg(xmm1VReg), xmm0VReg) }, 426 want: "f30f58c1", 427 wantFormat: "addss %xmm1, %xmm0", 428 }, 429 { 430 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAddsd, newOperandReg(xmm1VReg), xmm0VReg) }, 431 want: "f20f58c1", 432 wantFormat: "addsd %xmm1, %xmm0", 433 }, 434 { 435 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAndps, newOperandReg(xmm1VReg), xmm0VReg) }, 436 want: "0f54c1", 437 wantFormat: "andps %xmm1, %xmm0", 438 }, 439 { 440 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAndpd, newOperandReg(xmm1VReg), xmm0VReg) }, 441 want: "660f54c1", 442 wantFormat: "andpd %xmm1, %xmm0", 443 }, 444 { 445 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAndnps, newOperandReg(xmm1VReg), xmm0VReg) }, 446 want: "0f55c1", 447 wantFormat: "andnps %xmm1, %xmm0", 448 }, 449 { 450 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeAndnpd, newOperandReg(xmm1VReg), xmm0VReg) }, 451 want: "660f55c1", 452 wantFormat: "andnpd %xmm1, %xmm0", 453 }, 454 { 455 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeBlendvpd, newOperandReg(xmm1VReg), xmm0VReg) }, 456 want: "660f3815c1", 457 wantFormat: "blendvpd %xmm1, %xmm0", 458 }, 459 { 460 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeBlendvps, newOperandReg(xmm1VReg), xmm0VReg) }, 461 want: "660f3814c1", 462 wantFormat: "blendvps %xmm1, %xmm0", 463 }, 464 { 465 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvttps2dq, newOperandReg(xmm1VReg), xmm0VReg) }, 466 want: "f30f5bc1", 467 wantFormat: "cvttps2dq %xmm1, %xmm0", 468 }, 469 { 470 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvtdq2ps, newOperandReg(xmm1VReg), xmm0VReg) }, 471 want: "0f5bc1", 472 wantFormat: "cvtdq2ps %xmm1, %xmm0", 473 }, 474 { 475 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvtdq2pd, newOperandReg(xmm1VReg), xmm0VReg) }, 476 want: "f30fe6c1", 477 wantFormat: "cvtdq2pd %xmm1, %xmm0", 478 }, 479 { 480 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeDivps, newOperandReg(xmm1VReg), xmm0VReg) }, 481 want: "0f5ec1", 482 wantFormat: "divps %xmm1, %xmm0", 483 }, 484 { 485 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeDivpd, newOperandReg(xmm1VReg), xmm0VReg) }, 486 want: "660f5ec1", 487 wantFormat: "divpd %xmm1, %xmm0", 488 }, 489 { 490 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeDivss, newOperandReg(xmm1VReg), xmm0VReg) }, 491 want: "f30f5ec1", 492 wantFormat: "divss %xmm1, %xmm0", 493 }, 494 { 495 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeDivsd, newOperandReg(xmm1VReg), xmm0VReg) }, 496 want: "f20f5ec1", 497 wantFormat: "divsd %xmm1, %xmm0", 498 }, 499 { 500 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMaxps, newOperandReg(xmm1VReg), xmm0VReg) }, 501 want: "0f5fc1", 502 wantFormat: "maxps %xmm1, %xmm0", 503 }, 504 { 505 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMaxpd, newOperandReg(xmm1VReg), xmm0VReg) }, 506 want: "660f5fc1", 507 wantFormat: "maxpd %xmm1, %xmm0", 508 }, 509 { 510 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMaxss, newOperandReg(xmm1VReg), xmm0VReg) }, 511 want: "f30f5fc1", 512 wantFormat: "maxss %xmm1, %xmm0", 513 }, 514 { 515 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMaxsd, newOperandReg(xmm1VReg), xmm0VReg) }, 516 want: "f20f5fc1", 517 wantFormat: "maxsd %xmm1, %xmm0", 518 }, 519 { 520 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMinps, newOperandReg(xmm1VReg), xmm0VReg) }, 521 want: "0f5dc1", 522 wantFormat: "minps %xmm1, %xmm0", 523 }, 524 { 525 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddsw, newOperandReg(xmm7VReg), xmm6VReg) }, 526 want: "660fedf7", 527 wantFormat: "paddsw %xmm7, %xmm6", 528 }, 529 { 530 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddusb, newOperandReg(xmm1VReg), xmm0VReg) }, 531 want: "660fdcc1", 532 wantFormat: "paddusb %xmm1, %xmm0", 533 }, 534 { 535 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddusw, newOperandReg(xmm1VReg), xmm0VReg) }, 536 want: "660fddc1", 537 wantFormat: "paddusw %xmm1, %xmm0", 538 }, 539 { 540 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePand, newOperandReg(xmm1VReg), xmm0VReg) }, 541 want: "660fdbc1", 542 wantFormat: "pand %xmm1, %xmm0", 543 }, 544 { 545 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePandn, newOperandReg(xmm1VReg), xmm0VReg) }, 546 want: "660fdfc1", 547 wantFormat: "pandn %xmm1, %xmm0", 548 }, 549 { 550 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePavgb, newOperandReg(xmm1VReg), xmm0VReg) }, 551 want: "660fe0c1", 552 wantFormat: "pavgb %xmm1, %xmm0", 553 }, 554 { 555 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePavgw, newOperandReg(xmm1VReg), xmm0VReg) }, 556 want: "660fe3c1", 557 wantFormat: "pavgw %xmm1, %xmm0", 558 }, 559 { 560 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpeqb, newOperandReg(xmm1VReg), xmm0VReg) }, 561 want: "660f74c1", 562 wantFormat: "pcmpeqb %xmm1, %xmm0", 563 }, 564 { 565 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpeqw, newOperandReg(xmm1VReg), xmm0VReg) }, 566 want: "660f75c1", 567 wantFormat: "pcmpeqw %xmm1, %xmm0", 568 }, 569 { 570 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpeqd, newOperandReg(xmm1VReg), xmm0VReg) }, 571 want: "660f76c1", 572 wantFormat: "pcmpeqd %xmm1, %xmm0", 573 }, 574 { 575 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpeqq, newOperandReg(xmm1VReg), xmm0VReg) }, 576 want: "660f3829c1", 577 wantFormat: "pcmpeqq %xmm1, %xmm0", 578 }, 579 { 580 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpgtb, newOperandReg(xmm1VReg), xmm0VReg) }, 581 want: "660f64c1", 582 wantFormat: "pcmpgtb %xmm1, %xmm0", 583 }, 584 { 585 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpgtw, newOperandReg(xmm1VReg), xmm0VReg) }, 586 want: "660f65c1", 587 wantFormat: "pcmpgtw %xmm1, %xmm0", 588 }, 589 { 590 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpgtd, newOperandReg(xmm1VReg), xmm0VReg) }, 591 want: "660f66c1", 592 wantFormat: "pcmpgtd %xmm1, %xmm0", 593 }, 594 { 595 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePcmpgtq, newOperandReg(xmm1VReg), xmm0VReg) }, 596 want: "660f3837c1", 597 wantFormat: "pcmpgtq %xmm1, %xmm0", 598 }, 599 { 600 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaddwd, newOperandReg(xmm1VReg), xmm0VReg) }, 601 want: "660ff5c1", 602 wantFormat: "pmaddwd %xmm1, %xmm0", 603 }, 604 { 605 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaxsb, newOperandReg(xmm1VReg), xmm0VReg) }, 606 want: "660f383cc1", 607 wantFormat: "pmaxsb %xmm1, %xmm0", 608 }, 609 { 610 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaxsw, newOperandReg(xmm1VReg), xmm0VReg) }, 611 want: "660feec1", 612 wantFormat: "pmaxsw %xmm1, %xmm0", 613 }, 614 { 615 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaxsd, newOperandReg(xmm1VReg), xmm0VReg) }, 616 want: "660f383dc1", 617 wantFormat: "pmaxsd %xmm1, %xmm0", 618 }, 619 { 620 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaxub, newOperandReg(xmm1VReg), xmm0VReg) }, 621 want: "660fdec1", 622 wantFormat: "pmaxub %xmm1, %xmm0", 623 }, 624 { 625 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaxuw, newOperandReg(xmm1VReg), xmm0VReg) }, 626 want: "660f383ec1", 627 wantFormat: "pmaxuw %xmm1, %xmm0", 628 }, 629 { 630 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaxud, newOperandReg(xmm1VReg), xmm0VReg) }, 631 want: "660f383fc1", 632 wantFormat: "pmaxud %xmm1, %xmm0", 633 }, 634 { 635 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePminsb, newOperandReg(xmm1VReg), xmm0VReg) }, 636 want: "660f3838c1", 637 wantFormat: "pminsb %xmm1, %xmm0", 638 }, 639 { 640 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePminsw, newOperandReg(xmm1VReg), xmm0VReg) }, 641 want: "660feac1", 642 wantFormat: "pminsw %xmm1, %xmm0", 643 }, 644 { 645 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePminsd, newOperandReg(xmm1VReg), xmm0VReg) }, 646 want: "660f3839c1", 647 wantFormat: "pminsd %xmm1, %xmm0", 648 }, 649 { 650 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePminub, newOperandReg(xmm1VReg), xmm0VReg) }, 651 want: "660fdac1", 652 wantFormat: "pminub %xmm1, %xmm0", 653 }, 654 { 655 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePminuw, newOperandReg(xmm1VReg), xmm0VReg) }, 656 want: "660f383ac1", 657 wantFormat: "pminuw %xmm1, %xmm0", 658 }, 659 { 660 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePminud, newOperandReg(xmm1VReg), xmm0VReg) }, 661 want: "660f383bc1", 662 wantFormat: "pminud %xmm1, %xmm0", 663 }, 664 { 665 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmulld, newOperandReg(xmm1VReg), xmm0VReg) }, 666 want: "660f3840c1", 667 wantFormat: "pmulld %xmm1, %xmm0", 668 }, 669 { 670 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmullw, newOperandReg(xmm1VReg), xmm0VReg) }, 671 want: "660fd5c1", 672 wantFormat: "pmullw %xmm1, %xmm0", 673 }, 674 { 675 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmuludq, newOperandReg(xmm1VReg), xmm0VReg) }, 676 want: "660ff4c1", 677 wantFormat: "pmuludq %xmm1, %xmm0", 678 }, 679 { 680 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePor, newOperandReg(xmm1VReg), xmm0VReg) }, 681 want: "660febc1", 682 wantFormat: "por %xmm1, %xmm0", 683 }, 684 { 685 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePshufb, newOperandReg(xmm1VReg), xmm0VReg) }, 686 want: "660f3800c1", 687 wantFormat: "pshufb %xmm1, %xmm0", 688 }, 689 { 690 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubb, newOperandReg(xmm1VReg), xmm0VReg) }, 691 want: "660ff8c1", 692 wantFormat: "psubb %xmm1, %xmm0", 693 }, 694 { 695 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubd, newOperandReg(xmm1VReg), xmm0VReg) }, 696 want: "660ffac1", 697 wantFormat: "psubd %xmm1, %xmm0", 698 }, 699 { 700 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubq, newOperandReg(xmm1VReg), xmm0VReg) }, 701 want: "660ffbc1", 702 wantFormat: "psubq %xmm1, %xmm0", 703 }, 704 { 705 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubw, newOperandReg(xmm1VReg), xmm0VReg) }, 706 want: "660ff9c1", 707 wantFormat: "psubw %xmm1, %xmm0", 708 }, 709 { 710 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubsb, newOperandReg(xmm1VReg), xmm0VReg) }, 711 want: "660fe8c1", 712 wantFormat: "psubsb %xmm1, %xmm0", 713 }, 714 { 715 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubsw, newOperandReg(xmm1VReg), xmm0VReg) }, 716 want: "660fe9c1", 717 wantFormat: "psubsw %xmm1, %xmm0", 718 }, 719 { 720 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubusb, newOperandReg(xmm1VReg), xmm0VReg) }, 721 want: "660fd8c1", 722 wantFormat: "psubusb %xmm1, %xmm0", 723 }, 724 { 725 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePsubusw, newOperandReg(xmm1VReg), xmm0VReg) }, 726 want: "660fd9c1", 727 wantFormat: "psubusw %xmm1, %xmm0", 728 }, 729 { 730 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePunpckhbw, newOperandReg(xmm1VReg), xmm0VReg) }, 731 want: "660f68c1", 732 wantFormat: "punpckhbw %xmm1, %xmm0", 733 }, 734 { 735 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePunpcklbw, newOperandReg(xmm1VReg), xmm0VReg) }, 736 want: "660f60c1", 737 wantFormat: "punpcklbw %xmm1, %xmm0", 738 }, 739 { 740 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePxor, newOperandReg(xmm1VReg), xmm0VReg) }, 741 want: "660fefc1", 742 wantFormat: "pxor %xmm1, %xmm0", 743 }, 744 { 745 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeSubps, newOperandReg(xmm1VReg), xmm0VReg) }, 746 want: "0f5cc1", 747 wantFormat: "subps %xmm1, %xmm0", 748 }, 749 { 750 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeSubpd, newOperandReg(xmm1VReg), xmm0VReg) }, 751 want: "660f5cc1", 752 wantFormat: "subpd %xmm1, %xmm0", 753 }, 754 { 755 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeSubss, newOperandReg(xmm1VReg), xmm0VReg) }, 756 want: "f30f5cc1", 757 wantFormat: "subss %xmm1, %xmm0", 758 }, 759 { 760 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeSubsd, newOperandReg(xmm1VReg), xmm0VReg) }, 761 want: "f20f5cc1", 762 wantFormat: "subsd %xmm1, %xmm0", 763 }, 764 { 765 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeXorps, newOperandReg(xmm1VReg), xmm0VReg) }, 766 want: "0f57c1", 767 wantFormat: "xorps %xmm1, %xmm0", 768 }, 769 { 770 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeXorps, newOperandReg(xmm1VReg), xmm0VReg) }, 771 want: "0f57c1", 772 wantFormat: "xorps %xmm1, %xmm0", 773 }, 774 { 775 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeXorpd, newOperandReg(xmm1VReg), xmm0VReg) }, 776 want: "660f57c1", 777 wantFormat: "xorpd %xmm1, %xmm0", 778 }, 779 { 780 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeXorpd, newOperandReg(xmm1VReg), xmm0VReg) }, 781 want: "660f57c1", 782 wantFormat: "xorpd %xmm1, %xmm0", 783 }, 784 { 785 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMinpd, newOperandReg(xmm1VReg), xmm0VReg) }, 786 want: "660f5dc1", 787 wantFormat: "minpd %xmm1, %xmm0", 788 }, 789 { 790 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMinss, newOperandReg(xmm1VReg), xmm0VReg) }, 791 want: "f30f5dc1", 792 wantFormat: "minss %xmm1, %xmm0", 793 }, 794 { 795 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMinsd, newOperandReg(xmm1VReg), xmm0VReg) }, 796 want: "f20f5dc1", 797 wantFormat: "minsd %xmm1, %xmm0", 798 }, 799 { 800 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMovlhps, newOperandReg(xmm1VReg), xmm0VReg) }, 801 want: "0f16c1", 802 wantFormat: "movlhps %xmm1, %xmm0", 803 }, 804 { 805 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMovsd, newOperandReg(xmm1VReg), xmm0VReg) }, 806 want: "f20f10c1", 807 wantFormat: "movsd %xmm1, %xmm0", 808 }, 809 { 810 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMulps, newOperandReg(xmm1VReg), xmm0VReg) }, 811 want: "0f59c1", 812 wantFormat: "mulps %xmm1, %xmm0", 813 }, 814 { 815 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMulpd, newOperandReg(xmm1VReg), xmm0VReg) }, 816 want: "660f59c1", 817 wantFormat: "mulpd %xmm1, %xmm0", 818 }, 819 { 820 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMulss, newOperandReg(xmm1VReg), xmm0VReg) }, 821 want: "f30f59c1", 822 wantFormat: "mulss %xmm1, %xmm0", 823 }, 824 { 825 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeMulsd, newOperandReg(xmm1VReg), xmm0VReg) }, 826 want: "f20f59c1", 827 wantFormat: "mulsd %xmm1, %xmm0", 828 }, 829 { 830 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeOrpd, newOperandReg(xmm1VReg), xmm0VReg) }, 831 want: "660f56c1", 832 wantFormat: "orpd %xmm1, %xmm0", 833 }, 834 { 835 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeOrps, newOperandReg(xmm1VReg), xmm0VReg) }, 836 want: "0f56c1", 837 wantFormat: "orps %xmm1, %xmm0", 838 }, 839 { 840 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePackssdw, newOperandReg(xmm1VReg), xmm0VReg) }, 841 want: "660f6bc1", 842 wantFormat: "packssdw %xmm1, %xmm0", 843 }, 844 { 845 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePacksswb, newOperandReg(xmm1VReg), xmm0VReg) }, 846 want: "660f63c1", 847 wantFormat: "packsswb %xmm1, %xmm0", 848 }, 849 { 850 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePackusdw, newOperandReg(xmm1VReg), xmm0VReg) }, 851 want: "660f382bc1", 852 wantFormat: "packusdw %xmm1, %xmm0", 853 }, 854 { 855 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePackuswb, newOperandReg(xmm1VReg), xmm0VReg) }, 856 want: "660f67c1", 857 wantFormat: "packuswb %xmm1, %xmm0", 858 }, 859 { 860 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddb, newOperandReg(xmm1VReg), xmm0VReg) }, 861 want: "660ffcc1", 862 wantFormat: "paddb %xmm1, %xmm0", 863 }, 864 { 865 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddd, newOperandReg(xmm1VReg), xmm0VReg) }, 866 want: "660ffec1", 867 wantFormat: "paddd %xmm1, %xmm0", 868 }, 869 { 870 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddq, newOperandReg(xmm1VReg), xmm0VReg) }, 871 want: "660fd4c1", 872 wantFormat: "paddq %xmm1, %xmm0", 873 }, 874 { 875 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddw, newOperandReg(xmm1VReg), xmm0VReg) }, 876 want: "660ffdc1", 877 wantFormat: "paddw %xmm1, %xmm0", 878 }, 879 { 880 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePaddsb, newOperandReg(xmm1VReg), xmm0VReg) }, 881 want: "660fecc1", 882 wantFormat: "paddsb %xmm1, %xmm0", 883 }, 884 { 885 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvtss2sd, newOperandReg(xmm1VReg), xmm0VReg) }, 886 want: "f30f5ac1", 887 wantFormat: "cvtss2sd %xmm1, %xmm0", 888 }, 889 { 890 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvtsd2ss, newOperandReg(xmm1VReg), xmm0VReg) }, 891 want: "f20f5ac1", 892 wantFormat: "cvtsd2ss %xmm1, %xmm0", 893 }, 894 { 895 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovaps, newOperandReg(xmm1VReg), xmm0VReg) }, 896 want: "0f28c1", 897 wantFormat: "movaps %xmm1, %xmm0", 898 }, 899 { 900 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovapd, newOperandReg(xmm1VReg), xmm0VReg) }, 901 want: "660f28c1", 902 wantFormat: "movapd %xmm1, %xmm0", 903 }, 904 { 905 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovdqa, newOperandReg(xmm1VReg), xmm0VReg) }, 906 want: "660f6fc1", 907 wantFormat: "movdqa %xmm1, %xmm0", 908 }, 909 { 910 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovdqu, newOperandReg(xmm1VReg), xmm0VReg) }, 911 want: "f30f6fc1", 912 wantFormat: "movdqu %xmm1, %xmm0", 913 }, 914 { 915 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovsd, newOperandReg(xmm1VReg), xmm0VReg) }, 916 want: "f20f10c1", 917 wantFormat: "movsd %xmm1, %xmm0", 918 }, 919 { 920 setup: func(i *instruction) { 921 i.asXmmUnaryRmR(sseOpcodeMovsd, newOperandMem(newAmodeImmReg(16, r12VReg)), xmm0VReg) 922 }, 923 want: "f2410f10442410", 924 wantFormat: "movsd 16(%r12), %xmm0", 925 }, 926 { 927 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovss, newOperandReg(xmm1VReg), xmm0VReg) }, 928 want: "f30f10c1", 929 wantFormat: "movss %xmm1, %xmm0", 930 }, 931 { 932 setup: func(i *instruction) { 933 i.asXmmUnaryRmR(sseOpcodeMovss, newOperandMem(newAmodeImmReg(160, r12VReg)), xmm15VReg) 934 }, 935 want: "f3450f10bc24a0000000", 936 wantFormat: "movss 160(%r12), %xmm15", 937 }, 938 { 939 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovups, newOperandReg(xmm1VReg), xmm0VReg) }, 940 want: "0f10c1", 941 wantFormat: "movups %xmm1, %xmm0", 942 }, 943 { 944 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeMovupd, newOperandReg(xmm1VReg), xmm0VReg) }, 945 want: "660f10c1", 946 wantFormat: "movupd %xmm1, %xmm0", 947 }, 948 { 949 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePabsb, newOperandReg(xmm1VReg), xmm0VReg) }, 950 want: "660f381cc1", 951 wantFormat: "pabsb %xmm1, %xmm0", 952 }, 953 { 954 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePabsw, newOperandReg(xmm1VReg), xmm0VReg) }, 955 want: "660f381dc1", 956 wantFormat: "pabsw %xmm1, %xmm0", 957 }, 958 { 959 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePabsd, newOperandReg(xmm1VReg), xmm0VReg) }, 960 want: "660f381ec1", 961 wantFormat: "pabsd %xmm1, %xmm0", 962 }, 963 { 964 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovsxbd, newOperandReg(xmm1VReg), xmm0VReg) }, 965 want: "660f3821c1", 966 wantFormat: "pmovsxbd %xmm1, %xmm0", 967 }, 968 { 969 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovsxbw, newOperandReg(xmm1VReg), xmm0VReg) }, 970 want: "660f3820c1", 971 wantFormat: "pmovsxbw %xmm1, %xmm0", 972 }, 973 { 974 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovsxbq, newOperandReg(xmm1VReg), xmm0VReg) }, 975 want: "660f3822c1", 976 wantFormat: "pmovsxbq %xmm1, %xmm0", 977 }, 978 { 979 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovsxwd, newOperandReg(xmm1VReg), xmm0VReg) }, 980 want: "660f3823c1", 981 wantFormat: "pmovsxwd %xmm1, %xmm0", 982 }, 983 { 984 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovsxwq, newOperandReg(xmm1VReg), xmm0VReg) }, 985 want: "660f3824c1", 986 wantFormat: "pmovsxwq %xmm1, %xmm0", 987 }, 988 { 989 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovsxdq, newOperandReg(xmm1VReg), xmm0VReg) }, 990 want: "660f3825c1", 991 wantFormat: "pmovsxdq %xmm1, %xmm0", 992 }, 993 { 994 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovzxbd, newOperandReg(xmm1VReg), xmm0VReg) }, 995 want: "660f3831c1", 996 wantFormat: "pmovzxbd %xmm1, %xmm0", 997 }, 998 { 999 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovzxbw, newOperandReg(xmm1VReg), xmm0VReg) }, 1000 want: "660f3830c1", 1001 wantFormat: "pmovzxbw %xmm1, %xmm0", 1002 }, 1003 { 1004 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovzxbq, newOperandReg(xmm1VReg), xmm0VReg) }, 1005 want: "660f3832c1", 1006 wantFormat: "pmovzxbq %xmm1, %xmm0", 1007 }, 1008 { 1009 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovzxwd, newOperandReg(xmm1VReg), xmm0VReg) }, 1010 want: "660f3833c1", 1011 wantFormat: "pmovzxwd %xmm1, %xmm0", 1012 }, 1013 { 1014 setup: func(i *instruction) { 1015 i.asXmmUnaryRmR(sseOpcodePmovzxwd, newOperandMem(newAmodeImmReg(0, rbpVReg)), xmm11VReg) 1016 }, 1017 want: "66440f38335d00", 1018 wantFormat: "pmovzxwd (%rbp), %xmm11", 1019 }, 1020 { 1021 setup: func(i *instruction) { 1022 i.asXmmUnaryRmR(sseOpcodePmovzxwd, newOperandMem(newAmodeImmReg(123, rbpVReg)), xmm11VReg) 1023 }, 1024 want: "66440f38335d7b", 1025 wantFormat: "pmovzxwd 123(%rbp), %xmm11", 1026 }, 1027 { 1028 setup: func(i *instruction) { 1029 i.asXmmUnaryRmR(sseOpcodePmovzxwd, newOperandMem(newAmodeImmReg(1<<25, rbpVReg)), xmm11VReg) 1030 }, 1031 want: "66440f38339d00000002", 1032 wantFormat: "pmovzxwd 33554432(%rbp), %xmm11", 1033 }, 1034 { 1035 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovzxwq, newOperandReg(xmm1VReg), xmm0VReg) }, 1036 want: "660f3834c1", 1037 wantFormat: "pmovzxwq %xmm1, %xmm0", 1038 }, 1039 { 1040 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodePmovzxdq, newOperandReg(xmm1VReg), xmm0VReg) }, 1041 want: "660f3835c1", 1042 wantFormat: "pmovzxdq %xmm1, %xmm0", 1043 }, 1044 { 1045 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtps, newOperandReg(xmm1VReg), xmm0VReg) }, 1046 want: "0f51c1", 1047 wantFormat: "sqrtps %xmm1, %xmm0", 1048 }, 1049 { 1050 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtpd, newOperandReg(xmm1VReg), xmm0VReg) }, 1051 want: "660f51c1", 1052 wantFormat: "sqrtpd %xmm1, %xmm0", 1053 }, 1054 { 1055 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtss, newOperandReg(xmm1VReg), xmm0VReg) }, 1056 want: "f30f51c1", 1057 wantFormat: "sqrtss %xmm1, %xmm0", 1058 }, 1059 { 1060 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtsd, newOperandReg(xmm1VReg), xmm0VReg) }, 1061 want: "f20f51c1", 1062 wantFormat: "sqrtsd %xmm1, %xmm0", 1063 }, 1064 { 1065 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtsd, newOperandReg(xmm15VReg), xmm0VReg) }, 1066 want: "f2410f51c7", 1067 wantFormat: "sqrtsd %xmm15, %xmm0", 1068 }, 1069 { 1070 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtsd, newOperandReg(xmm1VReg), xmm15VReg) }, 1071 want: "f2440f51f9", 1072 wantFormat: "sqrtsd %xmm1, %xmm15", 1073 }, 1074 { 1075 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeSqrtsd, newOperandReg(xmm11VReg), xmm15VReg) }, 1076 want: "f2450f51fb", 1077 wantFormat: "sqrtsd %xmm11, %xmm15", 1078 }, 1079 { 1080 setup: func(i *instruction) { 1081 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeNearest), newOperandReg(xmm11VReg), xmm15VReg) 1082 }, 1083 want: "66450f3a0afb00", 1084 wantFormat: "roundss $0, %xmm11, %xmm15", 1085 }, 1086 { 1087 setup: func(i *instruction) { 1088 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeDown), newOperandReg(xmm11VReg), xmm15VReg) 1089 }, 1090 want: "66450f3a0afb01", 1091 wantFormat: "roundss $1, %xmm11, %xmm15", 1092 }, 1093 { 1094 setup: func(i *instruction) { 1095 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeUp), newOperandReg(xmm11VReg), xmm15VReg) 1096 }, 1097 want: "66450f3a0afb02", 1098 wantFormat: "roundss $2, %xmm11, %xmm15", 1099 }, 1100 { 1101 setup: func(i *instruction) { 1102 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeZero), newOperandReg(xmm11VReg), xmm15VReg) 1103 }, 1104 want: "66450f3a0afb03", 1105 wantFormat: "roundss $3, %xmm11, %xmm15", 1106 }, 1107 { 1108 setup: func(i *instruction) { 1109 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeNearest), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1110 }, 1111 want: "66440f3a0a787b00", 1112 wantFormat: "roundss $0, 123(%rax), %xmm15", 1113 }, 1114 { 1115 setup: func(i *instruction) { 1116 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeDown), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1117 }, 1118 want: "66440f3a0a787b01", 1119 wantFormat: "roundss $1, 123(%rax), %xmm15", 1120 }, 1121 { 1122 setup: func(i *instruction) { 1123 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeUp), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1124 }, 1125 want: "66440f3a0a787b02", 1126 wantFormat: "roundss $2, 123(%rax), %xmm15", 1127 }, 1128 { 1129 setup: func(i *instruction) { 1130 i.asXmmUnaryRmRImm(sseOpcodeRoundss, uint8(roundingModeZero), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1131 }, 1132 want: "66440f3a0a787b03", 1133 wantFormat: "roundss $3, 123(%rax), %xmm15", 1134 }, 1135 { 1136 setup: func(i *instruction) { 1137 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeNearest), newOperandReg(xmm11VReg), xmm15VReg) 1138 }, 1139 want: "66450f3a0bfb00", 1140 wantFormat: "roundsd $0, %xmm11, %xmm15", 1141 }, 1142 { 1143 setup: func(i *instruction) { 1144 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeDown), newOperandReg(xmm11VReg), xmm15VReg) 1145 }, 1146 want: "66450f3a0bfb01", 1147 wantFormat: "roundsd $1, %xmm11, %xmm15", 1148 }, 1149 { 1150 setup: func(i *instruction) { 1151 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeUp), newOperandReg(xmm11VReg), xmm15VReg) 1152 }, 1153 want: "66450f3a0bfb02", 1154 wantFormat: "roundsd $2, %xmm11, %xmm15", 1155 }, 1156 { 1157 setup: func(i *instruction) { 1158 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeZero), newOperandReg(xmm11VReg), xmm15VReg) 1159 }, 1160 want: "66450f3a0bfb03", 1161 wantFormat: "roundsd $3, %xmm11, %xmm15", 1162 }, 1163 { 1164 setup: func(i *instruction) { 1165 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeNearest), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1166 }, 1167 want: "66440f3a0b787b00", 1168 wantFormat: "roundsd $0, 123(%rax), %xmm15", 1169 }, 1170 { 1171 setup: func(i *instruction) { 1172 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeDown), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1173 }, 1174 want: "66440f3a0b787b01", 1175 wantFormat: "roundsd $1, 123(%rax), %xmm15", 1176 }, 1177 { 1178 setup: func(i *instruction) { 1179 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeUp), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1180 }, 1181 want: "66440f3a0b787b02", 1182 wantFormat: "roundsd $2, 123(%rax), %xmm15", 1183 }, 1184 { 1185 setup: func(i *instruction) { 1186 i.asXmmUnaryRmRImm(sseOpcodeRoundsd, uint8(roundingModeZero), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm15VReg) 1187 }, 1188 want: "66440f3a0b787b03", 1189 wantFormat: "roundsd $3, 123(%rax), %xmm15", 1190 }, 1191 { 1192 setup: func(i *instruction) { i.asXmmCmpRmR(sseOpcodePtest, newOperandReg(xmm1VReg), xmm0VReg) }, 1193 want: "660f3817c1", 1194 wantFormat: "ptest %xmm1, %xmm0", 1195 }, 1196 { 1197 setup: func(i *instruction) { i.asXmmCmpRmR(sseOpcodeUcomisd, newOperandReg(xmm1VReg), xmm0VReg) }, 1198 want: "660f2ec1", 1199 wantFormat: "ucomisd %xmm1, %xmm0", 1200 }, 1201 { 1202 setup: func(i *instruction) { i.asXmmCmpRmR(sseOpcodeUcomiss, newOperandReg(xmm1VReg), xmm0VReg) }, 1203 want: "0f2ec1", 1204 wantFormat: "ucomiss %xmm1, %xmm0", 1205 }, 1206 { 1207 setup: func(i *instruction) { 1208 i.asXmmCmpRmR(sseOpcodePtest, newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1209 }, 1210 want: "660f3817407b", 1211 wantFormat: "ptest 123(%rax), %xmm0", 1212 }, 1213 { 1214 setup: func(i *instruction) { 1215 i.asXmmCmpRmR(sseOpcodeUcomisd, newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1216 }, 1217 want: "660f2e407b", 1218 wantFormat: "ucomisd 123(%rax), %xmm0", 1219 }, 1220 { 1221 setup: func(i *instruction) { 1222 i.asXmmCmpRmR(sseOpcodeUcomiss, newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1223 }, 1224 want: "0f2e407b", 1225 wantFormat: "ucomiss 123(%rax), %xmm0", 1226 }, 1227 // movd 1228 { 1229 setup: func(i *instruction) { i.asGprToXmm(sseOpcodeMovd, newOperandReg(rdiVReg), xmm0VReg, false) }, 1230 want: "660f6ec7", 1231 wantFormat: "movd %edi, %xmm0", 1232 }, 1233 { 1234 setup: func(i *instruction) { 1235 i.asGprToXmm(sseOpcodeMovd, newOperandMem(newAmodeImmReg(0, rspVReg)), xmm0VReg, true) 1236 }, 1237 want: "66480f6e0424", 1238 wantFormat: "movd (%rsp), %xmm0", 1239 }, 1240 { 1241 setup: func(i *instruction) { 1242 i.asGprToXmm(sseOpcodeMovd, newOperandMem(newAmodeImmReg(123, rspVReg)), xmm0VReg, true) 1243 }, 1244 want: "66480f6e44247b", 1245 wantFormat: "movd 123(%rsp), %xmm0", 1246 }, 1247 { 1248 setup: func(i *instruction) { 1249 i.asGprToXmm(sseOpcodeMovd, newOperandMem(newAmodeImmReg(1<<25, rspVReg)), xmm0VReg, true) 1250 }, 1251 want: "66480f6e842400000002", 1252 wantFormat: "movd 33554432(%rsp), %xmm0", 1253 }, 1254 // movq 1255 { 1256 setup: func(i *instruction) { i.asGprToXmm(sseOpcodeMovq, newOperandReg(rcxVReg), xmm0VReg, true) }, 1257 want: "66480f6ec1", 1258 wantFormat: "movq %rcx, %xmm0", 1259 }, 1260 // cvtsi2ss 1261 { 1262 setup: func(i *instruction) { i.asGprToXmm(sseOpcodeCvtsi2ss, newOperandReg(rdiVReg), xmm0VReg, true) }, 1263 want: "f3480f2ac7", 1264 wantFormat: "cvtsi2ss %rdi, %xmm0", 1265 }, 1266 { 1267 setup: func(i *instruction) { i.asGprToXmm(sseOpcodeCvtsi2ss, newOperandReg(rdiVReg), xmm0VReg, false) }, 1268 want: "f30f2ac7", 1269 wantFormat: "cvtsi2ss %edi, %xmm0", 1270 }, 1271 { 1272 setup: func(i *instruction) { 1273 i.asGprToXmm(sseOpcodeCvtsi2ss, newOperandMem(newAmodeImmReg(0, rspVReg)), xmm0VReg, true) 1274 }, 1275 want: "f3480f2a0424", 1276 wantFormat: "cvtsi2ss (%rsp), %xmm0", 1277 }, 1278 { 1279 setup: func(i *instruction) { 1280 i.asGprToXmm(sseOpcodeCvtsi2ss, newOperandMem(newAmodeImmReg(123, rspVReg)), xmm0VReg, true) 1281 }, 1282 want: "f3480f2a44247b", 1283 wantFormat: "cvtsi2ss 123(%rsp), %xmm0", 1284 }, 1285 { 1286 setup: func(i *instruction) { 1287 i.asGprToXmm(sseOpcodeCvtsi2ss, newOperandMem(newAmodeImmReg(123, rspVReg)), xmm15VReg, false) 1288 }, 1289 want: "f3440f2a7c247b", 1290 wantFormat: "cvtsi2ss 123(%rsp), %xmm15", 1291 }, 1292 { 1293 setup: func(i *instruction) { 1294 i.asGprToXmm(sseOpcodeCvtsi2ss, newOperandMem(newAmodeImmReg(1<<25, rspVReg)), xmm0VReg, true) 1295 }, 1296 want: "f3480f2a842400000002", 1297 wantFormat: "cvtsi2ss 33554432(%rsp), %xmm0", 1298 }, 1299 // cvtsi2sd 1300 { 1301 setup: func(i *instruction) { i.asGprToXmm(sseOpcodeCvtsi2sd, newOperandReg(rdiVReg), xmm0VReg, true) }, 1302 want: "f2480f2ac7", 1303 wantFormat: "cvtsi2sd %rdi, %xmm0", 1304 }, 1305 { 1306 setup: func(i *instruction) { i.asGprToXmm(sseOpcodeCvtsi2sd, newOperandReg(rdiVReg), xmm0VReg, false) }, 1307 want: "f20f2ac7", 1308 wantFormat: "cvtsi2sd %edi, %xmm0", 1309 }, 1310 { 1311 // This is actually equivalent to movq, because of _64=true. 1312 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovd, xmm0VReg, rdiVReg, true) }, 1313 want: "66480f7ec7", 1314 wantFormat: "movd %xmm0, %rdi", 1315 }, 1316 { 1317 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovd, xmm0VReg, rdiVReg, false) }, 1318 want: "660f7ec7", 1319 wantFormat: "movd %xmm0, %edi", 1320 }, 1321 { 1322 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovq, xmm0VReg, rdiVReg, true) }, 1323 want: "66480f7ec7", 1324 wantFormat: "movq %xmm0, %rdi", 1325 }, 1326 // This is actually equivalent to movq, because of _64=false. 1327 { 1328 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovq, xmm0VReg, rdiVReg, false) }, 1329 want: "660f7ec7", 1330 wantFormat: "movq %xmm0, %edi", 1331 }, 1332 { 1333 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttss2si, xmm0VReg, rdiVReg, true) }, 1334 want: "f3480f2cf8", 1335 wantFormat: "cvttss2si %xmm0, %rdi", 1336 }, 1337 { 1338 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttss2si, xmm0VReg, rdiVReg, false) }, 1339 want: "f30f2cf8", 1340 wantFormat: "cvttss2si %xmm0, %edi", 1341 }, 1342 { 1343 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttsd2si, xmm0VReg, rdiVReg, true) }, 1344 want: "f2480f2cf8", 1345 wantFormat: "cvttsd2si %xmm0, %rdi", 1346 }, 1347 { 1348 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttsd2si, xmm0VReg, rdiVReg, false) }, 1349 want: "f20f2cf8", 1350 wantFormat: "cvttsd2si %xmm0, %edi", 1351 }, 1352 { 1353 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovmskps, xmm1VReg, xmm0VReg, true) }, 1354 want: "480f50c1", 1355 wantFormat: "movmskps %xmm1, %xmm0", 1356 }, 1357 { 1358 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovmskpd, xmm1VReg, xmm0VReg, true) }, 1359 want: "66480f50c1", 1360 wantFormat: "movmskpd %xmm1, %xmm0", 1361 }, 1362 { 1363 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodePmovmskb, xmm1VReg, xmm0VReg, true) }, 1364 want: "66480fd7c1", 1365 wantFormat: "pmovmskb %xmm1, %xmm0", 1366 }, 1367 { 1368 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovmskps, xmm1VReg, xmm0VReg, false) }, 1369 want: "0f50c1", 1370 wantFormat: "movmskps %xmm1, %xmm0", 1371 }, 1372 { 1373 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodeMovmskpd, xmm1VReg, xmm0VReg, false) }, 1374 want: "660f50c1", 1375 wantFormat: "movmskpd %xmm1, %xmm0", 1376 }, 1377 { 1378 setup: func(i *instruction) { i.asXmmToGpr(sseOpcodePmovmskb, xmm1VReg, xmm0VReg, false) }, 1379 want: "660fd7c1", 1380 wantFormat: "pmovmskb %xmm1, %xmm0", 1381 }, 1382 { 1383 setup: func(i *instruction) { 1384 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1385 }, 1386 want: "660fc2c100", 1387 wantFormat: "cmppd $0, %xmm1, %xmm0", 1388 }, 1389 { 1390 setup: func(i *instruction) { 1391 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLT_OS), newOperandReg(xmm1VReg), xmm0VReg) 1392 }, 1393 want: "660fc2c101", 1394 wantFormat: "cmppd $1, %xmm1, %xmm0", 1395 }, 1396 { 1397 setup: func(i *instruction) { 1398 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLE_OS), newOperandReg(xmm1VReg), xmm0VReg) 1399 }, 1400 want: "660fc2c102", 1401 wantFormat: "cmppd $2, %xmm1, %xmm0", 1402 }, 1403 { 1404 setup: func(i *instruction) { 1405 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredUNORD_Q), newOperandReg(xmm1VReg), xmm0VReg) 1406 }, 1407 want: "660fc2c103", 1408 wantFormat: "cmppd $3, %xmm1, %xmm0", 1409 }, 1410 { 1411 setup: func(i *instruction) { 1412 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1413 }, 1414 want: "660fc2c104", 1415 wantFormat: "cmppd $4, %xmm1, %xmm0", 1416 }, 1417 { 1418 setup: func(i *instruction) { 1419 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLT_US), newOperandReg(xmm1VReg), xmm0VReg) 1420 }, 1421 want: "660fc2c105", 1422 wantFormat: "cmppd $5, %xmm1, %xmm0", 1423 }, 1424 { 1425 setup: func(i *instruction) { 1426 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLE_US), newOperandReg(xmm1VReg), xmm0VReg) 1427 }, 1428 want: "660fc2c106", 1429 wantFormat: "cmppd $6, %xmm1, %xmm0", 1430 }, 1431 { 1432 setup: func(i *instruction) { 1433 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredORD_Q), newOperandReg(xmm1VReg), xmm0VReg) 1434 }, 1435 want: "660fc2c107", 1436 wantFormat: "cmppd $7, %xmm1, %xmm0", 1437 }, 1438 { 1439 setup: func(i *instruction) { 1440 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1441 }, 1442 want: "660fc2c108", 1443 wantFormat: "cmppd $8, %xmm1, %xmm0", 1444 }, 1445 { 1446 setup: func(i *instruction) { 1447 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGE_US), newOperandReg(xmm1VReg), xmm0VReg) 1448 }, 1449 want: "660fc2c109", 1450 wantFormat: "cmppd $9, %xmm1, %xmm0", 1451 }, 1452 { 1453 setup: func(i *instruction) { 1454 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGT_US), newOperandReg(xmm1VReg), xmm0VReg) 1455 }, 1456 want: "660fc2c10a", 1457 wantFormat: "cmppd $10, %xmm1, %xmm0", 1458 }, 1459 { 1460 setup: func(i *instruction) { 1461 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredFALSE_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1462 }, 1463 want: "660fc2c10b", 1464 wantFormat: "cmppd $11, %xmm1, %xmm0", 1465 }, 1466 { 1467 setup: func(i *instruction) { 1468 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1469 }, 1470 want: "660fc2c10c", 1471 wantFormat: "cmppd $12, %xmm1, %xmm0", 1472 }, 1473 { 1474 setup: func(i *instruction) { 1475 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGE_OS), newOperandReg(xmm1VReg), xmm0VReg) 1476 }, 1477 want: "660fc2c10d", 1478 wantFormat: "cmppd $13, %xmm1, %xmm0", 1479 }, 1480 { 1481 setup: func(i *instruction) { 1482 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGT_OS), newOperandReg(xmm1VReg), xmm0VReg) 1483 }, 1484 want: "660fc2c10e", 1485 wantFormat: "cmppd $14, %xmm1, %xmm0", 1486 }, 1487 { 1488 setup: func(i *instruction) { 1489 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredTRUE_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1490 }, 1491 want: "660fc2c10f", 1492 wantFormat: "cmppd $15, %xmm1, %xmm0", 1493 }, 1494 { 1495 setup: func(i *instruction) { 1496 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_OS), newOperandReg(xmm1VReg), xmm0VReg) 1497 }, 1498 want: "660fc2c110", 1499 wantFormat: "cmppd $16, %xmm1, %xmm0", 1500 }, 1501 { 1502 setup: func(i *instruction) { 1503 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLT_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1504 }, 1505 want: "660fc2c111", 1506 wantFormat: "cmppd $17, %xmm1, %xmm0", 1507 }, 1508 { 1509 setup: func(i *instruction) { 1510 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLE_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1511 }, 1512 want: "660fc2c112", 1513 wantFormat: "cmppd $18, %xmm1, %xmm0", 1514 }, 1515 { 1516 setup: func(i *instruction) { 1517 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredUNORD_S), newOperandReg(xmm1VReg), xmm0VReg) 1518 }, 1519 want: "660fc2c113", 1520 wantFormat: "cmppd $19, %xmm1, %xmm0", 1521 }, 1522 { 1523 setup: func(i *instruction) { 1524 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_US), newOperandReg(xmm1VReg), xmm0VReg) 1525 }, 1526 want: "660fc2c114", 1527 wantFormat: "cmppd $20, %xmm1, %xmm0", 1528 }, 1529 { 1530 setup: func(i *instruction) { 1531 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLT_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1532 }, 1533 want: "660fc2c115", 1534 wantFormat: "cmppd $21, %xmm1, %xmm0", 1535 }, 1536 { 1537 setup: func(i *instruction) { 1538 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLE_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1539 }, 1540 want: "660fc2c116", 1541 wantFormat: "cmppd $22, %xmm1, %xmm0", 1542 }, 1543 { 1544 setup: func(i *instruction) { 1545 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredORD_S), newOperandReg(xmm1VReg), xmm0VReg) 1546 }, 1547 want: "660fc2c117", 1548 wantFormat: "cmppd $23, %xmm1, %xmm0", 1549 }, 1550 { 1551 setup: func(i *instruction) { 1552 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_US), newOperandReg(xmm1VReg), xmm0VReg) 1553 }, 1554 want: "660fc2c118", 1555 wantFormat: "cmppd $24, %xmm1, %xmm0", 1556 }, 1557 { 1558 setup: func(i *instruction) { 1559 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGE_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1560 }, 1561 want: "660fc2c119", 1562 wantFormat: "cmppd $25, %xmm1, %xmm0", 1563 }, 1564 { 1565 setup: func(i *instruction) { 1566 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGT_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1567 }, 1568 want: "660fc2c11a", 1569 wantFormat: "cmppd $26, %xmm1, %xmm0", 1570 }, 1571 { 1572 setup: func(i *instruction) { 1573 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredFALSE_OS), newOperandReg(xmm1VReg), xmm0VReg) 1574 }, 1575 want: "660fc2c11b", 1576 wantFormat: "cmppd $27, %xmm1, %xmm0", 1577 }, 1578 { 1579 setup: func(i *instruction) { 1580 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_OS), newOperandReg(xmm1VReg), xmm0VReg) 1581 }, 1582 want: "660fc2c11c", 1583 wantFormat: "cmppd $28, %xmm1, %xmm0", 1584 }, 1585 { 1586 setup: func(i *instruction) { 1587 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGE_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1588 }, 1589 want: "660fc2c11d", 1590 wantFormat: "cmppd $29, %xmm1, %xmm0", 1591 }, 1592 { 1593 setup: func(i *instruction) { 1594 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGT_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1595 }, 1596 want: "660fc2c11e", 1597 wantFormat: "cmppd $30, %xmm1, %xmm0", 1598 }, 1599 { 1600 setup: func(i *instruction) { 1601 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredTRUE_US), newOperandReg(xmm1VReg), xmm0VReg) 1602 }, 1603 want: "660fc2c11f", 1604 wantFormat: "cmppd $31, %xmm1, %xmm0", 1605 }, 1606 { 1607 setup: func(i *instruction) { 1608 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1609 }, 1610 want: "660fc2407b00", 1611 wantFormat: "cmppd $0, 123(%rax), %xmm0", 1612 }, 1613 { 1614 setup: func(i *instruction) { 1615 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLT_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1616 }, 1617 want: "660fc2407b01", 1618 wantFormat: "cmppd $1, 123(%rax), %xmm0", 1619 }, 1620 { 1621 setup: func(i *instruction) { 1622 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLE_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1623 }, 1624 want: "660fc2407b02", 1625 wantFormat: "cmppd $2, 123(%rax), %xmm0", 1626 }, 1627 { 1628 setup: func(i *instruction) { 1629 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredUNORD_Q), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1630 }, 1631 want: "660fc2407b03", 1632 wantFormat: "cmppd $3, 123(%rax), %xmm0", 1633 }, 1634 { 1635 setup: func(i *instruction) { 1636 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1637 }, 1638 want: "660fc2407b04", 1639 wantFormat: "cmppd $4, 123(%rax), %xmm0", 1640 }, 1641 { 1642 setup: func(i *instruction) { 1643 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLT_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1644 }, 1645 want: "660fc2407b05", 1646 wantFormat: "cmppd $5, 123(%rax), %xmm0", 1647 }, 1648 { 1649 setup: func(i *instruction) { 1650 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLE_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1651 }, 1652 want: "660fc2407b06", 1653 wantFormat: "cmppd $6, 123(%rax), %xmm0", 1654 }, 1655 { 1656 setup: func(i *instruction) { 1657 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredORD_Q), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1658 }, 1659 want: "660fc2407b07", 1660 wantFormat: "cmppd $7, 123(%rax), %xmm0", 1661 }, 1662 { 1663 setup: func(i *instruction) { 1664 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1665 }, 1666 want: "660fc2407b08", 1667 wantFormat: "cmppd $8, 123(%rax), %xmm0", 1668 }, 1669 { 1670 setup: func(i *instruction) { 1671 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGE_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1672 }, 1673 want: "660fc2407b09", 1674 wantFormat: "cmppd $9, 123(%rax), %xmm0", 1675 }, 1676 { 1677 setup: func(i *instruction) { 1678 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGT_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1679 }, 1680 want: "660fc2407b0a", 1681 wantFormat: "cmppd $10, 123(%rax), %xmm0", 1682 }, 1683 { 1684 setup: func(i *instruction) { 1685 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredFALSE_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1686 }, 1687 want: "660fc2407b0b", 1688 wantFormat: "cmppd $11, 123(%rax), %xmm0", 1689 }, 1690 { 1691 setup: func(i *instruction) { 1692 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1693 }, 1694 want: "660fc2407b0c", 1695 wantFormat: "cmppd $12, 123(%rax), %xmm0", 1696 }, 1697 { 1698 setup: func(i *instruction) { 1699 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGE_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1700 }, 1701 want: "660fc2407b0d", 1702 wantFormat: "cmppd $13, 123(%rax), %xmm0", 1703 }, 1704 { 1705 setup: func(i *instruction) { 1706 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGT_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1707 }, 1708 want: "660fc2407b0e", 1709 wantFormat: "cmppd $14, 123(%rax), %xmm0", 1710 }, 1711 { 1712 setup: func(i *instruction) { 1713 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredTRUE_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1714 }, 1715 want: "660fc2407b0f", 1716 wantFormat: "cmppd $15, 123(%rax), %xmm0", 1717 }, 1718 { 1719 setup: func(i *instruction) { 1720 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1721 }, 1722 want: "660fc2407b10", 1723 wantFormat: "cmppd $16, 123(%rax), %xmm0", 1724 }, 1725 { 1726 setup: func(i *instruction) { 1727 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLT_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1728 }, 1729 want: "660fc2407b11", 1730 wantFormat: "cmppd $17, 123(%rax), %xmm0", 1731 }, 1732 { 1733 setup: func(i *instruction) { 1734 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredLE_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1735 }, 1736 want: "660fc2407b12", 1737 wantFormat: "cmppd $18, 123(%rax), %xmm0", 1738 }, 1739 { 1740 setup: func(i *instruction) { 1741 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredUNORD_S), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1742 }, 1743 want: "660fc2407b13", 1744 wantFormat: "cmppd $19, 123(%rax), %xmm0", 1745 }, 1746 { 1747 setup: func(i *instruction) { 1748 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1749 }, 1750 want: "660fc2407b14", 1751 wantFormat: "cmppd $20, 123(%rax), %xmm0", 1752 }, 1753 { 1754 setup: func(i *instruction) { 1755 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLT_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1756 }, 1757 want: "660fc2407b15", 1758 wantFormat: "cmppd $21, 123(%rax), %xmm0", 1759 }, 1760 { 1761 setup: func(i *instruction) { 1762 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNLE_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1763 }, 1764 want: "660fc2407b16", 1765 wantFormat: "cmppd $22, 123(%rax), %xmm0", 1766 }, 1767 { 1768 setup: func(i *instruction) { 1769 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredORD_S), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1770 }, 1771 want: "660fc2407b17", 1772 wantFormat: "cmppd $23, 123(%rax), %xmm0", 1773 }, 1774 { 1775 setup: func(i *instruction) { 1776 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredEQ_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1777 }, 1778 want: "660fc2407b18", 1779 wantFormat: "cmppd $24, 123(%rax), %xmm0", 1780 }, 1781 { 1782 setup: func(i *instruction) { 1783 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGE_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1784 }, 1785 want: "660fc2407b19", 1786 wantFormat: "cmppd $25, 123(%rax), %xmm0", 1787 }, 1788 { 1789 setup: func(i *instruction) { 1790 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNGT_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1791 }, 1792 want: "660fc2407b1a", 1793 wantFormat: "cmppd $26, 123(%rax), %xmm0", 1794 }, 1795 { 1796 setup: func(i *instruction) { 1797 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredFALSE_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1798 }, 1799 want: "660fc2407b1b", 1800 wantFormat: "cmppd $27, 123(%rax), %xmm0", 1801 }, 1802 { 1803 setup: func(i *instruction) { 1804 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredNEQ_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1805 }, 1806 want: "660fc2407b1c", 1807 wantFormat: "cmppd $28, 123(%rax), %xmm0", 1808 }, 1809 { 1810 setup: func(i *instruction) { 1811 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGE_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1812 }, 1813 want: "660fc2407b1d", 1814 wantFormat: "cmppd $29, 123(%rax), %xmm0", 1815 }, 1816 { 1817 setup: func(i *instruction) { 1818 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredGT_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1819 }, 1820 want: "660fc2407b1e", 1821 wantFormat: "cmppd $30, 123(%rax), %xmm0", 1822 }, 1823 { 1824 setup: func(i *instruction) { 1825 i.asXmmRmRImm(sseOpcodeCmppd, uint8(cmpPredTRUE_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 1826 }, 1827 want: "660fc2407b1f", 1828 wantFormat: "cmppd $31, 123(%rax), %xmm0", 1829 }, 1830 { 1831 setup: func(i *instruction) { 1832 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1833 }, 1834 want: "0fc2c100", 1835 wantFormat: "cmpps $0, %xmm1, %xmm0", 1836 }, 1837 { 1838 setup: func(i *instruction) { 1839 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLT_OS), newOperandReg(xmm1VReg), xmm0VReg) 1840 }, 1841 want: "0fc2c101", 1842 wantFormat: "cmpps $1, %xmm1, %xmm0", 1843 }, 1844 { 1845 setup: func(i *instruction) { 1846 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLE_OS), newOperandReg(xmm1VReg), xmm0VReg) 1847 }, 1848 want: "0fc2c102", 1849 wantFormat: "cmpps $2, %xmm1, %xmm0", 1850 }, 1851 { 1852 setup: func(i *instruction) { 1853 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredUNORD_Q), newOperandReg(xmm1VReg), xmm0VReg) 1854 }, 1855 want: "0fc2c103", 1856 wantFormat: "cmpps $3, %xmm1, %xmm0", 1857 }, 1858 { 1859 setup: func(i *instruction) { 1860 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1861 }, 1862 want: "0fc2c104", 1863 wantFormat: "cmpps $4, %xmm1, %xmm0", 1864 }, 1865 { 1866 setup: func(i *instruction) { 1867 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLT_US), newOperandReg(xmm1VReg), xmm0VReg) 1868 }, 1869 want: "0fc2c105", 1870 wantFormat: "cmpps $5, %xmm1, %xmm0", 1871 }, 1872 { 1873 setup: func(i *instruction) { 1874 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLE_US), newOperandReg(xmm1VReg), xmm0VReg) 1875 }, 1876 want: "0fc2c106", 1877 wantFormat: "cmpps $6, %xmm1, %xmm0", 1878 }, 1879 { 1880 setup: func(i *instruction) { 1881 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredORD_Q), newOperandReg(xmm1VReg), xmm0VReg) 1882 }, 1883 want: "0fc2c107", 1884 wantFormat: "cmpps $7, %xmm1, %xmm0", 1885 }, 1886 { 1887 setup: func(i *instruction) { 1888 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1889 }, 1890 want: "0fc2c108", 1891 wantFormat: "cmpps $8, %xmm1, %xmm0", 1892 }, 1893 { 1894 setup: func(i *instruction) { 1895 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGE_US), newOperandReg(xmm1VReg), xmm0VReg) 1896 }, 1897 want: "0fc2c109", 1898 wantFormat: "cmpps $9, %xmm1, %xmm0", 1899 }, 1900 { 1901 setup: func(i *instruction) { 1902 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGT_US), newOperandReg(xmm1VReg), xmm0VReg) 1903 }, 1904 want: "0fc2c10a", 1905 wantFormat: "cmpps $10, %xmm1, %xmm0", 1906 }, 1907 { 1908 setup: func(i *instruction) { 1909 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredFALSE_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1910 }, 1911 want: "0fc2c10b", 1912 wantFormat: "cmpps $11, %xmm1, %xmm0", 1913 }, 1914 { 1915 setup: func(i *instruction) { 1916 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1917 }, 1918 want: "0fc2c10c", 1919 wantFormat: "cmpps $12, %xmm1, %xmm0", 1920 }, 1921 { 1922 setup: func(i *instruction) { 1923 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGE_OS), newOperandReg(xmm1VReg), xmm0VReg) 1924 }, 1925 want: "0fc2c10d", 1926 wantFormat: "cmpps $13, %xmm1, %xmm0", 1927 }, 1928 { 1929 setup: func(i *instruction) { 1930 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGT_OS), newOperandReg(xmm1VReg), xmm0VReg) 1931 }, 1932 want: "0fc2c10e", 1933 wantFormat: "cmpps $14, %xmm1, %xmm0", 1934 }, 1935 { 1936 setup: func(i *instruction) { 1937 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredTRUE_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1938 }, 1939 want: "0fc2c10f", 1940 wantFormat: "cmpps $15, %xmm1, %xmm0", 1941 }, 1942 { 1943 setup: func(i *instruction) { 1944 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_OS), newOperandReg(xmm1VReg), xmm0VReg) 1945 }, 1946 want: "0fc2c110", 1947 wantFormat: "cmpps $16, %xmm1, %xmm0", 1948 }, 1949 { 1950 setup: func(i *instruction) { 1951 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLT_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1952 }, 1953 want: "0fc2c111", 1954 wantFormat: "cmpps $17, %xmm1, %xmm0", 1955 }, 1956 { 1957 setup: func(i *instruction) { 1958 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLE_OQ), newOperandReg(xmm1VReg), xmm0VReg) 1959 }, 1960 want: "0fc2c112", 1961 wantFormat: "cmpps $18, %xmm1, %xmm0", 1962 }, 1963 { 1964 setup: func(i *instruction) { 1965 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredUNORD_S), newOperandReg(xmm1VReg), xmm0VReg) 1966 }, 1967 want: "0fc2c113", 1968 wantFormat: "cmpps $19, %xmm1, %xmm0", 1969 }, 1970 { 1971 setup: func(i *instruction) { 1972 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_US), newOperandReg(xmm1VReg), xmm0VReg) 1973 }, 1974 want: "0fc2c114", 1975 wantFormat: "cmpps $20, %xmm1, %xmm0", 1976 }, 1977 { 1978 setup: func(i *instruction) { 1979 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLT_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1980 }, 1981 want: "0fc2c115", 1982 wantFormat: "cmpps $21, %xmm1, %xmm0", 1983 }, 1984 { 1985 setup: func(i *instruction) { 1986 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLE_UQ), newOperandReg(xmm1VReg), xmm0VReg) 1987 }, 1988 want: "0fc2c116", 1989 wantFormat: "cmpps $22, %xmm1, %xmm0", 1990 }, 1991 { 1992 setup: func(i *instruction) { 1993 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredORD_S), newOperandReg(xmm1VReg), xmm0VReg) 1994 }, 1995 want: "0fc2c117", 1996 wantFormat: "cmpps $23, %xmm1, %xmm0", 1997 }, 1998 { 1999 setup: func(i *instruction) { 2000 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_US), newOperandReg(xmm1VReg), xmm0VReg) 2001 }, 2002 want: "0fc2c118", 2003 wantFormat: "cmpps $24, %xmm1, %xmm0", 2004 }, 2005 { 2006 setup: func(i *instruction) { 2007 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGE_UQ), newOperandReg(xmm1VReg), xmm0VReg) 2008 }, 2009 want: "0fc2c119", 2010 wantFormat: "cmpps $25, %xmm1, %xmm0", 2011 }, 2012 { 2013 setup: func(i *instruction) { 2014 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGT_UQ), newOperandReg(xmm1VReg), xmm0VReg) 2015 }, 2016 want: "0fc2c11a", 2017 wantFormat: "cmpps $26, %xmm1, %xmm0", 2018 }, 2019 { 2020 setup: func(i *instruction) { 2021 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredFALSE_OS), newOperandReg(xmm1VReg), xmm0VReg) 2022 }, 2023 want: "0fc2c11b", 2024 wantFormat: "cmpps $27, %xmm1, %xmm0", 2025 }, 2026 { 2027 setup: func(i *instruction) { 2028 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_OS), newOperandReg(xmm1VReg), xmm0VReg) 2029 }, 2030 want: "0fc2c11c", 2031 wantFormat: "cmpps $28, %xmm1, %xmm0", 2032 }, 2033 { 2034 setup: func(i *instruction) { 2035 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGE_OQ), newOperandReg(xmm1VReg), xmm0VReg) 2036 }, 2037 want: "0fc2c11d", 2038 wantFormat: "cmpps $29, %xmm1, %xmm0", 2039 }, 2040 { 2041 setup: func(i *instruction) { 2042 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGT_OQ), newOperandReg(xmm1VReg), xmm0VReg) 2043 }, 2044 want: "0fc2c11e", 2045 wantFormat: "cmpps $30, %xmm1, %xmm0", 2046 }, 2047 { 2048 setup: func(i *instruction) { 2049 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredTRUE_US), newOperandReg(xmm1VReg), xmm0VReg) 2050 }, 2051 want: "0fc2c11f", 2052 wantFormat: "cmpps $31, %xmm1, %xmm0", 2053 }, 2054 { 2055 setup: func(i *instruction) { 2056 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2057 }, 2058 want: "0fc2407b00", 2059 wantFormat: "cmpps $0, 123(%rax), %xmm0", 2060 }, 2061 { 2062 setup: func(i *instruction) { 2063 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLT_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2064 }, 2065 want: "0fc2407b01", 2066 wantFormat: "cmpps $1, 123(%rax), %xmm0", 2067 }, 2068 { 2069 setup: func(i *instruction) { 2070 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLE_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2071 }, 2072 want: "0fc2407b02", 2073 wantFormat: "cmpps $2, 123(%rax), %xmm0", 2074 }, 2075 { 2076 setup: func(i *instruction) { 2077 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredUNORD_Q), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2078 }, 2079 want: "0fc2407b03", 2080 wantFormat: "cmpps $3, 123(%rax), %xmm0", 2081 }, 2082 { 2083 setup: func(i *instruction) { 2084 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2085 }, 2086 want: "0fc2407b04", 2087 wantFormat: "cmpps $4, 123(%rax), %xmm0", 2088 }, 2089 { 2090 setup: func(i *instruction) { 2091 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLT_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2092 }, 2093 want: "0fc2407b05", 2094 wantFormat: "cmpps $5, 123(%rax), %xmm0", 2095 }, 2096 { 2097 setup: func(i *instruction) { 2098 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLE_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2099 }, 2100 want: "0fc2407b06", 2101 wantFormat: "cmpps $6, 123(%rax), %xmm0", 2102 }, 2103 { 2104 setup: func(i *instruction) { 2105 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredORD_Q), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2106 }, 2107 want: "0fc2407b07", 2108 wantFormat: "cmpps $7, 123(%rax), %xmm0", 2109 }, 2110 { 2111 setup: func(i *instruction) { 2112 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2113 }, 2114 want: "0fc2407b08", 2115 wantFormat: "cmpps $8, 123(%rax), %xmm0", 2116 }, 2117 { 2118 setup: func(i *instruction) { 2119 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGE_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2120 }, 2121 want: "0fc2407b09", 2122 wantFormat: "cmpps $9, 123(%rax), %xmm0", 2123 }, 2124 { 2125 setup: func(i *instruction) { 2126 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGT_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2127 }, 2128 want: "0fc2407b0a", 2129 wantFormat: "cmpps $10, 123(%rax), %xmm0", 2130 }, 2131 { 2132 setup: func(i *instruction) { 2133 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredFALSE_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2134 }, 2135 want: "0fc2407b0b", 2136 wantFormat: "cmpps $11, 123(%rax), %xmm0", 2137 }, 2138 { 2139 setup: func(i *instruction) { 2140 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2141 }, 2142 want: "0fc2407b0c", 2143 wantFormat: "cmpps $12, 123(%rax), %xmm0", 2144 }, 2145 { 2146 setup: func(i *instruction) { 2147 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGE_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2148 }, 2149 want: "0fc2407b0d", 2150 wantFormat: "cmpps $13, 123(%rax), %xmm0", 2151 }, 2152 { 2153 setup: func(i *instruction) { 2154 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGT_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2155 }, 2156 want: "0fc2407b0e", 2157 wantFormat: "cmpps $14, 123(%rax), %xmm0", 2158 }, 2159 { 2160 setup: func(i *instruction) { 2161 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredTRUE_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2162 }, 2163 want: "0fc2407b0f", 2164 wantFormat: "cmpps $15, 123(%rax), %xmm0", 2165 }, 2166 { 2167 setup: func(i *instruction) { 2168 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2169 }, 2170 want: "0fc2407b10", 2171 wantFormat: "cmpps $16, 123(%rax), %xmm0", 2172 }, 2173 { 2174 setup: func(i *instruction) { 2175 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLT_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2176 }, 2177 want: "0fc2407b11", 2178 wantFormat: "cmpps $17, 123(%rax), %xmm0", 2179 }, 2180 { 2181 setup: func(i *instruction) { 2182 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredLE_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2183 }, 2184 want: "0fc2407b12", 2185 wantFormat: "cmpps $18, 123(%rax), %xmm0", 2186 }, 2187 { 2188 setup: func(i *instruction) { 2189 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredUNORD_S), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2190 }, 2191 want: "0fc2407b13", 2192 wantFormat: "cmpps $19, 123(%rax), %xmm0", 2193 }, 2194 { 2195 setup: func(i *instruction) { 2196 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2197 }, 2198 want: "0fc2407b14", 2199 wantFormat: "cmpps $20, 123(%rax), %xmm0", 2200 }, 2201 { 2202 setup: func(i *instruction) { 2203 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLT_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2204 }, 2205 want: "0fc2407b15", 2206 wantFormat: "cmpps $21, 123(%rax), %xmm0", 2207 }, 2208 { 2209 setup: func(i *instruction) { 2210 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNLE_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2211 }, 2212 want: "0fc2407b16", 2213 wantFormat: "cmpps $22, 123(%rax), %xmm0", 2214 }, 2215 { 2216 setup: func(i *instruction) { 2217 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredORD_S), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2218 }, 2219 want: "0fc2407b17", 2220 wantFormat: "cmpps $23, 123(%rax), %xmm0", 2221 }, 2222 { 2223 setup: func(i *instruction) { 2224 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredEQ_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2225 }, 2226 want: "0fc2407b18", 2227 wantFormat: "cmpps $24, 123(%rax), %xmm0", 2228 }, 2229 { 2230 setup: func(i *instruction) { 2231 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGE_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2232 }, 2233 want: "0fc2407b19", 2234 wantFormat: "cmpps $25, 123(%rax), %xmm0", 2235 }, 2236 { 2237 setup: func(i *instruction) { 2238 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNGT_UQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2239 }, 2240 want: "0fc2407b1a", 2241 wantFormat: "cmpps $26, 123(%rax), %xmm0", 2242 }, 2243 { 2244 setup: func(i *instruction) { 2245 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredFALSE_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2246 }, 2247 want: "0fc2407b1b", 2248 wantFormat: "cmpps $27, 123(%rax), %xmm0", 2249 }, 2250 { 2251 setup: func(i *instruction) { 2252 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredNEQ_OS), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2253 }, 2254 want: "0fc2407b1c", 2255 wantFormat: "cmpps $28, 123(%rax), %xmm0", 2256 }, 2257 { 2258 setup: func(i *instruction) { 2259 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGE_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2260 }, 2261 want: "0fc2407b1d", 2262 wantFormat: "cmpps $29, 123(%rax), %xmm0", 2263 }, 2264 { 2265 setup: func(i *instruction) { 2266 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredGT_OQ), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2267 }, 2268 want: "0fc2407b1e", 2269 wantFormat: "cmpps $30, 123(%rax), %xmm0", 2270 }, 2271 { 2272 setup: func(i *instruction) { 2273 i.asXmmRmRImm(sseOpcodeCmpps, uint8(cmpPredTRUE_US), newOperandMem(newAmodeImmReg(123, raxVReg)), xmm0VReg) 2274 }, 2275 want: "0fc2407b1f", 2276 wantFormat: "cmpps $31, 123(%rax), %xmm0", 2277 }, 2278 { 2279 setup: func(i *instruction) { i.asPop64(raxVReg) }, 2280 want: "58", 2281 wantFormat: "popq %rax", 2282 }, 2283 { 2284 setup: func(i *instruction) { i.asPop64(rdiVReg) }, 2285 want: "5f", 2286 wantFormat: "popq %rdi", 2287 }, 2288 { 2289 setup: func(i *instruction) { i.asPop64(r8VReg) }, 2290 want: "4158", 2291 wantFormat: "popq %r8", 2292 }, 2293 { 2294 setup: func(i *instruction) { i.asPop64(r15VReg) }, 2295 want: "415f", 2296 wantFormat: "popq %r15", 2297 }, 2298 { 2299 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(0, rbpVReg, r13VReg, 2))) }, 2300 want: "42ff74ad00", 2301 wantFormat: "pushq (%rbp,%r13,4)", 2302 }, 2303 { 2304 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(1, rspVReg, r13VReg, 2))) }, 2305 want: "42ff74ac01", 2306 wantFormat: "pushq 1(%rsp,%r13,4)", 2307 }, 2308 { 2309 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(1<<14, rspVReg, r13VReg, 3))) }, 2310 want: "42ffb4ec00400000", 2311 wantFormat: "pushq 16384(%rsp,%r13,8)", 2312 }, 2313 { 2314 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(1<<14, rspVReg, rcxVReg, 3))) }, 2315 want: "ffb4cc00400000", 2316 wantFormat: "pushq 16384(%rsp,%rcx,8)", 2317 }, 2318 { 2319 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(1<<14, rspVReg, rbpVReg, 3))) }, 2320 want: "ffb4ec00400000", 2321 wantFormat: "pushq 16384(%rsp,%rbp,8)", 2322 }, 2323 { 2324 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(1<<14, rsiVReg, rcxVReg, 3))) }, 2325 want: "ffb4ce00400000", 2326 wantFormat: "pushq 16384(%rsi,%rcx,8)", 2327 }, 2328 { 2329 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(321, rsiVReg, rcxVReg, 3))) }, 2330 want: "ffb4ce41010000", 2331 wantFormat: "pushq 321(%rsi,%rcx,8)", 2332 }, 2333 { 2334 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(0, rsiVReg, rcxVReg, 3))) }, 2335 want: "ff34ce", 2336 wantFormat: "pushq (%rsi,%rcx,8)", 2337 }, 2338 { 2339 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(321, r9VReg, rbxVReg, 2))) }, 2340 want: "41ffb49941010000", 2341 wantFormat: "pushq 321(%r9,%rbx,4)", 2342 }, 2343 { 2344 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(321, r9VReg, rbpVReg, 2))) }, 2345 want: "41ffb4a941010000", 2346 wantFormat: "pushq 321(%r9,%rbp,4)", 2347 }, 2348 { 2349 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(321, r9VReg, r13VReg, 2))) }, 2350 want: "43ffb4a941010000", 2351 wantFormat: "pushq 321(%r9,%r13,4)", 2352 }, 2353 { 2354 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(321, rbpVReg, r13VReg, 2))) }, 2355 want: "42ffb4ad41010000", 2356 wantFormat: "pushq 321(%rbp,%r13,4)", 2357 }, 2358 { 2359 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(0, r9VReg, r13VReg, 2))) }, 2360 want: "43ff34a9", 2361 wantFormat: "pushq (%r9,%r13,4)", 2362 }, 2363 { 2364 setup: func(i *instruction) { i.asPush64(newOperandMem(newAmodeRegRegShift(1<<20, r9VReg, r13VReg, 2))) }, 2365 want: "43ffb4a900001000", 2366 wantFormat: "pushq 1048576(%r9,%r13,4)", 2367 }, 2368 { 2369 setup: func(i *instruction) { i.asPush64(newOperandReg(rdiVReg)) }, 2370 want: "57", 2371 wantFormat: "pushq %rdi", 2372 }, 2373 { 2374 setup: func(i *instruction) { i.asPush64(newOperandReg(r8VReg)) }, 2375 want: "4150", 2376 wantFormat: "pushq %r8", 2377 }, 2378 { 2379 setup: func(i *instruction) { i.asPush64(newOperandImm32(128)) }, 2380 want: "6880000000", 2381 wantFormat: "pushq $128", 2382 }, 2383 { 2384 setup: func(i *instruction) { i.asPush64(newOperandImm32(0x31415927)) }, 2385 want: "6827594131", 2386 wantFormat: "pushq $826366247", 2387 }, 2388 { 2389 setup: func(i *instruction) { 2390 v := int32(-128) 2391 i.asPush64(newOperandImm32(uint32(v))) 2392 }, 2393 want: "6880ffffff", 2394 wantFormat: "pushq $-128", 2395 }, 2396 { 2397 setup: func(i *instruction) { 2398 v := int32(-129) 2399 i.asPush64(newOperandImm32(uint32(v))) 2400 }, 2401 want: "687fffffff", 2402 wantFormat: "pushq $-129", 2403 }, 2404 { 2405 setup: func(i *instruction) { 2406 v := int32(-0x75c4e8a1) 2407 i.asPush64(newOperandImm32(uint32(v))) 2408 }, 2409 want: "685f173b8a", 2410 wantFormat: "pushq $-1975838881", 2411 }, 2412 { 2413 setup: func(i *instruction) { 2414 i.asAluRmiR(aluRmiROpcodeMul, newOperandMem(newAmodeImmReg(0, rdiVReg)), rdxVReg, true) 2415 }, 2416 want: "480faf17", 2417 wantFormat: "imul (%rdi), %rdx", 2418 }, 2419 { 2420 setup: func(i *instruction) { 2421 i.asAluRmiR(aluRmiROpcodeMul, newOperandMem(newAmodeImmReg(99, rdiVReg)), rdxVReg, true) 2422 }, 2423 want: "480faf5763", 2424 wantFormat: "imul 99(%rdi), %rdx", 2425 }, 2426 { 2427 setup: func(i *instruction) { 2428 i.asAluRmiR(aluRmiROpcodeMul, newOperandMem(newAmodeImmReg(1<<21, rdiVReg)), rdxVReg, true) 2429 }, 2430 want: "480faf9700002000", 2431 wantFormat: "imul 2097152(%rdi), %rdx", 2432 }, 2433 { 2434 setup: func(i *instruction) { 2435 i.asAluRmiR(aluRmiROpcodeMul, newOperandReg(r15VReg), rdxVReg, true) 2436 }, 2437 want: "490fafd7", 2438 wantFormat: "imul %r15, %rdx", 2439 }, 2440 { 2441 setup: func(i *instruction) { 2442 i.asAluRmiR(aluRmiROpcodeMul, newOperandReg(rcxVReg), r8VReg, false) 2443 }, 2444 want: "440fafc1", 2445 wantFormat: "imul %ecx, %r8d", 2446 }, 2447 { 2448 setup: func(i *instruction) { 2449 i.asAluRmiR(aluRmiROpcodeMul, newOperandReg(rcxVReg), rsiVReg, false) 2450 }, 2451 want: "0faff1", 2452 wantFormat: "imul %ecx, %esi", 2453 }, 2454 { 2455 setup: func(i *instruction) { 2456 i.asAluRmiR(aluRmiROpcodeMul, newOperandImm32(76543210), rdxVReg, true) 2457 }, 2458 want: "4869d2eaf48f04", 2459 wantFormat: "imul $76543210, %rdx", 2460 }, 2461 { 2462 setup: func(i *instruction) { 2463 minusOne := int32(-1) 2464 i.asAluRmiR(aluRmiROpcodeMul, newOperandImm32(uint32(minusOne)), rdxVReg, true) 2465 }, 2466 want: "486bd2ff", 2467 wantFormat: "imul $-1, %rdx", 2468 }, 2469 { 2470 setup: func(i *instruction) { 2471 i.asAluRmiR(aluRmiROpcodeMul, newOperandImm32(76543210), rdxVReg, false) 2472 }, 2473 want: "69d2eaf48f04", 2474 wantFormat: "imul $76543210, %edx", 2475 }, 2476 { 2477 setup: func(i *instruction) { 2478 minusOne := int32(-1) 2479 i.asAluRmiR(aluRmiROpcodeMul, newOperandImm32(uint32(minusOne)), rdxVReg, false) 2480 }, 2481 want: "6bd2ff", 2482 wantFormat: "imul $-1, %edx", 2483 }, 2484 { 2485 setup: func(i *instruction) { 2486 i.asAluRmiR(aluRmiROpcodeAdd, newOperandMem(newAmodeImmReg(0, r12VReg)), rdxVReg, true) 2487 }, 2488 want: "49031424", 2489 wantFormat: "add (%r12), %rdx", 2490 }, 2491 { 2492 setup: func(i *instruction) { 2493 i.asAluRmiR(aluRmiROpcodeAdd, newOperandMem(newAmodeImmReg(123, r12VReg)), rdxVReg, true) 2494 }, 2495 want: "490354247b", 2496 wantFormat: "add 123(%r12), %rdx", 2497 }, 2498 { 2499 setup: func(i *instruction) { 2500 i.asAluRmiR(aluRmiROpcodeAdd, newOperandMem(newAmodeImmReg(1<<25, r12VReg)), rdxVReg, true) 2501 }, 2502 want: "4903942400000002", 2503 wantFormat: "add 33554432(%r12), %rdx", 2504 }, 2505 { 2506 setup: func(i *instruction) { 2507 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(76543210), r15VReg, true) 2508 }, 2509 want: "4981c7eaf48f04", 2510 wantFormat: "add $76543210, %r15", 2511 }, 2512 { 2513 setup: func(i *instruction) { 2514 minusOne := int32(-1) 2515 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(uint32(minusOne)), r15VReg, true) 2516 }, 2517 want: "4983c7ff", 2518 wantFormat: "add $-1, %r15", 2519 }, 2520 { 2521 setup: func(i *instruction) { 2522 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(76543210), rsiVReg, true) 2523 }, 2524 want: "4881c6eaf48f04", 2525 wantFormat: "add $76543210, %rsi", 2526 }, 2527 { 2528 setup: func(i *instruction) { 2529 minusOne := int32(-1) 2530 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(uint32(minusOne)), rsiVReg, true) 2531 }, 2532 want: "4883c6ff", 2533 wantFormat: "add $-1, %rsi", 2534 }, 2535 { 2536 setup: func(i *instruction) { 2537 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(76543210), r15VReg, false) 2538 }, 2539 want: "4181c7eaf48f04", 2540 wantFormat: "add $76543210, %r15d", 2541 }, 2542 { 2543 setup: func(i *instruction) { 2544 minusOne := int32(-1) 2545 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(uint32(minusOne)), r15VReg, false) 2546 }, 2547 want: "4183c7ff", 2548 wantFormat: "add $-1, %r15d", 2549 }, 2550 { 2551 setup: func(i *instruction) { 2552 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(76543210), rsiVReg, false) 2553 }, 2554 want: "81c6eaf48f04", 2555 wantFormat: "add $76543210, %esi", 2556 }, 2557 { 2558 setup: func(i *instruction) { 2559 minusOne := int32(-1) 2560 i.asAluRmiR(aluRmiROpcodeAdd, newOperandImm32(uint32(minusOne)), rsiVReg, false) 2561 }, 2562 want: "83c6ff", 2563 wantFormat: "add $-1, %esi", 2564 }, 2565 { 2566 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAdd, newOperandReg(raxVReg), rdxVReg, true) }, 2567 want: "4801c2", 2568 wantFormat: "add %rax, %rdx", 2569 }, 2570 { 2571 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAdd, newOperandReg(raxVReg), r15VReg, true) }, 2572 want: "4901c7", 2573 wantFormat: "add %rax, %r15", 2574 }, 2575 { 2576 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAdd, newOperandReg(r11VReg), r15VReg, true) }, 2577 want: "4d01df", 2578 wantFormat: "add %r11, %r15", 2579 }, 2580 { 2581 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAdd, newOperandReg(raxVReg), rdxVReg, false) }, 2582 want: "01c2", 2583 wantFormat: "add %eax, %edx", 2584 }, 2585 { 2586 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAdd, newOperandReg(raxVReg), r15VReg, false) }, 2587 want: "4101c7", 2588 wantFormat: "add %eax, %r15d", 2589 }, 2590 { 2591 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAdd, newOperandReg(r11VReg), r15VReg, false) }, 2592 want: "4501df", 2593 wantFormat: "add %r11d, %r15d", 2594 }, 2595 { 2596 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeSub, newOperandReg(r11VReg), r15VReg, false) }, 2597 want: "4529df", 2598 wantFormat: "sub %r11d, %r15d", 2599 }, 2600 { 2601 setup: func(i *instruction) { 2602 i.asAluRmiR(aluRmiROpcodeSub, newOperandMem(newAmodeImmReg(0, r13VReg)), rdxVReg, true) 2603 }, 2604 want: "492b5500", 2605 wantFormat: "sub (%r13), %rdx", 2606 }, 2607 { 2608 setup: func(i *instruction) { 2609 i.asAluRmiR(aluRmiROpcodeSub, newOperandMem(newAmodeImmReg(123, r13VReg)), rdxVReg, true) 2610 }, 2611 want: "492b557b", 2612 wantFormat: "sub 123(%r13), %rdx", 2613 }, 2614 { 2615 setup: func(i *instruction) { 2616 i.asAluRmiR(aluRmiROpcodeSub, newOperandMem(newAmodeImmReg(1<<25, r13VReg)), rdxVReg, true) 2617 }, 2618 want: "492b9500000002", 2619 wantFormat: "sub 33554432(%r13), %rdx", 2620 }, 2621 { 2622 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeAnd, newOperandReg(r11VReg), r15VReg, false) }, 2623 want: "4521df", 2624 wantFormat: "and %r11d, %r15d", 2625 }, 2626 { 2627 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeOr, newOperandReg(r11VReg), r15VReg, false) }, 2628 want: "4509df", 2629 wantFormat: "or %r11d, %r15d", 2630 }, 2631 { 2632 setup: func(i *instruction) { i.asAluRmiR(aluRmiROpcodeXor, newOperandReg(r11VReg), r15VReg, false) }, 2633 want: "4531df", 2634 wantFormat: "xor %r11d, %r15d", 2635 }, 2636 { 2637 setup: func(i *instruction) { i.asLEA(newOperandMem(newAmodeImmReg(0, rdiVReg)), rdxVReg) }, 2638 want: "488d17", 2639 wantFormat: "lea (%rdi), %rdx", 2640 }, 2641 { 2642 setup: func(i *instruction) { i.asLEA(newOperandMem(newAmodeImmReg(0xffff, rdiVReg)), rdxVReg) }, 2643 want: "488d97ffff0000", 2644 wantFormat: "lea 65535(%rdi), %rdx", 2645 }, 2646 { 2647 setup: func(i *instruction) { 2648 i.asLEA(newOperandMem(newAmodeRegRegShift(0xffff, rspVReg, r13VReg, 3)), rdxVReg) 2649 }, 2650 want: "4a8d94ecffff0000", 2651 wantFormat: "lea 65535(%rsp,%r13,8), %rdx", 2652 }, 2653 { 2654 setup: func(i *instruction) { 2655 i.asLEA(newOperandLabel(backend.Label(1234)), r11VReg) 2656 }, 2657 want: "4c8d1dffffffff", 2658 wantFormat: "lea L1234, %r11", 2659 }, 2660 { 2661 setup: func(i *instruction) { i.kind = ud2 }, 2662 want: "0f0b", 2663 wantFormat: "ud2", 2664 }, 2665 { 2666 setup: func(i *instruction) { 2667 i.asCall(0, nil) 2668 i.u2 = 0xff 2669 }, 2670 want: "e8ff000000", 2671 wantFormat: "call f0", 2672 }, 2673 { 2674 setup: func(i *instruction) { 2675 i.asCallIndirect(newOperandReg(r12VReg), nil) 2676 }, 2677 want: "41ffd4", 2678 wantFormat: "callq *%r12", 2679 }, 2680 { 2681 setup: func(i *instruction) { 2682 i.asCallIndirect(newOperandMem(newAmodeImmReg(0, raxVReg)), nil) 2683 }, 2684 want: "ff10", 2685 wantFormat: "callq *(%rax)", 2686 }, 2687 { 2688 setup: func(i *instruction) { 2689 i.asCallIndirect(newOperandMem(newAmodeImmReg(0xffff_0000, raxVReg)), nil) 2690 }, 2691 want: "ff900000ffff", 2692 wantFormat: "callq *-65536(%rax)", 2693 }, 2694 { 2695 setup: func(i *instruction) { i.asJmp(newOperandReg(r12VReg)) }, 2696 want: "41ffe4", 2697 wantFormat: "jmp %r12", 2698 }, 2699 { 2700 setup: func(i *instruction) { i.asJmp(newOperandMem(newAmodeImmReg(0, raxVReg))) }, 2701 want: "ff20", 2702 wantFormat: "jmp (%rax)", 2703 }, 2704 { 2705 setup: func(i *instruction) { i.asJmp(newOperandImm32(12345)) }, 2706 want: "e939300000", 2707 wantFormat: "jmp $12345", 2708 }, 2709 { 2710 setup: func(i *instruction) { i.asJmpIf(condO, newOperandImm32(4)) }, 2711 want: "0f8004000000", 2712 wantFormat: "jo $4", 2713 }, 2714 { 2715 setup: func(i *instruction) { i.asJmpIf(condNO, newOperandImm32(4)) }, 2716 want: "0f8104000000", 2717 wantFormat: "jno $4", 2718 }, 2719 { 2720 setup: func(i *instruction) { i.asJmpIf(condB, newOperandImm32(4)) }, 2721 want: "0f8204000000", 2722 wantFormat: "jb $4", 2723 }, 2724 { 2725 setup: func(i *instruction) { i.asJmpIf(condNB, newOperandImm32(4)) }, 2726 want: "0f8304000000", 2727 wantFormat: "jnb $4", 2728 }, 2729 { 2730 setup: func(i *instruction) { i.asJmpIf(condZ, newOperandImm32(4)) }, 2731 want: "0f8404000000", 2732 wantFormat: "jz $4", 2733 }, 2734 { 2735 setup: func(i *instruction) { i.asJmpIf(condNZ, newOperandImm32(4)) }, 2736 want: "0f8504000000", 2737 wantFormat: "jnz $4", 2738 }, 2739 { 2740 setup: func(i *instruction) { i.asJmpIf(condBE, newOperandImm32(4)) }, 2741 want: "0f8604000000", 2742 wantFormat: "jbe $4", 2743 }, 2744 { 2745 setup: func(i *instruction) { i.asJmpIf(condNBE, newOperandImm32(4)) }, 2746 want: "0f8704000000", 2747 wantFormat: "jnbe $4", 2748 }, 2749 { 2750 setup: func(i *instruction) { i.asJmpIf(condS, newOperandImm32(4)) }, 2751 want: "0f8804000000", 2752 wantFormat: "js $4", 2753 }, 2754 { 2755 setup: func(i *instruction) { i.asJmpIf(condNS, newOperandImm32(4)) }, 2756 want: "0f8904000000", 2757 wantFormat: "jns $4", 2758 }, 2759 { 2760 setup: func(i *instruction) { i.asJmpIf(condL, newOperandImm32(4)) }, 2761 want: "0f8c04000000", 2762 wantFormat: "jl $4", 2763 }, 2764 { 2765 setup: func(i *instruction) { i.asJmpIf(condNL, newOperandImm32(4)) }, 2766 want: "0f8d04000000", 2767 wantFormat: "jnl $4", 2768 }, 2769 { 2770 setup: func(i *instruction) { i.asJmpIf(condLE, newOperandImm32(4)) }, 2771 want: "0f8e04000000", 2772 wantFormat: "jle $4", 2773 }, 2774 { 2775 setup: func(i *instruction) { i.asJmpIf(condNLE, newOperandImm32(4)) }, 2776 want: "0f8f04000000", 2777 wantFormat: "jnle $4", 2778 }, 2779 { 2780 setup: func(i *instruction) { i.asJmpIf(condP, newOperandImm32(4)) }, 2781 want: "0f8a04000000", 2782 wantFormat: "jp $4", 2783 }, 2784 { 2785 setup: func(i *instruction) { i.asJmpIf(condNP, newOperandImm32(4)) }, 2786 want: "0f8b04000000", 2787 wantFormat: "jnp $4", 2788 }, 2789 { 2790 setup: func(i *instruction) { 2791 i.asMov64MR(newOperandMem( 2792 newAmodeImmReg(0, raxVReg), 2793 ), r15VReg) 2794 }, 2795 want: "4c8b38", 2796 wantFormat: "movq (%rax), %r15", 2797 }, 2798 { 2799 setup: func(i *instruction) { 2800 i.asMov64MR(newOperandMem( 2801 newAmodeImmReg(0, r12VReg), 2802 ), r15VReg) 2803 }, 2804 want: "4d8b3c24", 2805 wantFormat: "movq (%r12), %r15", 2806 }, 2807 { 2808 setup: func(i *instruction) { 2809 i.asMov64MR(newOperandMem( 2810 newAmodeImmReg(1, r12VReg), 2811 ), r15VReg) 2812 }, 2813 want: "4d8b7c2401", 2814 wantFormat: "movq 1(%r12), %r15", 2815 }, 2816 { 2817 setup: func(i *instruction) { 2818 i.asMov64MR(newOperandMem( 2819 newAmodeImmReg(1<<20, r12VReg), 2820 ), r15VReg) 2821 }, 2822 want: "4d8bbc2400001000", 2823 wantFormat: "movq 1048576(%r12), %r15", 2824 }, 2825 { 2826 setup: func(i *instruction) { 2827 i.asMov64MR(newOperandMem( 2828 newAmodeImmReg(1<<20, raxVReg), 2829 ), r15VReg) 2830 }, 2831 want: "4c8bb800001000", 2832 wantFormat: "movq 1048576(%rax), %r15", 2833 }, 2834 // 2835 { 2836 setup: func(i *instruction) { i.asMovsxRmR(extModeBL, newOperandReg(raxVReg), rdiVReg) }, 2837 want: "0fbef8", 2838 wantFormat: "movsx.bl %rax, %rdi", 2839 }, 2840 { 2841 setup: func(i *instruction) { i.asMovsxRmR(extModeBL, newOperandReg(rbxVReg), rdiVReg) }, 2842 want: "0fbefb", 2843 wantFormat: "movsx.bl %rbx, %rdi", 2844 }, 2845 { 2846 setup: func(i *instruction) { i.asMovsxRmR(extModeBQ, newOperandReg(raxVReg), rdiVReg) }, 2847 want: "480fbef8", 2848 wantFormat: "movsx.bq %rax, %rdi", 2849 }, 2850 { 2851 setup: func(i *instruction) { i.asMovsxRmR(extModeBQ, newOperandReg(r15VReg), rdiVReg) }, 2852 want: "490fbeff", 2853 wantFormat: "movsx.bq %r15, %rdi", 2854 }, 2855 { 2856 setup: func(i *instruction) { i.asMovsxRmR(extModeWL, newOperandReg(raxVReg), rdiVReg) }, 2857 want: "0fbff8", 2858 wantFormat: "movsx.wl %rax, %rdi", 2859 }, 2860 { 2861 setup: func(i *instruction) { i.asMovsxRmR(extModeWQ, newOperandReg(raxVReg), rdiVReg) }, 2862 want: "480fbff8", 2863 wantFormat: "movsx.wq %rax, %rdi", 2864 }, 2865 { 2866 setup: func(i *instruction) { i.asMovsxRmR(extModeLQ, newOperandReg(raxVReg), rdiVReg) }, 2867 want: "4863f8", 2868 wantFormat: "movsx.lq %rax, %rdi", 2869 }, 2870 { 2871 setup: func(i *instruction) { i.asMovzxRmR(extModeBL, newOperandReg(raxVReg), rdiVReg) }, 2872 want: "0fb6f8", 2873 wantFormat: "movzx.bl %rax, %rdi", 2874 }, 2875 { 2876 setup: func(i *instruction) { i.asMovzxRmR(extModeBL, newOperandReg(rbxVReg), rdiVReg) }, 2877 want: "0fb6fb", 2878 wantFormat: "movzx.bl %rbx, %rdi", 2879 }, 2880 { 2881 setup: func(i *instruction) { i.asMovzxRmR(extModeBQ, newOperandReg(raxVReg), rdiVReg) }, 2882 want: "480fb6f8", 2883 wantFormat: "movzx.bq %rax, %rdi", 2884 }, 2885 { 2886 setup: func(i *instruction) { i.asMovzxRmR(extModeBQ, newOperandReg(r15VReg), rdiVReg) }, 2887 want: "490fb6ff", 2888 wantFormat: "movzx.bq %r15, %rdi", 2889 }, 2890 { 2891 setup: func(i *instruction) { i.asMovzxRmR(extModeWL, newOperandReg(raxVReg), rdiVReg) }, 2892 want: "0fb7f8", 2893 wantFormat: "movzx.wl %rax, %rdi", 2894 }, 2895 { 2896 setup: func(i *instruction) { i.asMovzxRmR(extModeWQ, newOperandReg(raxVReg), rdiVReg) }, 2897 want: "480fb7f8", 2898 wantFormat: "movzx.wq %rax, %rdi", 2899 }, 2900 { 2901 setup: func(i *instruction) { i.asMovzxRmR(extModeLQ, newOperandReg(raxVReg), rdiVReg) }, 2902 want: "8bf8", 2903 wantFormat: "movzx.lq %rax, %rdi", 2904 }, 2905 { 2906 setup: func(i *instruction) { 2907 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2908 i.asMovsxRmR(extModeBQ, a, rdiVReg) 2909 }, 2910 want: "480fbeb800001000", 2911 wantFormat: "movsx.bq 1048576(%rax), %rdi", 2912 }, 2913 { 2914 setup: func(i *instruction) { 2915 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2916 i.asMovsxRmR(extModeBL, a, rdiVReg) 2917 }, 2918 want: "0fbeb800001000", 2919 wantFormat: "movsx.bl 1048576(%rax), %rdi", 2920 }, 2921 { 2922 setup: func(i *instruction) { 2923 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2924 i.asMovsxRmR(extModeWL, a, rdiVReg) 2925 }, 2926 want: "0fbfb800001000", 2927 wantFormat: "movsx.wl 1048576(%rax), %rdi", 2928 }, 2929 { 2930 setup: func(i *instruction) { 2931 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2932 i.asMovsxRmR(extModeWQ, a, rdiVReg) 2933 }, 2934 want: "480fbfb800001000", 2935 wantFormat: "movsx.wq 1048576(%rax), %rdi", 2936 }, 2937 { 2938 setup: func(i *instruction) { 2939 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2940 i.asMovsxRmR(extModeLQ, a, rdiVReg) 2941 }, 2942 want: "4863b800001000", 2943 wantFormat: "movsx.lq 1048576(%rax), %rdi", 2944 }, 2945 { 2946 setup: func(i *instruction) { 2947 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2948 i.asMovzxRmR(extModeLQ, a, rdiVReg) 2949 }, 2950 want: "8bb800001000", 2951 wantFormat: "movzx.lq 1048576(%rax), %rdi", 2952 }, 2953 { 2954 setup: func(i *instruction) { 2955 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2956 i.asMovRM(rcxVReg, a, 1) 2957 }, 2958 want: "888800001000", 2959 wantFormat: "mov.b %rcx, 1048576(%rax)", 2960 }, 2961 { 2962 setup: func(i *instruction) { 2963 a := newOperandMem(newAmodeImmReg(1<<20, raxVReg)) 2964 i.asMovRM(rdiVReg, a, 1) 2965 }, 2966 want: "4088b800001000", 2967 wantFormat: "mov.b %rdi, 1048576(%rax)", 2968 }, 2969 { 2970 setup: func(i *instruction) { 2971 a := newOperandMem(newAmodeRegRegShift(1, rcxVReg, rdxVReg, 0)) 2972 i.asMovRM(rsiVReg, a, 1) 2973 }, 2974 want: "4088741101", 2975 wantFormat: "mov.b %rsi, 1(%rcx,%rdx,1)", 2976 }, 2977 { 2978 setup: func(i *instruction) { 2979 a := newOperandMem(newAmodeRegRegShift(1, rcxVReg, rdxVReg, 1)) 2980 i.asMovRM(rdiVReg, a, 1) 2981 }, 2982 want: "40887c5101", 2983 wantFormat: "mov.b %rdi, 1(%rcx,%rdx,2)", 2984 }, 2985 { 2986 setup: func(i *instruction) { 2987 a := newOperandMem(newAmodeRegRegShift(1, rcxVReg, rdxVReg, 1)) 2988 i.asMovRM(rdiVReg, a, 2) 2989 }, 2990 want: "66897c5101", 2991 wantFormat: "mov.w %rdi, 1(%rcx,%rdx,2)", 2992 }, 2993 { 2994 setup: func(i *instruction) { 2995 a := newOperandMem(newAmodeRegRegShift(1<<20, raxVReg, rcxVReg, 3)) 2996 i.asMovRM(rdiVReg, a, 2) 2997 }, 2998 want: "6689bcc800001000", 2999 wantFormat: "mov.w %rdi, 1048576(%rax,%rcx,8)", 3000 }, 3001 { 3002 setup: func(i *instruction) { 3003 a := newOperandMem(newAmodeRegRegShift(1<<20, rcxVReg, rdxVReg, 3)) 3004 i.asMovRM(rdiVReg, a, 2) 3005 }, 3006 want: "6689bcd100001000", 3007 wantFormat: "mov.w %rdi, 1048576(%rcx,%rdx,8)", 3008 }, 3009 { 3010 setup: func(i *instruction) { 3011 a := newOperandMem(newAmodeRegRegShift(123, raxVReg, rcxVReg, 0)) 3012 i.asMovRM(rdiVReg, a, 4) 3013 }, 3014 want: "897c087b", 3015 wantFormat: "mov.l %rdi, 123(%rax,%rcx,1)", 3016 }, 3017 { 3018 setup: func(i *instruction) { 3019 a := newOperandMem(newAmodeRegRegShift(123, raxVReg, rcxVReg, 0)) 3020 i.asMovRM(rdiVReg, a, 8) 3021 }, 3022 want: "48897c087b", 3023 wantFormat: "mov.q %rdi, 123(%rax,%rcx,1)", 3024 }, 3025 { 3026 setup: func(i *instruction) { 3027 a := newOperandMem(newAmodeRegRegShift(123, raxVReg, rcxVReg, 0)) 3028 i.asXmmMovRM(sseOpcodeMovaps, xmm1VReg, a) 3029 }, 3030 want: "0f294c087b", 3031 wantFormat: "movaps %xmm1, 123(%rax,%rcx,1)", 3032 }, 3033 { 3034 setup: func(i *instruction) { 3035 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3036 i.asXmmMovRM(sseOpcodeMovaps, xmm15VReg, a) 3037 }, 3038 want: "440f29797b", 3039 wantFormat: "movaps %xmm15, 123(%rcx)", 3040 }, 3041 { 3042 setup: func(i *instruction) { 3043 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3044 i.asXmmMovRM(sseOpcodeMovapd, xmm15VReg, a) 3045 }, 3046 want: "66440f29797b", 3047 wantFormat: "movapd %xmm15, 123(%rcx)", 3048 }, 3049 { 3050 setup: func(i *instruction) { 3051 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3052 i.asXmmMovRM(sseOpcodeMovdqa, xmm15VReg, a) 3053 }, 3054 want: "66440f7f797b", 3055 wantFormat: "movdqa %xmm15, 123(%rcx)", 3056 }, 3057 { 3058 setup: func(i *instruction) { 3059 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3060 i.asXmmMovRM(sseOpcodeMovdqu, xmm15VReg, a) 3061 }, 3062 want: "f3440f7f797b", 3063 wantFormat: "movdqu %xmm15, 123(%rcx)", 3064 }, 3065 { 3066 setup: func(i *instruction) { 3067 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3068 i.asXmmMovRM(sseOpcodeMovss, xmm15VReg, a) 3069 }, 3070 want: "f3440f11797b", 3071 wantFormat: "movss %xmm15, 123(%rcx)", 3072 }, 3073 { 3074 setup: func(i *instruction) { 3075 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3076 i.asXmmMovRM(sseOpcodeMovsd, xmm15VReg, a) 3077 }, 3078 want: "f2440f11797b", 3079 wantFormat: "movsd %xmm15, 123(%rcx)", 3080 }, 3081 { 3082 setup: func(i *instruction) { 3083 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3084 i.asXmmMovRM(sseOpcodeMovups, xmm15VReg, a) 3085 }, 3086 want: "440f11797b", 3087 wantFormat: "movups %xmm15, 123(%rcx)", 3088 }, 3089 { 3090 setup: func(i *instruction) { 3091 a := newOperandMem(newAmodeImmReg(123, rcxVReg)) 3092 i.asXmmMovRM(sseOpcodeMovupd, xmm15VReg, a) 3093 }, 3094 want: "66440f11797b", 3095 wantFormat: "movupd %xmm15, 123(%rcx)", 3096 }, 3097 { 3098 setup: func(i *instruction) { 3099 i.asShiftR(shiftROpRotateLeft, newOperandReg(rcxVReg), rdiVReg, false) 3100 }, 3101 want: "d3c7", 3102 wantFormat: "roll %ecx, %edi", 3103 }, 3104 { 3105 setup: func(i *instruction) { 3106 i.asShiftR(shiftROpRotateLeft, newOperandImm32(128), rdiVReg, false) 3107 }, 3108 want: "c1c780", 3109 wantFormat: "roll $128, %edi", 3110 }, 3111 { 3112 setup: func(i *instruction) { 3113 i.asShiftR(shiftROpRotateLeft, newOperandReg(rcxVReg), rdiVReg, true) 3114 }, 3115 want: "48d3c7", 3116 wantFormat: "rolq %ecx, %rdi", 3117 }, 3118 { 3119 setup: func(i *instruction) { 3120 i.asShiftR(shiftROpRotateLeft, newOperandImm32(128), rdiVReg, true) 3121 }, 3122 want: "48c1c780", 3123 wantFormat: "rolq $128, %rdi", 3124 }, 3125 { 3126 setup: func(i *instruction) { 3127 i.asShiftR(shiftROpRotateRight, newOperandReg(rcxVReg), rdiVReg, false) 3128 }, 3129 want: "d3cf", 3130 wantFormat: "rorl %ecx, %edi", 3131 }, 3132 { 3133 setup: func(i *instruction) { 3134 i.asShiftR(shiftROpRotateRight, newOperandImm32(128), rdiVReg, false) 3135 }, 3136 want: "c1cf80", 3137 wantFormat: "rorl $128, %edi", 3138 }, 3139 { 3140 setup: func(i *instruction) { 3141 i.asShiftR(shiftROpRotateRight, newOperandReg(rcxVReg), rdiVReg, true) 3142 }, 3143 want: "48d3cf", 3144 wantFormat: "rorq %ecx, %rdi", 3145 }, 3146 { 3147 setup: func(i *instruction) { 3148 i.asShiftR(shiftROpRotateRight, newOperandImm32(128), rdiVReg, true) 3149 }, 3150 want: "48c1cf80", 3151 wantFormat: "rorq $128, %rdi", 3152 }, 3153 { 3154 setup: func(i *instruction) { 3155 i.asShiftR(shiftROpShiftLeft, newOperandReg(rcxVReg), rdiVReg, false) 3156 }, 3157 want: "d3e7", 3158 wantFormat: "shll %ecx, %edi", 3159 }, 3160 { 3161 setup: func(i *instruction) { 3162 i.asShiftR(shiftROpShiftLeft, newOperandImm32(128), rdiVReg, false) 3163 }, 3164 want: "c1e780", 3165 wantFormat: "shll $128, %edi", 3166 }, 3167 { 3168 setup: func(i *instruction) { 3169 i.asShiftR(shiftROpShiftLeft, newOperandReg(rcxVReg), rdiVReg, true) 3170 }, 3171 want: "48d3e7", 3172 wantFormat: "shlq %ecx, %rdi", 3173 }, 3174 { 3175 setup: func(i *instruction) { 3176 i.asShiftR(shiftROpShiftLeft, newOperandImm32(128), rdiVReg, true) 3177 }, 3178 want: "48c1e780", 3179 wantFormat: "shlq $128, %rdi", 3180 }, 3181 { 3182 setup: func(i *instruction) { 3183 i.asShiftR(shiftROpShiftRightLogical, newOperandReg(rcxVReg), rdiVReg, false) 3184 }, 3185 want: "d3ef", 3186 wantFormat: "shrl %ecx, %edi", 3187 }, 3188 { 3189 setup: func(i *instruction) { 3190 i.asShiftR(shiftROpShiftRightLogical, newOperandImm32(128), rdiVReg, false) 3191 }, 3192 want: "c1ef80", 3193 wantFormat: "shrl $128, %edi", 3194 }, 3195 { 3196 setup: func(i *instruction) { 3197 i.asShiftR(shiftROpShiftRightLogical, newOperandReg(rcxVReg), rdiVReg, true) 3198 }, 3199 want: "48d3ef", 3200 wantFormat: "shrq %ecx, %rdi", 3201 }, 3202 { 3203 setup: func(i *instruction) { 3204 i.asShiftR(shiftROpShiftRightLogical, newOperandImm32(128), rdiVReg, true) 3205 }, 3206 want: "48c1ef80", 3207 wantFormat: "shrq $128, %rdi", 3208 }, 3209 { 3210 setup: func(i *instruction) { 3211 i.asShiftR(shiftROpShiftRightArithmetic, newOperandReg(rcxVReg), rdiVReg, false) 3212 }, 3213 want: "d3ff", 3214 wantFormat: "sarl %ecx, %edi", 3215 }, 3216 { 3217 setup: func(i *instruction) { 3218 i.asShiftR(shiftROpShiftRightArithmetic, newOperandImm32(128), rdiVReg, false) 3219 }, 3220 want: "c1ff80", 3221 wantFormat: "sarl $128, %edi", 3222 }, 3223 { 3224 setup: func(i *instruction) { 3225 i.asShiftR(shiftROpShiftRightArithmetic, newOperandReg(rcxVReg), rdiVReg, true) 3226 }, 3227 want: "48d3ff", 3228 wantFormat: "sarq %ecx, %rdi", 3229 }, 3230 { 3231 setup: func(i *instruction) { 3232 i.asShiftR(shiftROpShiftRightArithmetic, newOperandImm32(128), rdiVReg, true) 3233 }, 3234 want: "48c1ff80", 3235 wantFormat: "sarq $128, %rdi", 3236 }, 3237 { 3238 setup: func(i *instruction) { 3239 i.asXmmRmiReg(sseOpcodePsllw, newOperandImm32(128), xmm11VReg) 3240 }, 3241 want: "66410f71f380", 3242 wantFormat: "psllw $128, %xmm11", 3243 }, 3244 { 3245 setup: func(i *instruction) { 3246 i.asXmmRmiReg(sseOpcodePslld, newOperandImm32(128), xmm11VReg) 3247 }, 3248 want: "66410f72f380", 3249 wantFormat: "pslld $128, %xmm11", 3250 }, 3251 { 3252 setup: func(i *instruction) { 3253 i.asXmmRmiReg(sseOpcodePsllq, newOperandImm32(128), xmm11VReg) 3254 }, 3255 want: "66410f73f380", 3256 wantFormat: "psllq $128, %xmm11", 3257 }, 3258 { 3259 setup: func(i *instruction) { 3260 i.asXmmRmiReg(sseOpcodePsraw, newOperandImm32(128), xmm11VReg) 3261 }, 3262 want: "66410f71e380", 3263 wantFormat: "psraw $128, %xmm11", 3264 }, 3265 { 3266 setup: func(i *instruction) { 3267 i.asXmmRmiReg(sseOpcodePsrad, newOperandImm32(128), xmm11VReg) 3268 }, 3269 want: "66410f72e380", 3270 wantFormat: "psrad $128, %xmm11", 3271 }, 3272 { 3273 setup: func(i *instruction) { 3274 i.asXmmRmiReg(sseOpcodePsrlw, newOperandImm32(128), xmm11VReg) 3275 }, 3276 want: "66410f71d380", 3277 wantFormat: "psrlw $128, %xmm11", 3278 }, 3279 { 3280 setup: func(i *instruction) { 3281 i.asXmmRmiReg(sseOpcodePsrld, newOperandImm32(128), xmm11VReg) 3282 }, 3283 want: "66410f72d380", 3284 wantFormat: "psrld $128, %xmm11", 3285 }, 3286 { 3287 setup: func(i *instruction) { 3288 i.asXmmRmiReg(sseOpcodePsrlq, newOperandImm32(128), xmm11VReg) 3289 }, 3290 want: "66410f73d380", 3291 wantFormat: "psrlq $128, %xmm11", 3292 }, 3293 { 3294 setup: func(i *instruction) { 3295 i.asXmmRmiReg(sseOpcodePsllw, newOperandReg(xmm13VReg), xmm11VReg) 3296 }, 3297 want: "66450ff1dd", 3298 wantFormat: "psllw %xmm13, %xmm11", 3299 }, 3300 { 3301 setup: func(i *instruction) { 3302 i.asXmmRmiReg(sseOpcodePslld, newOperandReg(xmm13VReg), xmm11VReg) 3303 }, 3304 want: "66450ff2dd", 3305 wantFormat: "pslld %xmm13, %xmm11", 3306 }, 3307 { 3308 setup: func(i *instruction) { 3309 i.asXmmRmiReg(sseOpcodePsllq, newOperandReg(xmm13VReg), xmm11VReg) 3310 }, 3311 want: "66450ff3dd", 3312 wantFormat: "psllq %xmm13, %xmm11", 3313 }, 3314 { 3315 setup: func(i *instruction) { 3316 i.asXmmRmiReg(sseOpcodePsraw, newOperandReg(xmm13VReg), xmm11VReg) 3317 }, 3318 want: "66450fe1dd", 3319 wantFormat: "psraw %xmm13, %xmm11", 3320 }, 3321 { 3322 setup: func(i *instruction) { 3323 i.asXmmRmiReg(sseOpcodePsrad, newOperandReg(xmm13VReg), xmm11VReg) 3324 }, 3325 want: "66450fe2dd", 3326 wantFormat: "psrad %xmm13, %xmm11", 3327 }, 3328 { 3329 setup: func(i *instruction) { 3330 i.asXmmRmiReg(sseOpcodePsrlw, newOperandReg(xmm13VReg), xmm11VReg) 3331 }, 3332 want: "66450fd1dd", 3333 wantFormat: "psrlw %xmm13, %xmm11", 3334 }, 3335 { 3336 setup: func(i *instruction) { 3337 i.asXmmRmiReg(sseOpcodePsrld, newOperandReg(xmm13VReg), xmm11VReg) 3338 }, 3339 want: "66450fd2dd", 3340 wantFormat: "psrld %xmm13, %xmm11", 3341 }, 3342 { 3343 setup: func(i *instruction) { 3344 i.asXmmRmiReg(sseOpcodePsrlq, newOperandReg(xmm13VReg), xmm11VReg) 3345 }, 3346 want: "66450fd3dd", 3347 wantFormat: "psrlq %xmm13, %xmm11", 3348 }, 3349 { 3350 setup: func(i *instruction) { 3351 i.asXmmRmiReg(sseOpcodePsllw, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3352 }, 3353 want: "66450ff19d80000000", 3354 wantFormat: "psllw 128(%r13), %xmm11", 3355 }, 3356 { 3357 setup: func(i *instruction) { 3358 i.asXmmRmiReg(sseOpcodePslld, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3359 }, 3360 want: "66450ff29d80000000", 3361 wantFormat: "pslld 128(%r13), %xmm11", 3362 }, 3363 { 3364 setup: func(i *instruction) { 3365 i.asXmmRmiReg(sseOpcodePsllq, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3366 }, 3367 want: "66450ff39d80000000", 3368 wantFormat: "psllq 128(%r13), %xmm11", 3369 }, 3370 { 3371 setup: func(i *instruction) { 3372 i.asXmmRmiReg(sseOpcodePsraw, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3373 }, 3374 want: "66450fe19d80000000", 3375 wantFormat: "psraw 128(%r13), %xmm11", 3376 }, 3377 { 3378 setup: func(i *instruction) { 3379 i.asXmmRmiReg(sseOpcodePsrad, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3380 }, 3381 want: "66450fe29d80000000", 3382 wantFormat: "psrad 128(%r13), %xmm11", 3383 }, 3384 { 3385 setup: func(i *instruction) { 3386 i.asXmmRmiReg(sseOpcodePsrlw, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3387 }, 3388 want: "66450fd19d80000000", 3389 wantFormat: "psrlw 128(%r13), %xmm11", 3390 }, 3391 { 3392 setup: func(i *instruction) { 3393 i.asXmmRmiReg(sseOpcodePsrld, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3394 }, 3395 want: "66450fd29d80000000", 3396 wantFormat: "psrld 128(%r13), %xmm11", 3397 }, 3398 { 3399 setup: func(i *instruction) { 3400 i.asXmmRmiReg(sseOpcodePsrlq, newOperandMem(newAmodeImmReg(128, r13VReg)), xmm11VReg) 3401 }, 3402 want: "66450fd39d80000000", 3403 wantFormat: "psrlq 128(%r13), %xmm11", 3404 }, 3405 { 3406 setup: func(i *instruction) { 3407 i.asCmpRmiR(true, newOperandReg(r13VReg), rdiVReg, true) 3408 }, 3409 want: "4c39ef", 3410 wantFormat: "cmpq %r13, %rdi", 3411 }, 3412 { 3413 setup: func(i *instruction) { 3414 i.asCmpRmiR(false, newOperandReg(r13VReg), rdiVReg, true) 3415 }, 3416 want: "4c85ef", 3417 wantFormat: "testq %r13, %rdi", 3418 }, 3419 { 3420 setup: func(i *instruction) { 3421 i.asCmpRmiR(true, newOperandReg(r13VReg), rdiVReg, false) 3422 }, 3423 want: "4439ef", 3424 wantFormat: "cmpl %r13d, %edi", 3425 }, 3426 { 3427 setup: func(i *instruction) { 3428 i.asCmpRmiR(false, newOperandReg(r13VReg), rdiVReg, false) 3429 }, 3430 want: "4485ef", 3431 wantFormat: "testl %r13d, %edi", 3432 }, 3433 { 3434 setup: func(i *instruction) { 3435 i.asCmpRmiR(true, newOperandMem(newAmodeImmReg(128, r13VReg)), rdiVReg, true) 3436 }, 3437 want: "493bbd80000000", 3438 wantFormat: "cmpq 128(%r13), %rdi", 3439 }, 3440 { 3441 setup: func(i *instruction) { 3442 i.asCmpRmiR(false, newOperandMem(newAmodeImmReg(128, r13VReg)), rdiVReg, true) 3443 }, 3444 want: "4985bd80000000", 3445 wantFormat: "testq %rdi, 128(%r13)", 3446 }, 3447 { 3448 setup: func(i *instruction) { 3449 i.asCmpRmiR(true, newOperandMem(newAmodeImmReg(128, r13VReg)), rdiVReg, false) 3450 }, 3451 want: "413bbd80000000", 3452 wantFormat: "cmpl 128(%r13), %edi", 3453 }, 3454 { 3455 setup: func(i *instruction) { 3456 i.asCmpRmiR(false, newOperandMem(newAmodeImmReg(128, r13VReg)), rdiVReg, false) 3457 }, 3458 want: "4185bd80000000", 3459 wantFormat: "testl %edi, 128(%r13)", 3460 }, 3461 { 3462 setup: func(i *instruction) { 3463 i.asCmpRmiR(true, newOperandImm32(128), rdiVReg, true) 3464 }, 3465 want: "4881ff80000000", 3466 wantFormat: "cmpq $128, %rdi", 3467 }, 3468 { 3469 setup: func(i *instruction) { 3470 i.asCmpRmiR(false, newOperandImm32(128), rdiVReg, true) 3471 }, 3472 want: "48f7c780000000", 3473 wantFormat: "testq $128, %rdi", 3474 }, 3475 { 3476 setup: func(i *instruction) { 3477 i.asCmpRmiR(true, newOperandImm32(128), rdiVReg, false) 3478 }, 3479 want: "81ff80000000", 3480 wantFormat: "cmpl $128, %edi", 3481 }, 3482 { 3483 setup: func(i *instruction) { 3484 i.asCmpRmiR(false, newOperandImm32(128), rdiVReg, false) 3485 }, 3486 want: "f7c780000000", 3487 wantFormat: "testl $128, %edi", 3488 }, 3489 { 3490 setup: func(i *instruction) { i.asSetcc(condO, rsiVReg) }, 3491 want: "400f90c6", 3492 wantFormat: "seto %rsi", 3493 }, 3494 { 3495 setup: func(i *instruction) { i.asSetcc(condNO, rsiVReg) }, 3496 want: "400f91c6", 3497 wantFormat: "setno %rsi", 3498 }, 3499 { 3500 setup: func(i *instruction) { i.asSetcc(condB, rsiVReg) }, 3501 want: "400f92c6", 3502 wantFormat: "setb %rsi", 3503 }, 3504 { 3505 setup: func(i *instruction) { i.asSetcc(condNB, rsiVReg) }, 3506 want: "400f93c6", 3507 wantFormat: "setnb %rsi", 3508 }, 3509 { 3510 setup: func(i *instruction) { i.asSetcc(condZ, rsiVReg) }, 3511 want: "400f94c6", 3512 wantFormat: "setz %rsi", 3513 }, 3514 { 3515 setup: func(i *instruction) { i.asSetcc(condNZ, rsiVReg) }, 3516 want: "400f95c6", 3517 wantFormat: "setnz %rsi", 3518 }, 3519 { 3520 setup: func(i *instruction) { i.asSetcc(condBE, rsiVReg) }, 3521 want: "400f96c6", 3522 wantFormat: "setbe %rsi", 3523 }, 3524 { 3525 setup: func(i *instruction) { i.asSetcc(condNBE, rsiVReg) }, 3526 want: "400f97c6", 3527 wantFormat: "setnbe %rsi", 3528 }, 3529 { 3530 setup: func(i *instruction) { i.asSetcc(condS, rsiVReg) }, 3531 want: "400f98c6", 3532 wantFormat: "sets %rsi", 3533 }, 3534 { 3535 setup: func(i *instruction) { i.asSetcc(condNS, rsiVReg) }, 3536 want: "400f99c6", 3537 wantFormat: "setns %rsi", 3538 }, 3539 { 3540 setup: func(i *instruction) { i.asSetcc(condP, rsiVReg) }, 3541 want: "400f9ac6", 3542 wantFormat: "setp %rsi", 3543 }, 3544 { 3545 setup: func(i *instruction) { i.asSetcc(condNP, rsiVReg) }, 3546 want: "400f9bc6", 3547 wantFormat: "setnp %rsi", 3548 }, 3549 { 3550 setup: func(i *instruction) { i.asSetcc(condL, rsiVReg) }, 3551 want: "400f9cc6", 3552 wantFormat: "setl %rsi", 3553 }, 3554 { 3555 setup: func(i *instruction) { i.asSetcc(condNL, rsiVReg) }, 3556 want: "400f9dc6", 3557 wantFormat: "setnl %rsi", 3558 }, 3559 { 3560 setup: func(i *instruction) { i.asSetcc(condLE, rsiVReg) }, 3561 want: "400f9ec6", 3562 wantFormat: "setle %rsi", 3563 }, 3564 { 3565 setup: func(i *instruction) { i.asSetcc(condNLE, rsiVReg) }, 3566 want: "400f9fc6", 3567 wantFormat: "setnle %rsi", 3568 }, 3569 { 3570 setup: func(i *instruction) { i.asCmove(condO, newOperandReg(rdiVReg), rsiVReg, true) }, 3571 want: "480f40f7", 3572 wantFormat: "cmovoq %rdi, %rsi", 3573 }, 3574 { 3575 setup: func(i *instruction) { i.asCmove(condNO, newOperandReg(rdiVReg), rsiVReg, true) }, 3576 want: "480f41f7", 3577 wantFormat: "cmovnoq %rdi, %rsi", 3578 }, 3579 { 3580 setup: func(i *instruction) { i.asCmove(condB, newOperandReg(rdiVReg), rsiVReg, true) }, 3581 want: "480f42f7", 3582 wantFormat: "cmovbq %rdi, %rsi", 3583 }, 3584 { 3585 setup: func(i *instruction) { i.asCmove(condNB, newOperandReg(rdiVReg), rsiVReg, true) }, 3586 want: "480f43f7", 3587 wantFormat: "cmovnbq %rdi, %rsi", 3588 }, 3589 { 3590 setup: func(i *instruction) { i.asCmove(condZ, newOperandReg(rdiVReg), rsiVReg, true) }, 3591 want: "480f44f7", 3592 wantFormat: "cmovzq %rdi, %rsi", 3593 }, 3594 { 3595 setup: func(i *instruction) { i.asCmove(condNZ, newOperandReg(rdiVReg), rsiVReg, true) }, 3596 want: "480f45f7", 3597 wantFormat: "cmovnzq %rdi, %rsi", 3598 }, 3599 { 3600 setup: func(i *instruction) { i.asCmove(condBE, newOperandReg(rdiVReg), rsiVReg, true) }, 3601 want: "480f46f7", 3602 wantFormat: "cmovbeq %rdi, %rsi", 3603 }, 3604 { 3605 setup: func(i *instruction) { i.asCmove(condNBE, newOperandReg(rdiVReg), rsiVReg, true) }, 3606 want: "480f47f7", 3607 wantFormat: "cmovnbeq %rdi, %rsi", 3608 }, 3609 { 3610 setup: func(i *instruction) { i.asCmove(condS, newOperandReg(rdiVReg), rsiVReg, true) }, 3611 want: "480f48f7", 3612 wantFormat: "cmovsq %rdi, %rsi", 3613 }, 3614 { 3615 setup: func(i *instruction) { i.asCmove(condNS, newOperandReg(rdiVReg), rsiVReg, true) }, 3616 want: "480f49f7", 3617 wantFormat: "cmovnsq %rdi, %rsi", 3618 }, 3619 { 3620 setup: func(i *instruction) { i.asCmove(condP, newOperandReg(rdiVReg), rsiVReg, true) }, 3621 want: "480f4af7", 3622 wantFormat: "cmovpq %rdi, %rsi", 3623 }, 3624 { 3625 setup: func(i *instruction) { i.asCmove(condNP, newOperandReg(rdiVReg), rsiVReg, true) }, 3626 want: "480f4bf7", 3627 wantFormat: "cmovnpq %rdi, %rsi", 3628 }, 3629 { 3630 setup: func(i *instruction) { i.asCmove(condL, newOperandReg(rdiVReg), rsiVReg, true) }, 3631 want: "480f4cf7", 3632 wantFormat: "cmovlq %rdi, %rsi", 3633 }, 3634 { 3635 setup: func(i *instruction) { i.asCmove(condNL, newOperandReg(rdiVReg), rsiVReg, true) }, 3636 want: "480f4df7", 3637 wantFormat: "cmovnlq %rdi, %rsi", 3638 }, 3639 { 3640 setup: func(i *instruction) { i.asCmove(condLE, newOperandReg(rdiVReg), rsiVReg, true) }, 3641 want: "480f4ef7", 3642 wantFormat: "cmovleq %rdi, %rsi", 3643 }, 3644 { 3645 setup: func(i *instruction) { i.asCmove(condNLE, newOperandReg(rdiVReg), rsiVReg, true) }, 3646 want: "480f4ff7", 3647 wantFormat: "cmovnleq %rdi, %rsi", 3648 }, 3649 { 3650 setup: func(i *instruction) { i.asCmove(condO, newOperandReg(rdiVReg), rsiVReg, false) }, 3651 want: "0f40f7", 3652 wantFormat: "cmovol %edi, %esi", 3653 }, 3654 { 3655 setup: func(i *instruction) { i.asCmove(condNO, newOperandReg(rdiVReg), rsiVReg, false) }, 3656 want: "0f41f7", 3657 wantFormat: "cmovnol %edi, %esi", 3658 }, 3659 { 3660 setup: func(i *instruction) { i.asCmove(condB, newOperandReg(rdiVReg), rsiVReg, false) }, 3661 want: "0f42f7", 3662 wantFormat: "cmovbl %edi, %esi", 3663 }, 3664 { 3665 setup: func(i *instruction) { i.asCmove(condNB, newOperandReg(rdiVReg), rsiVReg, false) }, 3666 want: "0f43f7", 3667 wantFormat: "cmovnbl %edi, %esi", 3668 }, 3669 { 3670 setup: func(i *instruction) { i.asCmove(condZ, newOperandReg(rdiVReg), rsiVReg, false) }, 3671 want: "0f44f7", 3672 wantFormat: "cmovzl %edi, %esi", 3673 }, 3674 { 3675 setup: func(i *instruction) { i.asCmove(condNZ, newOperandReg(rdiVReg), rsiVReg, false) }, 3676 want: "0f45f7", 3677 wantFormat: "cmovnzl %edi, %esi", 3678 }, 3679 { 3680 setup: func(i *instruction) { i.asCmove(condBE, newOperandReg(rdiVReg), rsiVReg, false) }, 3681 want: "0f46f7", 3682 wantFormat: "cmovbel %edi, %esi", 3683 }, 3684 { 3685 setup: func(i *instruction) { i.asCmove(condNBE, newOperandReg(rdiVReg), rsiVReg, false) }, 3686 want: "0f47f7", 3687 wantFormat: "cmovnbel %edi, %esi", 3688 }, 3689 { 3690 setup: func(i *instruction) { i.asCmove(condS, newOperandReg(rdiVReg), rsiVReg, false) }, 3691 want: "0f48f7", 3692 wantFormat: "cmovsl %edi, %esi", 3693 }, 3694 { 3695 setup: func(i *instruction) { i.asCmove(condNS, newOperandReg(rdiVReg), rsiVReg, false) }, 3696 want: "0f49f7", 3697 wantFormat: "cmovnsl %edi, %esi", 3698 }, 3699 { 3700 setup: func(i *instruction) { i.asCmove(condP, newOperandReg(rdiVReg), rsiVReg, false) }, 3701 want: "0f4af7", 3702 wantFormat: "cmovpl %edi, %esi", 3703 }, 3704 { 3705 setup: func(i *instruction) { i.asCmove(condNP, newOperandReg(rdiVReg), rsiVReg, false) }, 3706 want: "0f4bf7", 3707 wantFormat: "cmovnpl %edi, %esi", 3708 }, 3709 { 3710 setup: func(i *instruction) { i.asCmove(condL, newOperandReg(rdiVReg), rsiVReg, false) }, 3711 want: "0f4cf7", 3712 wantFormat: "cmovll %edi, %esi", 3713 }, 3714 { 3715 setup: func(i *instruction) { i.asCmove(condNL, newOperandReg(rdiVReg), rsiVReg, false) }, 3716 want: "0f4df7", 3717 wantFormat: "cmovnll %edi, %esi", 3718 }, 3719 { 3720 setup: func(i *instruction) { i.asCmove(condLE, newOperandReg(rdiVReg), rsiVReg, false) }, 3721 want: "0f4ef7", 3722 wantFormat: "cmovlel %edi, %esi", 3723 }, 3724 { 3725 setup: func(i *instruction) { i.asCmove(condNLE, newOperandReg(rdiVReg), rsiVReg, false) }, 3726 want: "0f4ff7", 3727 wantFormat: "cmovnlel %edi, %esi", 3728 }, 3729 { 3730 setup: func(i *instruction) { i.asCmove(condO, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3731 want: "480f40707b", 3732 wantFormat: "cmovoq 123(%rax), %rsi", 3733 }, 3734 { 3735 setup: func(i *instruction) { i.asCmove(condNO, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3736 want: "480f41707b", 3737 wantFormat: "cmovnoq 123(%rax), %rsi", 3738 }, 3739 { 3740 setup: func(i *instruction) { i.asCmove(condB, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3741 want: "480f42707b", 3742 wantFormat: "cmovbq 123(%rax), %rsi", 3743 }, 3744 { 3745 setup: func(i *instruction) { i.asCmove(condNB, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3746 want: "480f43707b", 3747 wantFormat: "cmovnbq 123(%rax), %rsi", 3748 }, 3749 { 3750 setup: func(i *instruction) { i.asCmove(condZ, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3751 want: "480f44707b", 3752 wantFormat: "cmovzq 123(%rax), %rsi", 3753 }, 3754 { 3755 setup: func(i *instruction) { i.asCmove(condNZ, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3756 want: "480f45707b", 3757 wantFormat: "cmovnzq 123(%rax), %rsi", 3758 }, 3759 { 3760 setup: func(i *instruction) { i.asCmove(condBE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3761 want: "480f46707b", 3762 wantFormat: "cmovbeq 123(%rax), %rsi", 3763 }, 3764 { 3765 setup: func(i *instruction) { i.asCmove(condNBE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3766 want: "480f47707b", 3767 wantFormat: "cmovnbeq 123(%rax), %rsi", 3768 }, 3769 { 3770 setup: func(i *instruction) { i.asCmove(condS, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3771 want: "480f48707b", 3772 wantFormat: "cmovsq 123(%rax), %rsi", 3773 }, 3774 { 3775 setup: func(i *instruction) { i.asCmove(condNS, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3776 want: "480f49707b", 3777 wantFormat: "cmovnsq 123(%rax), %rsi", 3778 }, 3779 { 3780 setup: func(i *instruction) { i.asCmove(condP, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3781 want: "480f4a707b", 3782 wantFormat: "cmovpq 123(%rax), %rsi", 3783 }, 3784 { 3785 setup: func(i *instruction) { i.asCmove(condNP, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3786 want: "480f4b707b", 3787 wantFormat: "cmovnpq 123(%rax), %rsi", 3788 }, 3789 { 3790 setup: func(i *instruction) { i.asCmove(condL, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3791 want: "480f4c707b", 3792 wantFormat: "cmovlq 123(%rax), %rsi", 3793 }, 3794 { 3795 setup: func(i *instruction) { i.asCmove(condNL, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3796 want: "480f4d707b", 3797 wantFormat: "cmovnlq 123(%rax), %rsi", 3798 }, 3799 { 3800 setup: func(i *instruction) { i.asCmove(condLE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3801 want: "480f4e707b", 3802 wantFormat: "cmovleq 123(%rax), %rsi", 3803 }, 3804 { 3805 setup: func(i *instruction) { i.asCmove(condNLE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, true) }, 3806 want: "480f4f707b", 3807 wantFormat: "cmovnleq 123(%rax), %rsi", 3808 }, 3809 { 3810 setup: func(i *instruction) { i.asCmove(condO, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3811 want: "0f40707b", 3812 wantFormat: "cmovol 123(%rax), %esi", 3813 }, 3814 { 3815 setup: func(i *instruction) { i.asCmove(condNO, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3816 want: "0f41707b", 3817 wantFormat: "cmovnol 123(%rax), %esi", 3818 }, 3819 { 3820 setup: func(i *instruction) { i.asCmove(condB, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3821 want: "0f42707b", 3822 wantFormat: "cmovbl 123(%rax), %esi", 3823 }, 3824 { 3825 setup: func(i *instruction) { i.asCmove(condNB, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3826 want: "0f43707b", 3827 wantFormat: "cmovnbl 123(%rax), %esi", 3828 }, 3829 { 3830 setup: func(i *instruction) { i.asCmove(condZ, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3831 want: "0f44707b", 3832 wantFormat: "cmovzl 123(%rax), %esi", 3833 }, 3834 { 3835 setup: func(i *instruction) { i.asCmove(condNZ, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3836 want: "0f45707b", 3837 wantFormat: "cmovnzl 123(%rax), %esi", 3838 }, 3839 { 3840 setup: func(i *instruction) { i.asCmove(condBE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3841 want: "0f46707b", 3842 wantFormat: "cmovbel 123(%rax), %esi", 3843 }, 3844 { 3845 setup: func(i *instruction) { i.asCmove(condNBE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3846 want: "0f47707b", 3847 wantFormat: "cmovnbel 123(%rax), %esi", 3848 }, 3849 { 3850 setup: func(i *instruction) { i.asCmove(condS, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3851 want: "0f48707b", 3852 wantFormat: "cmovsl 123(%rax), %esi", 3853 }, 3854 { 3855 setup: func(i *instruction) { i.asCmove(condNS, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3856 want: "0f49707b", 3857 wantFormat: "cmovnsl 123(%rax), %esi", 3858 }, 3859 { 3860 setup: func(i *instruction) { i.asCmove(condP, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3861 want: "0f4a707b", 3862 wantFormat: "cmovpl 123(%rax), %esi", 3863 }, 3864 { 3865 setup: func(i *instruction) { i.asCmove(condNP, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3866 want: "0f4b707b", 3867 wantFormat: "cmovnpl 123(%rax), %esi", 3868 }, 3869 { 3870 setup: func(i *instruction) { i.asCmove(condL, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3871 want: "0f4c707b", 3872 wantFormat: "cmovll 123(%rax), %esi", 3873 }, 3874 { 3875 setup: func(i *instruction) { i.asCmove(condNL, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3876 want: "0f4d707b", 3877 wantFormat: "cmovnll 123(%rax), %esi", 3878 }, 3879 { 3880 setup: func(i *instruction) { i.asCmove(condLE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3881 want: "0f4e707b", 3882 wantFormat: "cmovlel 123(%rax), %esi", 3883 }, 3884 { 3885 setup: func(i *instruction) { i.asCmove(condNLE, newOperandMem(newAmodeImmReg(123, raxVReg)), rsiVReg, false) }, 3886 want: "0f4f707b", 3887 wantFormat: "cmovnlel 123(%rax), %esi", 3888 }, 3889 { 3890 setup: func(i *instruction) { *i = *allocateExitSeq(r15VReg) }, 3891 // movq 0x10(%r15), %rbp 3892 // movq 0x18(%r15), %rsp 3893 // retq 3894 want: "498b6f10498b6718c3", 3895 wantFormat: "exit_sequence %r15", 3896 }, 3897 { 3898 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandReg(r14VReg), 8) }, 3899 want: "4d87de", 3900 wantFormat: "xchg.q %r11, %r14", 3901 }, 3902 { 3903 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandMem(newAmodeImmReg(123, raxVReg)), 8) }, 3904 want: "4c87587b", 3905 wantFormat: "xchg.q %r11, 123(%rax)", 3906 }, 3907 { 3908 setup: func(i *instruction) { i.asXCHG(r15VReg, newOperandReg(raxVReg), 8) }, 3909 want: "4c87f8", 3910 wantFormat: "xchg.q %r15, %rax", 3911 }, 3912 { 3913 setup: func(i *instruction) { i.asXCHG(rbxVReg, newOperandReg(rsiVReg), 8) }, 3914 want: "4887de", 3915 wantFormat: "xchg.q %rbx, %rsi", 3916 }, 3917 { 3918 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandReg(r14VReg), 4) }, 3919 want: "4587de", 3920 wantFormat: "xchg.l %r11, %r14", 3921 }, 3922 { 3923 setup: func(i *instruction) { i.asXCHG(r15VReg, newOperandReg(raxVReg), 4) }, 3924 want: "4487f8", 3925 wantFormat: "xchg.l %r15, %rax", 3926 }, 3927 { 3928 setup: func(i *instruction) { i.asXCHG(rbxVReg, newOperandReg(rsiVReg), 4) }, 3929 want: "87de", 3930 wantFormat: "xchg.l %rbx, %rsi", 3931 }, 3932 { 3933 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandMem(newAmodeImmReg(123, raxVReg)), 4) }, 3934 want: "4487587b", 3935 wantFormat: "xchg.l %r11, 123(%rax)", 3936 }, 3937 { 3938 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandReg(r14VReg), 2) }, 3939 want: "664587de", 3940 wantFormat: "xchg.w %r11, %r14", 3941 }, 3942 { 3943 setup: func(i *instruction) { i.asXCHG(r15VReg, newOperandReg(raxVReg), 2) }, 3944 want: "664487f8", 3945 wantFormat: "xchg.w %r15, %rax", 3946 }, 3947 { 3948 setup: func(i *instruction) { i.asXCHG(rbxVReg, newOperandReg(rsiVReg), 2) }, 3949 want: "6687de", 3950 wantFormat: "xchg.w %rbx, %rsi", 3951 }, 3952 { 3953 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandMem(newAmodeImmReg(123, raxVReg)), 2) }, 3954 want: "664487587b", 3955 wantFormat: "xchg.w %r11, 123(%rax)", 3956 }, 3957 { 3958 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandMem(newAmodeImmReg(123, raxVReg)), 1) }, 3959 want: "4486587b", 3960 wantFormat: "xchg.b %r11, 123(%rax)", 3961 }, 3962 { 3963 setup: func(i *instruction) { i.asXCHG(r11VReg, newOperandMem(newAmodeImmReg(123, rdiVReg)), 1) }, 3964 want: "44865f7b", 3965 wantFormat: "xchg.b %r11, 123(%rdi)", 3966 }, 3967 { 3968 setup: func(i *instruction) { i.asXCHG(rsiVReg, newOperandMem(newAmodeImmReg(123, raxVReg)), 1) }, 3969 want: "4086707b", 3970 wantFormat: "xchg.b %rsi, 123(%rax)", 3971 }, 3972 { 3973 setup: func(i *instruction) { i.asXCHG(rdiVReg, newOperandMem(newAmodeImmReg(123, raxVReg)), 1) }, 3974 want: "4086787b", 3975 wantFormat: "xchg.b %rdi, 123(%rax)", 3976 }, 3977 { 3978 setup: func(i *instruction) { i.asXCHG(rdiVReg, newOperandMem(newAmodeImmReg(123, rsiVReg)), 1) }, 3979 want: "40867e7b", 3980 wantFormat: "xchg.b %rdi, 123(%rsi)", 3981 }, 3982 { 3983 setup: func(i *instruction) { i.asZeros(rbxVReg) }, 3984 want: "4831db", 3985 wantFormat: "xor %rbx, %rbx", 3986 }, 3987 { 3988 setup: func(i *instruction) { i.asZeros(r14VReg) }, 3989 want: "4d31f6", 3990 wantFormat: "xor %r14, %r14", 3991 }, 3992 { 3993 setup: func(i *instruction) { i.asZeros(xmm1VReg) }, 3994 want: "660fefc9", 3995 wantFormat: "xor %xmm1, %xmm1", 3996 }, 3997 { 3998 setup: func(i *instruction) { i.asZeros(xmm12VReg) }, 3999 want: "66450fefe4", 4000 wantFormat: "xor %xmm12, %xmm12", 4001 }, 4002 { 4003 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodeCmpss, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4004 want: "f30fc2c119", 4005 wantFormat: "cmpss $25, %xmm1, %xmm0", 4006 }, 4007 { 4008 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodeCmpsd, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4009 want: "f20fc2c119", 4010 wantFormat: "cmpsd $25, %xmm1, %xmm0", 4011 }, 4012 { 4013 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodeInsertps, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4014 want: "660f3a21c119", 4015 wantFormat: "insertps $25, %xmm1, %xmm0", 4016 }, 4017 { 4018 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePalignr, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4019 want: "660f3a0fc119", 4020 wantFormat: "palignr $25, %xmm1, %xmm0", 4021 }, 4022 { 4023 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePinsrb, uint8(25), newOperandReg(r14VReg), xmm1VReg) }, 4024 want: "66410f3a20ce19", 4025 wantFormat: "pinsrb $25, %r14d, %xmm1", 4026 }, 4027 { 4028 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePinsrw, uint8(25), newOperandReg(r14VReg), xmm1VReg) }, 4029 want: "66410fc4ce19", 4030 wantFormat: "pinsrw $25, %r14d, %xmm1", 4031 }, 4032 { 4033 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePinsrd, uint8(25), newOperandReg(r14VReg), xmm1VReg) }, 4034 want: "66410f3a22ce19", 4035 wantFormat: "pinsrd $25, %r14d, %xmm1", 4036 }, 4037 { 4038 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePinsrq, uint8(25), newOperandReg(r14VReg), xmm1VReg) }, 4039 want: "66490f3a22ce19", 4040 wantFormat: "pinsrq $25, %r14, %xmm1", 4041 }, 4042 { 4043 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePextrb, uint8(25), newOperandReg(xmm1VReg), r14VReg) }, 4044 want: "66410f3a14ce19", 4045 wantFormat: "pextrb $25, %xmm1, %r14d", 4046 }, 4047 { 4048 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePextrw, uint8(25), newOperandReg(xmm1VReg), r14VReg) }, 4049 want: "66440fc5f119", 4050 wantFormat: "pextrw $25, %xmm1, %r14d", 4051 }, 4052 { 4053 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePextrd, uint8(25), newOperandReg(xmm1VReg), rbxVReg) }, 4054 want: "660f3a16cb19", 4055 wantFormat: "pextrd $25, %xmm1, %ebx", 4056 }, 4057 { 4058 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePextrq, uint8(25), newOperandReg(xmm1VReg), rdxVReg) }, 4059 want: "66480f3a16ca19", 4060 wantFormat: "pextrq $25, %xmm1, %rdx", 4061 }, 4062 { 4063 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodePshufd, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4064 want: "660f70c119", 4065 wantFormat: "pshufd $25, %xmm1, %xmm0", 4066 }, 4067 { 4068 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodeRoundps, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4069 want: "660f3a08c119", 4070 wantFormat: "roundps $25, %xmm1, %xmm0", 4071 }, 4072 { 4073 setup: func(i *instruction) { i.asXmmRmRImm(sseOpcodeRoundpd, uint8(25), newOperandReg(xmm1VReg), xmm0VReg) }, 4074 want: "660f3a09c119", 4075 wantFormat: "roundpd $25, %xmm1, %xmm0", 4076 }, 4077 { 4078 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmulhrsw, newOperandReg(xmm1VReg), xmm0VReg) }, 4079 want: "660f380bc1", 4080 wantFormat: "pmulhrsw %xmm1, %xmm0", 4081 }, 4082 { 4083 setup: func(i *instruction) { i.asXmmRmR(sseOpcodeUnpcklps, newOperandReg(xmm1VReg), xmm0VReg) }, 4084 want: "0f14c1", 4085 wantFormat: "unpcklps %xmm1, %xmm0", 4086 }, 4087 { 4088 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvtps2pd, newOperandReg(xmm1VReg), xmm0VReg) }, 4089 want: "0f5ac1", 4090 wantFormat: "cvtps2pd %xmm1, %xmm0", 4091 }, 4092 { 4093 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvtpd2ps, newOperandReg(xmm15VReg), xmm0VReg) }, 4094 want: "66410f5ac7", 4095 wantFormat: "cvtpd2ps %xmm15, %xmm0", 4096 }, 4097 { 4098 setup: func(i *instruction) { i.asXmmUnaryRmR(sseOpcodeCvttpd2dq, newOperandReg(xmm15VReg), xmm11VReg) }, 4099 want: "66450fe6df", 4100 wantFormat: "cvttpd2dq %xmm15, %xmm11", 4101 }, 4102 { 4103 setup: func(i *instruction) { 4104 i.asXmmRmRImm(sseOpcodeShufps, 0b00_00_10_00, newOperandReg(xmm15VReg), xmm11VReg) 4105 }, 4106 want: "450fc6df08", 4107 wantFormat: "shufps $8, %xmm15, %xmm11", 4108 }, 4109 { 4110 setup: func(i *instruction) { i.asXmmRmR(sseOpcodePmaddubsw, newOperandReg(xmm1VReg), xmm0VReg) }, 4111 want: "660f3804c1", 4112 wantFormat: "pmaddubsw %xmm1, %xmm0", 4113 }, 4114 { 4115 setup: func(i *instruction) { i.asBlendvpd(newOperandReg(xmm1VReg), xmm15VReg) }, 4116 want: "66440f3815f9", 4117 wantFormat: "blendvpd %xmm1, %xmm15, %xmm0", 4118 }, 4119 { 4120 setup: func(i *instruction) { i.asMFence() }, 4121 want: "0faef0", 4122 wantFormat: "mfence", 4123 }, 4124 { 4125 setup: func(i *instruction) { i.asLockCmpXCHG(rsiVReg, newAmodeImmReg(123, raxVReg), 8) }, 4126 want: "f0480fb1707b", 4127 wantFormat: "lock cmpxchg.q %rsi, 123(%rax)", 4128 }, 4129 { 4130 setup: func(i *instruction) { i.asLockCmpXCHG(r11VReg, newAmodeImmReg(123, raxVReg), 8) }, 4131 want: "f04c0fb1587b", 4132 wantFormat: "lock cmpxchg.q %r11, 123(%rax)", 4133 }, 4134 { 4135 setup: func(i *instruction) { i.asLockCmpXCHG(rsiVReg, newAmodeImmReg(123, raxVReg), 4) }, 4136 want: "f00fb1707b", 4137 wantFormat: "lock cmpxchg.l %rsi, 123(%rax)", 4138 }, 4139 { 4140 setup: func(i *instruction) { i.asLockCmpXCHG(r11VReg, newAmodeImmReg(123, raxVReg), 4) }, 4141 want: "f0440fb1587b", 4142 wantFormat: "lock cmpxchg.l %r11, 123(%rax)", 4143 }, 4144 { 4145 setup: func(i *instruction) { i.asLockCmpXCHG(r11VReg, newAmodeImmReg(123, raxVReg), 2) }, 4146 want: "66f0440fb1587b", 4147 wantFormat: "lock cmpxchg.w %r11, 123(%rax)", 4148 }, 4149 { 4150 setup: func(i *instruction) { i.asLockCmpXCHG(rsiVReg, newAmodeImmReg(123, raxVReg), 2) }, 4151 want: "66f00fb1707b", 4152 wantFormat: "lock cmpxchg.w %rsi, 123(%rax)", 4153 }, 4154 { 4155 setup: func(i *instruction) { i.asLockCmpXCHG(r11VReg, newAmodeImmReg(123, raxVReg), 1) }, 4156 want: "f0440fb0587b", 4157 wantFormat: "lock cmpxchg.b %r11, 123(%rax)", 4158 }, 4159 { 4160 setup: func(i *instruction) { i.asLockCmpXCHG(r11VReg, newAmodeImmReg(123, rdiVReg), 1) }, 4161 want: "f0440fb05f7b", 4162 wantFormat: "lock cmpxchg.b %r11, 123(%rdi)", 4163 }, 4164 { 4165 setup: func(i *instruction) { i.asLockCmpXCHG(rsiVReg, newAmodeImmReg(123, raxVReg), 1) }, 4166 want: "f0400fb0707b", 4167 wantFormat: "lock cmpxchg.b %rsi, 123(%rax)", 4168 }, 4169 { 4170 setup: func(i *instruction) { i.asLockCmpXCHG(rdiVReg, newAmodeImmReg(123, raxVReg), 1) }, 4171 want: "f0400fb0787b", 4172 wantFormat: "lock cmpxchg.b %rdi, 123(%rax)", 4173 }, 4174 { 4175 setup: func(i *instruction) { i.asLockCmpXCHG(rdiVReg, newAmodeImmReg(123, rsiVReg), 1) }, 4176 want: "f0400fb07e7b", 4177 wantFormat: "lock cmpxchg.b %rdi, 123(%rsi)", 4178 }, 4179 { 4180 setup: func(i *instruction) { i.asLockXAdd(rsiVReg, newAmodeImmReg(123, raxVReg), 8) }, 4181 want: "f0480fc1707b", 4182 wantFormat: "lock xadd.q %rsi, 123(%rax)", 4183 }, 4184 { 4185 setup: func(i *instruction) { i.asLockXAdd(r11VReg, newAmodeImmReg(123, raxVReg), 8) }, 4186 want: "f04c0fc1587b", 4187 wantFormat: "lock xadd.q %r11, 123(%rax)", 4188 }, 4189 { 4190 setup: func(i *instruction) { i.asLockXAdd(rsiVReg, newAmodeImmReg(123, raxVReg), 4) }, 4191 want: "f00fc1707b", 4192 wantFormat: "lock xadd.l %rsi, 123(%rax)", 4193 }, 4194 { 4195 setup: func(i *instruction) { i.asLockXAdd(r11VReg, newAmodeImmReg(123, raxVReg), 4) }, 4196 want: "f0440fc1587b", 4197 wantFormat: "lock xadd.l %r11, 123(%rax)", 4198 }, 4199 { 4200 setup: func(i *instruction) { i.asLockXAdd(r11VReg, newAmodeImmReg(123, raxVReg), 2) }, 4201 want: "66f0440fc1587b", 4202 wantFormat: "lock xadd.w %r11, 123(%rax)", 4203 }, 4204 { 4205 setup: func(i *instruction) { i.asLockXAdd(rsiVReg, newAmodeImmReg(123, raxVReg), 2) }, 4206 want: "66f00fc1707b", 4207 wantFormat: "lock xadd.w %rsi, 123(%rax)", 4208 }, 4209 { 4210 setup: func(i *instruction) { i.asLockXAdd(r11VReg, newAmodeImmReg(123, raxVReg), 1) }, 4211 want: "f0440fc0587b", 4212 wantFormat: "lock xadd.b %r11, 123(%rax)", 4213 }, 4214 { 4215 setup: func(i *instruction) { i.asLockXAdd(r11VReg, newAmodeImmReg(123, rdiVReg), 1) }, 4216 want: "f0440fc05f7b", 4217 wantFormat: "lock xadd.b %r11, 123(%rdi)", 4218 }, 4219 { 4220 setup: func(i *instruction) { i.asLockXAdd(rsiVReg, newAmodeImmReg(123, raxVReg), 1) }, 4221 want: "f0400fc0707b", 4222 wantFormat: "lock xadd.b %rsi, 123(%rax)", 4223 }, 4224 { 4225 setup: func(i *instruction) { i.asLockXAdd(rdiVReg, newAmodeImmReg(123, raxVReg), 1) }, 4226 want: "f0400fc0787b", 4227 wantFormat: "lock xadd.b %rdi, 123(%rax)", 4228 }, 4229 { 4230 setup: func(i *instruction) { i.asLockXAdd(rdiVReg, newAmodeImmReg(123, rsiVReg), 1) }, 4231 want: "f0400fc07e7b", 4232 wantFormat: "lock xadd.b %rdi, 123(%rsi)", 4233 }, 4234 } { 4235 tc := tc 4236 t.Run(tc.wantFormat, func(t *testing.T) { 4237 i := &instruction{} 4238 tc.setup(i) 4239 4240 require.Equal(t, tc.wantFormat, i.String()) 4241 4242 mc := &mockCompiler{} 4243 m := &machine{c: mc} 4244 i.encode(m.c) 4245 require.Equal(t, tc.want, hex.EncodeToString(mc.buf)) 4246 }) 4247 } 4248 }