1 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s 2 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -target-feature +avx -emit-llvm -o - %s | FileCheck %s 3 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -target-feature +avx512f -emit-llvm -o - %s | FileCheck %s 4 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw -emit-llvm -o - %s | FileCheck %s 5 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw -target-feature +avx -emit-llvm -o - %s | FileCheck %s 6 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw -target-feature +avx512f -emit-llvm -o - %s | FileCheck %s 7 8 #include <immintrin.h> 9 10 // CHECK-LABEL: define dso_local void @testm128 11 // CHECK-LABEL: %argp.cur = load i8*, i8** %args, align 4 12 // CHECK-NEXT: %0 = ptrtoint i8* %argp.cur to i32 13 // CHECK-NEXT: %1 = add i32 %0, 15 14 // CHECK-NEXT: %2 = and i32 %1, -16 15 // CHECK-NEXT: %argp.cur.aligned = inttoptr i32 %2 to i8* 16 void testm128(int argCount, ...) { 17 __m128 res; 18 __builtin_va_list args; 19 __builtin_va_start(args, argCount); 20 res = __builtin_va_arg(args, __m128); 21 __builtin_va_end(args); 22 } 23 24 // CHECK-LABEL: define dso_local void @testm256 25 // CHECK-LABEL: %argp.cur = load i8*, i8** %args, align 4 26 // CHECK-NEXT: %0 = ptrtoint i8* %argp.cur to i32 27 // CHECK-NEXT: %1 = add i32 %0, 31 28 // CHECK-NEXT: %2 = and i32 %1, -32 29 // CHECK-NEXT: %argp.cur.aligned = inttoptr i32 %2 to i8* 30 void testm256(int argCount, ...) { 31 __m256 res; 32 __builtin_va_list args; 33 __builtin_va_start(args, argCount); 34 res = __builtin_va_arg(args, __m256); 35 __builtin_va_end(args); 36 } 37 38 // CHECK-LABEL: define dso_local void @testm512 39 // CHECK-LABEL: %argp.cur = load i8*, i8** %args, align 4 40 // CHECK-NEXT: %0 = ptrtoint i8* %argp.cur to i32 41 // CHECK-NEXT: %1 = add i32 %0, 63 42 // CHECK-NEXT: %2 = and i32 %1, -64 43 // CHECK-NEXT: %argp.cur.aligned = inttoptr i32 %2 to i8* 44 void testm512(int argCount, ...) { 45 __m512 res; 46 __builtin_va_list args; 47 __builtin_va_start(args, argCount); 48 res = __builtin_va_arg(args, __m512); 49 __builtin_va_end(args); 50 } 51 52 // CHECK-LABEL: define dso_local void @testPastArguments 53 // CHECK: call void (i32, ...) @testm128(i32 noundef 1, <4 x float> noundef %0) 54 // CHECK: call void (i32, ...) @testm256(i32 noundef 1, <8 x float> noundef %1) 55 // CHECK: call void (i32, ...) @testm512(i32 noundef 1, <16 x float> noundef %2) 56 void testPastArguments(void) { 57 __m128 a; 58 __m256 b; 59 __m512 c; 60 testm128(1, a); 61 testm256(1, b); 62 testm512(1, c); 63 } 64