13573b2c84372d9484296fa658f5276f6c09acb92Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s 2d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 3d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor// Test template instantiation for Clang-specific features. 4d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 5d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor// --------------------------------------------------------------------- 6d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor// Vector types 7d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor// --------------------------------------------------------------------- 8d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortypedef __attribute__(( ext_vector_type(2) )) double double2; 9d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortypedef __attribute__(( ext_vector_type(4) )) double double4; 10d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 11d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortemplate<typename T> 12d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregorstruct ExtVectorAccess0 { 13d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor void f(T v1, double4 v2) { 14d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor v1.xy = v2.yx; 15d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor } 16d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor}; 17d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 18d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortemplate struct ExtVectorAccess0<double2>; 19d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortemplate struct ExtVectorAccess0<double4>; 20d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 21d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortypedef __attribute__(( ext_vector_type(2) )) double double2; 22d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 23d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortemplate<typename T, typename U, int N, int M> 24d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregorstruct ShuffleVector0 { 25d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor void f(T t, U u, double2 a, double2 b) { 26d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor (void)__builtin_shufflevector(t, u, N, M); // expected-error{{index}} 277ce323c99954cff6060c412ccceaaa9504804761John McCall (void)__builtin_shufflevector(a, b, N, M); // expected-error{{index}} 28d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor (void)__builtin_shufflevector(a, b, 2, 1); 29d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor } 30d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor}; 31d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 32d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortemplate struct ShuffleVector0<double2, double2, 2, 1>; 33d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregortemplate struct ShuffleVector0<double2, double2, 4, 3>; // expected-note{{instantiation}} 34d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 35d56ae46dfec4c501b7bca0e144a121020841aa53Douglas Gregor 36