This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<complex>: Force aligning to the total size of both components in com…
…plex<T>
- Loading branch information
Showing
4 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
.upstream-tests/test/std/numerics/complex.number/complex/abi_latest.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <cuda/std/complex> | ||
|
||
// template<class T> | ||
// class complex | ||
// { | ||
// public: | ||
// typedef T value_type; | ||
// ... | ||
// }; | ||
|
||
#include <cuda/std/complex> | ||
#include <cuda/std/type_traits> | ||
|
||
#include "test_macros.h" | ||
|
||
template <class T> | ||
__host__ __device__ void | ||
test() | ||
{ | ||
typedef cuda::std::complex<T> C; | ||
|
||
static_assert(sizeof(C) == (sizeof(T)*2), "wrong size"); | ||
static_assert(alignof(C) == (alignof(T)*2), "misaligned"); | ||
} | ||
|
||
int main(int, char**) | ||
{ | ||
test<float>(); | ||
test<double>(); | ||
// CUDA treats long double as double | ||
// test<long double>(); | ||
|
||
return 0; | ||
} |
44 changes: 44 additions & 0 deletions
44
.upstream-tests/test/std/numerics/complex.number/complex/abi_v3.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <cuda/std/complex> | ||
|
||
// template<class T> | ||
// class complex | ||
// { | ||
// public: | ||
// typedef T value_type; | ||
// ... | ||
// }; | ||
|
||
#define _LIBCUDACXX_CUDA_ABI_VERSION 3 | ||
|
||
#include <cuda/std/complex> | ||
#include <cuda/std/type_traits> | ||
|
||
#include "test_macros.h" | ||
|
||
template <class T> | ||
__host__ __device__ void | ||
test() | ||
{ | ||
typedef cuda::std::complex<T> C; | ||
|
||
static_assert(sizeof(C) == (sizeof(T)*2), "wrong size"); | ||
static_assert(alignof(C) == (alignof(T)), "misaligned"); | ||
} | ||
|
||
int main(int, char**) | ||
{ | ||
test<float>(); | ||
test<double>(); | ||
// CUDA treats long double as double | ||
// test<long double>(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters