| 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 ptr, ptr %args, align 4 |
| 12 |
// CHECK-NEXT: %0 = getelementptr inbounds i8, ptr %argp.cur, i32 15 |
| 13 |
// CHECK-NEXT: %argp.cur.aligned = call ptr @llvm.ptrmask.p0.i32(ptr %0, i32 -16) |
| 14 |
void testm128(int argCount, ...) { |
| 15 |
__m128 res; |
| 16 |
__builtin_va_list args; |
| 17 |
__builtin_va_start(args, argCount); |
| 18 |
res = __builtin_va_arg(args, __m128); |
| 19 |
__builtin_va_end(args); |
| 20 |
} |
| 21 |
|
| 22 |
// CHECK-LABEL: define dso_local void @testm256 |
| 23 |
// CHECK-LABEL: %argp.cur = load ptr, ptr %args, align 4 |
| 24 |
// CHECK-NEXT: %0 = getelementptr inbounds i8, ptr %argp.cur, i32 31 |
| 25 |
// CHECK-NEXT: %argp.cur.aligned = call ptr @llvm.ptrmask.p0.i32(ptr %0, i32 -32) |
| 26 |
void testm256(int argCount, ...) { |
| 27 |
__m256 res; |
| 28 |
__builtin_va_list args; |
| 29 |
__builtin_va_start(args, argCount); |
| 30 |
res = __builtin_va_arg(args, __m256); |
| 31 |
__builtin_va_end(args); |
| 32 |
} |
| 33 |
|
| 34 |
// CHECK-LABEL: define dso_local void @testm512 |
| 35 |
// CHECK-LABEL: %argp.cur = load ptr, ptr %args, align 4 |
| 36 |
// CHECK-NEXT: %0 = getelementptr inbounds i8, ptr %argp.cur, i32 63 |
| 37 |
// CHECK-NEXT: %argp.cur.aligned = call ptr @llvm.ptrmask.p0.i32(ptr %0, i32 -64) |
| 38 |
void testm512(int argCount, ...) { |
| 39 |
__m512 res; |
| 40 |
__builtin_va_list args; |
| 41 |
__builtin_va_start(args, argCount); |
| 42 |
res = __builtin_va_arg(args, __m512); |
| 43 |
__builtin_va_end(args); |
| 44 |
} |
| 45 |
|
| 46 |
// CHECK-LABEL: define dso_local void @testPastArguments |
| 47 |
// CHECK: call void (i32, ...) @testm128(i32 noundef 1, <4 x float> noundef %0) |
| 48 |
// CHECK: call void (i32, ...) @testm256(i32 noundef 1, <8 x float> noundef %1) |
| 49 |
// CHECK: call void (i32, ...) @testm512(i32 noundef 1, <16 x float> noundef %2) |
| 50 |
void testPastArguments(void) { |
| 51 |
__m128 a; |
| 52 |
__m256 b; |
| 53 |
__m512 c; |
| 54 |
testm128(1, a); |
| 55 |
testm256(1, b); |
| 56 |
testm512(1, c); |
| 57 |
} |