| 1 |
// { dg-additional-options "-mavx" { target avx_runtime } } |
| 2 |
// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } } |
| 3 |
module gcc.simd; |
| 4 |
|
| 5 |
alias int4 = __vector(int[4]); |
| 6 |
alias short8 = __vector(short[8]); |
| 7 |
alias float4 = __vector(float[4]); |
| 8 |
alias byte16 = __vector(byte[16]); |
| 9 |
struct fake4 { int[4] v; } |
| 10 |
enum f = fake4(); |
| 11 |
|
| 12 |
void test_convertvector() |
| 13 |
{ |
| 14 |
convertvector!(int, int)(0); // { dg-warning "mismatch in return type" } |
| 15 |
convertvector!(double, int)(0); // { dg-warning "mismatch in return type" } |
| 16 |
convertvector!(fake4, int)(0); // { dg-warning "mismatch in return type" } |
| 17 |
|
| 18 |
convertvector!(int4, int)(0); // { dg-warning "mismatch in argument 1" } |
| 19 |
convertvector!(int4, double)(0); // { dg-warning "mismatch in argument 1" } |
| 20 |
convertvector!(int4, int4)(0); |
| 21 |
convertvector!(int4, short8)(0); // { dg-error "mismatch in argument 1" } |
| 22 |
convertvector!(int4, float4)(0); |
| 23 |
convertvector!(int4, byte16)(0); // { dg-error "mismatch in argument 1" } |
| 24 |
convertvector!(int4, fake4)(f); // { dg-warning "mismatch in argument 1" } |
| 25 |
|
| 26 |
convertvector!(short8, int)(0); // { dg-warning "mismatch in argument 1" } |
| 27 |
convertvector!(short8, double)(0); // { dg-warning "mismatch in argument 1" } |
| 28 |
convertvector!(short8, int4)(0); // { dg-error "mismatch in argument 1" } |
| 29 |
convertvector!(short8, short8)(0); |
| 30 |
convertvector!(short8, float4)(0); // { dg-error "mismatch in argument 1" } |
| 31 |
convertvector!(short8, byte16)(0); // { dg-error "mismatch in argument 1" } |
| 32 |
convertvector!(short8, fake4)(f); // { dg-warning "mismatch in argument 1" } |
| 33 |
|
| 34 |
convertvector!(float4, int)(0); // { dg-warning "mismatch in argument 1" } |
| 35 |
convertvector!(float4, double)(0); // { dg-warning "mismatch in argument 1" } |
| 36 |
convertvector!(float4, int4)(0); |
| 37 |
convertvector!(float4, short8)(0); // { dg-error "mismatch in argument 1" } |
| 38 |
convertvector!(float4, float4)(0); |
| 39 |
convertvector!(float4, byte16)(0); // { dg-error "mismatch in argument 1" } |
| 40 |
convertvector!(float4, fake4)(f); // { dg-warning "mismatch in argument 1" } |
| 41 |
|
| 42 |
convertvector!(byte16, int)(0); // { dg-warning "mismatch in argument 1" } |
| 43 |
convertvector!(byte16, double)(0); // { dg-warning "mismatch in argument 1" } |
| 44 |
convertvector!(byte16, int4)(0); // { dg-error "mismatch in argument 1" } |
| 45 |
convertvector!(byte16, short8)(0); // { dg-error "mismatch in argument 1" } |
| 46 |
convertvector!(byte16, float4)(0); // { dg-error "mismatch in argument 1" } |
| 47 |
convertvector!(byte16, byte16)(0); |
| 48 |
convertvector!(byte16, fake4)(f); // { dg-warning "mismatch in argument 1" } |
| 49 |
} |
| 50 |
|
| 51 |
// The following declarations of the simd intrinsics are without any guards |
| 52 |
// to verify `d/intrinsics.cc` is doing checks to prevent invalid lowerings. |
| 53 |
V convertvector(V, T)(T); |