This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A bit of vector extension documentation


On Fri, Sep 28, 2001 at 09:03:57AM +0200, Daniel Egger wrote:
> I'm actually more concerned about the braindead interface to those functions.
> Using __bultin_whatever to apply single operations to SIMD types is about
> as comfortable as inline ASM programming at large with the advantage of
> scheduling.

So wrap it in something.


r~


class v4sf
{
  public:
    typedef int vector __attribute__((mode(V4SF)));

  private:
    union {
      vector v;
      float a[4];
    };

  public:
    v4sf(float w, float x, float y, float z) {
      a[0] = w;
      a[1] = x;
      a[2] = y;
      a[3] = z;
    }

    v4sf(vector x) {
      v = x;
    }

    v4sf(const v4sf &other) {
      v = other.v;
    }

    v4sf operator + (const v4sf &other) {
      return v4sf(__builtin_vec_add(v, other.v));
    }
};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]