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

            Bug ID: 92880
           Summary: Documentation for Built-in Vector-Extensions should
                    mention C99 Fixed-width ints as base types
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: web
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur200126 at gmail dot com
  Target Milestone: ---

The current version of gcc doc section 6.52 "Using Vector Instructions through
Built-in Functions" does not seem to mention the possibility of using C99
fixed-width stdint types like uint32_t.

Since a quick test seems to show that these types do in fact work, it would be
a good idea to mention it in the documentation. This should, in theory, allow
programmers to write truly platform-independent vectorized code.

A test case with some knobs to play with:

  #include <stdint.h>

  #define namevxsi(u, l) vec_i##u##x##l##_t
  #define mkvxsi(u, l) \
    typedef uint##u##_t namevxsi(u, l) __attribute__ ((vector_size (l * u /
8)))

  mkvxsi(8, 16);  /* vec_i8x16_t */
  #define vectype namevxsi(8, 16)

  vectype op(vectype a, vectype b)
  {
    a = 2 * b + 1;
    return a;
  }

(Hell, it even works with __uint128_t.)

Reply via email to