[llvm-bugs] [Bug 34878] New: Can this constraint be relaxed? 'vector_size' attribute requires an integer constant

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 8 11:13:25 PDT 2017


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

            Bug ID: 34878
           Summary: Can this constraint be relaxed? 'vector_size'
                    attribute requires an integer constant
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at marehr.dialup.fu-berlin.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Hi clang team,

I wanted to ask if you could relax this restriction:

```
#include <cstddef>
#include <type_traits>

template <typename scalar_t, size_t length>
struct builtin_simd
{
    using type [[gnu::vector_size(sizeof(scalar_t) * length)]] = scalar_t;
};

int main() {
    using scalar_t = int;
    constexpr size_t length = 4u;
    using int32x4_t [[gnu::vector_size (sizeof(scalar_t) * length)]] =
scalar_t;

    static_assert(std::is_same<int32x4_t, builtin_simd<scalar_t,
length>::type>::value, "");

    return 0;
}
```

Gcc allows this.

Thank you!

-- 
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/20171008/8c6cfd8c/attachment.html>


More information about the llvm-bugs mailing list