================
@@ -0,0 +1,15 @@
+/// Tests that preprocessing succeeds with different getBuiltinVaListKind() 
delegations.
+
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -aux-triple 
x86_64-unknown-linux-gnu \
+// RUN:   -fsycl-is-device -E -dM %s | FileCheck --check-prefix=LINUX %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -aux-triple 
x86_64-pc-windows-msvc \
+// RUN:   -fsycl-is-device -E -dM %s | FileCheck --check-prefix=WIN %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -aux-triple 
aarch64-unknown-linux-gnu \
+// RUN:   -fsycl-is-device -E -dM %s | FileCheck --check-prefix=AARCH64 %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown \
+// RUN:   -fsycl-is-device -E -dM %s | FileCheck --check-prefix=NOHOST %s
+
+// LINUX: #define __SPIRV64__ 1
+// WIN: #define __SPIRV64__ 1
+// AARCH64: #define __SPIRV64__ 1
+// NOHOST: #define __SPIRV64__ 1
----------------
tahonermann wrote:

Here is a simple test that exercises the stdarg builtins.
```
int f(int n, ...) {
  __builtin_va_list ap1, ap2;
  __builtin_va_start(ap1, n);
  int v = __builtin_va_arg(ap1, int);
  __builtin_va_copy(ap2, ap1);
  __builtin_va_end(ap1);
  __builtin_va_end(ap2);
  return v;
}
int g() {
  return f(0, 1);
}
```

The LLVM IR can then be checked for the following (with suitable elisions).
```
CHECK-LINUX:  define dso_local noundef i32 @_Z1fiz(i32 noundef %n, ...) #0 {
CHECK-LINUX:    %ap1 = alloca [1 x %struct.__va_list_tag], align 16
CHECK-LINUX:    %ap2 = alloca [1 x %struct.__va_list_tag], align 16
CHECK-WINDOWS:define dso_local noundef i32 @"?f@@YAHHZZ"(i32 noundef %n, ...) 
#0 {
CHECK-WINDOWS:  %ap1 = alloca ptr, align 8
CHECK-WINDOWS:  %ap2 = alloca ptr, align 8

```

https://github.com/llvm/llvm-project/pull/208196
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to