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