[libcxx-commits] [libcxx] 9bd9cbf - [libc++][AIX] Fix trivial_abi return tests for unique_ptr/weak_ptr
Jinsong Ji via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 23 11:23:03 PST 2022
Author: Jinsong Ji
Date: 2022-02-23T14:22:34-05:00
New Revision: 9bd9cbfa2f7b60ddb95cb321eaf2a4804aeef611
URL: https://github.com/llvm/llvm-project/commit/9bd9cbfa2f7b60ddb95cb321eaf2a4804aeef611
DIFF: https://github.com/llvm/llvm-project/commit/9bd9cbfa2f7b60ddb95cb321eaf2a4804aeef611.diff
LOG: [libc++][AIX] Fix trivial_abi return tests for unique_ptr/weak_ptr
The unique_ptr_ret and weak_ptr_ret tests are not expected to pass on
AIX. These tests check that unique_ptr and weak_ptr are returned by
value, but on AIX, all structs are always returned by reference.
```
3.9.6 Function Return Values
...
Note: Structures of any length and character strings longer than four
bytes are returned in a storage buffer allocated by the caller. The
address of this buffer is passed as a hidden first argument in GPR3,
which causes the first explicit argument word to be passed in GPR4. This
hidden argument is treated as a formal argument and corresponds to the
first word of the argument area.
```
Reviewed By: #powerpc, daltenty, #libc, Quuxplusone, philnik
Differential Revision: https://reviews.llvm.org/D119952
Added:
Modified:
libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
index 01db9b806a433..946786e3d3016 100644
--- a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: LIBCXX-AIX-FIXME
-
// <memory>
// Test unique_ptr<T> with trivial_abi as return-type.
@@ -47,8 +45,9 @@ int main(int, char**) {
//
// With trivial_abi, local_addr is the address of a local variable in
// make_val, and hence
diff erent from &ret.
-#if !defined(__i386__) && !defined(_WIN32)
+#if !defined(__i386__) && !defined(_WIN32) && !defined(_AIX)
// On X86, structs are never returned in registers.
+ // On AIX, structs are never returned in registers.
// Thus, unique_ptr will be passed indirectly even if it is trivial.
// On Windows, structs with a destructor are always returned indirectly.
assert((void*)&ret != local_addr);
diff --git a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
index 3e3d978e79ad6..050073c4a6d7f 100644
--- a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
@@ -13,7 +13,6 @@
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
// XFAIL: gcc
-// XFAIL: LIBCXX-AIX-FIXME
#include <memory>
#include <cassert>
@@ -49,8 +48,9 @@ int main(int, char**) {
//
// With trivial_abi, local_addr is the address of a local variable in
// make_val, and hence
diff erent from &ret.
-#if !defined(__i386__) && !defined(__arm__) && !defined(_WIN32)
+#if !defined(__i386__) && !defined(__arm__) && !defined(_WIN32) && !defined(_AIX)
// On X86, structs are never returned in registers.
+ // On AIX, structs are never returned in registers.
// On ARM32, structs larger than 4 bytes cannot be returned in registers.
// On Windows, structs with a destructor are always returned indirectly.
// Thus, weak_ptr will be passed indirectly even if it is trivial.
More information about the libcxx-commits
mailing list