[llvm-bugs] [Bug 50796] New: [SIMD] OR reduction with !!result not recognized as v128.any_true

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 21 21:10:51 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50796

            Bug ID: 50796
           Summary: [SIMD] OR reduction with !!result not recognized as
                    v128.any_true
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: clang at evan.coeusgroup.com
                CC: llvm-bugs at lists.llvm.org

I even tried using an OpenMP SIMD pragma to help LLVM recognized the reduction,
no luck.  Here is a quick test (CE: https://godbolt.org/z/fhMvKj6Mh):


#include <wasm_simd128.h>

#pragma clang diagnostic ignored "-Wmissing-prototypes"

typedef int8_t i8x16 __attribute__((__vector_size__(16)));
typedef int16_t i16x8 __attribute__((__vector_size__(16)));
typedef int32_t i32x4 __attribute__((__vector_size__(16)));
typedef int64_t i64x2 __attribute__((__vector_size__(16)));

int
i8x16_any_true(i8x16 a) {
    int8_t r = 0;
    #pragma omp simd reduction(|:r)
    for (int i = 0 ; i < 16 ; i++) {
        r |= a[i];
    }
    return !!r;
}

int
i16x8_any_true(i16x8 a) {
    int16_t r = 0;
    #pragma omp simd reduction(|:r)
    for (int i = 0 ; i < 8 ; i++) {
        r |= a[i];
    }
    return !!r;
}

int
i32x4_any_true(i32x4 a) {
    int32_t r = 0;
    #pragma omp simd reduction(|:r)
    for (int i = 0 ; i < 4 ; i++) {
        r |= a[i];
    }
    return !!r;
}

int
i64x2_any_true(i64x2 a) {
    int64_t r = 0;
    #pragma omp simd reduction(|:r)
    for (int i = 0 ; i < 2 ; i++) {
        r |= a[i];
    }
    return !!r;
}

int
any_true_intrin(i8x16 a) {
    return __builtin_wasm_any_true_v128(a);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210622/4588c84b/attachment.html>


More information about the llvm-bugs mailing list