| 18 | } |
| 19 | |
| 20 | bool BFXPreferred(uint32_t sf, uint32_t uns, uint32_t imms, uint32_t immr) |
| 21 | { |
| 22 | // must not match UBFIZ/SBFIX alias |
| 23 | if (imms < immr) |
| 24 | return false; |
| 25 | |
| 26 | // must not match LSR/ASR/LSL alias (imms == 31 or 63) |
| 27 | if (imms == ((sf << 5) | 0x1F)) |
| 28 | return false; |
| 29 | |
| 30 | // must not match UXTx/SXTx alias |
| 31 | if (immr == 0) |
| 32 | { |
| 33 | // must not match 32-bit UXT[BH] or SXT[BH] |
| 34 | if (sf == 0 && (imms == 7 || imms == 15)) |
| 35 | return false; |
| 36 | |
| 37 | // must not match 64-bit SXT[BHW] |
| 38 | if ((sf == 1 && uns == 0) && (imms == 7 || imms == 15 || imms == 31)) |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | // must be UBFX/SBFX alias |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | uint64_t rotate_right(uint64_t x, unsigned width, unsigned amount) |
| 47 | { |