- /* Would it take fewer insns to begin with MOVN? For the value and its
- inverse, count the number of 16-bit lanes that are 0. */
- for (i = wantinv = 0; i < 64; i += 16) {
- tcg_target_long mask = 0xffffull << i;
- wantinv -= ((value & mask) == 0);
- wantinv += ((ivalue & mask) == 0);
- }
-
- if (wantinv <= 0) {
- /* Find the lowest lane that is not 0x0000. */
- shift = ctz64(value) & (63 & -16);
- tcg_out_insn(s, 3405, MOVZ, type, rd, value >> shift, shift);
- /* Clear out the lane that we just set. */
- value &= ~(0xffffUL << shift);
- /* Iterate until all non-zero lanes have been processed. */
- while (value) {
- shift = ctz64(value) & (63 & -16);
- tcg_out_insn(s, 3405, MOVK, type, rd, value >> shift, shift);
- value &= ~(0xffffUL << shift);
- }