1*207e5cccSFangrui Song // RUN: %clang_cc1 -O3 -triple aarch64 -target-feature +sve -mvscale-min=1 -mvscale-max=1 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK-C 2*207e5cccSFangrui Song // RUN: %clang_cc1 -x c++ -O3 -triple aarch64 -target-feature +sve -mvscale-min=1 -mvscale-max=1 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK-CXX 3*207e5cccSFangrui Song 4*207e5cccSFangrui Song typedef __SVFloat32_t fvec32 __attribute__((arm_sve_vector_bits(128))); 5*207e5cccSFangrui Song 6*207e5cccSFangrui Song // PST containing an empty union: when compiled as C pass it in registers, 7*207e5cccSFangrui Song // when compiled as C++ - in memory. 8*207e5cccSFangrui Song typedef struct { 9*207e5cccSFangrui Song fvec32 x[4]; 10*207e5cccSFangrui Song union {} u; 11*207e5cccSFangrui Song } S0; 12*207e5cccSFangrui Song 13*207e5cccSFangrui Song #ifdef __cplusplus 14*207e5cccSFangrui Song extern "C" 15*207e5cccSFangrui Song #endif 16*207e5cccSFangrui Song void use0(S0); 17*207e5cccSFangrui Song 18*207e5cccSFangrui Song void f0(S0 *p) { 19*207e5cccSFangrui Song use0(*p); 20*207e5cccSFangrui Song } 21*207e5cccSFangrui Song // CHECK-C: declare void @use0(<vscale x 4 x float>, <vscale x 4 x float>, <vscale x 4 x float>, <vscale x 4 x float>) 22*207e5cccSFangrui Song // CHECK-CXX: declare void @use0(ptr noundef) 23*207e5cccSFangrui Song 24*207e5cccSFangrui Song #ifdef __cplusplus 25*207e5cccSFangrui Song 26*207e5cccSFangrui Song // PST containing an empty union with `[[no_unique_address]]`` - pass in registers. 27*207e5cccSFangrui Song typedef struct { 28*207e5cccSFangrui Song fvec32 x[4]; 29*207e5cccSFangrui Song [[no_unique_address]] 30*207e5cccSFangrui Song union {} u; 31*207e5cccSFangrui Song } S1; 32*207e5cccSFangrui Song 33*207e5cccSFangrui Song extern "C" void use1(S1); 34*207e5cccSFangrui Song void f1(S1 *p) { 35*207e5cccSFangrui Song use1(*p); 36*207e5cccSFangrui Song } 37*207e5cccSFangrui Song // CHECK-CXX: declare void @use1(<vscale x 4 x float>, <vscale x 4 x float>, <vscale x 4 x float>, <vscale x 4 x float>) 38*207e5cccSFangrui Song 39*207e5cccSFangrui Song #endif // __cplusplus 40