| 382 | SCC = SDST!=0</code></p> |
| 383 | <h4>S_BFE_I64</h4> |
| 384 | <p>Opcode: 42 (0x2a) for GCN 1.0/1.1; 40 (0x28) for GCN 1.2<br /> |
| 385 | Syntax: S_BFE_I64 SDST, SSRC0, SSRC1<br /> |
| 386 | Description: Extracts bits in SSRC0 from range (SSRC1&63) with length ((SSRC1>>16)&0x7f) |
| 387 | and extend sign from last bit of extracted value. |
| 388 | If result is non-zero store 1 to SCC, otherwise store 0 to SCC.<br /> |
| 389 | Operation:<br /> |
| 390 | <code>UINT8 shift = SSRC1 & 63 |
| 391 | UINT8 length = (SSRC1>>16) & 0x7f |
| 392 | if (length==0) |
| 393 | SDST = 0 |
| 394 | if (shift+length < 64) |
| 395 | SDST = (INT64)(SSRC0 << (64 - shift - length)) >> (64 - length) |
| 396 | else |
| 397 | SDST = (INT64)SSRC0 >> shift |
398 | | <h4>S_BFE_I64</h4> |
399 | | <p>Opcode: 42 (0x2a) for GCN 1.0/1.1; 40 (0x28) for GCN 1.2<br /> |
400 | | Syntax: S_BFE_I64 SDST, SSRC0, SSRC1<br /> |
401 | | Description: Extracts bits in SSRC0 from range (SSRC1&63) with length ((SSRC1>>16)&0x7f) |
402 | | and extend sign from last bit of extracted value. |
403 | | If result is non-zero store 1 to SCC, otherwise store 0 to SCC.<br /> |
404 | | Operation:<br /> |
405 | | <code>UINT8 shift = SSRC1&63 |
406 | | UINT8 length = (SSRC1>>16) & 0x7f |
407 | | if (length==0) |
408 | | SDST = 0 |
409 | | if (shift+length < 64) |
410 | | SDST = (INT64)(SSRC0 << (64 - shift - length)) >> (64 - length) |
411 | | else |
412 | | SDST = (INT64)SSRC0 >> shift |
413 | | SCC = SDST!=0</code></p> |
| 444 | <h4>S_CBRANCH_G_FORK</h4> |
| 445 | <p>Opcode: 43 (0x2b) for GCN 1.0/1.1; 41 (0x29) for GCN 1.2<br /> |
| 446 | Syntax: S_CBRANCH_G_FORK SSRC0(2), SSRC1(2)<br /> |
| 447 | Description: Fork control flow to passed and failed condition, jump to address SSRC1 for |
| 448 | passed conditions. Make two masks: for passed conditions (EXEC & SSRC0), |
| 449 | for failed conditions: (EXEC & ~SSRC0). |
| 450 | Choose way that have smallest active threads and push data for second way to control stack |
| 451 | (EXEC mask, jump address). Control stack pointer is stored in CSP |
| 452 | (3 last bits in MODE register). One entry of the stack have 4 dwords. |
| 453 | This instruction doesn't work if SSRC0 is immediate value.<br /> |
| 454 | Operation:<br /> |
| 455 | <code>UINT64 passes = (EXEC & SSRC0) |
| 456 | UINT64 failures = (EXEC & ~SSRC0) |
| 457 | if (passes == EXEC) |
| 458 | PC = SSRC1 |
| 459 | else if (failures == EXEC) |
| 460 | PC += 4 |
| 461 | else if (BITCOUNT(failures) < BITCOUNT(passes)) { |
| 462 | EXEC = failures |
| 463 | SGPR[CSP*4:CSP*4+1] = passes |
| 464 | SGPR[CSP*4+2:CSP*4+3] = SSRC1 |
| 465 | CSP++ |
| 466 | PC += 4 /* jump to failure */ |
| 467 | } else { |
| 468 | EXEC = passes |
| 469 | SGPR[CSP*4:CSP*4+1] = failures |
| 470 | SGPR[CSP*4+2:CSP*4+3] = PC+4 |
| 471 | CSP++ |
| 472 | PC = SSRC1 /* jump to passes */ |
| 473 | }</code></p> |