Hi, This patch splits Wbuiltin_declaration_mismatch2.d into multiple tests. When looking at failures on ARM64, this aided in understanding which specific tests weren't passing.
Regression tested on x86_64-linux-gnu, committed to mainline. Regards, Iain. --- gcc/testsuite/ChangeLog: * gdc.dg/Wbuiltin_declaration_mismatch2.d: Split test into ... * gdc.dg/Wbuiltin_declaration_mismatch3.d: New test. * gdc.dg/Wbuiltin_declaration_mismatch4.d: New test. * gdc.dg/Wbuiltin_declaration_mismatch5.d: New test. * gdc.dg/Wbuiltin_declaration_mismatch6.d: New test. --- .../gdc.dg/Wbuiltin_declaration_mismatch2.d | 176 ------------------ .../gdc.dg/Wbuiltin_declaration_mismatch3.d | 61 ++++++ .../gdc.dg/Wbuiltin_declaration_mismatch4.d | 51 +++++ .../gdc.dg/Wbuiltin_declaration_mismatch5.d | 53 ++++++ .../gdc.dg/Wbuiltin_declaration_mismatch6.d | 61 ++++++ 5 files changed, 226 insertions(+), 176 deletions(-) create mode 100644 gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch3.d create mode 100644 gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch4.d create mode 100644 gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch5.d create mode 100644 gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch6.d diff --git a/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch2.d b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch2.d index 0d12bcb8b07..8dcba79bfc3 100644 --- a/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch2.d +++ b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch2.d @@ -28,183 +28,7 @@ void test_load_store() storeUnaligned!fake4(null, f); // { dg-warning "mismatch in return type" } } -void test_shuffle() -{ - shuffle!(int, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } - shuffle!(double, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } - shuffle!(fake4, int, int)(f, 0, 0); // { dg-warning "mismatch in return type" } - - shuffle!(int4, int, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } - shuffle!(int4, double, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } - shuffle!(int4, fake4, int)(0, f, 0); // { dg-warning "mismatch in argument 2" } - - shuffle!(int4, int4, int)(0, 0, 0); // { dg-warning "mismatch in argument 3" } - shuffle!(int4, int4, double)(0, 0, 0); // { dg-warning "mismatch in argument 3" } - shuffle!(int4, int4, fake4)(0, 0, f); // { dg-warning "mismatch in argument 3" } - - shuffle!(int4, int4, int4)(0, 0, 0); - shuffle!(int4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(int4, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(int4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(int4, int4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(int4, int4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(int4, int4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } - - shuffle!(float4, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(float4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(float4, float4, int4)(0, 0, 0); - shuffle!(float4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(float4, float4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(float4, float4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(float4, float4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } - - shuffle!(short8, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(short8, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(short8, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(short8, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(short8, short8, short8)(0, 0, 0); - shuffle!(short8, short8, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(short8, short8, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } - - shuffle!(byte16, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(byte16, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(byte16, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - shuffle!(byte16, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(byte16, byte16, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(byte16, byte16, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - shuffle!(byte16, byte16, byte16)(0, 0, 0); -} - -void test_shufflevector() -{ - shufflevector!(int, int4, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 1" } - shufflevector!(double, int4, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 1" } - shufflevector!(fake4, int4, int, int, int, int)(f, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 1" } - - shufflevector!(int4, int, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 2" } - shufflevector!(int4, double, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 2" } - shufflevector!(int4, int4, int, int, int, int)(0, 0, 0, 0, 0, 0); - shufflevector!(int4, short8, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-error "mismatch in argument 2" } - shufflevector!(int4, float4, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-error "mismatch in argument 2" } - shufflevector!(int4, byte16, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-error "mismatch in argument 2" } - shufflevector!(int4, fake4, int, int, int, int)(0, f, 0, 0, 0, 0); // { dg-warning "mismatch in argument 2" } - - shufflevector!(int4, int4, double, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } - shufflevector!(int4, int4, int4, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } - shufflevector!(int4, int4, short8, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } - shufflevector!(int4, int4, float4, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } - shufflevector!(int4, int4, byte16, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } - - shufflevector!(int4, int4, int, double, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 4" } - shufflevector!(int4, int4, int, int, double, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 5" } - shufflevector!(int4, int4, int, int, int, double)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 6" } - - int i; - shufflevector!(int4, int4, int, int, int, int)(0, 0, i, 0, 0, 0); // { dg-error "argument .i. cannot be read at compile time" } - shufflevector!(int4, int4, int, int, int, int)(0, 0, -1u, 0, 0, 0); // { dg-error "element index .-1. is out of bounds" } - shufflevector!(int4, int4, int, int, int, int)(0, 0, 8, 0, 0, 0); // { dg-error "element index .8. is out of bounds" } -} - -void test_convertvector() -{ - convertvector!(int, int)(0); // { dg-warning "mismatch in return type" } - convertvector!(double, int)(0); // { dg-warning "mismatch in return type" } - convertvector!(fake4, int)(0); // { dg-warning "mismatch in return type" } - - convertvector!(int4, int)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(int4, double)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(int4, int4)(0); - convertvector!(int4, short8)(0); // { dg-error "mismatch in argument 1" } - convertvector!(int4, float4)(0); - convertvector!(int4, byte16)(0); // { dg-error "mismatch in argument 1" } - convertvector!(int4, fake4)(f); // { dg-warning "mismatch in argument 1" } - - convertvector!(short8, int)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(short8, double)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(short8, int4)(0); // { dg-error "mismatch in argument 1" } - convertvector!(short8, short8)(0); - convertvector!(short8, float4)(0); // { dg-error "mismatch in argument 1" } - convertvector!(short8, byte16)(0); // { dg-error "mismatch in argument 1" } - convertvector!(short8, fake4)(f); // { dg-warning "mismatch in argument 1" } - - convertvector!(float4, int)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(float4, double)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(float4, int4)(0); - convertvector!(float4, short8)(0); // { dg-error "mismatch in argument 1" } - convertvector!(float4, float4)(0); - convertvector!(float4, byte16)(0); // { dg-error "mismatch in argument 1" } - convertvector!(float4, fake4)(f); // { dg-warning "mismatch in argument 1" } - - convertvector!(byte16, int)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(byte16, double)(0); // { dg-warning "mismatch in argument 1" } - convertvector!(byte16, int4)(0); // { dg-error "mismatch in argument 1" } - convertvector!(byte16, short8)(0); // { dg-error "mismatch in argument 1" } - convertvector!(byte16, float4)(0); // { dg-error "mismatch in argument 1" } - convertvector!(byte16, byte16)(0); - convertvector!(byte16, fake4)(f); // { dg-warning "mismatch in argument 1" } -} - -void test_blendvector() -{ - blendvector!(int, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } - blendvector!(double, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } - blendvector!(fake4, int, int)(f, 0, 0); // { dg-warning "mismatch in return type" } - - blendvector!(int4, int, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } - blendvector!(int4, double, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } - blendvector!(int4, fake4, int)(0, f, 0); // { dg-warning "mismatch in argument 2" } - - blendvector!(int4, int4, int)(0, 0, 0); // { dg-warning "mismatch in argument 3" } - blendvector!(int4, int4, double)(0, 0, 0); // { dg-warning "mismatch in argument 3" } - blendvector!(int4, int4, fake4)(0, 0, f); // { dg-warning "mismatch in argument 3" } - - blendvector!(int4, int4, int4)(0, 0, 0); - blendvector!(int4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(int4, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(int4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(int4, int4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(int4, int4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(int4, int4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } - - blendvector!(float4, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(float4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(float4, float4, int4)(0, 0, 0); - blendvector!(float4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(float4, float4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(float4, float4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(float4, float4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } - - blendvector!(short8, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(short8, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(short8, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(short8, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(short8, short8, short8)(0, 0, 0); - blendvector!(short8, short8, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(short8, short8, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } - - blendvector!(byte16, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(byte16, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(byte16, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } - blendvector!(byte16, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(byte16, byte16, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(byte16, byte16, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } - blendvector!(byte16, byte16, byte16)(0, 0, 0); -} - // The following declarations of the simd intrinsics are without any guards // to verify `d/intrinsics.cc` is doing checks to prevent invalid lowerings. V loadUnaligned(V)(const V*); V storeUnaligned(V)(V*, V); - -V0 shuffle(V0, V1, M)(V0, V1, M); - -// Use overloads to test different argument positions. -template E(V) { alias typeof(V.array[0]) E; } -enum isV(T) = is(T : __vector(V[N]), V, size_t N); - -__vector(E!V1[M.length]) shufflevector(V1, V2, M...)(V1, V2, M) if (isV!V1 && !isV!V2); -__vector(E!V2[M.length]) shufflevector(V1, V2, M...)(V1, V2, M) if (isV!V2 && !isV!V1); -__vector(E!V1[M.length]) shufflevector(V1, V2, M...)(V1, V2, M) if (isV!V1 && isV!V2); - -V convertvector(V, T)(T); -V0 blendvector(V0, V1, M)(V0, V1, M); diff --git a/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch3.d b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch3.d new file mode 100644 index 00000000000..5529de3731a --- /dev/null +++ b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch3.d @@ -0,0 +1,61 @@ +// { dg-additional-options "-mavx" { target avx_runtime } } +// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } } +module gcc.simd; + +alias int4 = __vector(int[4]); +alias short8 = __vector(short[8]); +alias float4 = __vector(float[4]); +alias byte16 = __vector(byte[16]); +struct fake4 { int[4] v; } +enum f = fake4(); + +void test_shuffle() +{ + shuffle!(int, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } + shuffle!(double, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } + shuffle!(fake4, int, int)(f, 0, 0); // { dg-warning "mismatch in return type" } + + shuffle!(int4, int, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } + shuffle!(int4, double, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } + shuffle!(int4, fake4, int)(0, f, 0); // { dg-warning "mismatch in argument 2" } + + shuffle!(int4, int4, int)(0, 0, 0); // { dg-warning "mismatch in argument 3" } + shuffle!(int4, int4, double)(0, 0, 0); // { dg-warning "mismatch in argument 3" } + shuffle!(int4, int4, fake4)(0, 0, f); // { dg-warning "mismatch in argument 3" } + + shuffle!(int4, int4, int4)(0, 0, 0); + shuffle!(int4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(int4, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(int4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(int4, int4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(int4, int4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(int4, int4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } + + shuffle!(float4, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(float4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(float4, float4, int4)(0, 0, 0); + shuffle!(float4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(float4, float4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(float4, float4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(float4, float4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } + + shuffle!(short8, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(short8, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(short8, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(short8, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(short8, short8, short8)(0, 0, 0); + shuffle!(short8, short8, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(short8, short8, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } + + shuffle!(byte16, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(byte16, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(byte16, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + shuffle!(byte16, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(byte16, byte16, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(byte16, byte16, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + shuffle!(byte16, byte16, byte16)(0, 0, 0); +} + +// The following declarations of the simd intrinsics are without any guards +// to verify `d/intrinsics.cc` is doing checks to prevent invalid lowerings. +V0 shuffle(V0, V1, M)(V0, V1, M); diff --git a/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch4.d b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch4.d new file mode 100644 index 00000000000..06ce83e49ab --- /dev/null +++ b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch4.d @@ -0,0 +1,51 @@ +// { dg-additional-options "-mavx" { target avx_runtime } } +// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } } +module gcc.simd; + +alias int4 = __vector(int[4]); +alias short8 = __vector(short[8]); +alias float4 = __vector(float[4]); +alias byte16 = __vector(byte[16]); +struct fake4 { int[4] v; } +enum f = fake4(); + +void test_shufflevector() +{ + shufflevector!(int, int4, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 1" } + shufflevector!(double, int4, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 1" } + shufflevector!(fake4, int4, int, int, int, int)(f, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 1" } + + shufflevector!(int4, int, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 2" } + shufflevector!(int4, double, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 2" } + shufflevector!(int4, int4, int, int, int, int)(0, 0, 0, 0, 0, 0); + shufflevector!(int4, short8, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-error "mismatch in argument 2" } + shufflevector!(int4, float4, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-error "mismatch in argument 2" } + shufflevector!(int4, byte16, int, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-error "mismatch in argument 2" } + shufflevector!(int4, fake4, int, int, int, int)(0, f, 0, 0, 0, 0); // { dg-warning "mismatch in argument 2" } + + shufflevector!(int4, int4, double, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } + shufflevector!(int4, int4, int4, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } + shufflevector!(int4, int4, short8, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } + shufflevector!(int4, int4, float4, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } + shufflevector!(int4, int4, byte16, int, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 3" } + + shufflevector!(int4, int4, int, double, int, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 4" } + shufflevector!(int4, int4, int, int, double, int)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 5" } + shufflevector!(int4, int4, int, int, int, double)(0, 0, 0, 0, 0, 0); // { dg-warning "mismatch in argument 6" } + + int i; + shufflevector!(int4, int4, int, int, int, int)(0, 0, i, 0, 0, 0); // { dg-error "argument .i. cannot be read at compile time" } + shufflevector!(int4, int4, int, int, int, int)(0, 0, -1u, 0, 0, 0); // { dg-error "element index .-1. is out of bounds" } + shufflevector!(int4, int4, int, int, int, int)(0, 0, 8, 0, 0, 0); // { dg-error "element index .8. is out of bounds" } +} + +// The following declarations of the simd intrinsics are without any guards +// to verify `d/intrinsics.cc` is doing checks to prevent invalid lowerings. + +// Use overloads to test different argument positions. +template E(V) { alias typeof(V.array[0]) E; } +enum isV(T) = is(T : __vector(V[N]), V, size_t N); + +__vector(E!V1[M.length]) shufflevector(V1, V2, M...)(V1, V2, M) if (isV!V1 && !isV!V2); +__vector(E!V2[M.length]) shufflevector(V1, V2, M...)(V1, V2, M) if (isV!V2 && !isV!V1); +__vector(E!V1[M.length]) shufflevector(V1, V2, M...)(V1, V2, M) if (isV!V1 && isV!V2); diff --git a/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch5.d b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch5.d new file mode 100644 index 00000000000..28a0f023005 --- /dev/null +++ b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch5.d @@ -0,0 +1,53 @@ +// { dg-additional-options "-mavx" { target avx_runtime } } +// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } } +module gcc.simd; + +alias int4 = __vector(int[4]); +alias short8 = __vector(short[8]); +alias float4 = __vector(float[4]); +alias byte16 = __vector(byte[16]); +struct fake4 { int[4] v; } +enum f = fake4(); + +void test_convertvector() +{ + convertvector!(int, int)(0); // { dg-warning "mismatch in return type" } + convertvector!(double, int)(0); // { dg-warning "mismatch in return type" } + convertvector!(fake4, int)(0); // { dg-warning "mismatch in return type" } + + convertvector!(int4, int)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(int4, double)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(int4, int4)(0); + convertvector!(int4, short8)(0); // { dg-error "mismatch in argument 1" } + convertvector!(int4, float4)(0); + convertvector!(int4, byte16)(0); // { dg-error "mismatch in argument 1" } + convertvector!(int4, fake4)(f); // { dg-warning "mismatch in argument 1" } + + convertvector!(short8, int)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(short8, double)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(short8, int4)(0); // { dg-error "mismatch in argument 1" } + convertvector!(short8, short8)(0); + convertvector!(short8, float4)(0); // { dg-error "mismatch in argument 1" } + convertvector!(short8, byte16)(0); // { dg-error "mismatch in argument 1" } + convertvector!(short8, fake4)(f); // { dg-warning "mismatch in argument 1" } + + convertvector!(float4, int)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(float4, double)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(float4, int4)(0); + convertvector!(float4, short8)(0); // { dg-error "mismatch in argument 1" } + convertvector!(float4, float4)(0); + convertvector!(float4, byte16)(0); // { dg-error "mismatch in argument 1" } + convertvector!(float4, fake4)(f); // { dg-warning "mismatch in argument 1" } + + convertvector!(byte16, int)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(byte16, double)(0); // { dg-warning "mismatch in argument 1" } + convertvector!(byte16, int4)(0); // { dg-error "mismatch in argument 1" } + convertvector!(byte16, short8)(0); // { dg-error "mismatch in argument 1" } + convertvector!(byte16, float4)(0); // { dg-error "mismatch in argument 1" } + convertvector!(byte16, byte16)(0); + convertvector!(byte16, fake4)(f); // { dg-warning "mismatch in argument 1" } +} + +// The following declarations of the simd intrinsics are without any guards +// to verify `d/intrinsics.cc` is doing checks to prevent invalid lowerings. +V convertvector(V, T)(T); diff --git a/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch6.d b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch6.d new file mode 100644 index 00000000000..7fe17eba862 --- /dev/null +++ b/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch6.d @@ -0,0 +1,61 @@ +// { dg-additional-options "-mavx" { target avx_runtime } } +// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } } +module gcc.simd; + +alias int4 = __vector(int[4]); +alias short8 = __vector(short[8]); +alias float4 = __vector(float[4]); +alias byte16 = __vector(byte[16]); +struct fake4 { int[4] v; } +enum f = fake4(); + +void test_blendvector() +{ + blendvector!(int, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } + blendvector!(double, int, int)(0, 0, 0); // { dg-warning "mismatch in return type" } + blendvector!(fake4, int, int)(f, 0, 0); // { dg-warning "mismatch in return type" } + + blendvector!(int4, int, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } + blendvector!(int4, double, int)(0, 0, 0); // { dg-warning "mismatch in argument 2" } + blendvector!(int4, fake4, int)(0, f, 0); // { dg-warning "mismatch in argument 2" } + + blendvector!(int4, int4, int)(0, 0, 0); // { dg-warning "mismatch in argument 3" } + blendvector!(int4, int4, double)(0, 0, 0); // { dg-warning "mismatch in argument 3" } + blendvector!(int4, int4, fake4)(0, 0, f); // { dg-warning "mismatch in argument 3" } + + blendvector!(int4, int4, int4)(0, 0, 0); + blendvector!(int4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(int4, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(int4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(int4, int4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(int4, int4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(int4, int4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } + + blendvector!(float4, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(float4, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(float4, float4, int4)(0, 0, 0); + blendvector!(float4, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(float4, float4, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(float4, float4, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(float4, float4, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } + + blendvector!(short8, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(short8, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(short8, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(short8, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(short8, short8, short8)(0, 0, 0); + blendvector!(short8, short8, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(short8, short8, byte16)(0, 0, 0); // { dg-error "mismatch in argument 3" } + + blendvector!(byte16, int4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(byte16, short8, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(byte16, float4, int4)(0, 0, 0); // { dg-error "mismatch in argument 2" } + blendvector!(byte16, byte16, int4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(byte16, byte16, short8)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(byte16, byte16, float4)(0, 0, 0); // { dg-error "mismatch in argument 3" } + blendvector!(byte16, byte16, byte16)(0, 0, 0); +} + +// The following declarations of the simd intrinsics are without any guards +// to verify `d/intrinsics.cc` is doing checks to prevent invalid lowerings. +V0 blendvector(V0, V1, M)(V0, V1, M); -- 2.43.0