https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119187

--- Comment #14 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
boolean vector handling now works.

#include <arm_neon.h>

void foo (uint8_t *a, uint8_t *b, uint8_t *c, int n)
{
  for (int i = 0; i < n; i+=8, a+=8, b+=8, c+=8)
    {
        uint8x8_t av1 = vld1_u8 (a);
        uint8x8_t bv1 = vld1_u8 (b);
        vst1_u8 (c, vcgt_u8 (av1, bv1));
    }
}

compiled with -march=armv9-a+sve -O3 gives

.L5:
        ldr     q31, [x1, x3]
        ldr     q30, [x0, x3]
        cmhi    v30.16b, v30.16b, v31.16b
        str     q30, [x2, x3]
        add     x3, x3, 16
        cmp     x3, x5
        bne     .L5
        lsl     w3, w4, 4
        cmp     w6, w3
        beq     .L1
.L4:
        sub     w6, w6, w3
        ptrue   p6.b, all
        ubfiz   x3, x3, 3, 32
        whilelo p7.b, xzr, x6
        ld1b    z28.b, p7/z, [x0, x3]
        ld1b    z27.b, p7/z, [x1, x3]
        cmplo   p15.b, p6/z, z27.b, z28.b
        mov     z29.b, p15/z, #-1
        st1b    z29.b, p7, [x2, x3]
.L1:
        ret
        .p2align 2,,3
.L6:
        mov     x4, 0
        .p2align 5,,15
.L3:
        ldr     d26, [x0, x4]
        ldr     d25, [x1, x4]
        cmhi    v25.8b, v26.8b, v25.8b
        str     d25, [x2, x4]
        add     x4, x4, 8
        cmp     w3, w4
        bgt     .L3
        ret
.L7:
        mov     w3, 0
        b       .L4

and so the vectorizer is now able to handle the conversion between different
boolean modes.

working on MASK_CALL now and then moving on to live values with e.g.

#include <arm_neon.h>

uint8_t foo (uint8_t *a, uint8_t *b, uint8_t *c, int n)
{
  uint8x8_t sum = {0};
  for (int i = 0; i < n; i+=8, a+=8, b+=8, c+=8)
    {
        uint8x8_t av1 = vld1_u8 (a);
        uint8x8_t bv1 = vld1_u8 (b);
        sum = vadd_u8 (sum, vadd_u8 (av1, bv1));
    }
  return vaddv_u8 (sum);
}

Reply via email to