From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.dg/pr45788.C | 108 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr45788.C (limited to 'gcc/testsuite/g++.dg/pr45788.C') diff --git a/gcc/testsuite/g++.dg/pr45788.C b/gcc/testsuite/g++.dg/pr45788.C new file mode 100644 index 000000000..de3340df3 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr45788.C @@ -0,0 +1,108 @@ +// { dg-do compile { target x86_64-*-* } } +// { dg-options "-O3 -fwhole-program -msse2" } + +typedef long unsigned int __darwin_size_t; +typedef __darwin_size_t size_t; + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef float __v4sf __attribute__ ((__vector_size__ (16))); +extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_mul_ps (__m128 __A, __m128 __B) { + return (__m128) __builtin_ia32_mulps ((__v4sf)__A, (__v4sf)__B); +} +extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_set1_ps (float __F) { + return __extension__ (__m128)(__v4sf){ + __F, __F, __F, __F }; +} +extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_setr_ps (float __Z, float __Y, float __X, float __W) { +} +typedef float real; +template struct vectorX { +}; +template<> struct vectorX { + union { + __m128 s; + struct { + }; + }; + vectorX(__m128 s) : s(s) { + } + +} +__attribute__((aligned)); +template<> struct vectorX { + typedef float T; + typedef vectorX V; + union { + __m128 s; + struct { + T r, g, b, a; + }; + }; + vectorX(T a_, T b, T c, T d = 1) : s(_mm_setr_ps(a_,b,c,d)) { + } + vectorX(__m128 s) : s(s) { + } + vectorX(const V &t) : s(t.s) { + } + V &operator *=(const T t) { + s = _mm_mul_ps(s, _mm_set1_ps(t)); + return *this; + } + inline V operator *(const T t) const __attribute__((always_inline)) { + return V(*this) *= t; + }; +} +__attribute__((aligned)); +typedef vectorX color3; +typedef vectorX color4; +typedef color3 color; +static inline color4 c3to4(color c) { + color4 res(c.s); + res.a=1; + return res; +} +static inline color c4to3(color4 c) { + return color(c.s); +} +static inline color4 to_premultiplied(color c, real a) { + color4 res = c3to4(c); + return res * a; +} +static inline color4 to_premultiplied(color4 cs) { + return to_premultiplied(c4to3(cs), cs.a); +} +struct texture { +}; +struct flat_texture : public texture { + color4 c; + flat_texture(const color4 &c) : c(to_premultiplied(c)) { + } +}; +struct checkerboard_texture : public texture { + color4 even, odd; + checkerboard_texture(const color4 &even, const color4 &odd) : even(to_premultiplied(even)), odd(to_premultiplied(odd)) { + } +}; +struct texture_placement { + texture *tex; +}; +struct surface { + texture_placement textures[16]; + size_t texcount; +}; +struct primitive { + surface mat; +}; +static void set_color(primitive *p, color4 c) { + p->mat.textures[0].tex = new flat_texture(c); +} +static primitive **checkerboard_scene(int *pi) { + primitive **prims = new primitive*[6]; + set_color(prims[0], color4(.7,.7,.7)); + prims[1]->mat.textures[prims[1]->mat.texcount++].tex = new checkerboard_texture(color4(1,.1,.1),color4(.1,.15,1)); + set_color(prims[2], color4(.7,.9,.7)); +} +int main (int argc, char * const argv[]) { + int primi; + primitive **prims = checkerboard_scene(&primi); +} -- cgit v1.2.3