Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 0e1c36c

Browse files
committed
Merge llvm/llvm-test-suite master branch into intel
2 parents e119c17 + 4bdbe4a commit 0e1c36c

File tree

14 files changed

+390
-6
lines changed

14 files changed

+390
-6
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_SUITE_EXTRA_CXX_FLAGS}")
170170
set(CMAKE_EXE_LINKER_FLAGS
171171
"${CMAKE_EXE_LINKER_FLAGS} ${TEST_SUITE_EXTRA_EXE_LINKER_FLAGS}")
172172

173+
# Use X/OPEN compatibility flag on AIX for C tests to avoid problems
174+
# with some versions of the system headers.
175+
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
176+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700")
177+
endif()
178+
173179
# This is either directly the C++ ABI library or the full C++ library
174180
# which pulls in the ABI transitively.
175181
set(TEST_SUITE_CXX_ABI "default" CACHE STRING "Specify C++ ABI library to use.")

External/CUDA/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ macro(create_cuda_tests)
269269
if(EXISTS ${_path_to_libcxx})
270270
add_library(libcxx SHARED IMPORTED)
271271
set_property(TARGET libcxx PROPERTY IMPORTED_LOCATION ${_path_to_libcxx})
272+
get_filename_component(_libcxx_dir ${_path_to_libcxx} DIRECTORY)
273+
target_link_options(libcxx INTERFACE "-Wl,-rpath,${_libcxx_dir}")
272274
set(HAVE_LIBCXX 1)
273275
else()
274276
message(WARNING "Can't find libcxx location.")

External/CUDA/lit.local.cfg

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cuda_env_vars = [
88
'CUDA_CACHE_PATH',
99
'CUDA_FORCE_PTX_JIT',
1010
'CUDA_VISIBLE_DEVICES',
11+
'LD_LIBRARY_PATH',
1112
]
1213

1314
# We need to propagate cuda environment vars to tests so we can
@@ -17,8 +18,3 @@ for var in cuda_env_vars:
1718
config.environment[var] = os.environ[var]
1819

1920
config.traditional_output = True
20-
21-
# "compiletime" wants to traverse whole build directory after each test which
22-
# takes a lot of time if we have config with split thrust tests. Disable it
23-
# until it has smaller overhead.
24-
config.test_modules.remove("compiletime")

HashProgramOutput.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fi
1818

1919
mv $1 $1.bak
2020
if [ $is_md5sum = "0" ]; then
21-
$md5cmd < $1.bak > $1
21+
$md5cmd -q < $1.bak > $1
2222
else
2323
$md5cmd < $1.bak | cut -d' ' -f 1 > $1
2424
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(Int128)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set(CMAKE_CXX_STANDARD 14)
2+
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
3+
4+
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
5+
6+
llvm_test_executable(Builtins main.cpp)
7+
8+
target_link_libraries(Builtins benchmark)
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#include <algorithm>
2+
#include <cstdint>
3+
#include <limits>
4+
#include <random>
5+
#include <type_traits>
6+
#include <vector>
7+
8+
#include "benchmark/benchmark.h"
9+
10+
#if defined(__SIZEOF_INT128__)
11+
12+
namespace {
13+
14+
constexpr size_t kSampleSize = 1 << 20;
15+
16+
// Some implementations of <random> do not support __int128_t when it is
17+
// available, so we make our own uniform_int_distribution-like type.
18+
template <typename T>
19+
class UniformIntDistribution128 {
20+
public:
21+
T operator()(std::mt19937& generator) {
22+
return (static_cast<T>(dist64_(generator)) << 64) | dist64_(generator);
23+
}
24+
25+
private:
26+
using H = typename std::conditional<
27+
std::is_same<T, __int128_t>::value, int64_t, uint64_t>::type;
28+
std::uniform_int_distribution<H> dist64_;
29+
};
30+
31+
// Generates uniformly pairs (a, b) of 128-bit integers such as a >= b.
32+
template <typename T>
33+
std::vector<std::pair<T, T>> GetRandomIntrinsic128SampleUniformDivisor() {
34+
std::vector<std::pair<T, T>> values;
35+
std::mt19937 random;
36+
UniformIntDistribution128<T> uniform_128;
37+
values.reserve(kSampleSize);
38+
for (size_t i = 0; i < kSampleSize; ++i) {
39+
T a = uniform_128(random);
40+
T b = uniform_128(random);
41+
values.emplace_back(std::max(static_cast<T>(2), std::max(a, b)),
42+
std::max(static_cast<T>(2), std::min(a, b)));
43+
}
44+
return values;
45+
}
46+
47+
template <typename T>
48+
void BM_DivideIntrinsic128UniformDivisor(benchmark::State& state) {
49+
auto values = GetRandomIntrinsic128SampleUniformDivisor<T>();
50+
size_t i = 0;
51+
for (const auto _ : state) {
52+
benchmark::DoNotOptimize(values[i].first / values[i].second);
53+
i = (i + 1) % kSampleSize;
54+
}
55+
}
56+
BENCHMARK_TEMPLATE(BM_DivideIntrinsic128UniformDivisor, __uint128_t);
57+
BENCHMARK_TEMPLATE(BM_DivideIntrinsic128UniformDivisor, __int128_t);
58+
59+
template <typename T>
60+
void BM_RemainderIntrinsic128UniformDivisor(benchmark::State& state) {
61+
auto values = GetRandomIntrinsic128SampleUniformDivisor<T>();
62+
size_t i = 0;
63+
for (const auto _ : state) {
64+
benchmark::DoNotOptimize(values[i].first % values[i].second);
65+
i = (i + 1) % kSampleSize;
66+
}
67+
}
68+
BENCHMARK_TEMPLATE(BM_RemainderIntrinsic128UniformDivisor, __uint128_t);
69+
BENCHMARK_TEMPLATE(BM_RemainderIntrinsic128UniformDivisor, __int128_t);
70+
71+
// Generates random pairs of (a, b) where a >= b, a is 128-bit and
72+
// b is 64-bit.
73+
template <typename T, typename H = typename std::conditional<
74+
std::is_same<T, __int128_t>::value, int64_t, uint64_t>::type>
75+
std::vector<std::pair<T, H>> GetRandomIntrinsic128SampleSmallDivisor() {
76+
std::vector<std::pair<T, H>> values;
77+
std::mt19937 random;
78+
UniformIntDistribution128<T> uniform_int128;
79+
std::uniform_int_distribution<H> uniform_int64;
80+
values.reserve(kSampleSize);
81+
for (size_t i = 0; i < kSampleSize; ++i) {
82+
T a = uniform_int128(random);
83+
H b = std::max(H{2}, uniform_int64(random));
84+
values.emplace_back(std::max(a, static_cast<T>(b)), b);
85+
}
86+
return values;
87+
}
88+
89+
template <typename T>
90+
void BM_DivideIntrinsic128SmallDivisor(benchmark::State& state) {
91+
auto values = GetRandomIntrinsic128SampleSmallDivisor<T>();
92+
size_t i = 0;
93+
for (const auto _ : state) {
94+
benchmark::DoNotOptimize(values[i].first / values[i].second);
95+
i = (i + 1) % kSampleSize;
96+
}
97+
}
98+
BENCHMARK_TEMPLATE(BM_DivideIntrinsic128SmallDivisor, __uint128_t);
99+
BENCHMARK_TEMPLATE(BM_DivideIntrinsic128SmallDivisor, __int128_t);
100+
101+
template <typename T>
102+
void BM_RemainderIntrinsic128SmallDivisor(benchmark::State& state) {
103+
auto values = GetRandomIntrinsic128SampleSmallDivisor<T>();
104+
size_t i = 0;
105+
for (const auto _ : state) {
106+
benchmark::DoNotOptimize(values[i].first % values[i].second);
107+
i = (i + 1) % kSampleSize;
108+
}
109+
}
110+
BENCHMARK_TEMPLATE(BM_RemainderIntrinsic128SmallDivisor, __uint128_t);
111+
BENCHMARK_TEMPLATE(BM_RemainderIntrinsic128SmallDivisor, __int128_t);
112+
113+
} // namespace
114+
115+
#endif
116+
117+
BENCHMARK_MAIN();

MicroBenchmarks/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
file(COPY lit.local.cfg DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
22

3+
add_subdirectory(Builtins)
34
add_subdirectory(libs)
45
add_subdirectory(XRay)
56
add_subdirectory(LCALS)

MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
list(APPEND CXXFLAGS -I. -DMINIFE_SCALAR=double -DMINIFE_LOCAL_ORDINAL=int -DMINIFE_GLOBAL_ORDINAL=int -DMINIFE_CSR_MATRIX -DREDSTORM) # -DREDSTORM for mkdir
2+
# Use X/OPEN compatibility flag on AIX to avoid problems with some
3+
# versions of the system headers. Define "UseTimes" to avoid usages of
4+
# "struct timezone" in some source files because it's not available on
5+
# AIX when the compatibility flag is set.
6+
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
7+
list(APPEND CXXFLAGS -D_XOPEN_SOURCE=700 -DUseTimes)
8+
endif()
29
list(APPEND LDFLAGS -lm)
310
set(RUN_OPTIONS -nx 64 -ny 64 -nz 64)
411
llvm_multisource(miniFE)

SingleSource/Regression/C/gcc-c-torture/execute/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ file(GLOB UnsupportedTests CONFIGURE_DEPENDS
9999
# UB: Creates two `restrict` pointers that alias in the same scope.
100100
pr38212.c
101101

102+
# UB: Each comparisons in (cyx != cyy || mpn_cmp (dx, dy, size + 1) != 0 ||
103+
# dx[size] != 0x12345678) is UB on its own.
104+
921202-1.c
105+
102106
# The following all expect very specific optimiser behavior from the compiler
103107

104108
# __builtin_return_address(n) with n > 0 not guaranteed to give expected result

SingleSource/UnitTests/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(CheckCCompilerFlag)
2+
13
add_subdirectory(C++11)
24
add_subdirectory(SignlessTypes)
35
add_subdirectory(Threads)
@@ -45,4 +47,13 @@ if(NOT ARCH STREQUAL "x86")
4547
ms_struct_pack_layout-1.c
4648
)
4749
endif()
50+
51+
# Enable matrix types extension tests for compilers supporting -fenable-matrix.
52+
check_c_compiler_flag(-fenable-matrix COMPILER_HAS_MATRIX_FLAG)
53+
if (COMPILER_HAS_MATRIX_FLAG)
54+
set_property(SOURCE matrix-types-spec.cpp PROPERTY COMPILE_FLAGS -fenable-matrix)
55+
else()
56+
list(REMOVE_ITEM Source matrix-types-spec.cpp)
57+
endif()
58+
4859
llvm_singlesource()

0 commit comments

Comments
 (0)