56 lines · c
1// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX2// RUN: %clang_cc1 -triple x86_64-mingw -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX3// RUN: %clang_cc1 -triple x86_64-cygwin -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX4// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX5// RUN: %clang_cc1 -triple x86_64-uefi -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX6// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX7// RUN: %clang_cc1 -triple x86_64-mingw -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX8// RUN: %clang_cc1 -triple x86_64-cygwin -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX9// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX10// RUN: %clang_cc1 -triple x86_64-uefi -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX11 12#define SYSV_CC __attribute__((sysv_abi))13 14// Make sure we coerce structs according to the SysV rules instead of passing15// them indirectly as we would for Win64.16struct StringRef {17 char *Str;18 __SIZE_TYPE__ Size;19};20extern volatile char gc;21void SYSV_CC take_stringref(struct StringRef s);22void callit(void) {23 struct StringRef s = {"asdf", 4};24 take_stringref(s);25}26// CHECK: define {{(dso_local )?}}void @callit()27// CHECK: call {{(x86_64_sysvcc )?}}void @take_stringref(ptr {{[^,]*}}, i64 {{[^,]*}})28// CHECK: declare {{(dso_local )?}}{{(x86_64_sysvcc )?}}void @take_stringref(ptr, i64)29 30// Check that we pass vectors directly if the target feature is enabled, and31// not otherwise.32typedef __attribute__((vector_size(32))) float my_m256;33typedef __attribute__((vector_size(64))) float my_m512;34 35my_m256 SYSV_CC get_m256(void);36void SYSV_CC take_m256(my_m256);37my_m512 SYSV_CC get_m512(void);38void SYSV_CC take_m512(my_m512);39 40void use_vectors(void) {41 my_m256 v1 = get_m256();42 take_m256(v1);43 my_m512 v2 = get_m512();44 take_m512(v2);45}46 47// CHECK: define {{(dso_local )?}}void @use_vectors()48// AVX: call {{(x86_64_sysvcc )?}}<8 x float> @get_m256()49// AVX: call {{(x86_64_sysvcc )?}}void @take_m256(<8 x float> noundef %{{.*}})50// AVX: call {{(x86_64_sysvcc )?}}<16 x float> @get_m512()51// AVX: call {{(x86_64_sysvcc )?}}void @take_m512(<16 x float> noundef %{{.*}})52// NOAVX: call {{(x86_64_sysvcc )?}}<8 x float> @get_m256()53// NOAVX: call {{(x86_64_sysvcc )?}}void @take_m256(ptr noundef byval(<8 x float>) align 32 %{{.*}})54// NOAVX: call {{(x86_64_sysvcc )?}}<16 x float> @get_m512()55// NOAVX: call {{(x86_64_sysvcc )?}}void @take_m512(ptr noundef byval(<16 x float>) align 64 %{{.*}})56