| 1 |
// RUN: %clang_cc1 -x c++ -emit-llvm -triple=mips-unknown-linux-gnu < %s | FileCheck --check-prefix=O32 %s |
| 2 |
// RUN: %clang_cc1 -x c++ -emit-llvm -triple=mips64-unknown-linux-gnu -target-abi n32 < %s | FileCheck --check-prefix=N32 %s |
| 3 |
// RUN: %clang_cc1 -x c++ -emit-llvm -triple=mips64-unknown-linux-gnu -target-abi n64 < %s | FileCheck --check-prefix=N64 %s |
| 4 |
|
| 5 |
// Test that the size_t is correct for the ABI. It's not sufficient to be the |
| 6 |
// correct size, it must be the same type for correct name mangling. |
| 7 |
|
| 8 |
long *alloc_long() { |
| 9 |
long *rv = new long; // size_t is implicit in the new operator |
| 10 |
return rv; |
| 11 |
} |
| 12 |
// O32-LABEL: define{{.*}} ptr @_Z10alloc_longv() |
| 13 |
// O32: call noalias noundef nonnull ptr @_Znwj(i32 noundef signext 4) |
| 14 |
|
| 15 |
// N32-LABEL: define{{.*}} ptr @_Z10alloc_longv() |
| 16 |
// N32: call noalias noundef nonnull ptr @_Znwj(i32 noundef signext 4) |
| 17 |
|
| 18 |
// N64-LABEL: define{{.*}} ptr @_Z10alloc_longv() |
| 19 |
// N64: call noalias noundef nonnull ptr @_Znwm(i64 noundef zeroext 8) |
| 20 |
|
| 21 |
long *alloc_long_array() { |
| 22 |
long *rv = new long[2]; |
| 23 |
return rv; |
| 24 |
} |
| 25 |
|
| 26 |
// O32-LABEL: define{{.*}} ptr @_Z16alloc_long_arrayv() |
| 27 |
// O32: call noalias noundef nonnull ptr @_Znaj(i32 noundef signext 8) |
| 28 |
|
| 29 |
// N32-LABEL: define{{.*}} ptr @_Z16alloc_long_arrayv() |
| 30 |
// N32: call noalias noundef nonnull ptr @_Znaj(i32 noundef signext 8) |
| 31 |
|
| 32 |
// N64-LABEL: define{{.*}} ptr @_Z16alloc_long_arrayv() |
| 33 |
// N64: call noalias noundef nonnull ptr @_Znam(i64 noundef zeroext 16) |
| 34 |
|
| 35 |
#include <stddef.h> |
| 36 |
|
| 37 |
void size_t_arg(size_t a) { |
| 38 |
} |
| 39 |
|
| 40 |
// O32-LABEL: _Z10size_t_argj |
| 41 |
// N32-LABEL: _Z10size_t_argj |
| 42 |
// N64-LABEL: _Z10size_t_argm |
| 43 |
|
| 44 |
void ptrdiff_t_arg(ptrdiff_t a) { |
| 45 |
} |
| 46 |
|
| 47 |
// O32-LABEL: _Z13ptrdiff_t_argi |
| 48 |
// N32-LABEL: _Z13ptrdiff_t_argi |
| 49 |
// N64-LABEL: _Z13ptrdiff_t_argl |