83 lines · c
1// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s2// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s3 4// REQUIRES: aarch64-registered-target5// Note: -fopemp and -fopenmp-simd behavior are expected to be the same.6 7// This test checks the values of Narrowest Data Size (NDS), as defined in8// https://github.com/ARM-software/abi-aa/tree/main/vfabia649//10// NDS is used to compute the <vlen> token in the name of AdvSIMD11// vector functions when no `simdlen` is specified, with the rule:12//13// if NDS(f) = 1, then VLEN = 16, 8;14// if NDS(f) = 2, then VLEN = 8, 4;15// if NDS(f) = 4, then VLEN = 4, 2;16// if NDS(f) = 8 or NDS(f) = 16, then VLEN = 2.17 18// NDS(NDS_is_sizeof_char) = 119#pragma omp declare simd notinbranch20char NDS_is_sizeof_char(short in);21// CHECK-DAG: _ZGVnN16v_NDS_is_sizeof_char22// CHECK-DAG: _ZGVnN8v_NDS_is_sizeof_char23// CHECK-NOT: _ZGV{{.*}}_NDS_is_sizeof_char24 25// NDS(NDS_is_sizeof_short) = 226#pragma omp declare simd notinbranch27int NDS_is_sizeof_short(short in);28// CHECK-DAG: _ZGVnN8v_NDS_is_sizeof_short29// CHECK-DAG: _ZGVnN4v_NDS_is_sizeof_short30// CHECK-NOT: _ZGV{{.*}}_NDS_is_sizeof_short31 32// NDS(NDS_is_sizeof_float_with_linear) = 4, and not 2, because the pointers are33// marked as `linear` and therefore the size of the pointee realizes34// the NDS.35#pragma omp declare simd linear(sin) notinbranch36void NDS_is_sizeof_float_with_linear(double in, float *sin);37// Neon accepts only power of 2 values as <vlen>.38// CHECK-DAG: _ZGVnN4vl4_NDS_is_sizeof_float_with_linear39// CHECK-DAG: _ZGVnN2vl4_NDS_is_sizeof_float_with_linear40// CHECK-NOT: _ZGV{{.*}}_NDS_is_sizeof_float_with_linear41 42// NDS(NDS_is_size_of_float) = 443#pragma omp declare simd notinbranch44double NDS_is_size_of_float(float in);45// CHECK-DAG: _ZGVnN4v_NDS_is_size_of_float46// CHECK-DAG: _ZGVnN2v_NDS_is_size_of_float47// CHECK-NOT: _ZGV{{.*}}_NDS_is_size_of_float48 49// NDS(NDS_is_sizeof_double) = 850#pragma omp declare simd linear(sin) notinbranch51void NDS_is_sizeof_double(double in, double *sin);52// CHECK-DAG: _ZGVnN2vl8_NDS_is_sizeof_double53// CHECK-NOT: _ZGV{{.*}}_NDS_is_sizeof_double54 55// NDS(double_complex) = 1656#pragma omp declare simd notinbranch57double _Complex double_complex(double _Complex);58// CHECK-DAG: _ZGVnN2v_double_complex59// CHECK-NOT: _ZGV{{.*}}_double_complex60 61// NDS(double_complex_linear_char) = 1, becasue `x` is marked linear.62#pragma omp declare simd linear(x) notinbranch63double _Complex double_complex_linear_char(double _Complex y, char *x);64// CHECK-DAG: _ZGVnN8vl_double_complex_linear_char65// CHECK-DAG: _ZGVnN16vl_double_complex_linear_char66// CHECK-NOT: _ZGV{{.*}}_double_complex_linear_char67 68static float *F;69static double *D;70static short S;71static int I;72static char C;73static double _Complex DC;74void do_something() {75 C = NDS_is_sizeof_char(S);76 I = NDS_is_sizeof_short(S);77 NDS_is_sizeof_float_with_linear(*D, F);78 *D = NDS_is_size_of_float(*F);79 NDS_is_sizeof_double(*D, D);80 DC = double_complex(DC);81 DC = double_complex_linear_char(DC, &C);82}83