1 // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX
2 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX
3 // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX
4 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX
6 #define SYSV_CC __attribute__((sysv_abi))
8 // Make sure we coerce structs according to the SysV rules instead of passing
9 // them indirectly as we would for Win64.
14 extern volatile char gc
;
15 void SYSV_CC
take_stringref(struct StringRef s
);
17 struct StringRef s
= {"asdf", 4};
20 // CHECK: define {{(dso_local )?}}void @callit()
21 // CHECK: call {{(x86_64_sysvcc )?}}void @take_stringref(ptr {{[^,]*}}, i64 {{[^,]*}})
22 // CHECK: declare {{(dso_local )?}}{{(x86_64_sysvcc )?}}void @take_stringref(ptr, i64)
24 // Check that we pass vectors directly if the target feature is enabled, and
26 typedef __attribute__((vector_size(32))) float my_m256
;
27 typedef __attribute__((vector_size(64))) float my_m512
;
29 my_m256 SYSV_CC
get_m256(void);
30 void SYSV_CC
take_m256(my_m256
);
31 my_m512 SYSV_CC
get_m512(void);
32 void SYSV_CC
take_m512(my_m512
);
34 void use_vectors(void) {
35 my_m256 v1
= get_m256();
37 my_m512 v2
= get_m512();
41 // CHECK: define {{(dso_local )?}}void @use_vectors()
42 // AVX: call {{(x86_64_sysvcc )?}}<8 x float> @get_m256()
43 // AVX: call {{(x86_64_sysvcc )?}}void @take_m256(<8 x float> noundef %{{.*}})
44 // AVX: call {{(x86_64_sysvcc )?}}<16 x float> @get_m512()
45 // AVX: call {{(x86_64_sysvcc )?}}void @take_m512(<16 x float> noundef %{{.*}})
46 // NOAVX: call {{(x86_64_sysvcc )?}}<8 x float> @get_m256()
47 // NOAVX: call {{(x86_64_sysvcc )?}}void @take_m256(ptr noundef byval(<8 x float>) align 32 %{{.*}})
48 // NOAVX: call {{(x86_64_sysvcc )?}}<16 x float> @get_m512()
49 // NOAVX: call {{(x86_64_sysvcc )?}}void @take_m512(ptr noundef byval(<16 x float>) align 64 %{{.*}})