Ping: [C++ PATCH] Opt out of GNU vector extensions for built-in SVE types

Message ID mptr21rx80y.fsf@arm.com
State New
Headers show
Series
  • Ping: [C++ PATCH] Opt out of GNU vector extensions for built-in SVE types
Related show

Commit Message

Richard Sandiford Nov. 29, 2019, 10:59 a.m.
Ping

Richard Sandiford <richard.sandiford@arm.com> writes:
> This is the C++ equivalent of r277950, which prevented the

> use of the GNU vector extensions with SVE vector types for C.

> [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277950].

> I've copied the rationale below for reference.

>

> The changes here are very similar to the C ones.  Perhaps the only

> noteworthy thing (that I know of) is that the patch continues to treat

> !gnu_vector_type_p vector types as literal types/potential constexprs.

> Disabling the GNU vector extensions shouldn't in itself stop the types

> from being literal types, since whatever the target provides instead

> might be constexpr material.

>

> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

>

> Richard

>

> -------------------------------------------------------------------------

> The AArch64 port defines built-in SVE types at start-up under names

> like __SVInt8_t.  These types are represented in the front end and

> gimple as normal VECTOR_TYPEs and are code-generated as normal vectors.

> However, we'd like to stop the frontends from treating them in the

> same way as GNU-style ("vector_size") vectors, for several reasons:

>

> (1) We allowed the GNU vector extensions to be mixed with Advanced SIMD

>     vector types and it ended up causing a lot of confusion on big-endian

>     targets.  Although SVE handles big-endian vectors differently from

>     Advanced SIMD, there are still potential surprises; see the block

>     comment near the head of aarch64-sve.md for details.

>

> (2) One of the SVE vectors is a packed one-bit-per-element boolean vector.

>     That isn't a combination the GNU vector extensions have supported

>     before.  E.g. it means that vectors can no longer decompose to

>     arrays for indexing, and that not all elements are individually

>     addressable.  It also makes it less clear which order the initialiser

>     should be in (lsb first, or bitfield ordering?).  We could define

>     all that of course, but it seems a bit weird to go to the effort

>     for this case when, given all the other reasons, we don't want the

>     extensions anyway.

>

> (3) The GNU vector extensions only provide full-vector operations,

>     which is a very artifical limitation on a predicated architecture

>     like SVE.

>

> (4) The set of operations provided by the GNU vector extensions is

>     relatively small, whereas the SVE intrinsics provide many more.

>

> (5) It makes it easier to ensure that (with default options) code is

>     portable between compilers without the GNU vector extensions having

>     to become an official part of the SVE intrinsics spec.

>

> (6) The length of the SVE types is usually not fixed at compile time,

>     whereas the GNU vector extension is geared around fixed-length

>     vectors.

>

>     It's possible to specify the length of an SVE vector using the

>     command-line option -msve-vector-bits=N, but in principle it should

>     be possible to have functions compiled for different N in the same

>     translation unit.  This isn't supported yet but would be very useful

>     for implementing ifuncs.  Once mixing lengths in a translation unit

>     is supported, the SVE types should represent the same type throughout

>     the translation unit, just as GNU vector types do.

>

> However, when -msve-vector-bits=N is in effect, we do allow conversions

> between explicit GNU vector types of N bits and the corresponding SVE

> types.  This doesn't undermine the intent of (5) because in this case

> the use of GNU vector types is explicit and intentional.  It also doesn't

> undermine the intent of (6) because converting between the types is just

> a conditionally-supported operation.  In other words, the types still

> represent the same types throughout the translation unit, it's just that

> conversions between them are valid in cases where a certain precondition

> is known to hold.  It's similar to the way that the SVE vector types are

> defined throughout the translation unit but can only be used in functions

> for which SVE is enabled.

> -------------------------------------------------------------------------


2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/cp/
	* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p
	instead of VECTOR_TYPE.
	* call.c (build_conditional_expr_1): Restrict vector handling
	to vectors that satisfy gnu_vector_type_p.  Don't treat the
	"then" and "else" types as equivalent if they have the same
	vector shape but differ in whether they're GNU vectors.
	* cvt.c (ocp_convert): Only allow vectors to be converted
	to bool if they satisfy gnu_vector_type_p.
	(build_expr_type_conversion): Only allow conversions from
	vectors if they satisfy gnu_vector_type_p.
	* typeck.c (cp_build_binary_op): Only allow binary operators to be
	applied to vectors if they satisfy gnu_vector_type_p.
	(cp_build_unary_op): Likewise unary operators.
	(build_reinterpret_cast_1):

gcc/testsuite/
	* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C: New test.
	* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C: New test.

Comments

Jason Merrill Dec. 2, 2019, 7:06 p.m. | #1
On 11/29/19 5:59 AM, Richard Sandiford wrote:
> Ping

> 

> Richard Sandiford <richard.sandiford@arm.com> writes:

>> This is the C++ equivalent of r277950, which prevented the

>> use of the GNU vector extensions with SVE vector types for C.

>> [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277950].

>> I've copied the rationale below for reference.

>>

>> The changes here are very similar to the C ones.  Perhaps the only

>> noteworthy thing (that I know of) is that the patch continues to treat

>> !gnu_vector_type_p vector types as literal types/potential constexprs.

>> Disabling the GNU vector extensions shouldn't in itself stop the types

>> from being literal types, since whatever the target provides instead

>> might be constexpr material.

>>

>> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

>>

>> Richard

>>

>> -------------------------------------------------------------------------

>> The AArch64 port defines built-in SVE types at start-up under names

>> like __SVInt8_t.  These types are represented in the front end and

>> gimple as normal VECTOR_TYPEs and are code-generated as normal vectors.

>> However, we'd like to stop the frontends from treating them in the

>> same way as GNU-style ("vector_size") vectors, for several reasons:

>>

>> (1) We allowed the GNU vector extensions to be mixed with Advanced SIMD

>>      vector types and it ended up causing a lot of confusion on big-endian

>>      targets.  Although SVE handles big-endian vectors differently from

>>      Advanced SIMD, there are still potential surprises; see the block

>>      comment near the head of aarch64-sve.md for details.

>>

>> (2) One of the SVE vectors is a packed one-bit-per-element boolean vector.

>>      That isn't a combination the GNU vector extensions have supported

>>      before.  E.g. it means that vectors can no longer decompose to

>>      arrays for indexing, and that not all elements are individually

>>      addressable.  It also makes it less clear which order the initialiser

>>      should be in (lsb first, or bitfield ordering?).  We could define

>>      all that of course, but it seems a bit weird to go to the effort

>>      for this case when, given all the other reasons, we don't want the

>>      extensions anyway.

>>

>> (3) The GNU vector extensions only provide full-vector operations,

>>      which is a very artifical limitation on a predicated architecture

>>      like SVE.

>>

>> (4) The set of operations provided by the GNU vector extensions is

>>      relatively small, whereas the SVE intrinsics provide many more.

>>

>> (5) It makes it easier to ensure that (with default options) code is

>>      portable between compilers without the GNU vector extensions having

>>      to become an official part of the SVE intrinsics spec.

>>

>> (6) The length of the SVE types is usually not fixed at compile time,

>>      whereas the GNU vector extension is geared around fixed-length

>>      vectors.

>>

>>      It's possible to specify the length of an SVE vector using the

>>      command-line option -msve-vector-bits=N, but in principle it should

>>      be possible to have functions compiled for different N in the same

>>      translation unit.  This isn't supported yet but would be very useful

>>      for implementing ifuncs.  Once mixing lengths in a translation unit

>>      is supported, the SVE types should represent the same type throughout

>>      the translation unit, just as GNU vector types do.

>>

>> However, when -msve-vector-bits=N is in effect, we do allow conversions

>> between explicit GNU vector types of N bits and the corresponding SVE

>> types.  This doesn't undermine the intent of (5) because in this case

>> the use of GNU vector types is explicit and intentional.  It also doesn't

>> undermine the intent of (6) because converting between the types is just

>> a conditionally-supported operation.  In other words, the types still

>> represent the same types throughout the translation unit, it's just that

>> conversions between them are valid in cases where a certain precondition

>> is known to hold.  It's similar to the way that the SVE vector types are

>> defined throughout the translation unit but can only be used in functions

>> for which SVE is enabled.

>> -------------------------------------------------------------------------

> 

> 2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

> 

> gcc/cp/

> 	* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p

> 	instead of VECTOR_TYPE.

> 	* call.c (build_conditional_expr_1): Restrict vector handling

> 	to vectors that satisfy gnu_vector_type_p.  Don't treat the

> 	"then" and "else" types as equivalent if they have the same

> 	vector shape but differ in whether they're GNU vectors.

> 	* cvt.c (ocp_convert): Only allow vectors to be converted

> 	to bool if they satisfy gnu_vector_type_p.

> 	(build_expr_type_conversion): Only allow conversions from

> 	vectors if they satisfy gnu_vector_type_p.

> 	* typeck.c (cp_build_binary_op): Only allow binary operators to be

> 	applied to vectors if they satisfy gnu_vector_type_p.

> 	(cp_build_unary_op): Likewise unary operators.

> 	(build_reinterpret_cast_1):

> 

> Index: gcc/cp/call.c

> ===================================================================

> --- gcc/cp/call.c	2019-11-08 08:31:19.000000000 +0000

> +++ gcc/cp/call.c	2019-11-08 17:43:07.172264122 +0000

> @@ -5397,6 +5401,7 @@ build_conditional_expr_1 (const op_locat

>        value category.  */

>     if (((lvalue_p (arg2) && lvalue_p (arg3))

>          || (xvalue_p (arg2) && xvalue_p (arg3)))

> +      && gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>         && same_type_p (arg2_type, arg3_type))


If the GNU-vector-ness differs, surely same_type_p should be false?

>       {

>         result_type = arg2_type;

> @@ -5500,7 +5505,8 @@ build_conditional_expr_1 (const op_locat

>   

>        --The second and third operands have the same type; the result  is  of

>          that type.  */

> -  if (same_type_p (arg2_type, arg3_type))

> +  if (gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

> +      && same_type_p (arg2_type, arg3_type))


Here too.

Jason
Richard Sandiford Dec. 3, 2019, 12:39 p.m. | #2
Jason Merrill <jason@redhat.com> writes:
> On 11/29/19 5:59 AM, Richard Sandiford wrote:

>> Ping

>> 

>> Richard Sandiford <richard.sandiford@arm.com> writes:

>>> This is the C++ equivalent of r277950, which prevented the

>>> use of the GNU vector extensions with SVE vector types for C.

>>> [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277950].

>>> I've copied the rationale below for reference.

>>>

>>> The changes here are very similar to the C ones.  Perhaps the only

>>> noteworthy thing (that I know of) is that the patch continues to treat

>>> !gnu_vector_type_p vector types as literal types/potential constexprs.

>>> Disabling the GNU vector extensions shouldn't in itself stop the types

>>> from being literal types, since whatever the target provides instead

>>> might be constexpr material.

>>>

>>> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

>>>

>>> Richard

>>>

>>> -------------------------------------------------------------------------

>>> The AArch64 port defines built-in SVE types at start-up under names

>>> like __SVInt8_t.  These types are represented in the front end and

>>> gimple as normal VECTOR_TYPEs and are code-generated as normal vectors.

>>> However, we'd like to stop the frontends from treating them in the

>>> same way as GNU-style ("vector_size") vectors, for several reasons:

>>>

>>> (1) We allowed the GNU vector extensions to be mixed with Advanced SIMD

>>>      vector types and it ended up causing a lot of confusion on big-endian

>>>      targets.  Although SVE handles big-endian vectors differently from

>>>      Advanced SIMD, there are still potential surprises; see the block

>>>      comment near the head of aarch64-sve.md for details.

>>>

>>> (2) One of the SVE vectors is a packed one-bit-per-element boolean vector.

>>>      That isn't a combination the GNU vector extensions have supported

>>>      before.  E.g. it means that vectors can no longer decompose to

>>>      arrays for indexing, and that not all elements are individually

>>>      addressable.  It also makes it less clear which order the initialiser

>>>      should be in (lsb first, or bitfield ordering?).  We could define

>>>      all that of course, but it seems a bit weird to go to the effort

>>>      for this case when, given all the other reasons, we don't want the

>>>      extensions anyway.

>>>

>>> (3) The GNU vector extensions only provide full-vector operations,

>>>      which is a very artifical limitation on a predicated architecture

>>>      like SVE.

>>>

>>> (4) The set of operations provided by the GNU vector extensions is

>>>      relatively small, whereas the SVE intrinsics provide many more.

>>>

>>> (5) It makes it easier to ensure that (with default options) code is

>>>      portable between compilers without the GNU vector extensions having

>>>      to become an official part of the SVE intrinsics spec.

>>>

>>> (6) The length of the SVE types is usually not fixed at compile time,

>>>      whereas the GNU vector extension is geared around fixed-length

>>>      vectors.

>>>

>>>      It's possible to specify the length of an SVE vector using the

>>>      command-line option -msve-vector-bits=N, but in principle it should

>>>      be possible to have functions compiled for different N in the same

>>>      translation unit.  This isn't supported yet but would be very useful

>>>      for implementing ifuncs.  Once mixing lengths in a translation unit

>>>      is supported, the SVE types should represent the same type throughout

>>>      the translation unit, just as GNU vector types do.

>>>

>>> However, when -msve-vector-bits=N is in effect, we do allow conversions

>>> between explicit GNU vector types of N bits and the corresponding SVE

>>> types.  This doesn't undermine the intent of (5) because in this case

>>> the use of GNU vector types is explicit and intentional.  It also doesn't

>>> undermine the intent of (6) because converting between the types is just

>>> a conditionally-supported operation.  In other words, the types still

>>> represent the same types throughout the translation unit, it's just that

>>> conversions between them are valid in cases where a certain precondition

>>> is known to hold.  It's similar to the way that the SVE vector types are

>>> defined throughout the translation unit but can only be used in functions

>>> for which SVE is enabled.

>>> -------------------------------------------------------------------------

>> 

>> 2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

>> 

>> gcc/cp/

>> 	* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p

>> 	instead of VECTOR_TYPE.

>> 	* call.c (build_conditional_expr_1): Restrict vector handling

>> 	to vectors that satisfy gnu_vector_type_p.  Don't treat the

>> 	"then" and "else" types as equivalent if they have the same

>> 	vector shape but differ in whether they're GNU vectors.

>> 	* cvt.c (ocp_convert): Only allow vectors to be converted

>> 	to bool if they satisfy gnu_vector_type_p.

>> 	(build_expr_type_conversion): Only allow conversions from

>> 	vectors if they satisfy gnu_vector_type_p.

>> 	* typeck.c (cp_build_binary_op): Only allow binary operators to be

>> 	applied to vectors if they satisfy gnu_vector_type_p.

>> 	(cp_build_unary_op): Likewise unary operators.

>> 	(build_reinterpret_cast_1):

>> 

>> Index: gcc/cp/call.c

>> ===================================================================

>> --- gcc/cp/call.c	2019-11-08 08:31:19.000000000 +0000

>> +++ gcc/cp/call.c	2019-11-08 17:43:07.172264122 +0000

>> @@ -5397,6 +5401,7 @@ build_conditional_expr_1 (const op_locat

>>        value category.  */

>>     if (((lvalue_p (arg2) && lvalue_p (arg3))

>>          || (xvalue_p (arg2) && xvalue_p (arg3)))

>> +      && gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>>         && same_type_p (arg2_type, arg3_type))

>

> If the GNU-vector-ness differs, surely same_type_p should be false?

>

>>       {

>>         result_type = arg2_type;

>> @@ -5500,7 +5505,8 @@ build_conditional_expr_1 (const op_locat

>>   

>>        --The second and third operands have the same type; the result  is  of

>>          that type.  */

>> -  if (same_type_p (arg2_type, arg3_type))

>> +  if (gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>> +      && same_type_p (arg2_type, arg3_type))

>

> Here too.


Although the types aren't supposed to support GNU-style vector operations
directly, they're still supposed to be structurally equivalent to GNU
vectors with the same size and element type.  E.g.:

  typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));

is structurally equivalent to svuint8_t for -msve-vector-bits=256.

svuint8_t and gnu_uint8_t (need to) have separate identities though,
since svuint8_t has an ABI-defined mangling that doesn't depend on
-msve-vector-bits, whereas GNU vector types have their established
target-independent mangling.  So the SVE types are built like this:

      vectype = build_distinct_type_copy (vectype);
      gcc_assert (vectype == TYPE_MAIN_VARIANT (vectype));
      SET_TYPE_STRUCTURAL_EQUALITY (vectype);
      TYPE_ARTIFICIAL (vectype) = 1;
      TYPE_INDIVISIBLE_P (vectype) = 1;

same_type_p seems to be operating at the structural level and doesn't
care whether the types are different enough to need different mangling.
I assumed it also shouldn't care whether the types had the same
restrictions on the operators they support.

If we do make same_type_p return false, we'd need checks elsewhere
to keep the test working.  E.g.:

  gnu_uint8_t init_gnu_u3 = { sve_u1 };
  gnu_uint8_t init_gnu_u4 = { gnu_u1 };

needs reference_related_p to be true and requires:

      /* If the constructor already has the array type, it's been through
	 digest_init, so we shouldn't try to do anything more.  */
      bool digested = same_type_p (atype, TREE_TYPE (init));

(build_vec_init) to be true.  ISTR there are similar digest_init checks
elsewhere.  The pointer checks:

  svuint8_t *sve_ptr1 = &sve_u1;
  svuint8_t *sve_ptr2 = &gnu_u1;

need comp_ptr_ttypes_real to be true.  I can try doing it that way
instead if that seems better.

The reason for calling out gnu_vector_type_p above is that it isn't
clear whether x ? y : z should return typeof(y) or typeof(z) if y
and z are structurally equivalent but distinct.

I guess that's a problem even before the patch though.  E.g.,
leaving SVE to one side, the AArch64 code:

  #include <arm_neon.h>
  typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (16)));
  void f(gnu_uint8_t x) {}
  void g(uint8x16_t y) {}

correctly mangles f as _Z1fDv16_h and g as _Z1g12__Uint8x16_t.  But:

  void h1(decltype(*(int *)nullptr ? *(gnu_uint8_t *)nullptr : *(uint8x16_t *)nullptr)) {}
  void h2(decltype(*(int *)nullptr ? *(uint8x16_t *)nullptr : *(gnu_uint8_t *)nullptr)) {}

mangles h1 as _Z2h1RDv16_h and h2 as _Z2h2R12__Uint8x16_t.  If that's
the expected behaviour, maybe we should just embrace it for SVE too.
But if it isn't, is there some other check we should be using here
instead?

Thanks,
Richard
Jason Merrill Dec. 3, 2019, 7:59 p.m. | #3
On 12/3/19 7:39 AM, Richard Sandiford wrote:
> Jason Merrill <jason@redhat.com> writes:

>> On 11/29/19 5:59 AM, Richard Sandiford wrote:

>>> Ping

>>>

>>> Richard Sandiford <richard.sandiford@arm.com> writes:

>>>> This is the C++ equivalent of r277950, which prevented the

>>>> use of the GNU vector extensions with SVE vector types for C.

>>>> [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277950].

>>>> I've copied the rationale below for reference.

>>>>

>>>> The changes here are very similar to the C ones.  Perhaps the only

>>>> noteworthy thing (that I know of) is that the patch continues to treat

>>>> !gnu_vector_type_p vector types as literal types/potential constexprs.

>>>> Disabling the GNU vector extensions shouldn't in itself stop the types

>>>> from being literal types, since whatever the target provides instead

>>>> might be constexpr material.

>>>>

>>>> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

>>>>

>>>> Richard

>>>>

>>>> -------------------------------------------------------------------------

>>>> The AArch64 port defines built-in SVE types at start-up under names

>>>> like __SVInt8_t.  These types are represented in the front end and

>>>> gimple as normal VECTOR_TYPEs and are code-generated as normal vectors.

>>>> However, we'd like to stop the frontends from treating them in the

>>>> same way as GNU-style ("vector_size") vectors, for several reasons:

>>>>

>>>> (1) We allowed the GNU vector extensions to be mixed with Advanced SIMD

>>>>       vector types and it ended up causing a lot of confusion on big-endian

>>>>       targets.  Although SVE handles big-endian vectors differently from

>>>>       Advanced SIMD, there are still potential surprises; see the block

>>>>       comment near the head of aarch64-sve.md for details.

>>>>

>>>> (2) One of the SVE vectors is a packed one-bit-per-element boolean vector.

>>>>       That isn't a combination the GNU vector extensions have supported

>>>>       before.  E.g. it means that vectors can no longer decompose to

>>>>       arrays for indexing, and that not all elements are individually

>>>>       addressable.  It also makes it less clear which order the initialiser

>>>>       should be in (lsb first, or bitfield ordering?).  We could define

>>>>       all that of course, but it seems a bit weird to go to the effort

>>>>       for this case when, given all the other reasons, we don't want the

>>>>       extensions anyway.

>>>>

>>>> (3) The GNU vector extensions only provide full-vector operations,

>>>>       which is a very artifical limitation on a predicated architecture

>>>>       like SVE.

>>>>

>>>> (4) The set of operations provided by the GNU vector extensions is

>>>>       relatively small, whereas the SVE intrinsics provide many more.

>>>>

>>>> (5) It makes it easier to ensure that (with default options) code is

>>>>       portable between compilers without the GNU vector extensions having

>>>>       to become an official part of the SVE intrinsics spec.

>>>>

>>>> (6) The length of the SVE types is usually not fixed at compile time,

>>>>       whereas the GNU vector extension is geared around fixed-length

>>>>       vectors.

>>>>

>>>>       It's possible to specify the length of an SVE vector using the

>>>>       command-line option -msve-vector-bits=N, but in principle it should

>>>>       be possible to have functions compiled for different N in the same

>>>>       translation unit.  This isn't supported yet but would be very useful

>>>>       for implementing ifuncs.  Once mixing lengths in a translation unit

>>>>       is supported, the SVE types should represent the same type throughout

>>>>       the translation unit, just as GNU vector types do.

>>>>

>>>> However, when -msve-vector-bits=N is in effect, we do allow conversions

>>>> between explicit GNU vector types of N bits and the corresponding SVE

>>>> types.  This doesn't undermine the intent of (5) because in this case

>>>> the use of GNU vector types is explicit and intentional.  It also doesn't

>>>> undermine the intent of (6) because converting between the types is just

>>>> a conditionally-supported operation.  In other words, the types still

>>>> represent the same types throughout the translation unit, it's just that

>>>> conversions between them are valid in cases where a certain precondition

>>>> is known to hold.  It's similar to the way that the SVE vector types are

>>>> defined throughout the translation unit but can only be used in functions

>>>> for which SVE is enabled.

>>>> -------------------------------------------------------------------------

>>>

>>> 2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

>>>

>>> gcc/cp/

>>> 	* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p

>>> 	instead of VECTOR_TYPE.

>>> 	* call.c (build_conditional_expr_1): Restrict vector handling

>>> 	to vectors that satisfy gnu_vector_type_p.  Don't treat the

>>> 	"then" and "else" types as equivalent if they have the same

>>> 	vector shape but differ in whether they're GNU vectors.

>>> 	* cvt.c (ocp_convert): Only allow vectors to be converted

>>> 	to bool if they satisfy gnu_vector_type_p.

>>> 	(build_expr_type_conversion): Only allow conversions from

>>> 	vectors if they satisfy gnu_vector_type_p.

>>> 	* typeck.c (cp_build_binary_op): Only allow binary operators to be

>>> 	applied to vectors if they satisfy gnu_vector_type_p.

>>> 	(cp_build_unary_op): Likewise unary operators.

>>> 	(build_reinterpret_cast_1):

>>>

>>> Index: gcc/cp/call.c

>>> ===================================================================

>>> --- gcc/cp/call.c	2019-11-08 08:31:19.000000000 +0000

>>> +++ gcc/cp/call.c	2019-11-08 17:43:07.172264122 +0000

>>> @@ -5397,6 +5401,7 @@ build_conditional_expr_1 (const op_locat

>>>         value category.  */

>>>      if (((lvalue_p (arg2) && lvalue_p (arg3))

>>>           || (xvalue_p (arg2) && xvalue_p (arg3)))

>>> +      && gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>>>          && same_type_p (arg2_type, arg3_type))

>>

>> If the GNU-vector-ness differs, surely same_type_p should be false?

>>

>>>        {

>>>          result_type = arg2_type;

>>> @@ -5500,7 +5505,8 @@ build_conditional_expr_1 (const op_locat

>>>    

>>>         --The second and third operands have the same type; the result  is  of

>>>           that type.  */

>>> -  if (same_type_p (arg2_type, arg3_type))

>>> +  if (gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>>> +      && same_type_p (arg2_type, arg3_type))

>>

>> Here too.

> 

> Although the types aren't supposed to support GNU-style vector operations

> directly, they're still supposed to be structurally equivalent to GNU

> vectors with the same size and element type.  E.g.:

> 

>    typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));

> 

> is structurally equivalent to svuint8_t for -msve-vector-bits=256.

> 

> svuint8_t and gnu_uint8_t (need to) have separate identities though,

> since svuint8_t has an ABI-defined mangling that doesn't depend on

> -msve-vector-bits, whereas GNU vector types have their established

> target-independent mangling.  So the SVE types are built like this:

> 

>        vectype = build_distinct_type_copy (vectype);

>        gcc_assert (vectype == TYPE_MAIN_VARIANT (vectype));

>        SET_TYPE_STRUCTURAL_EQUALITY (vectype);

>        TYPE_ARTIFICIAL (vectype) = 1;

>        TYPE_INDIVISIBLE_P (vectype) = 1;

> 

> same_type_p seems to be operating at the structural level and doesn't

> care whether the types are different enough to need different mangling.

> I assumed it also shouldn't care whether the types had the same

> restrictions on the operators they support.


No, types that behave differently should not be considered to be the 
same.  (Apart from some alias template cases, but I'm working on that)

> If we do make same_type_p return false, we'd need checks elsewhere

> to keep the test working.  E.g.:

> 

>    gnu_uint8_t init_gnu_u3 = { sve_u1 };

>    gnu_uint8_t init_gnu_u4 = { gnu_u1 };

> 

> needs reference_related_p to be true


Perhaps similar_type_p is a good place to handle this.

> and requires:

> 

>        /* If the constructor already has the array type, it's been through

> 	 digest_init, so we shouldn't try to do anything more.  */

>        bool digested = same_type_p (atype, TREE_TYPE (init));

> 

> (build_vec_init) to be true.  ISTR there are similar digest_init checks

> elsewhere.


And these tests could change to similar_type_p.  Or perhaps 
!BRACE_ENCLOSED_INITIALIZER_P (init).

> The pointer checks:

> 

>    svuint8_t *sve_ptr1 = &sve_u1;

>    svuint8_t *sve_ptr2 = &gnu_u1;

> 

> need comp_ptr_ttypes_real to be true.  I can try doing it that way

> instead if that seems better.


It looks like comp_ptr_ttypes_real already uses 
vector_types_convertible_p, doesn't that do the trick for you?

> The reason for calling out gnu_vector_type_p above is that it isn't

> clear whether x ? y : z should return typeof(y) or typeof(z) if y

> and z are structurally equivalent but distinct.

> 

> I guess that's a problem even before the patch though.  E.g.,

> leaving SVE to one side, the AArch64 code:

> 

>    #include <arm_neon.h>

>    typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (16)));

>    void f(gnu_uint8_t x) {}

>    void g(uint8x16_t y) {}

> 

> correctly mangles f as _Z1fDv16_h and g as _Z1g12__Uint8x16_t.  But:

> 

>    void h1(decltype(*(int *)nullptr ? *(gnu_uint8_t *)nullptr : *(uint8x16_t *)nullptr)) {}

>    void h2(decltype(*(int *)nullptr ? *(uint8x16_t *)nullptr : *(gnu_uint8_t *)nullptr)) {}

> 

> mangles h1 as _Z2h1RDv16_h and h2 as _Z2h2R12__Uint8x16_t.  If that's

> the expected behaviour, maybe we should just embrace it for SVE too.

> But if it isn't, is there some other check we should be using here

> instead?


Hmm, that does suggest that this is a broader issue.  Perhaps drop the 
two hunks above and leave this issue for later?  OK with that change.

Jason
Richard Sandiford Dec. 4, 2019, 9:45 a.m. | #4
Jason Merrill <jason@redhat.com> writes:
> On 12/3/19 7:39 AM, Richard Sandiford wrote:

>> Jason Merrill <jason@redhat.com> writes:

>>> On 11/29/19 5:59 AM, Richard Sandiford wrote:

>>>> Ping

>>>>

>>>> Richard Sandiford <richard.sandiford@arm.com> writes:

>>>>> This is the C++ equivalent of r277950, which prevented the

>>>>> use of the GNU vector extensions with SVE vector types for C.

>>>>> [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277950].

>>>>> I've copied the rationale below for reference.

>>>>>

>>>>> The changes here are very similar to the C ones.  Perhaps the only

>>>>> noteworthy thing (that I know of) is that the patch continues to treat

>>>>> !gnu_vector_type_p vector types as literal types/potential constexprs.

>>>>> Disabling the GNU vector extensions shouldn't in itself stop the types

>>>>> from being literal types, since whatever the target provides instead

>>>>> might be constexpr material.

>>>>>

>>>>> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

>>>>>

>>>>> Richard

>>>>>

>>>>> -------------------------------------------------------------------------

>>>>> The AArch64 port defines built-in SVE types at start-up under names

>>>>> like __SVInt8_t.  These types are represented in the front end and

>>>>> gimple as normal VECTOR_TYPEs and are code-generated as normal vectors.

>>>>> However, we'd like to stop the frontends from treating them in the

>>>>> same way as GNU-style ("vector_size") vectors, for several reasons:

>>>>>

>>>>> (1) We allowed the GNU vector extensions to be mixed with Advanced SIMD

>>>>>       vector types and it ended up causing a lot of confusion on big-endian

>>>>>       targets.  Although SVE handles big-endian vectors differently from

>>>>>       Advanced SIMD, there are still potential surprises; see the block

>>>>>       comment near the head of aarch64-sve.md for details.

>>>>>

>>>>> (2) One of the SVE vectors is a packed one-bit-per-element boolean vector.

>>>>>       That isn't a combination the GNU vector extensions have supported

>>>>>       before.  E.g. it means that vectors can no longer decompose to

>>>>>       arrays for indexing, and that not all elements are individually

>>>>>       addressable.  It also makes it less clear which order the initialiser

>>>>>       should be in (lsb first, or bitfield ordering?).  We could define

>>>>>       all that of course, but it seems a bit weird to go to the effort

>>>>>       for this case when, given all the other reasons, we don't want the

>>>>>       extensions anyway.

>>>>>

>>>>> (3) The GNU vector extensions only provide full-vector operations,

>>>>>       which is a very artifical limitation on a predicated architecture

>>>>>       like SVE.

>>>>>

>>>>> (4) The set of operations provided by the GNU vector extensions is

>>>>>       relatively small, whereas the SVE intrinsics provide many more.

>>>>>

>>>>> (5) It makes it easier to ensure that (with default options) code is

>>>>>       portable between compilers without the GNU vector extensions having

>>>>>       to become an official part of the SVE intrinsics spec.

>>>>>

>>>>> (6) The length of the SVE types is usually not fixed at compile time,

>>>>>       whereas the GNU vector extension is geared around fixed-length

>>>>>       vectors.

>>>>>

>>>>>       It's possible to specify the length of an SVE vector using the

>>>>>       command-line option -msve-vector-bits=N, but in principle it should

>>>>>       be possible to have functions compiled for different N in the same

>>>>>       translation unit.  This isn't supported yet but would be very useful

>>>>>       for implementing ifuncs.  Once mixing lengths in a translation unit

>>>>>       is supported, the SVE types should represent the same type throughout

>>>>>       the translation unit, just as GNU vector types do.

>>>>>

>>>>> However, when -msve-vector-bits=N is in effect, we do allow conversions

>>>>> between explicit GNU vector types of N bits and the corresponding SVE

>>>>> types.  This doesn't undermine the intent of (5) because in this case

>>>>> the use of GNU vector types is explicit and intentional.  It also doesn't

>>>>> undermine the intent of (6) because converting between the types is just

>>>>> a conditionally-supported operation.  In other words, the types still

>>>>> represent the same types throughout the translation unit, it's just that

>>>>> conversions between them are valid in cases where a certain precondition

>>>>> is known to hold.  It's similar to the way that the SVE vector types are

>>>>> defined throughout the translation unit but can only be used in functions

>>>>> for which SVE is enabled.

>>>>> -------------------------------------------------------------------------

>>>>

>>>> 2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

>>>>

>>>> gcc/cp/

>>>> 	* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p

>>>> 	instead of VECTOR_TYPE.

>>>> 	* call.c (build_conditional_expr_1): Restrict vector handling

>>>> 	to vectors that satisfy gnu_vector_type_p.  Don't treat the

>>>> 	"then" and "else" types as equivalent if they have the same

>>>> 	vector shape but differ in whether they're GNU vectors.

>>>> 	* cvt.c (ocp_convert): Only allow vectors to be converted

>>>> 	to bool if they satisfy gnu_vector_type_p.

>>>> 	(build_expr_type_conversion): Only allow conversions from

>>>> 	vectors if they satisfy gnu_vector_type_p.

>>>> 	* typeck.c (cp_build_binary_op): Only allow binary operators to be

>>>> 	applied to vectors if they satisfy gnu_vector_type_p.

>>>> 	(cp_build_unary_op): Likewise unary operators.

>>>> 	(build_reinterpret_cast_1):

>>>>

>>>> Index: gcc/cp/call.c

>>>> ===================================================================

>>>> --- gcc/cp/call.c	2019-11-08 08:31:19.000000000 +0000

>>>> +++ gcc/cp/call.c	2019-11-08 17:43:07.172264122 +0000

>>>> @@ -5397,6 +5401,7 @@ build_conditional_expr_1 (const op_locat

>>>>         value category.  */

>>>>      if (((lvalue_p (arg2) && lvalue_p (arg3))

>>>>           || (xvalue_p (arg2) && xvalue_p (arg3)))

>>>> +      && gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>>>>          && same_type_p (arg2_type, arg3_type))

>>>

>>> If the GNU-vector-ness differs, surely same_type_p should be false?

>>>

>>>>        {

>>>>          result_type = arg2_type;

>>>> @@ -5500,7 +5505,8 @@ build_conditional_expr_1 (const op_locat

>>>>    

>>>>         --The second and third operands have the same type; the result  is  of

>>>>           that type.  */

>>>> -  if (same_type_p (arg2_type, arg3_type))

>>>> +  if (gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)

>>>> +      && same_type_p (arg2_type, arg3_type))

>>>

>>> Here too.

>> 

>> Although the types aren't supposed to support GNU-style vector operations

>> directly, they're still supposed to be structurally equivalent to GNU

>> vectors with the same size and element type.  E.g.:

>> 

>>    typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));

>> 

>> is structurally equivalent to svuint8_t for -msve-vector-bits=256.

>> 

>> svuint8_t and gnu_uint8_t (need to) have separate identities though,

>> since svuint8_t has an ABI-defined mangling that doesn't depend on

>> -msve-vector-bits, whereas GNU vector types have their established

>> target-independent mangling.  So the SVE types are built like this:

>> 

>>        vectype = build_distinct_type_copy (vectype);

>>        gcc_assert (vectype == TYPE_MAIN_VARIANT (vectype));

>>        SET_TYPE_STRUCTURAL_EQUALITY (vectype);

>>        TYPE_ARTIFICIAL (vectype) = 1;

>>        TYPE_INDIVISIBLE_P (vectype) = 1;

>> 

>> same_type_p seems to be operating at the structural level and doesn't

>> care whether the types are different enough to need different mangling.

>> I assumed it also shouldn't care whether the types had the same

>> restrictions on the operators they support.

>

> No, types that behave differently should not be considered to be the 

> same.  (Apart from some alias template cases, but I'm working on that)

>

>> If we do make same_type_p return false, we'd need checks elsewhere

>> to keep the test working.  E.g.:

>> 

>>    gnu_uint8_t init_gnu_u3 = { sve_u1 };

>>    gnu_uint8_t init_gnu_u4 = { gnu_u1 };

>> 

>> needs reference_related_p to be true

>

> Perhaps similar_type_p is a good place to handle this.

>

>> and requires:

>> 

>>        /* If the constructor already has the array type, it's been through

>> 	 digest_init, so we shouldn't try to do anything more.  */

>>        bool digested = same_type_p (atype, TREE_TYPE (init));

>> 

>> (build_vec_init) to be true.  ISTR there are similar digest_init checks

>> elsewhere.

>

> And these tests could change to similar_type_p.  Or perhaps 

> !BRACE_ENCLOSED_INITIALIZER_P (init).


OK.

>> The pointer checks:

>> 

>>    svuint8_t *sve_ptr1 = &sve_u1;

>>    svuint8_t *sve_ptr2 = &gnu_u1;

>> 

>> need comp_ptr_ttypes_real to be true.  I can try doing it that way

>> instead if that seems better.

>

> It looks like comp_ptr_ttypes_real already uses 

> vector_types_convertible_p, doesn't that do the trick for you?


At the moment that just handles TYPE_VECTOR_OPAQUE (which isn't
true for SVE vectors).  But yeah, I guess that would be the natural
place to handle this if the types were no longer same_type_p.

>> The reason for calling out gnu_vector_type_p above is that it isn't

>> clear whether x ? y : z should return typeof(y) or typeof(z) if y

>> and z are structurally equivalent but distinct.

>> 

>> I guess that's a problem even before the patch though.  E.g.,

>> leaving SVE to one side, the AArch64 code:

>> 

>>    #include <arm_neon.h>

>>    typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (16)));

>>    void f(gnu_uint8_t x) {}

>>    void g(uint8x16_t y) {}

>> 

>> correctly mangles f as _Z1fDv16_h and g as _Z1g12__Uint8x16_t.  But:

>> 

>>    void h1(decltype(*(int *)nullptr ? *(gnu_uint8_t *)nullptr : *(uint8x16_t *)nullptr)) {}

>>    void h2(decltype(*(int *)nullptr ? *(uint8x16_t *)nullptr : *(gnu_uint8_t *)nullptr)) {}

>> 

>> mangles h1 as _Z2h1RDv16_h and h2 as _Z2h2R12__Uint8x16_t.  If that's

>> the expected behaviour, maybe we should just embrace it for SVE too.

>> But if it isn't, is there some other check we should be using here

>> instead?

>

> Hmm, that does suggest that this is a broader issue.  Perhaps drop the 

> two hunks above and leave this issue for later?  OK with that change.


Thanks.  For the record, here's what I applied.  I've filed PR92789
to track the issue above.

Richard


2019-12-04  Richard Sandiford  <richard.sandiford@arm.com>

gcc/cp/
	* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p
	instead of VECTOR_TYPE.
	* call.c (build_conditional_expr_1): Restrict vector handling
	to vectors that satisfy gnu_vector_type_p.
	* cvt.c (ocp_convert): Only allow vectors to be converted
	to bool if they satisfy gnu_vector_type_p.
	(build_expr_type_conversion): Only allow conversions from
	vectors if they satisfy gnu_vector_type_p.
	* typeck.c (cp_build_binary_op): Only allow binary operators to be
	applied to vectors if they satisfy gnu_vector_type_p.
	(cp_build_unary_op): Likewise unary operators.
	(build_reinterpret_cast_1):

gcc/testsuite/
	* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C: New test.
	* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C: New test.

Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	2019-12-04 09:17:04.810417681 +0000
+++ gcc/cp/cp-tree.h	2019-12-04 09:17:44.206133852 +0000
@@ -4254,7 +4254,7 @@ #define ENUM_UNDERLYING_TYPE(TYPE) \
    As an extension, we also treat vectors as aggregates.  Keep these
    checks in ascending code order.  */
 #define CP_AGGREGATE_TYPE_P(TYPE)				\
-  (TREE_CODE (TYPE) == VECTOR_TYPE				\
+  (gnu_vector_type_p (TYPE)					\
    || TREE_CODE (TYPE) == ARRAY_TYPE				\
    || (CLASS_TYPE_P (TYPE) && COMPLETE_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
 
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	2019-12-03 18:06:09.501653102 +0000
+++ gcc/cp/call.c	2019-12-04 09:17:44.202133883 +0000
@@ -5093,7 +5093,8 @@ build_conditional_expr_1 (const op_locat
   orig_arg2 = arg2;
   orig_arg3 = arg3;
 
-  if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1)))
+  if (gnu_vector_type_p (TREE_TYPE (arg1))
+      && VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1)))
     {
       tree arg1_type = TREE_TYPE (arg1);
 
@@ -5172,7 +5173,8 @@ build_conditional_expr_1 (const op_locat
 	  arg3_type = vtype;
 	}
 
-      if (VECTOR_TYPE_P (arg2_type) != VECTOR_TYPE_P (arg3_type))
+      if ((gnu_vector_type_p (arg2_type) && !VECTOR_TYPE_P (arg3_type))
+	  || (gnu_vector_type_p (arg3_type) && !VECTOR_TYPE_P (arg2_type)))
 	{
 	  enum stv_conv convert_flag =
 	    scalar_to_vector (loc, VEC_COND_EXPR, arg2, arg3,
@@ -5203,7 +5205,9 @@ build_conditional_expr_1 (const op_locat
 	    }
 	}
 
-      if (!same_type_p (arg2_type, arg3_type)
+      if (!gnu_vector_type_p (arg2_type)
+	  || !gnu_vector_type_p (arg3_type)
+	  || !same_type_p (arg2_type, arg3_type)
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (arg1_type),
 		       TYPE_VECTOR_SUBPARTS (arg2_type))
 	  || TYPE_SIZE (arg1_type) != TYPE_SIZE (arg2_type))
Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c	2019-11-29 13:04:13.654674379 +0000
+++ gcc/cp/cvt.c	2019-12-04 09:17:44.206133852 +0000
@@ -836,6 +836,14 @@ ocp_convert (tree type, tree expr, int c
 	      return error_mark_node;
 	    }
 
+	  if (VECTOR_TYPE_P (intype) && !gnu_vector_type_p (intype))
+	    {
+	      if (complain & tf_error)
+		error_at (loc, "could not convert %qE from %qH to %qI", expr,
+			  TREE_TYPE (expr), type);
+	      return error_mark_node;
+	    }
+
 	  /* We can't implicitly convert a scoped enum to bool, so convert
 	     to the underlying type first.  */
 	  if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC))
@@ -1763,8 +1771,11 @@ build_expr_type_conversion (int desires,
 							    tf_warning_or_error)
 					: NULL_TREE;
 
-      case COMPLEX_TYPE:
       case VECTOR_TYPE:
+	if (!gnu_vector_type_p (basetype))
+	  return NULL_TREE;
+	/* FALLTHROUGH */
+      case COMPLEX_TYPE:
 	if ((desires & WANT_VECTOR_OR_COMPLEX) == 0)
 	  return NULL_TREE;
 	switch (TREE_CODE (TREE_TYPE (basetype)))
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c	2019-12-04 09:17:04.802417736 +0000
+++ gcc/cp/typeck.c	2019-12-04 09:17:44.210133825 +0000
@@ -4547,7 +4547,8 @@ cp_build_binary_op (const op_location_t
 
   /* In case when one of the operands of the binary operation is
      a vector and another is a scalar -- convert scalar to vector.  */
-  if ((code0 == VECTOR_TYPE) != (code1 == VECTOR_TYPE))
+  if ((gnu_vector_type_p (type0) && code1 != VECTOR_TYPE)
+      || (gnu_vector_type_p (type1) && code0 != VECTOR_TYPE))
     {
       enum stv_conv convert_flag = scalar_to_vector (location, code, op0, op1,
 						     complain & tf_error);
@@ -4740,7 +4741,7 @@ cp_build_binary_op (const op_location_t
     case TRUTH_ORIF_EXPR:
     case TRUTH_AND_EXPR:
     case TRUTH_OR_EXPR:
-      if (!VECTOR_TYPE_P (type0) && VECTOR_TYPE_P (type1))
+      if (!VECTOR_TYPE_P (type0) && gnu_vector_type_p (type1))
 	{
 	  if (!COMPARISON_CLASS_P (op1))
 	    op1 = cp_build_binary_op (EXPR_LOCATION (op1), NE_EXPR, op1,
@@ -4758,7 +4759,8 @@ cp_build_binary_op (const op_location_t
 	  else
 	    gcc_unreachable ();
 	}
-      if (VECTOR_TYPE_P (type0))
+      if (gnu_vector_type_p (type0)
+	  && (!VECTOR_TYPE_P (type1) || gnu_vector_type_p (type1)))
 	{
 	  if (!COMPARISON_CLASS_P (op0))
 	    op0 = cp_build_binary_op (EXPR_LOCATION (op0), NE_EXPR, op0,
@@ -4791,13 +4793,15 @@ cp_build_binary_op (const op_location_t
 	 Also set SHORT_SHIFT if shifting rightward.  */
 
     case RSHIFT_EXPR:
-      if (code0 == VECTOR_TYPE && code1 == INTEGER_TYPE
-          && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE)
+      if (gnu_vector_type_p (type0)
+	  && code1 == INTEGER_TYPE
+	  && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE)
         {
           result_type = type0;
           converted = 1;
         }
-      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+      else if (gnu_vector_type_p (type0)
+	       && gnu_vector_type_p (type1)
 	       && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE
 	       && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE
 	       && known_eq (TYPE_VECTOR_SUBPARTS (type0),
@@ -4837,13 +4841,15 @@ cp_build_binary_op (const op_location_t
       break;
 
     case LSHIFT_EXPR:
-      if (code0 == VECTOR_TYPE && code1 == INTEGER_TYPE
+      if (gnu_vector_type_p (type0)
+	  && code1 == INTEGER_TYPE
           && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE)
         {
           result_type = type0;
           converted = 1;
         }
-      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+      else if (gnu_vector_type_p (type0)
+	       && gnu_vector_type_p (type1)
 	       && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE
 	       && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE
 	       && known_eq (TYPE_VECTOR_SUBPARTS (type0),
@@ -4896,7 +4902,7 @@ cp_build_binary_op (const op_location_t
 
     case EQ_EXPR:
     case NE_EXPR:
-      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      if (gnu_vector_type_p (type0) && gnu_vector_type_p (type1))
 	goto vector_compare;
       if ((complain & tf_warning)
 	  && c_inhibit_evaluation_warnings == 0
@@ -5186,7 +5192,7 @@ cp_build_binary_op (const op_location_t
 			"in unspecified behavior");
 	}
 
-      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      if (gnu_vector_type_p (type0) && gnu_vector_type_p (type1))
 	{
 	vector_compare:
 	  tree intt;
@@ -5341,7 +5347,7 @@ cp_build_binary_op (const op_location_t
     {
       arithmetic_types_p = 0;
       /* Vector arithmetic is only allowed when both sides are vectors.  */
-      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      if (gnu_vector_type_p (type0) && gnu_vector_type_p (type1))
 	{
 	  if (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1))
 	      || !vector_types_compatible_elements_p (type0, type1))
@@ -6435,7 +6441,7 @@ cp_build_unary_op (enum tree_code code,
       break;
 
     case TRUTH_NOT_EXPR:
-      if (VECTOR_TYPE_P (TREE_TYPE (arg)))
+      if (gnu_vector_type_p (TREE_TYPE (arg)))
 	return cp_build_binary_op (input_location, EQ_EXPR, arg,
 				   build_zero_cst (TREE_TYPE (arg)), complain);
       arg = perform_implicit_conversion (boolean_type_node, arg,
@@ -7811,9 +7817,9 @@ build_reinterpret_cast_1 (tree type, tre
 		 "is conditionally-supported");
       return build_nop_reinterpret (type, expr);
     }
-  else if (VECTOR_TYPE_P (type))
+  else if (gnu_vector_type_p (type))
     return convert_to_vector (type, expr);
-  else if (VECTOR_TYPE_P (intype)
+  else if (gnu_vector_type_p (intype)
 	   && INTEGRAL_OR_ENUMERATION_TYPE_P (type))
     return convert_to_integer_nofold (type, expr);
   else
Index: gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C
===================================================================
--- /dev/null	2019-09-17 11:41:18.176664108 +0100
+++ gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C	2019-12-04 09:17:44.210133825 +0000
@@ -0,0 +1,489 @@
+// { dg-options "-msve-vector-bits=256 -std=gnu++2a" }
+
+#include <arm_sve.h>
+
+typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
+typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
+
+void
+f (svuint8_t sve_u1, svint8_t sve_s1,
+   gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc)
+{
+  // Initialization
+
+  svuint8_t init_sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u2 = {};
+  svuint8_t init_sve_u3 = { sve_u1 };
+  svuint8_t init_sve_u4 = { gnu_u1 };
+  svuint8_t init_sve_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u7 = { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u10 {};
+  svuint8_t init_sve_u11 { sve_u1 };
+  svuint8_t init_sve_u12 { gnu_u1 };
+  svuint8_t init_sve_u13 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u14 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u15 { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u16 { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u17 { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u18 (0); // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u19 (sve_u1);
+  svuint8_t init_sve_u20 (gnu_u1);
+  svuint8_t init_sve_u21 (sve_s1); // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u22 (gnu_s1); // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+
+  gnu_uint8_t init_gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u2 = {};
+  gnu_uint8_t init_gnu_u3 = { sve_u1 };
+  gnu_uint8_t init_gnu_u4 = { gnu_u1 };
+  gnu_uint8_t init_gnu_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u7 = { 0 };
+  gnu_uint8_t init_gnu_u8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u10 { sve_u1 };
+  gnu_uint8_t init_gnu_u11 { gnu_u1 };
+  gnu_uint8_t init_gnu_u12 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u13 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u14 { 0 };
+  gnu_uint8_t init_gnu_u15 { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u16 { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u17 (0); // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u18 (sve_u1);
+  gnu_uint8_t init_gnu_u19 (gnu_u1);
+  gnu_uint8_t init_gnu_u20 (sve_s1); // { dg-error {cannot convert 'svint8_t' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u21 (gnu_s1); // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'gnu_uint8_t'[^\n]* in initialization} }
+
+  // Compound literals
+
+  (svuint8_t) {};
+  (svuint8_t) { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  (svuint8_t) { sve_u1 };
+  (svuint8_t) { gnu_u1 };
+  (svuint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  (svuint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+  (svuint8_t) { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  (svuint8_t) { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+
+  (gnu_uint8_t) {};
+  (gnu_uint8_t) { 0 };
+  (gnu_uint8_t) { sve_u1 };
+  (gnu_uint8_t) { gnu_u1 };
+  (gnu_uint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+
+  // Assignment
+
+  sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} }
+  sve_u1 = sve_u1;
+  sve_u1 = gnu_u1;
+  sve_u1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in assignment} }
+  sve_u1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in assignment} }
+
+  gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in assignment} }
+  gnu_u1 = sve_u1;
+  gnu_u1 = gnu_u1;
+  gnu_u1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'gnu_uint8_t'[^\n]* in assignment} }
+  gnu_u1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'gnu_uint8_t'[^\n]* in assignment} }
+
+  // Casts
+
+  (void) sve_u1;
+  (int) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'int'} }
+  (bool) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'bool'} }
+  (svuint8_t) 0; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) n; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) sve_u1;
+  (svuint8_t) gnu_u1;
+  (svuint8_t) sve_s1; // { dg-error {invalid cast from type 'svint8_t' to type 'svuint8_t'} }
+  (svuint8_t) gnu_s1; // { dg-error {invalid cast from type 'gnu_int8_t'[^\n]* to type 'svuint8_t'} }
+
+  (void) gnu_u1;
+  (int) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'int'} }
+  (bool) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'bool'} }
+  (gnu_uint8_t) 0; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) n; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) sve_u1;
+  (gnu_uint8_t) gnu_u1;
+  (gnu_uint8_t) sve_s1;
+  (gnu_uint8_t) gnu_s1;
+
+  // Vector indexing.
+
+  sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+  &sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+
+  gnu_u1[0];
+  &gnu_u1[0];
+
+  // Unary vector arithmetic.
+
+  +sve_u1; // { dg-error {wrong type argument to unary plus} }
+  -sve_u1; // { dg-error {wrong type argument to unary minus} }
+  ~sve_u1; // { dg-error {wrong type argument to bit-complement} }
+  !sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+        // { dg-error {in argument to unary !} "" { target *-*-* } .-1 }
+  *sve_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real sve_u1; // { dg-error {wrong type argument to __real} }
+  __imag sve_u1; // { dg-error {wrong type argument to __imag} }
+  ++sve_u1; // { dg-error {no pre-increment operator for type} }
+  --sve_u1; // { dg-error {no pre-decrement operator for type} }
+  sve_u1++; // { dg-error {no post-increment operator for type} }
+  sve_u1--; // { dg-error {no post-decrement operator for type} }
+
+  +gnu_u1;
+  -gnu_u1;
+  ~gnu_u1;
+  !gnu_u1;
+  *gnu_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real gnu_u1; // { dg-error {wrong type argument to __real} }
+  __imag gnu_u1; // { dg-error {wrong type argument to __imag} }
+  ++gnu_u1;
+  --gnu_u1;
+  gnu_u1++;
+  gnu_u1--;
+
+  // Vector-vector binary arithmetic.
+
+  sve_u1 + sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator-'} }
+  sve_u1 * sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator/'} }
+  sve_u1 % sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator%'} }
+  sve_u1 & sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator=='} }
+  sve_u1 != sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<='} }
+  sve_u1 < sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<'} }
+  sve_u1 > sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>>'} }
+  sve_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>>'} }
+  sve_u1 && gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>>'} }
+  gnu_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  gnu_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + gnu_u1;
+  gnu_u1 - gnu_u1;
+  gnu_u1 * gnu_u1;
+  gnu_u1 / gnu_u1;
+  gnu_u1 % gnu_u1;
+  gnu_u1 & gnu_u1;
+  gnu_u1 | gnu_u1;
+  gnu_u1 ^ gnu_u1;
+  gnu_u1 == gnu_u1;
+  gnu_u1 != gnu_u1;
+  gnu_u1 <= gnu_u1;
+  gnu_u1 < gnu_u1;
+  gnu_u1 > gnu_u1;
+  gnu_u1 >= gnu_u1;
+  // This is a target-independent sorry.  There's no ACLE reason why it
+  // needs to be kept.
+  gnu_u1 <=> gnu_u1; // { dg-message {three-way comparison of vectors} }
+  gnu_u1 << gnu_u1;
+  gnu_u1 >> gnu_u1;
+  gnu_u1 && gnu_u1;
+  gnu_u1 || gnu_u1;
+
+  // Vector-scalar binary arithmetic.
+
+  sve_u1 + 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\+'} }
+  sve_u1 - 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator-'} }
+  sve_u1 * 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\*'} }
+  sve_u1 / 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator/'} }
+  sve_u1 % 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator%'} }
+  sve_u1 & 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\&'} }
+  sve_u1 | 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\|'} }
+  sve_u1 ^ 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\^'} }
+  sve_u1 == 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator=='} }
+  sve_u1 != 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator!='} }
+  sve_u1 <= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<='} }
+  sve_u1 < 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<'} }
+  sve_u1 > 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>'} }
+  sve_u1 >= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>='} }
+  sve_u1 <=> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<=>'} }
+  sve_u1 << 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<<'} }
+  sve_u1 >> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>>'} }
+  sve_u1 && 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\+'} }
+  sve_u1 - uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator-'} }
+  sve_u1 * uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\*'} }
+  sve_u1 / uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator/'} }
+  sve_u1 % uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator%'} }
+  sve_u1 & uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\&'} }
+  sve_u1 | uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\|'} }
+  sve_u1 ^ uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\^'} }
+  sve_u1 == uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator=='} }
+  sve_u1 != uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator!='} }
+  sve_u1 <= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<='} }
+  sve_u1 < uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<'} }
+  sve_u1 > uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>'} }
+  sve_u1 >= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>='} }
+  sve_u1 <=> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<=>'} }
+  sve_u1 << uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<<'} }
+  sve_u1 >> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>>'} }
+  sve_u1 && uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + 2;
+  gnu_u1 - 2;
+  gnu_u1 * 2;
+  gnu_u1 / 2;
+  gnu_u1 % 2;
+  gnu_u1 & 2;
+  gnu_u1 | 2;
+  gnu_u1 ^ 2;
+  gnu_u1 == 2;
+  gnu_u1 != 2;
+  gnu_u1 <= 2;
+  gnu_u1 < 2;
+  gnu_u1 > 2;
+  gnu_u1 >= 2;
+  gnu_u1 <=> 2; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'int' to binary 'operator<=>'} }
+  gnu_u1 << 2;
+  gnu_u1 >> 2;
+  gnu_u1 && 2;
+  gnu_u1 || 2;
+
+  gnu_u1 + uc;
+  gnu_u1 - uc;
+  gnu_u1 * uc;
+  gnu_u1 / uc;
+  gnu_u1 % uc;
+  gnu_u1 & uc;
+  gnu_u1 | uc;
+  gnu_u1 ^ uc;
+  gnu_u1 == uc;
+  gnu_u1 != uc;
+  gnu_u1 <= uc;
+  gnu_u1 < uc;
+  gnu_u1 > uc;
+  gnu_u1 >= uc;
+  gnu_u1 <=> uc; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'unsigned char' to binary 'operator<=>'} }
+  gnu_u1 << uc;
+  gnu_u1 >> uc;
+  gnu_u1 && uc;
+  gnu_u1 || uc;
+
+  // Scalar-vector binary 'operatorarithmetic.
+
+  3 + sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\+'} }
+  3 - sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator-'} }
+  3 * sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\*'} }
+  3 / sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator/'} }
+  3 % sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator%'} }
+  3 & sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\&'} }
+  3 | sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\|'} }
+  3 ^ sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\^'} }
+  3 == sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator=='} }
+  3 != sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator!='} }
+  3 <= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<='} }
+  3 <=> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<=>'} }
+  3 < sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<'} }
+  3 > sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>'} }
+  3 >= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>='} }
+  3 << sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<<'} }
+  3 >> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>>'} }
+  3 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  3 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  3 + gnu_u1;
+  3 - gnu_u1;
+  3 * gnu_u1;
+  3 / gnu_u1;
+  3 % gnu_u1;
+  3 & gnu_u1;
+  3 | gnu_u1;
+  3 ^ gnu_u1;
+  3 == gnu_u1;
+  3 != gnu_u1;
+  3 <= gnu_u1;
+  3 <=> gnu_u1; // { dg-error {invalid operands of types 'int' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  3 < gnu_u1;
+  3 > gnu_u1;
+  3 >= gnu_u1;
+  3 << gnu_u1;
+  3 >> gnu_u1;
+  3 && gnu_u1;
+  3 || gnu_u1;
+
+  // Mismatched types.
+
+  sve_u1 + sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator-'} }
+  sve_u1 * sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator/'} }
+  sve_u1 % sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator%'} }
+  sve_u1 & sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator=='} }
+  sve_u1 != sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<='} }
+  sve_u1 < sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<'} }
+  sve_u1 > sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>>'} }
+
+  sve_u1 + gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>>'} }
+
+  gnu_u1 + sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>>'} }
+
+  gnu_u1 + gnu_s1;
+  gnu_u1 - gnu_s1;
+  gnu_u1 * gnu_s1;
+  gnu_u1 / gnu_s1;
+  gnu_u1 % gnu_s1;
+  gnu_u1 & gnu_s1;
+  gnu_u1 | gnu_s1;
+  gnu_u1 ^ gnu_s1;
+  gnu_u1 == gnu_s1;
+  gnu_u1 != gnu_s1;
+  gnu_u1 <= gnu_s1;
+  gnu_u1 < gnu_s1;
+  gnu_u1 > gnu_s1;
+  gnu_u1 >= gnu_s1;
+  // This is a target-independent sorry.  There's no ACLE reason why it
+  // needs to be kept.
+  gnu_u1 <=> gnu_s1; // { dg-message {three-way comparison of vectors} }
+  gnu_u1 << gnu_s1;
+  gnu_u1 >> gnu_s1;
+
+  // Conditional expressions.
+
+  uc ? sve_u1 : sve_u1;
+  uc ? gnu_u1 : sve_u1; // { dg-error {operands to '\?:' have different types 'gnu_uint8_t'[^\n]* and 'svuint8_t'} "" { xfail *-*-* } }
+  uc ? sve_u1 : gnu_u1; // { dg-error {operands to '\?:' have different types 'svuint8_t' and 'gnu_uint8_t'} "" { xfail *-*-* } }
+  uc ? gnu_u1 : gnu_u1;
+
+  sve_u1 ? sve_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : gnu_u1;
+  gnu_u1 ? sve_u1 : uc; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? uc : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : uc;
+  gnu_u1 ? uc : gnu_u1;
+
+  // Vector built-ins.
+
+  __builtin_shuffle (sve_u1, sve_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (sve_u1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, sve_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, gnu_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (gnu_u1, gnu_u1, gnu_u1);
+
+  __builtin_convertvector (sve_u1, svuint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, svuint8_t); // { dg-error {'__builtin_convertvector' second argument must be an integer or floating vector type} }
+  __builtin_convertvector (sve_u1, gnu_uint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, gnu_uint8_t);
+
+  // Type queries.
+
+  static_assert(__is_literal_type(svuint8_t));
+  static_assert(__is_literal_type(gnu_uint8_t));
+
+  svuint8_t *sve_ptr1 = &sve_u1;
+  svuint8_t *sve_ptr2 = &gnu_u1;
+  svuint8_t *sve_ptr3 = &sve_s1; // { dg-error {cannot convert 'svint8_t\*' to 'svuint8_t\*' in initialization} }
+  svuint8_t *sve_ptr4 = &gnu_s1; // { dg-error {cannot convert 'gnu_int8_t\*'[^\n]* to 'svuint8_t\*' in initialization} }
+
+  gnu_uint8_t *gnu_ptr1 = &sve_u1;
+  gnu_uint8_t *gnu_ptr2 = &gnu_u1;
+  gnu_uint8_t *gnu_ptr3 = &sve_s1; // { dg-error {cannot convert 'svint8_t\*' to 'gnu_uint8_t\*'} }
+  gnu_uint8_t *gnu_ptr4 = &gnu_s1; // { dg-error {cannot convert 'gnu_int8_t\*'[^\n]* to 'gnu_uint8_t\*'} }
+}
+
+constexpr svuint8_t const1 (svuint8_t x) { return x; }
+constexpr gnu_uint8_t const2 (gnu_uint8_t x) { return x; }
Index: gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C
===================================================================
--- /dev/null	2019-09-17 11:41:18.176664108 +0100
+++ gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C	2019-12-04 09:17:44.210133825 +0000
@@ -0,0 +1,489 @@
+// { dg-options "-msve-vector-bits=256 -std=gnu++2a -flax-vector-conversions" }
+
+#include <arm_sve.h>
+
+typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
+typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
+
+void
+f (svuint8_t sve_u1, svint8_t sve_s1,
+   gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc)
+{
+  // Initialization
+
+  svuint8_t init_sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u2 = {};
+  svuint8_t init_sve_u3 = { sve_u1 };
+  svuint8_t init_sve_u4 = { gnu_u1 };
+  svuint8_t init_sve_u5 = { sve_s1 };
+  svuint8_t init_sve_u6 = { gnu_s1 };
+  svuint8_t init_sve_u7 = { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u10 {};
+  svuint8_t init_sve_u11 { sve_u1 };
+  svuint8_t init_sve_u12 { gnu_u1 };
+  svuint8_t init_sve_u13 { sve_s1 };
+  svuint8_t init_sve_u14 { gnu_s1 };
+  svuint8_t init_sve_u15 { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u16 { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u17 { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u18 (0); // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u19 (sve_u1);
+  svuint8_t init_sve_u20 (gnu_u1);
+  svuint8_t init_sve_u21 (sve_s1);
+  svuint8_t init_sve_u22 (gnu_s1);
+
+  gnu_uint8_t init_gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u2 = {};
+  gnu_uint8_t init_gnu_u3 = { sve_u1 };
+  gnu_uint8_t init_gnu_u4 = { gnu_u1 };
+  gnu_uint8_t init_gnu_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u7 = { 0 };
+  gnu_uint8_t init_gnu_u8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u10 { sve_u1 };
+  gnu_uint8_t init_gnu_u11 { gnu_u1 };
+  gnu_uint8_t init_gnu_u12 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u13 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u14 { 0 };
+  gnu_uint8_t init_gnu_u15 { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u16 { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u17 (0); // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u18 (sve_u1);
+  gnu_uint8_t init_gnu_u19 (gnu_u1);
+  gnu_uint8_t init_gnu_u20 (sve_s1);
+  gnu_uint8_t init_gnu_u21 (gnu_s1);
+
+  // Compound literals
+
+  (svuint8_t) {};
+  (svuint8_t) { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  (svuint8_t) { sve_u1 };
+  (svuint8_t) { gnu_u1 };
+  (svuint8_t) { sve_s1 };
+  (svuint8_t) { gnu_s1 };
+  (svuint8_t) { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  (svuint8_t) { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+
+  (gnu_uint8_t) {};
+  (gnu_uint8_t) { 0 };
+  (gnu_uint8_t) { sve_u1 };
+  (gnu_uint8_t) { gnu_u1 };
+  (gnu_uint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+
+  // Assignment
+
+  sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} }
+  sve_u1 = sve_u1;
+  sve_u1 = gnu_u1;
+  sve_u1 = sve_s1;
+  sve_u1 = gnu_s1;
+
+  gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in assignment} }
+  gnu_u1 = sve_u1;
+  gnu_u1 = gnu_u1;
+  gnu_u1 = sve_s1;
+  gnu_u1 = gnu_s1;
+
+  // Casts
+
+  (void) sve_u1;
+  (int) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'int'} }
+  (bool) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'bool'} }
+  (svuint8_t) 0; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) n; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) sve_u1;
+  (svuint8_t) gnu_u1;
+  (svuint8_t) sve_s1;
+  (svuint8_t) gnu_s1;
+
+  (void) gnu_u1;
+  (int) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'int'} }
+  (bool) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'bool'} }
+  (gnu_uint8_t) 0; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) n; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) sve_u1;
+  (gnu_uint8_t) gnu_u1;
+  (gnu_uint8_t) sve_s1;
+  (gnu_uint8_t) gnu_s1;
+
+  // Vector indexing.
+
+  sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+  &sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+
+  gnu_u1[0];
+  &gnu_u1[0];
+
+  // Unary vector arithmetic.
+
+  +sve_u1; // { dg-error {wrong type argument to unary plus} }
+  -sve_u1; // { dg-error {wrong type argument to unary minus} }
+  ~sve_u1; // { dg-error {wrong type argument to bit-complement} }
+  !sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+        // { dg-error {in argument to unary !} "" { target *-*-* } .-1 }
+  *sve_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real sve_u1; // { dg-error {wrong type argument to __real} }
+  __imag sve_u1; // { dg-error {wrong type argument to __imag} }
+  ++sve_u1; // { dg-error {no pre-increment operator for type} }
+  --sve_u1; // { dg-error {no pre-decrement operator for type} }
+  sve_u1++; // { dg-error {no post-increment operator for type} }
+  sve_u1--; // { dg-error {no post-decrement operator for type} }
+
+  +gnu_u1;
+  -gnu_u1;
+  ~gnu_u1;
+  !gnu_u1;
+  *gnu_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real gnu_u1; // { dg-error {wrong type argument to __real} }
+  __imag gnu_u1; // { dg-error {wrong type argument to __imag} }
+  ++gnu_u1;
+  --gnu_u1;
+  gnu_u1++;
+  gnu_u1--;
+
+  // Vector-vector binary arithmetic.
+
+  sve_u1 + sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator-'} }
+  sve_u1 * sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator/'} }
+  sve_u1 % sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator%'} }
+  sve_u1 & sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator=='} }
+  sve_u1 != sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<='} }
+  sve_u1 < sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<'} }
+  sve_u1 > sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>>'} }
+  sve_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>>'} }
+  sve_u1 && gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>>'} }
+  gnu_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  gnu_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + gnu_u1;
+  gnu_u1 - gnu_u1;
+  gnu_u1 * gnu_u1;
+  gnu_u1 / gnu_u1;
+  gnu_u1 % gnu_u1;
+  gnu_u1 & gnu_u1;
+  gnu_u1 | gnu_u1;
+  gnu_u1 ^ gnu_u1;
+  gnu_u1 == gnu_u1;
+  gnu_u1 != gnu_u1;
+  gnu_u1 <= gnu_u1;
+  gnu_u1 < gnu_u1;
+  gnu_u1 > gnu_u1;
+  gnu_u1 >= gnu_u1;
+  // This is a target-independent sorry.  There's no ACLE reason why it
+  // needs to be kept.
+  gnu_u1 <=> gnu_u1; // { dg-message {three-way comparison of vectors} }
+  gnu_u1 << gnu_u1;
+  gnu_u1 >> gnu_u1;
+  gnu_u1 && gnu_u1;
+  gnu_u1 || gnu_u1;
+
+  // Vector-scalar binary arithmetic.
+
+  sve_u1 + 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\+'} }
+  sve_u1 - 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator-'} }
+  sve_u1 * 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\*'} }
+  sve_u1 / 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator/'} }
+  sve_u1 % 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator%'} }
+  sve_u1 & 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\&'} }
+  sve_u1 | 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\|'} }
+  sve_u1 ^ 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\^'} }
+  sve_u1 == 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator=='} }
+  sve_u1 != 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator!='} }
+  sve_u1 <= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<='} }
+  sve_u1 < 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<'} }
+  sve_u1 > 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>'} }
+  sve_u1 >= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>='} }
+  sve_u1 <=> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<=>'} }
+  sve_u1 << 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<<'} }
+  sve_u1 >> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>>'} }
+  sve_u1 && 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\+'} }
+  sve_u1 - uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator-'} }
+  sve_u1 * uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\*'} }
+  sve_u1 / uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator/'} }
+  sve_u1 % uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator%'} }
+  sve_u1 & uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\&'} }
+  sve_u1 | uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\|'} }
+  sve_u1 ^ uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\^'} }
+  sve_u1 == uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator=='} }
+  sve_u1 != uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator!='} }
+  sve_u1 <= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<='} }
+  sve_u1 < uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<'} }
+  sve_u1 > uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>'} }
+  sve_u1 >= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>='} }
+  sve_u1 <=> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<=>'} }
+  sve_u1 << uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<<'} }
+  sve_u1 >> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>>'} }
+  sve_u1 && uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + 2;
+  gnu_u1 - 2;
+  gnu_u1 * 2;
+  gnu_u1 / 2;
+  gnu_u1 % 2;
+  gnu_u1 & 2;
+  gnu_u1 | 2;
+  gnu_u1 ^ 2;
+  gnu_u1 == 2;
+  gnu_u1 != 2;
+  gnu_u1 <= 2;
+  gnu_u1 < 2;
+  gnu_u1 > 2;
+  gnu_u1 >= 2;
+  gnu_u1 <=> 2; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'int' to binary 'operator<=>'} }
+  gnu_u1 << 2;
+  gnu_u1 >> 2;
+  gnu_u1 && 2;
+  gnu_u1 || 2;
+
+  gnu_u1 + uc;
+  gnu_u1 - uc;
+  gnu_u1 * uc;
+  gnu_u1 / uc;
+  gnu_u1 % uc;
+  gnu_u1 & uc;
+  gnu_u1 | uc;
+  gnu_u1 ^ uc;
+  gnu_u1 == uc;
+  gnu_u1 != uc;
+  gnu_u1 <= uc;
+  gnu_u1 < uc;
+  gnu_u1 > uc;
+  gnu_u1 >= uc;
+  gnu_u1 <=> uc; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'unsigned char' to binary 'operator<=>'} }
+  gnu_u1 << uc;
+  gnu_u1 >> uc;
+  gnu_u1 && uc;
+  gnu_u1 || uc;
+
+  // Scalar-vector binary 'operatorarithmetic.
+
+  3 + sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\+'} }
+  3 - sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator-'} }
+  3 * sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\*'} }
+  3 / sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator/'} }
+  3 % sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator%'} }
+  3 & sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\&'} }
+  3 | sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\|'} }
+  3 ^ sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\^'} }
+  3 == sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator=='} }
+  3 != sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator!='} }
+  3 <= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<='} }
+  3 <=> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<=>'} }
+  3 < sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<'} }
+  3 > sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>'} }
+  3 >= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>='} }
+  3 << sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<<'} }
+  3 >> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>>'} }
+  3 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  3 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  3 + gnu_u1;
+  3 - gnu_u1;
+  3 * gnu_u1;
+  3 / gnu_u1;
+  3 % gnu_u1;
+  3 & gnu_u1;
+  3 | gnu_u1;
+  3 ^ gnu_u1;
+  3 == gnu_u1;
+  3 != gnu_u1;
+  3 <= gnu_u1;
+  3 <=> gnu_u1; // { dg-error {invalid operands of types 'int' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  3 < gnu_u1;
+  3 > gnu_u1;
+  3 >= gnu_u1;
+  3 << gnu_u1;
+  3 >> gnu_u1;
+  3 && gnu_u1;
+  3 || gnu_u1;
+
+  // Mismatched types.
+
+  sve_u1 + sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator-'} }
+  sve_u1 * sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator/'} }
+  sve_u1 % sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator%'} }
+  sve_u1 & sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator=='} }
+  sve_u1 != sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<='} }
+  sve_u1 < sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<'} }
+  sve_u1 > sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>>'} }
+
+  sve_u1 + gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>>'} }
+
+  gnu_u1 + sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>>'} }
+
+  gnu_u1 + gnu_s1;
+  gnu_u1 - gnu_s1;
+  gnu_u1 * gnu_s1;
+  gnu_u1 / gnu_s1;
+  gnu_u1 % gnu_s1;
+  gnu_u1 & gnu_s1;
+  gnu_u1 | gnu_s1;
+  gnu_u1 ^ gnu_s1;
+  gnu_u1 == gnu_s1;
+  gnu_u1 != gnu_s1;
+  gnu_u1 <= gnu_s1;
+  gnu_u1 < gnu_s1;
+  gnu_u1 > gnu_s1;
+  gnu_u1 >= gnu_s1;
+  // This is a target-independent sorry.  There's no ACLE reason why it
+  // needs to be kept.
+  gnu_u1 <=> gnu_s1; // { dg-message {three-way comparison of vectors} }
+  gnu_u1 << gnu_s1;
+  gnu_u1 >> gnu_s1;
+
+  // Conditional expressions.
+
+  uc ? sve_u1 : sve_u1;
+  uc ? gnu_u1 : sve_u1; // { dg-error {operands to '\?:' have different types 'gnu_uint8_t'[^\n]* and 'svuint8_t'} "" { xfail *-*-* } }
+  uc ? sve_u1 : gnu_u1; // { dg-error {operands to '\?:' have different types 'svuint8_t' and 'gnu_uint8_t'} "" { xfail *-*-* } }
+  uc ? gnu_u1 : gnu_u1;
+
+  sve_u1 ? sve_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : gnu_u1;
+  gnu_u1 ? sve_u1 : uc; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? uc : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : uc;
+  gnu_u1 ? uc : gnu_u1;
+
+  // Vector built-ins.
+
+  __builtin_shuffle (sve_u1, sve_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (sve_u1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, sve_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, gnu_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (gnu_u1, gnu_u1, gnu_u1);
+
+  __builtin_convertvector (sve_u1, svuint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, svuint8_t); // { dg-error {'__builtin_convertvector' second argument must be an integer or floating vector type} }
+  __builtin_convertvector (sve_u1, gnu_uint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, gnu_uint8_t);
+
+  // Type queries.
+
+  static_assert(__is_literal_type(svuint8_t));
+  static_assert(__is_literal_type(gnu_uint8_t));
+
+  svuint8_t *sve_ptr1 = &sve_u1;
+  svuint8_t *sve_ptr2 = &gnu_u1;
+  svuint8_t *sve_ptr3 = &sve_s1; // { dg-error {invalid conversion from 'svint8_t\*' to 'svuint8_t\*'} }
+  svuint8_t *sve_ptr4 = &gnu_s1; // { dg-error {invalid conversion from 'gnu_int8_t\*'[^\n]* to 'svuint8_t\*'} }
+
+  gnu_uint8_t *gnu_ptr1 = &sve_u1;
+  gnu_uint8_t *gnu_ptr2 = &gnu_u1;
+  gnu_uint8_t *gnu_ptr3 = &sve_s1; // { dg-error {invalid conversion from 'svint8_t\*' to 'gnu_uint8_t\*'} }
+  gnu_uint8_t *gnu_ptr4 = &gnu_s1; // { dg-error {invalid conversion from 'gnu_int8_t\*'[^\n]* to 'gnu_uint8_t\*'} }
+}
+
+constexpr svuint8_t const1 (svuint8_t x) { return x; }
+constexpr gnu_uint8_t const2 (gnu_uint8_t x) { return x; }

Patch

Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	2019-11-08 08:31:42.997602163 +0000
+++ gcc/cp/cp-tree.h	2019-11-08 17:43:07.176264096 +0000
@@ -4249,7 +4249,7 @@  #define ENUM_UNDERLYING_TYPE(TYPE) \
    As an extension, we also treat vectors as aggregates.  Keep these
    checks in ascending code order.  */
 #define CP_AGGREGATE_TYPE_P(TYPE)				\
-  (TREE_CODE (TYPE) == VECTOR_TYPE				\
+  (gnu_vector_type_p (TYPE)					\
    || TREE_CODE (TYPE) == ARRAY_TYPE				\
    || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
 
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	2019-11-08 08:31:19.000000000 +0000
+++ gcc/cp/call.c	2019-11-08 17:43:07.172264122 +0000
@@ -5073,7 +5073,8 @@  build_conditional_expr_1 (const op_locat
   orig_arg2 = arg2;
   orig_arg3 = arg3;
 
-  if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1)))
+  if (gnu_vector_type_p (TREE_TYPE (arg1))
+      && VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1)))
     {
       tree arg1_type = TREE_TYPE (arg1);
 
@@ -5152,7 +5153,8 @@  build_conditional_expr_1 (const op_locat
 	  arg3_type = vtype;
 	}
 
-      if (VECTOR_TYPE_P (arg2_type) != VECTOR_TYPE_P (arg3_type))
+      if ((gnu_vector_type_p (arg2_type) && !VECTOR_TYPE_P (arg3_type))
+	  || (gnu_vector_type_p (arg3_type) && !VECTOR_TYPE_P (arg2_type)))
 	{
 	  enum stv_conv convert_flag =
 	    scalar_to_vector (loc, VEC_COND_EXPR, arg2, arg3,
@@ -5183,7 +5185,9 @@  build_conditional_expr_1 (const op_locat
 	    }
 	}
 
-      if (!same_type_p (arg2_type, arg3_type)
+      if (!gnu_vector_type_p (arg2_type)
+	  || !gnu_vector_type_p (arg3_type)
+	  || !same_type_p (arg2_type, arg3_type)
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (arg1_type),
 		       TYPE_VECTOR_SUBPARTS (arg2_type))
 	  || TYPE_SIZE (arg1_type) != TYPE_SIZE (arg2_type))
@@ -5397,6 +5401,7 @@  build_conditional_expr_1 (const op_locat
      value category.  */
   if (((lvalue_p (arg2) && lvalue_p (arg3))
        || (xvalue_p (arg2) && xvalue_p (arg3)))
+      && gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)
       && same_type_p (arg2_type, arg3_type))
     {
       result_type = arg2_type;
@@ -5500,7 +5505,8 @@  build_conditional_expr_1 (const op_locat
 
      --The second and third operands have the same type; the result  is  of
        that type.  */
-  if (same_type_p (arg2_type, arg3_type))
+  if (gnu_vector_type_p (arg2_type) == gnu_vector_type_p (arg3_type)
+      && same_type_p (arg2_type, arg3_type))
     result_type = arg2_type;
   /* [expr.cond]
 
Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c	2019-10-20 13:58:01.739636931 +0100
+++ gcc/cp/cvt.c	2019-11-08 17:43:07.176264096 +0000
@@ -836,6 +836,14 @@  ocp_convert (tree type, tree expr, int c
 	      return error_mark_node;
 	    }
 
+	  if (VECTOR_TYPE_P (intype) && !gnu_vector_type_p (intype))
+	    {
+	      if (complain & tf_error)
+		error_at (loc, "could not convert %qE from %qH to %qI", expr,
+			  TREE_TYPE (expr), type);
+	      return error_mark_node;
+	    }
+
 	  /* We can't implicitly convert a scoped enum to bool, so convert
 	     to the underlying type first.  */
 	  if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC))
@@ -1753,8 +1761,11 @@  build_expr_type_conversion (int desires,
 							    tf_warning_or_error)
 					: NULL_TREE;
 
-      case COMPLEX_TYPE:
       case VECTOR_TYPE:
+	if (!gnu_vector_type_p (basetype))
+	  return NULL_TREE;
+	/* FALLTHROUGH */
+      case COMPLEX_TYPE:
 	if ((desires & WANT_VECTOR_OR_COMPLEX) == 0)
 	  return NULL_TREE;
 	switch (TREE_CODE (TREE_TYPE (basetype)))
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c	2019-11-08 08:31:42.977602304 +0000
+++ gcc/cp/typeck.c	2019-11-08 17:43:07.176264096 +0000
@@ -4540,7 +4540,8 @@  cp_build_binary_op (const op_location_t
 
   /* In case when one of the operands of the binary operation is
      a vector and another is a scalar -- convert scalar to vector.  */
-  if ((code0 == VECTOR_TYPE) != (code1 == VECTOR_TYPE))
+  if ((gnu_vector_type_p (type0) && code1 != VECTOR_TYPE)
+      || (gnu_vector_type_p (type1) && code0 != VECTOR_TYPE))
     {
       enum stv_conv convert_flag = scalar_to_vector (location, code, op0, op1,
 						     complain & tf_error);
@@ -4733,7 +4734,7 @@  cp_build_binary_op (const op_location_t
     case TRUTH_ORIF_EXPR:
     case TRUTH_AND_EXPR:
     case TRUTH_OR_EXPR:
-      if (!VECTOR_TYPE_P (type0) && VECTOR_TYPE_P (type1))
+      if (!VECTOR_TYPE_P (type0) && gnu_vector_type_p (type1))
 	{
 	  if (!COMPARISON_CLASS_P (op1))
 	    op1 = cp_build_binary_op (EXPR_LOCATION (op1), NE_EXPR, op1,
@@ -4751,7 +4752,8 @@  cp_build_binary_op (const op_location_t
 	  else
 	    gcc_unreachable ();
 	}
-      if (VECTOR_TYPE_P (type0))
+      if (gnu_vector_type_p (type0)
+	  && (!VECTOR_TYPE_P (type1) || gnu_vector_type_p (type1)))
 	{
 	  if (!COMPARISON_CLASS_P (op0))
 	    op0 = cp_build_binary_op (EXPR_LOCATION (op0), NE_EXPR, op0,
@@ -4784,13 +4786,15 @@  cp_build_binary_op (const op_location_t
 	 Also set SHORT_SHIFT if shifting rightward.  */
 
     case RSHIFT_EXPR:
-      if (code0 == VECTOR_TYPE && code1 == INTEGER_TYPE
-          && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE)
+      if (gnu_vector_type_p (type0)
+	  && code1 == INTEGER_TYPE
+	  && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE)
         {
           result_type = type0;
           converted = 1;
         }
-      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+      else if (gnu_vector_type_p (type0)
+	       && gnu_vector_type_p (type1)
 	       && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE
 	       && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE
 	       && known_eq (TYPE_VECTOR_SUBPARTS (type0),
@@ -4830,13 +4834,15 @@  cp_build_binary_op (const op_location_t
       break;
 
     case LSHIFT_EXPR:
-      if (code0 == VECTOR_TYPE && code1 == INTEGER_TYPE
+      if (gnu_vector_type_p (type0)
+	  && code1 == INTEGER_TYPE
           && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE)
         {
           result_type = type0;
           converted = 1;
         }
-      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+      else if (gnu_vector_type_p (type0)
+	       && gnu_vector_type_p (type1)
 	       && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE
 	       && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE
 	       && known_eq (TYPE_VECTOR_SUBPARTS (type0),
@@ -4889,7 +4895,7 @@  cp_build_binary_op (const op_location_t
 
     case EQ_EXPR:
     case NE_EXPR:
-      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      if (gnu_vector_type_p (type0) && gnu_vector_type_p (type1))
 	goto vector_compare;
       if ((complain & tf_warning)
 	  && c_inhibit_evaluation_warnings == 0
@@ -5179,7 +5185,7 @@  cp_build_binary_op (const op_location_t
 			"in unspecified behavior");
 	}
 
-      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      if (gnu_vector_type_p (type0) && gnu_vector_type_p (type1))
 	{
 	vector_compare:
 	  tree intt;
@@ -5327,7 +5333,7 @@  cp_build_binary_op (const op_location_t
     {
       arithmetic_types_p = 0;
       /* Vector arithmetic is only allowed when both sides are vectors.  */
-      if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      if (gnu_vector_type_p (type0) && gnu_vector_type_p (type1))
 	{
 	  if (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1))
 	      || !vector_types_compatible_elements_p (type0, type1))
@@ -6416,7 +6422,7 @@  cp_build_unary_op (enum tree_code code,
       break;
 
     case TRUTH_NOT_EXPR:
-      if (VECTOR_TYPE_P (TREE_TYPE (arg)))
+      if (gnu_vector_type_p (TREE_TYPE (arg)))
 	return cp_build_binary_op (input_location, EQ_EXPR, arg,
 				   build_zero_cst (TREE_TYPE (arg)), complain);
       arg = perform_implicit_conversion (boolean_type_node, arg,
@@ -7783,9 +7789,9 @@  build_reinterpret_cast_1 (tree type, tre
 		 "is conditionally-supported");
       return build_nop_reinterpret (type, expr);
     }
-  else if (VECTOR_TYPE_P (type))
+  else if (gnu_vector_type_p (type))
     return convert_to_vector (type, expr);
-  else if (VECTOR_TYPE_P (intype)
+  else if (gnu_vector_type_p (intype)
 	   && INTEGRAL_OR_ENUMERATION_TYPE_P (type))
     return convert_to_integer_nofold (type, expr);
   else
Index: gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C
===================================================================
--- /dev/null	2019-09-17 11:41:18.176664108 +0100
+++ gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C	2019-11-08 17:43:07.180264067 +0000
@@ -0,0 +1,485 @@ 
+// { dg-options "-msve-vector-bits=256 -std=gnu++2a" }
+
+#include <arm_sve.h>
+
+typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
+typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
+
+void
+f (svuint8_t sve_u1, svint8_t sve_s1,
+   gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc)
+{
+  // Initialization
+
+  svuint8_t init_sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u2 = {};
+  svuint8_t init_sve_u3 = { sve_u1 };
+  svuint8_t init_sve_u4 = { gnu_u1 };
+  svuint8_t init_sve_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u7 = { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u10 {};
+  svuint8_t init_sve_u11 { sve_u1 };
+  svuint8_t init_sve_u12 { gnu_u1 };
+  svuint8_t init_sve_u13 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u14 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u15 { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u16 { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u17 { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u18 (0); // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u19 (sve_u1);
+  svuint8_t init_sve_u20 (gnu_u1);
+  svuint8_t init_sve_u21 (sve_s1); // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u22 (gnu_s1); // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+
+  gnu_uint8_t init_gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u2 = {};
+  gnu_uint8_t init_gnu_u3 = { sve_u1 };
+  gnu_uint8_t init_gnu_u4 = { gnu_u1 };
+  gnu_uint8_t init_gnu_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u7 = { 0 };
+  gnu_uint8_t init_gnu_u8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u10 { sve_u1 };
+  gnu_uint8_t init_gnu_u11 { gnu_u1 };
+  gnu_uint8_t init_gnu_u12 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u13 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u14 { 0 };
+  gnu_uint8_t init_gnu_u15 { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u16 { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u17 (0); // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u18 (sve_u1);
+  gnu_uint8_t init_gnu_u19 (gnu_u1);
+  gnu_uint8_t init_gnu_u20 (sve_s1); // { dg-error {cannot convert 'svint8_t' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u21 (gnu_s1); // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'gnu_uint8_t'[^\n]* in initialization} }
+
+  // Compound literals
+
+  (svuint8_t) {};
+  (svuint8_t) { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  (svuint8_t) { sve_u1 };
+  (svuint8_t) { gnu_u1 };
+  (svuint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in initialization} }
+  (svuint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in initialization} }
+  (svuint8_t) { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  (svuint8_t) { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+
+  (gnu_uint8_t) {};
+  (gnu_uint8_t) { 0 };
+  (gnu_uint8_t) { sve_u1 };
+  (gnu_uint8_t) { gnu_u1 };
+  (gnu_uint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+
+  // Assignment
+
+  sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} }
+  sve_u1 = sve_u1;
+  sve_u1 = gnu_u1;
+  sve_u1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'svuint8_t' in assignment} }
+  sve_u1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svuint8_t' in assignment} }
+
+  gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in assignment} }
+  gnu_u1 = sve_u1;
+  gnu_u1 = gnu_u1;
+  gnu_u1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'gnu_uint8_t'[^\n]* in assignment} }
+  gnu_u1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'gnu_uint8_t'[^\n]* in assignment} }
+
+  // Casts
+
+  (void) sve_u1;
+  (int) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'int'} }
+  (bool) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'bool'} }
+  (svuint8_t) 0; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) n; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) sve_u1;
+  (svuint8_t) gnu_u1;
+  (svuint8_t) sve_s1; // { dg-error {invalid cast from type 'svint8_t' to type 'svuint8_t'} }
+  (svuint8_t) gnu_s1; // { dg-error {invalid cast from type 'gnu_int8_t'[^\n]* to type 'svuint8_t'} }
+
+  (void) gnu_u1;
+  (int) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'int'} }
+  (bool) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'bool'} }
+  (gnu_uint8_t) 0; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) n; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) sve_u1;
+  (gnu_uint8_t) gnu_u1;
+  (gnu_uint8_t) sve_s1;
+  (gnu_uint8_t) gnu_s1;
+
+  // Vector indexing.
+
+  sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+  &sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+
+  gnu_u1[0];
+  &gnu_u1[0];
+
+  // Unary vector arithmetic.
+
+  +sve_u1; // { dg-error {wrong type argument to unary plus} }
+  -sve_u1; // { dg-error {wrong type argument to unary minus} }
+  ~sve_u1; // { dg-error {wrong type argument to bit-complement} }
+  !sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+        // { dg-error {in argument to unary !} "" { target *-*-* } .-1 }
+  *sve_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real sve_u1; // { dg-error {wrong type argument to __real} }
+  __imag sve_u1; // { dg-error {wrong type argument to __imag} }
+  ++sve_u1; // { dg-error {no pre-increment operator for type} }
+  --sve_u1; // { dg-error {no pre-decrement operator for type} }
+  sve_u1++; // { dg-error {no post-increment operator for type} }
+  sve_u1--; // { dg-error {no post-decrement operator for type} }
+
+  +gnu_u1;
+  -gnu_u1;
+  ~gnu_u1;
+  !gnu_u1;
+  *gnu_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real gnu_u1; // { dg-error {wrong type argument to __real} }
+  __imag gnu_u1; // { dg-error {wrong type argument to __imag} }
+  ++gnu_u1;
+  --gnu_u1;
+  gnu_u1++;
+  gnu_u1--;
+
+  // Vector-vector binary arithmetic.
+
+  sve_u1 + sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator-'} }
+  sve_u1 * sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator/'} }
+  sve_u1 % sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator%'} }
+  sve_u1 & sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator=='} }
+  sve_u1 != sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<='} }
+  sve_u1 < sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<'} }
+  sve_u1 > sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>>'} }
+  sve_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>>'} }
+  sve_u1 && gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>>'} }
+  gnu_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  gnu_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + gnu_u1;
+  gnu_u1 - gnu_u1;
+  gnu_u1 * gnu_u1;
+  gnu_u1 / gnu_u1;
+  gnu_u1 % gnu_u1;
+  gnu_u1 & gnu_u1;
+  gnu_u1 | gnu_u1;
+  gnu_u1 ^ gnu_u1;
+  gnu_u1 == gnu_u1;
+  gnu_u1 != gnu_u1;
+  gnu_u1 <= gnu_u1;
+  gnu_u1 < gnu_u1;
+  gnu_u1 > gnu_u1;
+  gnu_u1 >= gnu_u1;
+  gnu_u1 <=> gnu_u1;
+  gnu_u1 << gnu_u1;
+  gnu_u1 >> gnu_u1;
+  gnu_u1 && gnu_u1;
+  gnu_u1 || gnu_u1;
+
+  // Vector-scalar binary arithmetic.
+
+  sve_u1 + 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\+'} }
+  sve_u1 - 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator-'} }
+  sve_u1 * 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\*'} }
+  sve_u1 / 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator/'} }
+  sve_u1 % 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator%'} }
+  sve_u1 & 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\&'} }
+  sve_u1 | 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\|'} }
+  sve_u1 ^ 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\^'} }
+  sve_u1 == 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator=='} }
+  sve_u1 != 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator!='} }
+  sve_u1 <= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<='} }
+  sve_u1 < 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<'} }
+  sve_u1 > 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>'} }
+  sve_u1 >= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>='} }
+  sve_u1 <=> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<=>'} }
+  sve_u1 << 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<<'} }
+  sve_u1 >> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>>'} }
+  sve_u1 && 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\+'} }
+  sve_u1 - uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator-'} }
+  sve_u1 * uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\*'} }
+  sve_u1 / uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator/'} }
+  sve_u1 % uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator%'} }
+  sve_u1 & uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\&'} }
+  sve_u1 | uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\|'} }
+  sve_u1 ^ uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\^'} }
+  sve_u1 == uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator=='} }
+  sve_u1 != uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator!='} }
+  sve_u1 <= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<='} }
+  sve_u1 < uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<'} }
+  sve_u1 > uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>'} }
+  sve_u1 >= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>='} }
+  sve_u1 <=> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<=>'} }
+  sve_u1 << uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<<'} }
+  sve_u1 >> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>>'} }
+  sve_u1 && uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + 2;
+  gnu_u1 - 2;
+  gnu_u1 * 2;
+  gnu_u1 / 2;
+  gnu_u1 % 2;
+  gnu_u1 & 2;
+  gnu_u1 | 2;
+  gnu_u1 ^ 2;
+  gnu_u1 == 2;
+  gnu_u1 != 2;
+  gnu_u1 <= 2;
+  gnu_u1 < 2;
+  gnu_u1 > 2;
+  gnu_u1 >= 2;
+  gnu_u1 <=> 2; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'int' to binary 'operator<=>'} }
+  gnu_u1 << 2;
+  gnu_u1 >> 2;
+  gnu_u1 && 2;
+  gnu_u1 || 2;
+
+  gnu_u1 + uc;
+  gnu_u1 - uc;
+  gnu_u1 * uc;
+  gnu_u1 / uc;
+  gnu_u1 % uc;
+  gnu_u1 & uc;
+  gnu_u1 | uc;
+  gnu_u1 ^ uc;
+  gnu_u1 == uc;
+  gnu_u1 != uc;
+  gnu_u1 <= uc;
+  gnu_u1 < uc;
+  gnu_u1 > uc;
+  gnu_u1 >= uc;
+  gnu_u1 <=> uc; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'unsigned char' to binary 'operator<=>'} }
+  gnu_u1 << uc;
+  gnu_u1 >> uc;
+  gnu_u1 && uc;
+  gnu_u1 || uc;
+
+  // Scalar-vector binary 'operatorarithmetic.
+
+  3 + sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\+'} }
+  3 - sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator-'} }
+  3 * sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\*'} }
+  3 / sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator/'} }
+  3 % sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator%'} }
+  3 & sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\&'} }
+  3 | sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\|'} }
+  3 ^ sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\^'} }
+  3 == sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator=='} }
+  3 != sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator!='} }
+  3 <= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<='} }
+  3 <=> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<=>'} }
+  3 < sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<'} }
+  3 > sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>'} }
+  3 >= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>='} }
+  3 << sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<<'} }
+  3 >> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>>'} }
+  3 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  3 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  3 + gnu_u1;
+  3 - gnu_u1;
+  3 * gnu_u1;
+  3 / gnu_u1;
+  3 % gnu_u1;
+  3 & gnu_u1;
+  3 | gnu_u1;
+  3 ^ gnu_u1;
+  3 == gnu_u1;
+  3 != gnu_u1;
+  3 <= gnu_u1;
+  3 <=> gnu_u1; // { dg-error {invalid operands of types 'int' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  3 < gnu_u1;
+  3 > gnu_u1;
+  3 >= gnu_u1;
+  3 << gnu_u1;
+  3 >> gnu_u1;
+  3 && gnu_u1;
+  3 || gnu_u1;
+
+  // Mismatched types.
+
+  sve_u1 + sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator-'} }
+  sve_u1 * sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator/'} }
+  sve_u1 % sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator%'} }
+  sve_u1 & sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator=='} }
+  sve_u1 != sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<='} }
+  sve_u1 < sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<'} }
+  sve_u1 > sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>>'} }
+
+  sve_u1 + gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>>'} }
+
+  gnu_u1 + sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>>'} }
+
+  gnu_u1 + gnu_s1;
+  gnu_u1 - gnu_s1;
+  gnu_u1 * gnu_s1;
+  gnu_u1 / gnu_s1;
+  gnu_u1 % gnu_s1;
+  gnu_u1 & gnu_s1;
+  gnu_u1 | gnu_s1;
+  gnu_u1 ^ gnu_s1;
+  gnu_u1 == gnu_s1;
+  gnu_u1 != gnu_s1;
+  gnu_u1 <= gnu_s1;
+  gnu_u1 < gnu_s1;
+  gnu_u1 > gnu_s1;
+  gnu_u1 >= gnu_s1;
+  gnu_u1 <=> gnu_s1;
+  gnu_u1 << gnu_s1;
+  gnu_u1 >> gnu_s1;
+
+  // Conditional expressions.
+
+  uc ? sve_u1 : sve_u1;
+  uc ? gnu_u1 : sve_u1; // { dg-error {operands to '\?:' have different types 'gnu_uint8_t'[^\n]* and 'svuint8_t'} }
+  uc ? sve_u1 : gnu_u1; // { dg-error {operands to '\?:' have different types 'svuint8_t' and 'gnu_uint8_t'} }
+  uc ? gnu_u1 : gnu_u1;
+
+  sve_u1 ? sve_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : gnu_u1;
+  gnu_u1 ? sve_u1 : uc; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? uc : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : uc;
+  gnu_u1 ? uc : gnu_u1;
+
+  // Vector built-ins.
+
+  __builtin_shuffle (sve_u1, sve_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (sve_u1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, sve_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, gnu_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (gnu_u1, gnu_u1, gnu_u1);
+
+  __builtin_convertvector (sve_u1, svuint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, svuint8_t); // { dg-error {'__builtin_convertvector' second argument must be an integer or floating vector type} }
+  __builtin_convertvector (sve_u1, gnu_uint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, gnu_uint8_t);
+
+  // Type queries.
+
+  static_assert(__is_literal_type(svuint8_t));
+  static_assert(__is_literal_type(gnu_uint8_t));
+
+  svuint8_t *sve_ptr1 = &sve_u1;
+  svuint8_t *sve_ptr2 = &gnu_u1;
+  svuint8_t *sve_ptr3 = &sve_s1; // { dg-error {cannot convert 'svint8_t\*' to 'svuint8_t\*' in initialization} }
+  svuint8_t *sve_ptr4 = &gnu_s1; // { dg-error {cannot convert 'gnu_int8_t\*'[^\n]* to 'svuint8_t\*' in initialization} }
+
+  gnu_uint8_t *gnu_ptr1 = &sve_u1;
+  gnu_uint8_t *gnu_ptr2 = &gnu_u1;
+  gnu_uint8_t *gnu_ptr3 = &sve_s1; // { dg-error {cannot convert 'svint8_t\*' to 'gnu_uint8_t\*'} }
+  gnu_uint8_t *gnu_ptr4 = &gnu_s1; // { dg-error {cannot convert 'gnu_int8_t\*'[^\n]* to 'gnu_uint8_t\*'} }
+}
+
+constexpr svuint8_t const1 (svuint8_t x) { return x; }
+constexpr gnu_uint8_t const2 (gnu_uint8_t x) { return x; }
Index: gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C
===================================================================
--- /dev/null	2019-09-17 11:41:18.176664108 +0100
+++ gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C	2019-11-08 17:43:07.180264067 +0000
@@ -0,0 +1,485 @@ 
+// { dg-options "-msve-vector-bits=256 -std=gnu++2a -flax-vector-conversions" }
+
+#include <arm_sve.h>
+
+typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
+typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
+
+void
+f (svuint8_t sve_u1, svint8_t sve_s1,
+   gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc)
+{
+  // Initialization
+
+  svuint8_t init_sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u2 = {};
+  svuint8_t init_sve_u3 = { sve_u1 };
+  svuint8_t init_sve_u4 = { gnu_u1 };
+  svuint8_t init_sve_u5 = { sve_s1 };
+  svuint8_t init_sve_u6 = { gnu_s1 };
+  svuint8_t init_sve_u7 = { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u10 {};
+  svuint8_t init_sve_u11 { sve_u1 };
+  svuint8_t init_sve_u12 { gnu_u1 };
+  svuint8_t init_sve_u13 { sve_s1 };
+  svuint8_t init_sve_u14 { gnu_s1 };
+  svuint8_t init_sve_u15 { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u16 { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u17 { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  svuint8_t init_sve_u18 (0); // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  svuint8_t init_sve_u19 (sve_u1);
+  svuint8_t init_sve_u20 (gnu_u1);
+  svuint8_t init_sve_u21 (sve_s1);
+  svuint8_t init_sve_u22 (gnu_s1);
+
+  gnu_uint8_t init_gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u2 = {};
+  gnu_uint8_t init_gnu_u3 = { sve_u1 };
+  gnu_uint8_t init_gnu_u4 = { gnu_u1 };
+  gnu_uint8_t init_gnu_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u7 = { 0 };
+  gnu_uint8_t init_gnu_u8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u10 { sve_u1 };
+  gnu_uint8_t init_gnu_u11 { gnu_u1 };
+  gnu_uint8_t init_gnu_u12 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u13 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u14 { 0 };
+  gnu_uint8_t init_gnu_u15 { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u16 { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+  gnu_uint8_t init_gnu_u17 (0); // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} }
+  gnu_uint8_t init_gnu_u18 (sve_u1);
+  gnu_uint8_t init_gnu_u19 (gnu_u1);
+  gnu_uint8_t init_gnu_u20 (sve_s1);
+  gnu_uint8_t init_gnu_u21 (gnu_s1);
+
+  // Compound literals
+
+  (svuint8_t) {};
+  (svuint8_t) { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} }
+  (svuint8_t) { sve_u1 };
+  (svuint8_t) { gnu_u1 };
+  (svuint8_t) { sve_s1 };
+  (svuint8_t) { gnu_s1 };
+  (svuint8_t) { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+  (svuint8_t) { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} }
+
+  (gnu_uint8_t) {};
+  (gnu_uint8_t) { 0 };
+  (gnu_uint8_t) { sve_u1 };
+  (gnu_uint8_t) { gnu_u1 };
+  (gnu_uint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} }
+  (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} }
+
+  // Assignment
+
+  sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} }
+  sve_u1 = sve_u1;
+  sve_u1 = gnu_u1;
+  sve_u1 = sve_s1;
+  sve_u1 = gnu_s1;
+
+  gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in assignment} }
+  gnu_u1 = sve_u1;
+  gnu_u1 = gnu_u1;
+  gnu_u1 = sve_s1;
+  gnu_u1 = gnu_s1;
+
+  // Casts
+
+  (void) sve_u1;
+  (int) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'int'} }
+  (bool) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'bool'} }
+  (svuint8_t) 0; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) n; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} }
+  (svuint8_t) sve_u1;
+  (svuint8_t) gnu_u1;
+  (svuint8_t) sve_s1;
+  (svuint8_t) gnu_s1;
+
+  (void) gnu_u1;
+  (int) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'int'} }
+  (bool) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'bool'} }
+  (gnu_uint8_t) 0; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) n; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} }
+  (gnu_uint8_t) sve_u1;
+  (gnu_uint8_t) gnu_u1;
+  (gnu_uint8_t) sve_s1;
+  (gnu_uint8_t) gnu_s1;
+
+  // Vector indexing.
+
+  sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+  &sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} }
+
+  gnu_u1[0];
+  &gnu_u1[0];
+
+  // Unary vector arithmetic.
+
+  +sve_u1; // { dg-error {wrong type argument to unary plus} }
+  -sve_u1; // { dg-error {wrong type argument to unary minus} }
+  ~sve_u1; // { dg-error {wrong type argument to bit-complement} }
+  !sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+        // { dg-error {in argument to unary !} "" { target *-*-* } .-1 }
+  *sve_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real sve_u1; // { dg-error {wrong type argument to __real} }
+  __imag sve_u1; // { dg-error {wrong type argument to __imag} }
+  ++sve_u1; // { dg-error {no pre-increment operator for type} }
+  --sve_u1; // { dg-error {no pre-decrement operator for type} }
+  sve_u1++; // { dg-error {no post-increment operator for type} }
+  sve_u1--; // { dg-error {no post-decrement operator for type} }
+
+  +gnu_u1;
+  -gnu_u1;
+  ~gnu_u1;
+  !gnu_u1;
+  *gnu_u1; // { dg-error {invalid type argument of unary '\*'} }
+  __real gnu_u1; // { dg-error {wrong type argument to __real} }
+  __imag gnu_u1; // { dg-error {wrong type argument to __imag} }
+  ++gnu_u1;
+  --gnu_u1;
+  gnu_u1++;
+  gnu_u1--;
+
+  // Vector-vector binary arithmetic.
+
+  sve_u1 + sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator-'} }
+  sve_u1 * sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator/'} }
+  sve_u1 % sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator%'} }
+  sve_u1 & sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator=='} }
+  sve_u1 != sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<='} }
+  sve_u1 < sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<'} }
+  sve_u1 > sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>>'} }
+  sve_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>>'} }
+  sve_u1 && gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>>'} }
+  gnu_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  gnu_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + gnu_u1;
+  gnu_u1 - gnu_u1;
+  gnu_u1 * gnu_u1;
+  gnu_u1 / gnu_u1;
+  gnu_u1 % gnu_u1;
+  gnu_u1 & gnu_u1;
+  gnu_u1 | gnu_u1;
+  gnu_u1 ^ gnu_u1;
+  gnu_u1 == gnu_u1;
+  gnu_u1 != gnu_u1;
+  gnu_u1 <= gnu_u1;
+  gnu_u1 < gnu_u1;
+  gnu_u1 > gnu_u1;
+  gnu_u1 >= gnu_u1;
+  gnu_u1 <=> gnu_u1;
+  gnu_u1 << gnu_u1;
+  gnu_u1 >> gnu_u1;
+  gnu_u1 && gnu_u1;
+  gnu_u1 || gnu_u1;
+
+  // Vector-scalar binary arithmetic.
+
+  sve_u1 + 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\+'} }
+  sve_u1 - 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator-'} }
+  sve_u1 * 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\*'} }
+  sve_u1 / 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator/'} }
+  sve_u1 % 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator%'} }
+  sve_u1 & 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\&'} }
+  sve_u1 | 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\|'} }
+  sve_u1 ^ 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\^'} }
+  sve_u1 == 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator=='} }
+  sve_u1 != 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator!='} }
+  sve_u1 <= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<='} }
+  sve_u1 < 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<'} }
+  sve_u1 > 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>'} }
+  sve_u1 >= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>='} }
+  sve_u1 <=> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<=>'} }
+  sve_u1 << 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<<'} }
+  sve_u1 >> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>>'} }
+  sve_u1 && 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  sve_u1 + uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\+'} }
+  sve_u1 - uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator-'} }
+  sve_u1 * uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\*'} }
+  sve_u1 / uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator/'} }
+  sve_u1 % uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator%'} }
+  sve_u1 & uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\&'} }
+  sve_u1 | uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\|'} }
+  sve_u1 ^ uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\^'} }
+  sve_u1 == uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator=='} }
+  sve_u1 != uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator!='} }
+  sve_u1 <= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<='} }
+  sve_u1 < uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<'} }
+  sve_u1 > uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>'} }
+  sve_u1 >= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>='} }
+  sve_u1 <=> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<=>'} }
+  sve_u1 << uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<<'} }
+  sve_u1 >> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>>'} }
+  sve_u1 && uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 || uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 + 2;
+  gnu_u1 - 2;
+  gnu_u1 * 2;
+  gnu_u1 / 2;
+  gnu_u1 % 2;
+  gnu_u1 & 2;
+  gnu_u1 | 2;
+  gnu_u1 ^ 2;
+  gnu_u1 == 2;
+  gnu_u1 != 2;
+  gnu_u1 <= 2;
+  gnu_u1 < 2;
+  gnu_u1 > 2;
+  gnu_u1 >= 2;
+  gnu_u1 <=> 2; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'int' to binary 'operator<=>'} }
+  gnu_u1 << 2;
+  gnu_u1 >> 2;
+  gnu_u1 && 2;
+  gnu_u1 || 2;
+
+  gnu_u1 + uc;
+  gnu_u1 - uc;
+  gnu_u1 * uc;
+  gnu_u1 / uc;
+  gnu_u1 % uc;
+  gnu_u1 & uc;
+  gnu_u1 | uc;
+  gnu_u1 ^ uc;
+  gnu_u1 == uc;
+  gnu_u1 != uc;
+  gnu_u1 <= uc;
+  gnu_u1 < uc;
+  gnu_u1 > uc;
+  gnu_u1 >= uc;
+  gnu_u1 <=> uc; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'unsigned char' to binary 'operator<=>'} }
+  gnu_u1 << uc;
+  gnu_u1 >> uc;
+  gnu_u1 && uc;
+  gnu_u1 || uc;
+
+  // Scalar-vector binary 'operatorarithmetic.
+
+  3 + sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\+'} }
+  3 - sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator-'} }
+  3 * sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\*'} }
+  3 / sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator/'} }
+  3 % sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator%'} }
+  3 & sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\&'} }
+  3 | sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\|'} }
+  3 ^ sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\^'} }
+  3 == sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator=='} }
+  3 != sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator!='} }
+  3 <= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<='} }
+  3 <=> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<=>'} }
+  3 < sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<'} }
+  3 > sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>'} }
+  3 >= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>='} }
+  3 << sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<<'} }
+  3 >> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>>'} }
+  3 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  3 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  3 + gnu_u1;
+  3 - gnu_u1;
+  3 * gnu_u1;
+  3 / gnu_u1;
+  3 % gnu_u1;
+  3 & gnu_u1;
+  3 | gnu_u1;
+  3 ^ gnu_u1;
+  3 == gnu_u1;
+  3 != gnu_u1;
+  3 <= gnu_u1;
+  3 <=> gnu_u1; // { dg-error {invalid operands of types 'int' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} }
+  3 < gnu_u1;
+  3 > gnu_u1;
+  3 >= gnu_u1;
+  3 << gnu_u1;
+  3 >> gnu_u1;
+  3 && gnu_u1;
+  3 || gnu_u1;
+
+  // Mismatched types.
+
+  sve_u1 + sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\+'} }
+  sve_u1 - sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator-'} }
+  sve_u1 * sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\*'} }
+  sve_u1 / sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator/'} }
+  sve_u1 % sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator%'} }
+  sve_u1 & sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\&'} }
+  sve_u1 | sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\|'} }
+  sve_u1 ^ sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\^'} }
+  sve_u1 == sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator=='} }
+  sve_u1 != sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator!='} }
+  sve_u1 <= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<='} }
+  sve_u1 < sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<'} }
+  sve_u1 > sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>'} }
+  sve_u1 >= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>='} }
+  sve_u1 <=> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<=>'} }
+  sve_u1 << sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<<'} }
+  sve_u1 >> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>>'} }
+
+  sve_u1 + gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\+'} }
+  sve_u1 - gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator-'} }
+  sve_u1 * gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\*'} }
+  sve_u1 / gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator/'} }
+  sve_u1 % gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator%'} }
+  sve_u1 & gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\&'} }
+  sve_u1 | gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\|'} }
+  sve_u1 ^ gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\^'} }
+  sve_u1 == gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator=='} }
+  sve_u1 != gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator!='} }
+  sve_u1 <= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<='} }
+  sve_u1 < gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<'} }
+  sve_u1 > gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>'} }
+  sve_u1 >= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>='} }
+  sve_u1 <=> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<=>'} }
+  sve_u1 << gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<<'} }
+  sve_u1 >> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>>'} }
+
+  gnu_u1 + sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\+'} }
+  gnu_u1 - sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator-'} }
+  gnu_u1 * sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\*'} }
+  gnu_u1 / sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator/'} }
+  gnu_u1 % sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator%'} }
+  gnu_u1 & sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\&'} }
+  gnu_u1 | sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\|'} }
+  gnu_u1 ^ sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\^'} }
+  gnu_u1 == sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator=='} }
+  gnu_u1 != sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator!='} }
+  gnu_u1 <= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<='} }
+  gnu_u1 < sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<'} }
+  gnu_u1 > sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>'} }
+  gnu_u1 >= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>='} }
+  gnu_u1 <=> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<=>'} }
+  gnu_u1 << sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<<'} }
+  gnu_u1 >> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>>'} }
+
+  gnu_u1 + gnu_s1;
+  gnu_u1 - gnu_s1;
+  gnu_u1 * gnu_s1;
+  gnu_u1 / gnu_s1;
+  gnu_u1 % gnu_s1;
+  gnu_u1 & gnu_s1;
+  gnu_u1 | gnu_s1;
+  gnu_u1 ^ gnu_s1;
+  gnu_u1 == gnu_s1;
+  gnu_u1 != gnu_s1;
+  gnu_u1 <= gnu_s1;
+  gnu_u1 < gnu_s1;
+  gnu_u1 > gnu_s1;
+  gnu_u1 >= gnu_s1;
+  gnu_u1 <=> gnu_s1;
+  gnu_u1 << gnu_s1;
+  gnu_u1 >> gnu_s1;
+
+  // Conditional expressions.
+
+  uc ? sve_u1 : sve_u1;
+  uc ? gnu_u1 : sve_u1; // { dg-error {operands to '\?:' have different types 'gnu_uint8_t'[^\n]* and 'svuint8_t'} }
+  uc ? sve_u1 : gnu_u1; // { dg-error {operands to '\?:' have different types 'svuint8_t' and 'gnu_uint8_t'} }
+  uc ? gnu_u1 : gnu_u1;
+
+  sve_u1 ? sve_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? sve_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? gnu_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+  sve_u1 ? uc : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} }
+
+  gnu_u1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : gnu_u1;
+  gnu_u1 ? sve_u1 : uc; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? uc : sve_u1; // { dg-error {incompatible vector types in conditional expression} }
+  gnu_u1 ? gnu_u1 : uc;
+  gnu_u1 ? uc : gnu_u1;
+
+  // Vector built-ins.
+
+  __builtin_shuffle (sve_u1, sve_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (sve_u1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, sve_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} }
+  __builtin_shuffle (gnu_u1, gnu_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} }
+  __builtin_shuffle (gnu_u1, gnu_u1, gnu_u1);
+
+  __builtin_convertvector (sve_u1, svuint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, svuint8_t); // { dg-error {'__builtin_convertvector' second argument must be an integer or floating vector type} }
+  __builtin_convertvector (sve_u1, gnu_uint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} }
+  __builtin_convertvector (gnu_u1, gnu_uint8_t);
+
+  // Type queries.
+
+  static_assert(__is_literal_type(svuint8_t));
+  static_assert(__is_literal_type(gnu_uint8_t));
+
+  svuint8_t *sve_ptr1 = &sve_u1;
+  svuint8_t *sve_ptr2 = &gnu_u1;
+  svuint8_t *sve_ptr3 = &sve_s1; // { dg-error {invalid conversion from 'svint8_t\*' to 'svuint8_t\*'} }
+  svuint8_t *sve_ptr4 = &gnu_s1; // { dg-error {invalid conversion from 'gnu_int8_t\*'[^\n]* to 'svuint8_t\*'} }
+
+  gnu_uint8_t *gnu_ptr1 = &sve_u1;
+  gnu_uint8_t *gnu_ptr2 = &gnu_u1;
+  gnu_uint8_t *gnu_ptr3 = &sve_s1; // { dg-error {invalid conversion from 'svint8_t\*' to 'gnu_uint8_t\*'} }
+  gnu_uint8_t *gnu_ptr4 = &gnu_s1; // { dg-error {invalid conversion from 'gnu_int8_t\*'[^\n]* to 'gnu_uint8_t\*'} }
+}
+
+constexpr svuint8_t const1 (svuint8_t x) { return x; }
+constexpr gnu_uint8_t const2 (gnu_uint8_t x) { return x; }