Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -33,11 +33,13 @@ add_library(pstl::ParallelSTL ALIAS ParallelSTL) if (PARALLELSTL_USE_PARALLEL_POLICIES) + message(STATUS "Using Parallel Policies") if (PARALLELSTL_BACKEND STREQUAL "tbb") find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc) message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})") target_link_libraries(ParallelSTL INTERFACE TBB::tbb) - else() + else() + message(STATUS "Using Parallel Policies, but not tbb") if (TARGET ${PARALLELSTL_BACKEND}) target_link_libraries(ParallelSTL INTERFACE ${PARALLELSTL_BACKEND}) else() @@ -69,3 +71,4 @@ enable_testing() add_subdirectory(test) + Index: build/Makefile =================================================================== --- build/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -#===-- Makefile ----------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -#------------------------------------------------------------------------------ -# Define rules for making the Parallel STL library. -#------------------------------------------------------------------------------ - - -proj_root ?= $(CURDIR)/.. - -include $(proj_root)/build/Makefile.common -CPLUS := $(compiler) $(COMPILER_NOLOGO_KEY) $(USE_SHARED_CPPRUNTIME_KEY) - -.SECONDARY: -.PHONY: clean clean_all clean_pstl bench - -VPATH = $(proj_root)/test - -CPLUS_FLAGS += -I$(proj_root) - -PSTL_MAKEFILE = $(proj_root)/build/Makefile.pstl -BENCH_MAKEFILE = $(proj_root)/build/Makefile.bench - - -test_hdr = $(wildcard $(proj_root)/test/*.h) -test_src = $(wildcard $(proj_root)/test/test_*.cpp) -test_bin = $(notdir $(test_src:.cpp=.exe)) - - -all: $(test_bin) - -test_%.offload.exe: test_%.offload$(OBJ_SFX) exception_list.offload$(OBJ_SFX) - $(CPLUS) $(CPLUS_FLAGS) $^ $(FKEY)o$@ $(LDFLAGS) - -$(PSTL_LIB_NAME): - $(MAKE) -f $(PSTL_MAKEFILE) backend=$(backend) cfg=$(cfg) - -test_%.exe: test_%$(OBJ_SFX) $(PSTL_LIB_NAME) - $(LD) $< $(LD_OUT_KEY)$@ $(LDFLAGS) $(DYN_LDFLAGS) $(PSTL_LIB_LINK) - -test_%: test_%.exe - $(run_cmd) $(RUN_CMD)test_$*.exe - -test_%$(OBJ_SFX): test_%.cpp $(test_hdr) $(proj_root)/build/Makefile - $(CPLUS) $(CPLUS_FLAGS) -c $< $(FKEY)o$@ - -# This definition intentionally consists of two blank lines -define eol - - -endef - -test: $(test_bin) - $(foreach test, $(test_bin), $(run_cmd) $(RUN_CMD)$(test) $(args) $(eol)) - -%.s: %.cpp $(proj_root)/build/Makefile - $(CPLUS) $(CPLUS_FLAGS) -S $< $(FKEY)o$@ - -%.E: %.cpp - $(CPLUS) $(CPLUS_FLAGS) -E $< >$@ - -TEMPLATE_FILES=$(wildcard $(proj_root)/bench/*.*tmpl) -BENCH_COMMON_FILES=$(wildcard $(proj_root)/bench/*.h) $(wildcard $(proj_root)/bench/*.cpp) - -$(BENCH_MAKEFILE): $(proj_root)/bench/algorithm.json $(proj_root)/bench/gen.py $(TEMPLATE_FILES) - $(PYTHON) $(proj_root)/bench/gen.py $(proj_root)/bench/algorithm.json - -bench : $(BENCH_MAKEFILE) $(BENCH_COMMON_FILES) $(PSTL_LIB_NAME) - @echo TEMPLATE_FILES=$(TEMPLATE_FILES) - @echo proj_root=$(proj_root) - ls -la $(proj_root)/bench/gen.py - $(MAKE) -f $(BENCH_MAKEFILE) - -clean_bench: - $(DEL_CMD) $(BENCH_MAKEFILE) - $(DEL_CMD) batch.py - $(DEL_CMD) $(proj_root)/build/bench/*.* - -clean: - $(DEL_CMD) *$(OBJ_SFX) *.exe *.E *.s *.asm *.d *.pdb *.pdb *.suo *.ilk - -clean_pstl: - $(MAKE) -f $(PSTL_MAKEFILE) clean - -clean_all: clean clean_pstl clean_bench - -info: - @echo OS = $(os_name) - @echo proj_root = "$(proj_root)" - @echo $(CURDIR) - @echo VPATH = $(VPATH) - @echo LIBRARY_PATH = $(LIBRARY_PATH) - @echo backend = $(backend) - @echo compiler = $(compiler) - --include *.d Index: build/Makefile.common =================================================================== --- build/Makefile.common +++ /dev/null @@ -1,112 +0,0 @@ -#===-- Makefile.common ---------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -#------------------------------------------------------------------------------ -# Define common parts for Parallel STL -#------------------------------------------------------------------------------ - -.SUFFIXES: - -goals = $(or $(MAKECMDGOALS),all) -ifneq (, $(filter-out clean clean_all,$(goals))) - ifeq (, $(filter $(backend), tbb)) - $(info Threading backend was not specified; using TBB) - backend=tbb - endif -endif - -ifndef os_name - # Windows sets environment variable OS; for other systems, ask uname - ifeq ($(OS),) - OS:=$(shell uname) - ifeq ($(OS),) - $(error "Cannot detect operating system") - endif - os_name=$(OS) - endif - - ifeq ($(OS), Windows_NT) - os_name=windows - endif - ifeq ($(OS), Linux) - os_name=linux - endif - ifeq ($(OS), Darwin) - os_name=macos - endif -endif # !os_name - -cfg ?= release -stdver ?= c++11 - -override INCLUDES += -I$(proj_root)/include -I$(proj_root)/test - -TEST_MACRO += -D__PSTL_TEST_SUCCESSFUL_KEYWORD=1 - -ifeq ($(backend), tbb) - BACKEND_MACRO += -D__PSTL_PAR_BACKEND_TBB -endif - -target ?= $(os_name) -#OS specific keys -ifeq ($(target),windows) - ifneq (, $(filter $(compiler), gcc g++)) - include $(proj_root)/build/mingw.inc - else - include $(proj_root)/build/windows.inc - endif -else - include $(proj_root)/build/unix.inc - ifneq (,$(wildcard $(proj_root)/build/$(target).inc)) - include $(proj_root)/build/$(target).inc - $(info included additional file $(proj_root)/build/$(target).inc) - endif -endif - -# compiler specific keys -ifneq (, $(filter $(compiler), gcc g++)) - include $(proj_root)/build/gcc.inc -endif - -ifneq (, $(filter $(compiler), clang clang++)) - include $(proj_root)/build/clang.inc -endif - -ifneq (, $(filter $(compiler), icc icpc icx)) - include $(proj_root)/build/icc.inc -endif - -ifneq (, $(filter $(compiler), icl)) - include $(proj_root)/build/icl.inc -endif - - -OPTIMIZATION_ENABLED_FLAGS += $(XHOST_FLAG) -OPTIMIZATION_DISABLED_FLAGS += $(XHOST_FLAG) - - -ifeq ($(cfg), debug) - TBB_LIB_NAME = tbb_debug - BACKEND_MACRO += -DTBB_USE_DEBUG=1 - DEBUG_MACRO += -DPSTL_USE_DEBUG - OPTIMIZATION_KEYS = $(OPTIMIZATION_DISABLED_FLAGS) -else - OPTIMIZATION_KEYS = $(OPTIMIZATION_ENABLED_FLAGS) -endif - -DYN_LDFLAGS += $(PSTL_ARCH) - -CPLUS_FLAGS += $(TEST_MACRO) -CPLUS_FLAGS += $(INCLUDES) -CPLUS_FLAGS += $(BACKEND_MACRO) -CPLUS_FLAGS += $(DEBUG_MACRO) -CPLUS_FLAGS += $(CXXFLAGS) -CPLUS_FLAGS += $(OPTIMIZATION_KEYS) - -CPLUS_FLAGS += $(DISABLED_WARNINGS) -CPLUS_FLAGS += $(PSTL_ARCH) Index: build/Makefile.pstl =================================================================== --- build/Makefile.pstl +++ /dev/null @@ -1,46 +0,0 @@ -#===-- Makefile.pstl -----------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -#------------------------------------------------------------------------------ -# Define rules for making the Parallel STL library. -#------------------------------------------------------------------------------ - -proj_root ?= $(CURDIR)/.. - -include $(proj_root)/build/Makefile.common - -.PHONY: clean - -VPATH = $(proj_root)/src - -lib_src = $(wildcard $(proj_root)/src/*.cpp) -lib_obj = $(notdir $(lib_src:.cpp=$(OBJ_SFX))) - -all: pstl - -pstl: $(PSTL_LIB_NAME) - -%$(OBJ_SFX): %.cpp $(proj_root)/build/Makefile.pstl - $(CPLUS) $(CPLUS_FLAGS) -c $< $(FKEY)o$@ - -%.s: %.cpp $(proj_root)/build/Makefile - $(CPLUS) $(CPLUS_FLAGS) -S $< $(FKEY)o$@ - -%.E: %.cpp - $(CPLUS) $(CPLUS_FLAGS) -E $< >$@ - -clean: - $(DEL_CMD) *$(OBJ_SFX) *.lib *.dll *.so *.exp *$(PSTL_LIB_NAME)* - -info: - @echo OS = $(os_name) - @echo proj_root = "$(proj_root)" - @echo $(CURDIR) - @echo VPATH=$(VPATH) - --include *.d Index: build/android.inc =================================================================== --- build/android.inc +++ /dev/null @@ -1,47 +0,0 @@ -#===-- android.inc -------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -PSTL_ARCH= -PIE_FLAGS = -pie -fPIE -fPIC -SDL_FLAGS = -fstack-protector -Wformat -Wformat-security -CPLUS_FLAGS += $(TARGET_CFLAGS) $(PIE_FLAGS) $(SDL_FLAGS) - -# Paths to the NDK prebuilt tools and libraries -ifeq (,$(findstring $(ndk_version), $(foreach v, 7 8 9 10 11 12 13 14 15,r$(v) r$(v)b r$(v)c r$(v)d r$(v)e))) - ifeq (clang,$(compiler)) - # Since Android* NDK r16 another sysroot and isystem paths have to be specified - CPLUS_FLAGS += --sysroot=$(NDK_ROOT)/sysroot -isystem $(NDK_ROOT)/sysroot/usr/include/$(TRIPLE) - # Android* version flag required since r16 - CPLUS_FLAGS += -D__ANDROID_API__=$(API_LEVEL) - else - CPLUS_FLAGS += --sysroot=$(SYSROOT) - endif -else - CPLUS_FLAGS += --sysroot=$(SYSROOT) -endif - -LDFLAGS += --sysroot=$(SYSROOT) $(TARGET_CFLAGS) -PSTL_LIB_LINK += -lc++abi -L$(CPLUS_LIB_PATH) -lc++_shared - -ifeq (arm,$(arch)) - PSTL_LIB_LINK += -lunwind -endif - -# TARGET_CXX cames from NDK -override CPLUS:=$(TARGET_CXX) $(USE_SHARED_CPPRUNTIME_KEY) -LD = $(CPLUS) $(TARGET_CFLAGS) $(PIE_FLAGS) $(SDL_FLAGS) - -run_cmd ?= -sh $(proj_root)/build/android.linux.launcher.sh $(largs) - -# TBB_LIBRARIES := $(foreach dir,$(LIBRARY_PATH),$(wildcard $(dir)/libtbb*so)) -TBB_LIBRARIES := $(foreach dir,$(LIBRARY_PATH),$(wildcard $(dir)/*)) -LIB_STL_ANDROID += $(TBB_LIBRARIES) - -$(warning LIB_STL_ANDROID=$(LIB_STL_ANDROID)) -$(warning TBB_LIBRARIES=$(TBB_LIBRARIES)) -$(warning LIBRARY_PATH=$(LIBRARY_PATH)) Index: build/android.linux.launcher.sh =================================================================== --- build/android.linux.launcher.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh -#===-- android.linux.launcher.sh -----------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## -# -# - -# Usage: -# android.linux.launcher.sh [-v] [-q] [-s] [-r ] [-u] [-l ] -# where: -v enables verbose output -# where: -q enables quiet mode -# where: -s runs the test in stress mode (until non-zero exit code or ctrl-c pressed) -# where: -r specifies number of times to repeat execution -# where: -u is ignored on Android -# where: -l specifies the library name to be assigned to LD_PRELOAD -# -# Libs and executable necessary for testing should be present in the current directory before running. -# ANDROID_SERIAL must be set to the connected Android target device name for file transfer and test runs. -# ANDROID_TEST_DIRECTORY may be set to the directory used for testing on the Android target device; otherwise, -# the default directory used is "/data/local/tmp/$(basename $PWD)". -# Note: Do not remove the redirections to '/dev/null' in the script, otherwise the nightly test system will fail. - -do_cleanup() # -{ # - adb pull $targetdir/events.txt events.txt > /dev/null 2>&1 # - # Remove target directory on the device - adb shell "rm -r ${targetdir}; mkdir -p ${targetdir}" > /dev/null 2>&1 # -} # -do_trap_cleanup() # -{ # - do_cleanup # - exit -1 # -} # -while getopts "qvsr:ul:" flag # -do case $flag in # - s ) # Stress testing mode - echo Doing stress testing. Press Ctrl-C to terminate - run_env='stressed() { while $*; do :; done; }; ' # - run_prefix="stressed $run_prefix" ;; # - r ) # Repeats test n times - run_env="repeated() { for i in $(seq -s ' ' 1 $OPTARG) ; do echo \$i of $OPTARG:; \$*; done; }; " # - run_prefix="repeated $run_prefix" ;; # - l ) # Additional library - ldpreload="$OPTARG " ;; # - u ) # Stack limit - ;; # - q ) # Quiet mode, removes 'done' but prepends any other output by test name - OUTPUT='2>&1 | sed -e "s/done//;/^[[:space:]]*$/d;s!^!$exename: !"' ;; # - v ) # Verbose mode - SUPPRESS='' # - verbose=1 ;; # -esac done # -shift `expr $OPTIND - 1` # -[ -z "$OUTPUT" ] && OUTPUT='| sed -e "s/\\r$//"' # -[ $verbose ] || SUPPRESS='>/dev/null' # -# Collect the executable name -exename=$(basename $1) # -shift # - -# Prepare the target directory on the device -currentdir=$(basename $PWD) # -targetdir=${ANDROID_TEST_DIRECTORY:-/data/local/tmp/$currentdir} # -do_cleanup # -trap do_trap_cleanup INT # if someone hits control-c, cleanup the device - -# Collect the list of files to transfer to the target device, starting with executable itself. -fnamelist="$exename" # -# Add the C++ standard library from the NDK, which is required for all tests on Android. -if [ ! -z "${LIB_STL_ANDROID}" ]; then # - fnamelist="$fnamelist ${LIB_STL_ANDROID}" # -else # - fnamelist="$fnamelist libc++_shared.so" # -fi # - -# Find the TBB libraries and add them to the list. - -OLD_SEP=$IFS -IFS=':' -for dir in $LD_LIBRARY_PATH; do # - found="`ls $dir/lib*.so 2>/dev/null` "||: # - fnamelist+="$fnamelist $found" -done # -IFS=$OLD_SEP - -files="$(ls libtbb* 2> /dev/null)" # -[ -z "$files" ] || fnamelist="$fnamelist $files" # - -# Add any libraries built for specific tests. -exeroot=${exename%\.*} # -files="$(ls ${exeroot}*.so ${exeroot}*.so.* 2> /dev/null)" # -[ -z "$files" ] || fnamelist="$fnamelist $files" # - -# Transfer collected executable and library files to the target device. -transfers_ok=1 # -for fullname in $fnamelist; do { # - if [ -r $fullname ]; then { # - # Transfer the executable and libraries to top-level target directory - if [ "$OS" = 'Windows_NT' ]; then # - fullname=`cygpath -m "$fullname"` # - fi # - [ $verbose ] && echo -n "Pushing $fullname: " # - eval "adb push $fullname ${targetdir}/$(basename $fullname) $SUPPRESS 2>&1" # - }; else { # - echo "Error: required file ${currentdir}/${fullname} for test $exename not available for transfer." # - transfers_ok=0 # - }; fi # -}; done # -if [ "${transfers_ok}" = "0" ]; then { # - do_cleanup # - exit -1 # -}; fi # -# Transfer input files used by example codes by scanning the executable argument list. -for fullname in "$@"; do { # - if [ -r $fullname ]; then { # - directory=$(dirname $fullname) # - filename=$(basename $fullname) # - # strip leading "." from fullname if present - if [ "$directory" = "\." ]; then { # - directory="" # - fullname=$filename # - }; fi # - # Create the target directory to hold input file if necessary - if [ ! -z $directory ]; then { # - eval "adb shell 'mkdir $directory' $SUPPRESS 2>&1" # - }; fi # - # Transfer the input file to corresponding directory on target device - [ $verbose ] && echo -n "Pushing $fullname: " # - eval "adb push $fullname ${targetdir}/$fullname $SUPPRESS 2>&1" # - }; fi # -}; done # - -# Set LD_PRELOAD if necessary -[ -z "$ldpreload" ] || run_prefix="LD_PRELOAD='$ldpreload' $run_prefix" # -[ $verbose ] && echo Running $run_prefix ./$exename $* # -run_env="$run_env cd $targetdir; export LD_LIBRARY_PATH=." # -[ -z "$VIRTUAL_MACHINE" ] || run_env="$run_env; export VIRTUAL_MACHINE=$VIRTUAL_MACHINE" # -# The return_code file is the best way found to return the status of the test execution when using adb shell. -eval 'adb shell "$run_env; $run_prefix ./$exename $* || echo -n \$? >error_code"' "${OUTPUT}" # -# Capture the return code string and remove the trailing \r from the return_code file contents -err=`adb shell "cat $targetdir/error_code 2>/dev/null"` # -[ -z $err ] || echo $exename: exited with error $err # -do_cleanup # -# Return the exit code of the test. -exit $err # Index: build/clang.inc =================================================================== --- build/clang.inc +++ /dev/null @@ -1,21 +0,0 @@ -#===-- clang.inc ---------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -override compiler:=clang++ - -ifneq ($(target),android) - PSTL_ARCH += $(KEY)march=native -endif - -XHOST_FLAG = -fno-vectorize -CPLUS_FLAGS += $(FQKEY)std=$(stdver) -# XHOST_FLAG = $(KEY)mavx2 -fno-vectorize -# XHOST_FLAG = $(KEY)mavx512f -fno-vectorize -# DYN_LDFLAGS += $(LINK_KEY)c++ -# CPLUS_FLAGS += -stdlib=libc++ -# CPLUS_FLAGS += -fopenmp-simd //it will be supported in he future version Index: build/gcc.inc =================================================================== --- build/gcc.inc +++ /dev/null @@ -1,27 +0,0 @@ -#===-- gcc.inc -----------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -override compiler:=g++ -XHOST_FLAG = $(KEY)march=native -fno-tree-vectorize -# XHOST_FLAG = $(KEY)mavx2 -fno-tree-vectorize -# XHOST_FLAG = $(KEY)mavx512f -fno-tree-vectorize - DYN_LDFLAGS += $(LINK_KEY)stdc++ -# GCC 4.8.5 and early doesn't support -fopenmp-simd; GCC 4.9 supports OpenMP 4.0 for C/C++ -ifneq (, $(shell gcc -dumpversion | egrep "^4\.9\.[0-9]")) - CPLUS_FLAGS += -fopenmp-simd -endif -ifneq (, $(shell gcc -dumpversion | egrep "^[5-9]\.[0-9]\.[0-9]")) - CPLUS_FLAGS += -fopenmp-simd -# CPLUS_FLAGS += -fdump-rtl-loop2 #use this option to enable optimization report -endif - -CPLUS_FLAGS += $(FQKEY)std=$(stdver) - -ifeq ($(os_name),windows) -DISABLED_WARNINGS = $(KEY)Wno-attributes #disable MinGW warnings about extended alignment -endif Index: build/icc.inc =================================================================== --- build/icc.inc +++ /dev/null @@ -1,23 +0,0 @@ -#===-- icc.inc -----------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -vecreport ?= 0 #may be set to [0..7], see https://software.intel.com/en-us/node/522949 for details - -XHOST_FLAG = $(KEY)xHOST -no-vec -CPLUS_FLAGS += $(QKEY)opt-assume-safe-padding - -# XHOST_FLAG = $(KEY)xCORE-AVX2 -no-vec -# XHOST_FLAG = $(KEY)xSSE4.1 -no-vec -# XHOST_FLAG = $(KEY)xMIC-AVX512 -no-vec - -CPLUS_FLAGS += $(QKEY)openmp-simd -CPLUS_FLAGS += $(FQKEY)MMD -CPLUS_FLAGS += $(FQKEY)std=$(stdver) -CPLUS_FLAGS += $(QKEY)opt-report=$(vecreport) $(QKEY)opt-report-phase vec - -OPTIMIZATION_DISABLED_FLAGS += $(KEY)debug inline-debug-info Index: build/icl.inc =================================================================== --- build/icl.inc +++ /dev/null @@ -1,22 +0,0 @@ -#===-- icl.inc -----------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -vecreport ?= 0 #may be set to [0..7], see https://software.intel.com/en-us/node/522949 for details - -XHOST_FLAG = $(QKEY)xHOST -XHOST_FLAG = $(QKEY)vec- -# XHOST_FLAG = $(QKEY)xCORE-AVX2 -# XHOST_FLAG = $(QKEY)xSSE4.1 -# XHOST_FLAG = $(QKEY)xMIC-AVX512 -CPLUS_FLAGS += $(QKEY)opt-assume-safe-padding -CPLUS_FLAGS += $(QKEY)openmp-simd -CPLUS_FLAGS += $(FQKEY)MMD -CPLUS_FLAGS += $(FQKEY)std=$(stdver) -CPLUS_FLAGS += $(QKEY)opt-report:$(vecreport) $(QKEY)opt-report-phase:vec $(QKEY)opt-report-phase:loop - -DISABLED_WARNINGS = $(QKEY)diag-disable:2586 #use comma-separated values to specify multiple entries Index: build/jni/Android.mk =================================================================== --- build/jni/Android.mk +++ /dev/null @@ -1,53 +0,0 @@ -#===-- Android.mk --------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -export proj_root?=$(NDK_PROJECT_PATH)/.. - -ifeq (armeabi-v7a,$(APP_ABI)) - export SYSROOT:=$(NDK_ROOT)/platforms/$(APP_PLATFORM)/arch-arm -else ifeq (arm64-v8a,$(APP_ABI)) - export SYSROOT:=$(NDK_ROOT)/platforms/$(APP_PLATFORM)/arch-arm64 -else - export SYSROOT:=$(NDK_ROOT)/platforms/$(APP_PLATFORM)/arch-$(APP_ABI) -endif - -ifeq (windows,$(os_name)) - export CPATH_SEPARATOR :=; -else - export CPATH_SEPARATOR :=: -endif - -export ANDROID_NDK_ROOT:=$(NDK_ROOT) -export ndk_version:=$(lastword $(subst -, ,$(ANDROID_NDK_ROOT))) -ndk_version:= $(firstword $(subst /, ,$(ndk_version))) -ndk_version:= $(firstword $(subst \, ,$(ndk_version))) - -ifeq (clang,$(compiler)) - # "TBB_RTL :=llvm-libc++/libcxx" should be used for ndk_version r13 r13b r14. - TBB_RTL :=llvm-libc++ - TBB_RTL_LIB :=llvm-libc++ - TBB_RTL_FILE :=libc++_shared.so -else - TBB_RTL :=gnu-libstdc++/$(NDK_TOOLCHAIN_VERSION) - TBB_RTL_LIB :=$(TBB_RTL) - TBB_RTL_FILE :=libgnustl_shared.so -endif - -export CPATH := $(INCLUDE)$(CPATH_SEPARATOR)$(SYSROOT)/usr/include$(CPATH_SEPARATOR)$(NDK_ROOT)/sources/cxx-stl/$(TBB_RTL)/include$(CPATH_SEPARATOR)$(NDK_ROOT)/sources/cxx-stl/$(TBB_RTL)/libs/$(APP_ABI)/include$(CPATH_SEPARATOR)$(NDK_ROOT)/sources/android/support/include - -LIB_STL_ANDROID_DIR := $(NDK_ROOT)/sources/cxx-stl/$(TBB_RTL_LIB)/libs/$(APP_ABI) -#LIB_STL_ANDROID is required to be set up for copying Android specific library to a device next to test -export LIB_STL_ANDROID := $(LIB_STL_ANDROID_DIR)/$(TBB_RTL_FILE) -export CPLUS_LIB_PATH := $(SYSROOT)/usr/lib -L$(LIB_STL_ANDROID_DIR) -export target_os_version:=$(APP_PLATFORM) -export tbb_tool_prefix:=$(TOOLCHAIN_PREFIX) -export TARGET_CXX -export TARGET_CC -export TARGET_CFLAGS - -include $(proj_root)/build/Makefile Index: build/jni/Application.mk =================================================================== --- build/jni/Application.mk +++ /dev/null @@ -1,60 +0,0 @@ -#===-- Application.mk ----------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - - -ifndef os_name - # Windows sets environment variable OS; for other systems, ask uname - ifeq ($(OS),) - OS:=$(shell uname) - ifeq ($(OS),) - $(error "Cannot detect operating system") - endif - export os_name=$(OS) - endif - - ifeq ($(OS), Windows_NT) - export os_name=windows - endif - ifeq ($(OS), Linux) - export os_name=linux - endif - ifeq ($(OS), Darwin) - export os_name=macos - endif -endif - -export compiler?=clang -export arch?=ia32 -export target?=android - -ifeq (ia32,$(arch)) - APP_ABI:=x86 - export TRIPLE:=i686-linux-android -else ifeq (intel64,$(arch)) - APP_ABI:=x86_64 - export TRIPLE:=x86_64-linux-android -else ifeq (arm,$(arch)) - APP_ABI:=armeabi-v7a - export TRIPLE:=arm-linux-androideabi -else ifeq (arm64,$(arch)) - APP_ABI:=arm64-v8a - export TRIPLE:=aarch64-linux-android -else - APP_ABI:=$(arch) -endif - -api_version?=21 -export API_LEVEL:=$(api_version) -APP_PLATFORM:=android-$(api_version) - -ifeq (clang,$(compiler)) - NDK_TOOLCHAIN_VERSION:=clang - APP_STL:=c++_shared -else - NDK_TOOLCHAIN_VERSION:=4.9 -endif Index: build/macos.inc =================================================================== --- build/macos.inc +++ /dev/null @@ -1,9 +0,0 @@ -#===-- macos.inc ---------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -DYN_LDFLAGS += -Wl,-rpath,$(TBBROOT)/lib Index: build/mingw.inc =================================================================== --- build/mingw.inc +++ /dev/null @@ -1,49 +0,0 @@ -#===-- mingw.inc ---------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -PYTHON = python -KEY = - -QKEY = $(KEY)q -FKEY = $(KEY) -FQKEY = $(KEY) -MACHINE_KEY = $(KEY)m -OBJ_SFX = .o -DEL_CMD = del /F -RUN_CMD = -COMMAND_SEPARATOR = & -compiler ?= gcc -COMPILER_NOLOGO_KEY = -OPTIMIZATION_DISABLED_FLAGS = $(KEY)Og $(KEY)g -OPTIMIZATION_ENABLED_FLAGS += $(KEY)O2 -TBB_LIB_NAME = tbb -CPLUS = $(compiler) -LD = $(CPLUS) - -USE_SHARED_CPPRUNTIME_KEY = -LINK_KEY = $(KEY)l - -LD_OUT_KEY = $(KEY)o -DYN_LDFLAGS += -L. -L$(proj_root)/build - -ifneq ($(PSTL_LIB_NAME), ) - PSTL_LIB_LINK += $(LINK_KEY)$(PSTL_LIB_NAME)$(PSTL_LIB_EXT) -endif - -ifeq ($(backend),tbb) - DYN_LDFLAGS += $(LINK_KEY)$(TBB_LIB_NAME) -endif - -ifeq ($(arch),intel64) - PSTL_ARCH = $(MACHINE_KEY)64 -else ifeq ($(arch),ia32) - PSTL_ARCH = $(MACHINE_KEY)32 -else ifeq ($(arch),) - $(info arch=native by default) -else - PSTL_ARCH = $(MACHINE_KEY)$(arch) -endif Index: build/unix.inc =================================================================== --- build/unix.inc +++ /dev/null @@ -1,50 +0,0 @@ -#===-- unix.inc ----------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -PYTHON = python -KEY = - -QKEY = $(KEY)q -FKEY = $(KEY) -FQKEY = $(KEY) -MACHINE_KEY = $(KEY)m -OBJ_SFX = .o -DEL_CMD = rm $(KEY)f -RUN_CMD = ./ -COMMAND_SEPARATOR = ; -compiler ?= icc -COMPILER_NOLOGO_KEY = -OPTIMIZATION_DISABLED_FLAGS = $(KEY)O0 $(KEY)g -OPTIMIZATION_ENABLED_FLAGS += $(KEY)O2 -TBB_LIB_NAME = tbb -CPLUS = $(compiler) -LD = $(CPLUS) - -USE_SHARED_CPPRUNTIME_KEY = -LINK_KEY = $(KEY)l - -LD_OUT_KEY = $(KEY)o -DYN_LDFLAGS += -L. -L$(proj_root)/build - -ifneq ($(PSTL_LIB_NAME), ) - PSTL_LIB_LINK += $(LINK_KEY)$(PSTL_LIB_NAME)$(PSTL_LIB_EXT) -endif - -ifeq ($(backend), tbb) - DYN_LDFLAGS += $(LINK_KEY)$(TBB_LIB_NAME) -endif - - -ifeq ($(arch),intel64) - PSTL_ARCH = $(MACHINE_KEY)64 -else ifeq ($(arch),ia32) - PSTL_ARCH = $(MACHINE_KEY)32 -else ifeq ($(arch),) - $(info arch=native by default) -else - PSTL_ARCH = $(MACHINE_KEY)$(arch) -endif Index: build/windows.inc =================================================================== --- build/windows.inc +++ /dev/null @@ -1,53 +0,0 @@ -#===-- windows.inc -------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -PYTHON = python -compiler ?= icl -LD = LINK -KEY = / -LINK_KEY = -QKEY = $(KEY)Q -FKEY = $(KEY)F -FQKEY = $(QKEY) -MACHINE_KEY = $(QKEY) -OBJ_SFX = .obj -DEL_CMD = del $(KEY)F -RUN_CMD = -COMMAND_SEPARATOR = & -COMPILER_NOLOGO_KEY = $(KEY)nologo -OPTIMIZATION_DISABLED_FLAGS = $(KEY)Od $(KEY)Zi $(KEY)DEBUG $(KEY)Fd"$*.pdb" -OPTIMIZATION_ENABLED_FLAGS = $(KEY)O2 $(KEY)DNDEBUG -LD_OUT_KEY = $(KEY)OUT: - -ifneq ($(PSTL_LIB_NAME), ) - PSTL_LIB_EXT = .lib - PSTL_LIB_LINK += $(LINK_KEY)$(PSTL_LIB_NAME)$(PSTL_LIB_EXT) -endif -# Do not update LDFLAGS with corresponding TBB_LIB_NAME here, because of -# implicit linkage capability of TBB library - -ifeq ($(cfg),debug) - LINK_KEY += $(KEY)debug - USE_SHARED_CPPRUNTIME_KEY += $(KEY)MDd $(KEY)EHsc - BACKEND_MACRO += -DTBB_USE_DEBUG=1 -else - USE_SHARED_CPPRUNTIME_KEY += $(KEY)MD $(KEY)EHsc -endif - -ifneq (, $(filter $(compiler), cl icl)) - CPLUS_FLAGS += $(KEY)bigobj -endif - - -DYN_LDFLAGS += $(LINK_KEY) - -ifneq (,$(filter uwp,$(target_app) $(target_ui))) - CPLUS_FLAGS += /ZW:nostdlib /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" - _WIN32_WINNT = 0x0A00 - DYN_LDFLAGS += /NODEFAULTLIB:"kernel32.lib" OneCore.lib -endif Index: include/pstl/internal/algorithm_fwd.h =================================================================== --- /dev/null +++ include/pstl/internal/algorithm_fwd.h @@ -0,0 +1,1219 @@ +// -*- C++ -*- +//===-- algorithm_fwd.h --------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef __PSTL_algorithm_fwd_H +#define __PSTL_algorithm_fwd_H + +#include +#include + +namespace __pstl +{ +namespace internal +{ + +//------------------------------------------------------------------------ +// any_of +//------------------------------------------------------------------------ + +template +bool +brick_any_of(const _ForwardIterator, const _ForwardIterator, _Pred, + /*__is_vector=*/std::false_type) noexcept; + +template +bool +brick_any_of(const _ForwardIterator, const _ForwardIterator, _Pred, + /*__is_vector=*/std::true_type) noexcept; + +template +bool pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +bool pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector, + /*parallel=*/std::true_type); +#endif + + +#if 0 + // TODO does this even need forwarding? +template +_ForwardIterator for_each_n_it_serial(_ForwardIterator, _Size, _Function); +#endif + +//------------------------------------------------------------------------ +// walk1 (pseudo) +// +// walk1 evaluates f(x) for each dereferenced value x drawn from [first,last) +//------------------------------------------------------------------------ + +template +void brick_walk1(_ForwardIterator, _ForwardIterator, _Function, + /*vector=*/std::false_type) noexcept; + +template +void brick_walk1(_RandomAccessIterator, _RandomAccessIterator, _Function, + /*vector=*/std::true_type) noexcept; + +template +void pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector, + /*parallel=*/std::true_type); +#endif + +template +void pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick, + /*parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// walk1_n +//------------------------------------------------------------------------ + +template +_ForwardIterator brick_walk1_n(_ForwardIterator, _Size, _Function, + /*_IsVectorTag=*/std::false_type); + +template +_RandomAccessIterator brick_walk1_n(_RandomAccessIterator, _DifferenceType, _Function, + /*vectorTag=*/std::true_type) noexcept; + +template +_ForwardIterator pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Function, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator pattern_walk1_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Function, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +template +_ForwardIterator pattern_walk_brick_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Brick, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator pattern_walk_brick_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Brick, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// walk2 (pseudo) +// +// walk2 evaluates f(x,y) for deferenced values (x,y) drawn from [first1,last1) and [first2,...) +//------------------------------------------------------------------------ + +template +_ForwardIterator2 brick_walk2(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, + /*vector=*/std::false_type) noexcept; + +template +_ForwardIterator2 brick_walk2(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, + /*vector=*/std::true_type) noexcept; + +template +_ForwardIterator2 brick_walk2_n(_ForwardIterator1, _Size, _ForwardIterator2, _Function, + /*vector=*/std::false_type) noexcept; + +template +_ForwardIterator2 brick_walk2_n(_ForwardIterator1, _Size, _ForwardIterator2, _Function, + /*vector=*/std::true_type) noexcept; + +template +_ForwardIterator2 pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator2 pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector, + /*parallel=*/std::true_type); +#endif + +template +_ForwardIterator2 pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Function, _IsVector, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator2 pattern_walk2_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Function, _IsVector, + /*parallel=*/std::true_type); +#endif + +template +_ForwardIterator2 pattern_walk2_brick(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Brick, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator2 pattern_walk2_brick(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, + _Brick, + /*parallel=*/std::true_type); +#endif + +template +_ForwardIterator2 pattern_walk2_brick_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Brick, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator2 pattern_walk2_brick_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Brick, + /*parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// walk3 (pseudo) +// +// walk3 evaluates f(x,y,z) for (x,y,z) drawn from [first1,last1), [first2,...), [first3,...) +//------------------------------------------------------------------------ + +template +_ForwardIterator3 brick_walk3(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator3, _Function, + /*vector=*/std::false_type) noexcept; + +template +_RandomAccessIterator3 brick_walk3(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, + _RandomAccessIterator3, _Function, + /*vector=*/std::true_type) noexcept; + +template +_ForwardIterator3 pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator3, _Function, + _IsVector, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator3 pattern_walk3(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, + _RandomAccessIterator3, _Function, _IsVector, /*parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// equal +//------------------------------------------------------------------------ + +template +bool brick_equal(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate, + /* IsVector = */ std::false_type) noexcept; + +template +bool brick_equal(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _BinaryPredicate, + /* is_vector = */ std::true_type) noexcept; + +template +bool pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate, _IsVector, + /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +bool pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _BinaryPredicate, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// find_if +//------------------------------------------------------------------------ + +template +_ForwardIterator brick_find_if(_ForwardIterator, _ForwardIterator, _Predicate, + /*is_vector=*/std::false_type) noexcept; + +template +_RandomAccessIterator brick_find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, + /*is_vector=*/std::true_type) noexcept; + +template +_ForwardIterator pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// find_end +//------------------------------------------------------------------------ + +template +_ForwardIterator1 brick_find_end(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, + /*__is_vector=*/std::false_type) noexcept; + +template +_ForwardIterator1 brick_find_end(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, + /*__is_vector=*/std::true_type) noexcept; + +template +_ForwardIterator1 pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator1 pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, _IsVector, + /*is_parallel=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// find_first_of +//------------------------------------------------------------------------ + +template +_ForwardIterator1 brick_find_first_of(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, + /*__is_vector=*/std::false_type) noexcept; + +template +_ForwardIterator1 brick_find_first_of(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, + /*__is_vector=*/std::true_type) noexcept; + +template +_ForwardIterator1 pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator1 pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// search +//------------------------------------------------------------------------ + +template +_ForwardIterator1 brick_search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, + /*vector=*/std::false_type) noexcept; + +template +_ForwardIterator1 brick_search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, + /*vector=*/std::true_type) noexcept; + +template +_ForwardIterator1 pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator1 pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _BinaryPredicate, _IsVector, + /*is_parallel=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// search_n +//------------------------------------------------------------------------ + +template +_ForwardIterator +brick_search_n(_ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate, + /*vector=*/std::false_type) noexcept; + +template +_ForwardIterator +brick_search_n(_ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate, + /*vector=*/std::true_type) noexcept; + +template +_ForwardIterator +pattern_search_n(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate, IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator +pattern_search_n(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Size, const _Tp&, _BinaryPredicate, IsVector, + /*is_parallel=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// copy_n +//------------------------------------------------------------------------ + +template +_OutputIterator brick_copy_n(_ForwardIterator, _Size, _OutputIterator, + /*vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_copy_n(_ForwardIterator, _Size, _OutputIterator, + /*vector=*/std::true_type) noexcept; + +//------------------------------------------------------------------------ +// copy +//------------------------------------------------------------------------ + +template +_OutputIterator brick_copy(_ForwardIterator, _ForwardIterator, _OutputIterator, + /*vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, + /*vector=*/std::true_type) noexcept; + +//------------------------------------------------------------------------ +// move +//------------------------------------------------------------------------ + +template +_OutputIterator brick_move(_ForwardIterator, _ForwardIterator, _OutputIterator, + /*vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_move(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, + /*vector=*/std::true_type) noexcept; + +//------------------------------------------------------------------------ +// swap_ranges +//------------------------------------------------------------------------ +template +_OutputIterator brick_swap_ranges(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, + /*vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_swap_ranges(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, + /*vector=*/std::true_type) noexcept; + +//------------------------------------------------------------------------ +// copy_if +//------------------------------------------------------------------------ + +template +_OutputIterator brick_copy_if(_ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, + /*vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_copy_if(_ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, + /*vector=*/std::true_type) noexcept; + +template +std::pair<_DifferenceType, _DifferenceType> +brick_calc_mask_1(_ForwardIterator, _ForwardIterator, bool* __restrict, _UnaryPredicate, + /*vector=*/std::false_type) noexcept; +template +std::pair<_DifferenceType, _DifferenceType> +brick_calc_mask_1(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _UnaryPredicate, + /*vector=*/std::true_type) noexcept; + +template +void +brick_copy_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator, bool*, + /*vector=*/std::false_type) noexcept; + +template +void +brick_copy_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator, bool* __restrict, + /*vector=*/std::true_type) noexcept; + +template +void +brick_partition_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, bool*, + /*vector=*/std::false_type) noexcept; + +template +void +brick_partition_by_mask(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator1, _OutputIterator2, bool*, + /*vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, _IsVector, + /*parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_copy_if(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryPredicate, + _IsVector, /*parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// count +//------------------------------------------------------------------------ + +template +typename std::iterator_traits<_ForwardIterator>::difference_type +brick_count(_ForwardIterator, _ForwardIterator, _Predicate, + /* is_vector = */ std::true_type) noexcept; + +template +typename std::iterator_traits<_ForwardIterator>::difference_type +brick_count(_ForwardIterator, _ForwardIterator, _Predicate, + /* is_vector = */ std::false_type) noexcept; + +template +typename std::iterator_traits<_ForwardIterator>::difference_type +pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, + /* is_parallel */ std::false_type, _IsVector) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +typename std::iterator_traits<_ForwardIterator>::difference_type +pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, + /* is_parallel */ std::true_type, _IsVector); +#endif + +//------------------------------------------------------------------------ +// unique +//------------------------------------------------------------------------ + +template +_ForwardIterator brick_unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate, + /*is_vector=*/std::false_type) noexcept; + +template +_ForwardIterator brick_unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate, + /*is_vector=*/std::true_type) noexcept; + +template +_ForwardIterator pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector, + /*is_parallel=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// unique_copy +//------------------------------------------------------------------------ + +template +OutputIterator brick_unique_copy(_ForwardIterator, _ForwardIterator, OutputIterator, _BinaryPredicate, + /*vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_unique_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _BinaryPredicate, + /*vector=*/std::true_type) noexcept; + +template +OutputIterator pattern_unique_copy(_ForwardIterator, _ForwardIterator, OutputIterator, _BinaryPredicate, _IsVector, + /*parallel=*/std::false_type) noexcept; + +template +_DifferenceType +brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate, + /*vector=*/std::false_type) noexcept; + +template +_DifferenceType +brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate, + /*vector=*/std::true_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_unique_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _BinaryPredicate, + _IsVector, /*parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// reverse +//------------------------------------------------------------------------ + +template +void brick_reverse(_BidirectionalIterator, _BidirectionalIterator, + /*__is_vector=*/std::false_type) noexcept; + +template +void brick_reverse(_BidirectionalIterator, _BidirectionalIterator, + /*__is_vector=*/std::true_type) noexcept; + +template +void brick_reverse(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, + /*is_vector=*/std::false_type) noexcept; + +template +void brick_reverse(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, + /*is_vector=*/std::true_type) noexcept; + +template +void pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// reverse_copy +//------------------------------------------------------------------------ + +template +_OutputIterator brick_reverse_copy(_BidirectionalIterator, _BidirectionalIterator, _OutputIterator, + /*is_vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_reverse_copy(_BidirectionalIterator, _BidirectionalIterator, _OutputIterator, + /*is_vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// rotate +//------------------------------------------------------------------------ + +template +_ForwardIterator brick_rotate(_ForwardIterator, _ForwardIterator, _ForwardIterator, + /*is_vector=*/std::false_type) noexcept; + +template +_ForwardIterator brick_rotate(_ForwardIterator, _ForwardIterator, _ForwardIterator, + /*is_vector=*/std::true_type) noexcept; + +template +_ForwardIterator pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// rotate_copy +//------------------------------------------------------------------------ + +template +_OutputIterator brick_rotate_copy(_ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, + /*__is_vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_rotate_copy(_ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, + /*__is_vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// is_partitioned +//------------------------------------------------------------------------ + +template +bool brick_is_partitioned(_ForwardIterator, _ForwardIterator, _UnaryPredicate, + /*is_vector=*/std::false_type) noexcept; + +template +bool brick_is_partitioned(_ForwardIterator, _ForwardIterator, _UnaryPredicate, + /*is_vector=*/std::true_type) noexcept; + +template +bool pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +bool pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// partition +//------------------------------------------------------------------------ + +template +_ForwardIterator brick_partition(_ForwardIterator, _ForwardIterator, _UnaryPredicate, + /*is_vector=*/std::false_type) noexcept; + +template +_ForwardIterator brick_partition(_ForwardIterator, _ForwardIterator, _UnaryPredicate, + /*is_vector=*/std::true_type) noexcept; + +template +_ForwardIterator pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// stable_partition +//------------------------------------------------------------------------ + +template +_BidirectionalIterator brick_stable_partition(_BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, + /*__is_vector=*/std::false_type) noexcept; + +template +_BidirectionalIterator brick_stable_partition(_BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, + /*__is_vector=*/std::true_type) noexcept; + +template +_BidirectionalIterator pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, + _IsVector, + /*is_parallelization=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_BidirectionalIterator pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, + _IsVector, + /*is_parallelization=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// partition_copy +//------------------------------------------------------------------------ + +template +std::pair<_OutputIterator1, _OutputIterator2> brick_partition_copy(_ForwardIterator, _ForwardIterator, _OutputIterator1, + _OutputIterator2, _UnaryPredicate, + /*is_vector=*/std::false_type) noexcept; + +template +std::pair<_OutputIterator1, _OutputIterator2> brick_partition_copy(_ForwardIterator, _ForwardIterator, _OutputIterator1, + _OutputIterator2, _UnaryPredicate, + /*is_vector=*/std::true_type) noexcept; + +template +std::pair<_OutputIterator1, _OutputIterator2> +pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, + _OutputIterator1, _OutputIterator2, + _UnaryPredicate, _IsVector, + /*is_parallelization=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +std::pair<_OutputIterator1, _OutputIterator2> +pattern_partition_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, + _OutputIterator1, _OutputIterator2, + _UnaryPredicate, _IsVector, + /*is_parallelization=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// sort +//------------------------------------------------------------------------ + +template +void pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, + /*is_parallel=*/std::false_type, _IsMoveConstructible) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, + /*is_parallel=*/std::true_type, + /*is_move_constructible=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// stable_sort +//------------------------------------------------------------------------ + +template +void pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// partial_sort +//------------------------------------------------------------------------ + +template +void pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// partial_sort_copy +//------------------------------------------------------------------------ + +template +_RandomAccessIterator pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _RandomAccessIterator, + _RandomAccessIterator, _Compare, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _RandomAccessIterator, + _RandomAccessIterator, _Compare, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// adjacent_find +//------------------------------------------------------------------------ + +template +_ForwardIterator +brick_adjacent_find(_ForwardIterator, _ForwardIterator, _BinaryPredicate, + /* IsVector = */ std::true_type, bool) noexcept; + +template +_ForwardIterator +brick_adjacent_find(_ForwardIterator, _ForwardIterator, _BinaryPredicate, + /* IsVector = */ std::false_type, bool) noexcept; + +template +_ForwardIterator +pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, + /* is_parallel */ std::false_type, _IsVector, bool) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator +pattern_adjacent_find(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, + /* is_parallel */ std::true_type, _IsVector, bool); +#endif + +//------------------------------------------------------------------------ +// nth_element +//------------------------------------------------------------------------ +template +void pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /*is_parallel=*/std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// fill, fill_n +//------------------------------------------------------------------------ +template +void +brick_fill(_ForwardIterator, _ForwardIterator, const _Tp&, + /* __is_vector = */ std::true_type) noexcept; + +template +void +brick_fill(_ForwardIterator, _ForwardIterator, const _Tp&, + /* __is_vector = */ std::false_type) noexcept; + +template +void +pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, + /*is_parallel=*/std::false_type, _IsVector) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator +pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, + /*is_parallel=*/std::true_type, _IsVector); +#endif + +template +_OutputIterator +brick_fill_n(_OutputIterator, _Size, const _Tp&, + /* __is_vector = */ std::true_type) noexcept; + +template +_OutputIterator +brick_fill_n(_OutputIterator, _Size, const _Tp&, + /* __is_vector = */ std::false_type) noexcept; + +template +_OutputIterator +pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&, + /*is_parallel=*/std::false_type, _IsVector) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator +pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&, + /*is_parallel=*/std::true_type, _IsVector); +#endif + +//------------------------------------------------------------------------ +// generate, generate_n +//------------------------------------------------------------------------ + +template +void brick_generate(_RandomAccessIterator, _RandomAccessIterator, _Generator, + /* is_vector = */ std::true_type) noexcept; + +template +void brick_generate(_ForwardIterator, _ForwardIterator, _Generator, + /* is_vector = */ std::false_type) noexcept; + +template +void pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator, + /*is_parallel=*/std::false_type, _IsVector) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator, + /*is_parallel=*/std::true_type, _IsVector); +#endif + +template +OutputIterator brick_generate_n(OutputIterator, Size, _Generator, + /* is_vector = */ std::true_type) noexcept; + +template +OutputIterator brick_generate_n(OutputIterator, Size, _Generator, + /* is_vector = */ std::false_type) noexcept; + +template +OutputIterator pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator, + /*is_parallel=*/std::false_type, _IsVector) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +OutputIterator pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator, + /*is_parallel=*/std::true_type, _IsVector); +#endif + +//------------------------------------------------------------------------ +// remove +//------------------------------------------------------------------------ +template +_ForwardIterator brick_remove_if(_ForwardIterator, _ForwardIterator, _UnaryPredicate, + /* __is_vector = */ std::false_type) noexcept; + +template +_RandomAccessIterator brick_remove_if(_RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, + /* __is_vector = */ std::true_type) noexcept; + +template +_ForwardIterator pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, + /*is_parallel*/ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_ForwardIterator pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, + /*is_parallel*/ std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// merge +//------------------------------------------------------------------------ + +template +_OutputIterator brick_merge(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, + _Compare, + /* __is_vector = */ std::false_type) noexcept; + +template +_OutputIterator brick_merge(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, + _Compare, + /* __is_vector = */ std::true_type) noexcept; + +template +_OutputIterator pattern_merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_merge(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, + _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, + /* is_parallel = */ std::true_type); +#endif + +//------------------------------------------------------------------------ +// inplace_merge +//------------------------------------------------------------------------ + +template +void brick_inplace_merge(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare, + /* __is_vector = */ std::false_type) noexcept; + +template +void brick_inplace_merge(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare, + /* __is_vector = */ std::true_type) noexcept; + +template +void pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare, _IsVector, + /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +void pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +template +bool pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +bool pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// set_union +//------------------------------------------------------------------------ + +template +_OutputIterator brick_set_union(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, + /*__is_vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_set_union(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, + /*__is_vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// set_intersection +//------------------------------------------------------------------------ + +template +_OutputIterator brick_set_intersection(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, + /*__is_vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_set_intersection(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, + /*__is_vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// set_difference +//------------------------------------------------------------------------ + +template +_OutputIterator brick_set_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, + /*__is_vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_set_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, + /*__is_vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// set_symmetric_difference +//------------------------------------------------------------------------ + +template +_OutputIterator brick_set_symmetric_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _OutputIterator, _Compare, + /*__is_vector=*/std::false_type) noexcept; + +template +_OutputIterator brick_set_symmetric_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _OutputIterator, _Compare, + /*__is_vector=*/std::true_type) noexcept; + +template +_OutputIterator pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _OutputIterator, _Compare, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _OutputIterator, _Compare, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// is_heap_until +//------------------------------------------------------------------------ + +template +_RandomAccessIterator brick_is_heap_until(_RandomAccessIterator, _RandomAccessIterator, _Compare, + /* __is_vector = */ std::false_type) noexcept; + +template +_RandomAccessIterator brick_is_heap_until(_RandomAccessIterator, _RandomAccessIterator, _Compare, + /* __is_vector = */ std::true_type) noexcept; + +template +_RandomAccessIterator pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /* is_parallel = */ std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// min_element +//------------------------------------------------------------------------ + +template +_ForwardIterator brick_min_element(_ForwardIterator, _ForwardIterator, _Compare, + /* __is_vector = */ std::false_type) noexcept; + +template +_ForwardIterator brick_min_element(_ForwardIterator, _ForwardIterator, _Compare, + /* __is_vector = */ std::true_type) noexcept; + +template +_ForwardIterator pattern_min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector, + /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_RandomAccessIterator pattern_min_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, + /* is_parallel = */ std::true_type); +#endif + +//------------------------------------------------------------------------ +// minmax_element +//------------------------------------------------------------------------ + +template +std::pair<_ForwardIterator, _ForwardIterator> +brick_minmax_element(_ForwardIterator, _ForwardIterator, _Compare, + /* __is_vector = */ std::false_type) noexcept; + +template +std::pair<_ForwardIterator, _ForwardIterator> +brick_minmax_element(_ForwardIterator, _ForwardIterator, _Compare, + /* __is_vector = */ std::true_type) noexcept; + +template +std::pair<_ForwardIterator, _ForwardIterator> +pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, + _IsVector, + /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +std::pair<_ForwardIterator, _ForwardIterator> +pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, + _IsVector, + /* is_parallel = */ std::true_type); +#endif + +//------------------------------------------------------------------------ +// mismatch +//------------------------------------------------------------------------ + +template +std::pair<_ForwardIterator1, _ForwardIterator2> +brick_mismatch(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _Predicate, + /* __is_vector = */ std::false_type) noexcept; + +template +std::pair<_ForwardIterator1, _ForwardIterator2> +brick_mismatch(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _Predicate, + /* __is_vector = */ std::true_type) noexcept; + +template +std::pair<_ForwardIterator1, _ForwardIterator2> +pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Predicate, _IsVector, + /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +std::pair<_RandomAccessIterator1, _RandomAccessIterator2> +pattern_mismatch(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2, + _Predicate, _IsVector, /* is_parallel = */ std::true_type) noexcept; +#endif + +//------------------------------------------------------------------------ +// lexicographical_compare +//------------------------------------------------------------------------ + +template +bool brick_lexicographical_compare(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, + /* __is_vector = */ std::false_type) noexcept; + +template +bool brick_lexicographical_compare(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, + /* __is_vector = */ std::true_type) noexcept; + +template +bool pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +bool pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, + _Compare, _IsVector, /* is_parallel = */ std::true_type) noexcept; +#endif + +} // namespace internal +} // namespace __pstl +#endif /* __PSTL_algorithm_fwd_H */ Index: include/pstl/internal/glue_algorithm_impl.h =================================================================== --- include/pstl/internal/glue_algorithm_impl.h +++ include/pstl/internal/glue_algorithm_impl.h @@ -14,8 +14,8 @@ #include "execution_defs.h" #include "utils.h" -#include "algorithm_impl.h" -#include "numeric_impl.h" /* count and count_if use pattern_transform_reduce */ +#include "algorithm_fwd.h" +#include "numeric_fwd.h" /* count and count_if use pattern_transform_reduce */ namespace std { Index: include/pstl/internal/glue_execution_defs.h =================================================================== --- include/pstl/internal/glue_execution_defs.h +++ include/pstl/internal/glue_execution_defs.h @@ -49,4 +49,8 @@ } // namespace execution } // namespace std +#include "algorithm_impl.h" +#include "numeric_impl.h" +#include "parallel_backend.h" + #endif /* __PSTL_glue_execution_defs_H */ Index: include/pstl/internal/glue_memory_impl.h =================================================================== --- include/pstl/internal/glue_memory_impl.h +++ include/pstl/internal/glue_memory_impl.h @@ -11,7 +11,7 @@ #define __PSTL_glue_memory_impl_H #include "utils.h" -#include "algorithm_impl.h" +#include "algorithm_fwd.h" namespace std { Index: include/pstl/internal/numeric_fwd.h =================================================================== --- /dev/null +++ include/pstl/internal/numeric_fwd.h @@ -0,0 +1,131 @@ +// -*- C++ -*- +//===-- numeric_fwd.h --------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef __PSTL_numeric_fwd_H +#define __PSTL_numeric_fwd_H + +#include +#include + +namespace __pstl +{ +namespace internal +{ + +//------------------------------------------------------------------------ +// transform_reduce (version with two binary functions, according to draft N4659) +//------------------------------------------------------------------------ + +template +_Tp +brick_transform_reduce(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Tp, _BinaryOperation1, + _BinaryOperation2, + /*__is_vector=*/std::true_type) noexcept; + +template +_Tp +brick_transform_reduce(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Tp, _BinaryOperation1, + _BinaryOperation2, + /*__is_vector=*/std::false_type) noexcept; + +template +_Tp +pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Tp, _BinaryOperation1, + _BinaryOperation2, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_Tp +pattern_transform_reduce(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Tp, _BinaryOperation1, + _BinaryOperation2, _IsVector __is_vector, /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// transform_reduce (version with unary and binary functions) +//------------------------------------------------------------------------ + +template +_Tp +brick_transform_reduce(_ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation, + /*is_vector=*/std::true_type) noexcept; + +template +_Tp +brick_transform_reduce(_ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation, + /*is_vector=*/std::false_type) noexcept; + +template +_Tp +pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_Tp +pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation, _IsVector, + /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// transform_exclusive_scan +// +// walk3 evaluates f(x,y,z) for (x,y,z) drawn from [first1,last1), [first2,...), [first3,...) +//------------------------------------------------------------------------ + +template +std::pair<_OutputIterator, _Tp> brick_transform_scan(_ForwardIterator, _ForwardIterator, _OutputIterator, + _UnaryOperation, _Tp, _BinaryOperation, + /*Inclusive*/ std::false_type) noexcept; + +template +std::pair<_OutputIterator, _Tp> brick_transform_scan(_ForwardIterator, _ForwardIterator, _OutputIterator, + _UnaryOperation, _Tp, _BinaryOperation, + /*Inclusive*/ std::true_type) noexcept; + +template +_OutputIterator pattern_transform_scan(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryOperation, _Tp, + _BinaryOperation, _Inclusive, _IsVector, + /*is_parallel=*/std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_transform_scan(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryOperation, + _Tp, _BinaryOperation, _Inclusive, _IsVector, /*is_parallel=*/std::true_type); +#endif + +//------------------------------------------------------------------------ +// adjacent_difference +//------------------------------------------------------------------------ + +template +_OutputIterator brick_adjacent_difference(_ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation, + /*is_vector*/ std::false_type) noexcept; + +template +_OutputIterator brick_adjacent_difference(_ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation, + /*is_vector*/ std::true_type) noexcept; + +template +_OutputIterator pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation, + _IsVector, /*is_parallel*/ std::false_type) noexcept; + +#if __PSTL_USE_PAR_POLICIES +template +_OutputIterator pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation, + _IsVector, /*is_parallel*/ std::true_type); +#endif + +} // namespace internal +} // namespace __pstl +#endif /* __PSTL_numeric_fwd_H */ Index: include/pstl/internal/numeric_impl.h =================================================================== --- include/pstl/internal/numeric_impl.h +++ include/pstl/internal/numeric_impl.h @@ -14,9 +14,9 @@ #include #include -#include "pstl_config.h" #include "execution_impl.h" #include "unseq_backend_simd.h" +#include "algorithm_fwd.h" #if __PSTL_USE_PAR_POLICIES #include "parallel_backend.h" Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -1,33 +1,15 @@ -#===-- CMakeLists.txt ----------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## +# TODO implement me -# TODO(ldionne): This CMake testing infrastructure should be replaced with a -# llvm-lit test suite. +include_directories("${PROJECT_SOURCE_DIR}/include" + ${CMAKE_CURRENT_LIST_DIR}) -add_custom_target(pstl-build-tests - COMMENT "Build all the pstl tests.") +add_definitions(-DPSTL_STANDALONE_TESTS) -add_custom_target(check-pstl - COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure - USES_TERMINAL - DEPENDS pstl-build-tests - COMMENT "Build and run all the unit tests.") +macro(add_pass_test test_source) + string(REPLACE ".cpp" "" test_name ${test_source}) + add_executable(${test_name} ${test_source}) + target_link_libraries(${test_name} PRIVATE pstl::ParallelSTL) + add_test(NAME ${test_name} COMMAND ${test_name}) +endmacro() -file(GLOB_RECURSE UNIT_TESTS "test_*.cpp") -foreach(_file IN LISTS UNIT_TESTS) - file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}") - string(REPLACE ".cpp" "" _target "${_target}") - set(_target "pstl-${_target}") - - add_executable(${_target} EXCLUDE_FROM_ALL "${_file}") - target_link_libraries(${_target} PRIVATE pstl::ParallelSTL) - set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}") - add_dependencies(pstl-build-tests ${_target}) -endforeach() +add_subdirectory(std) Index: test/std/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(algorithms) +add_subdirectory(utilities) +add_subdirectory(numerics) Index: test/std/algorithms/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(alg.nonmodifying) +add_subdirectory(alg.modifying.operations) +add_subdirectory(alg.sorting) +add_subdirectory(alg.merge) Index: test/std/algorithms/alg.merge/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.merge/CMakeLists.txt @@ -0,0 +1,10 @@ +set(PASS_SOURCES + merge.pass.cpp; + inplace_merge.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.merge/inplace_merge.pass.cpp =================================================================== --- test/std/algorithms/alg.merge/inplace_merge.pass.cpp +++ test/std/algorithms/alg.merge/inplace_merge.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_inplace_merge.cpp --------------------------------------------===// +//===-- inplace_merge.pass.cpp --------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include #include "pstl/execution" #include "pstl/algorithm" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -#include "utils.h" +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_one_policy { @@ -23,14 +28,14 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, BiDirIt1 first1, BiDirIt1 last1, BiDirIt1 first2, BiDirIt1 last2, + operator()(__pstl::execution::unsequenced_policy, BiDirIt1 first1, BiDirIt1 last1, BiDirIt1 first2, BiDirIt1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, BiDirIt1 first1, BiDirIt1 last1, BiDirIt1 first2, + operator()(__pstl::execution::parallel_unsequenced_policy, BiDirIt1 first1, BiDirIt1 last1, BiDirIt1 first2, BiDirIt1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) { } Index: test/std/algorithms/alg.merge/merge.pass.cpp =================================================================== --- test/std/algorithms/alg.merge/merge.pass.cpp +++ test/std/algorithms/alg.merge/merge.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_merge.cpp ----------------------------------------------------===// +//===-- merge.pass.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,16 +7,21 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" -#include #include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -#include "utils.h" +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_merge { Index: test/std/algorithms/alg.modifying.operations/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.modifying.operations/CMakeLists.txt @@ -0,0 +1,26 @@ +add_subdirectory(alg.copy) +add_subdirectory(alg.partitions) +add_subdirectory(alg.reverse) + +set(PASS_SOURCES + copy_move.pass.cpp; + fill.pass.cpp; + generate.pass.cpp; + replace.pass.cpp; + replace_copy.pass.cpp; + remove.pass.cpp; + remove_copy.pass.cpp; + rotate_copy.pass.cpp; + rotate.pass.cpp; + swap_ranges.pass.cpp; + transform_unary.pass.cpp; + transform_binary.pass.cpp + unique_copy_equal.pass.cpp; + unique.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.modifying.operations/alg.copy/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.modifying.operations/alg.copy/CMakeLists.txt @@ -0,0 +1,7 @@ +set(PASS_SOURCES + copy_if.pass.cpp; +) + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp +++ test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_copy_if.cpp --------------------------------------------------===// +//===-- copy_if.pass.cpp --------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,13 +8,20 @@ //===----------------------------------------------------------------------===// // Tests for copy_if and remove_copy_if -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct run_copy_if { @@ -22,7 +29,7 @@ template void - operator()(pstl::execution::parallel_policy, InputIterator first, InputIterator last, OutputIterator out_first, + operator()(__pstl::execution::parallel_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size n, Predicate pred, T trash) { @@ -30,7 +37,7 @@ template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size n, Predicate pred, T trash) { Index: test/std/algorithms/alg.modifying.operations/alg.partitions/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.modifying.operations/alg.partitions/CMakeLists.txt @@ -0,0 +1,11 @@ +set(PASS_SOURCES + is_partitioned.pass.cpp; + partition_copy.pass.cpp; + partition.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp +++ test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_is_partitioned.cpp -------------------------------------------===// +//===-- is_partitioned.pass.cpp -------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_one_policy { @@ -22,12 +29,12 @@ template void - operator()(pstl::execution::unsequenced_policy, Iterator1 begin1, Iterator1 end1, Predicate pred) + operator()(__pstl::execution::unsequenced_policy, Iterator1 begin1, Iterator1 end1, Predicate pred) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, Iterator1 begin1, Iterator1 end1, Predicate pred) + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator1 begin1, Iterator1 end1, Predicate pred) { } #endif Index: test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp +++ test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_partition.cpp ------------------------------------------------===// +//===-- partition.pass.cpp ------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,16 +8,21 @@ //===----------------------------------------------------------------------===// // Tests for stable_partition and partition -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -#include -#include +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct DataType @@ -66,28 +71,28 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specializations to skip testing in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, BiDirIt exp_last, + operator()(__pstl::execution::unsequenced_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, BiDirIt exp_last, Size n, UnaryOp unary_op, Generator generator) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, + operator()(__pstl::execution::parallel_unsequenced_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, BiDirIt exp_last, Size n, UnaryOp unary_op, Generator generator) { } #elif __PSTL_ICC_16_VC14_TEST_PAR_TBB_RT_RELEASE_64_BROKEN //dummy specializations to skip testing in case of broken configuration template void - operator()(pstl::execution::parallel_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, BiDirIt exp_last, + operator()(__pstl::execution::parallel_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, BiDirIt exp_last, Size n, UnaryOp unary_op, Generator generator) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, + operator()(__pstl::execution::parallel_unsequenced_policy, BiDirIt first, BiDirIt last, BiDirIt exp_first, BiDirIt exp_last, Size n, UnaryOp unary_op, Generator generator) { } Index: test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp +++ test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_partition_copy.cpp -------------------------------------------===// +//===-- partition_copy.pass.cpp -------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,16 +8,22 @@ //===----------------------------------------------------------------------===// // Tests for stable_partition and partition_copy -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#include +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -#include -#include +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_partition_copy { @@ -41,7 +47,7 @@ #if __PSTL_ICC_1800_TEST_MONOTONIC_RELEASE_64_BROKEN template void - operator()(pstl::execution::unsequenced_policy, std::reverse_iterator first, + operator()(__pstl::execution::unsequenced_policy, std::reverse_iterator first, std::reverse_iterator last, std::reverse_iterator true_first, std::reverse_iterator true_last, std::reverse_iterator false_first, OutputIterator2 false_last, UnaryOp unary_op) @@ -49,7 +55,7 @@ } template void - operator()(pstl::execution::parallel_unsequenced_policy, std::reverse_iterator first, + operator()(__pstl::execution::parallel_unsequenced_policy, std::reverse_iterator first, std::reverse_iterator last, std::reverse_iterator true_first, std::reverse_iterator true_last, std::reverse_iterator false_first, OutputIterator2 false_last, UnaryOp unary_op) Index: test/std/algorithms/alg.modifying.operations/alg.reverse/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.modifying.operations/alg.reverse/CMakeLists.txt @@ -0,0 +1,10 @@ +set(PASS_SOURCES + reverse.pass.cpp; + reverse_copy.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.modifying.operations/alg.reverse/reverse.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/alg.reverse/reverse.pass.cpp +++ test/std/algorithms/alg.modifying.operations/alg.reverse/reverse.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_reverse.cpp --------------------------------------------------===// +//===-- reverse.pass.cpp --------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" #include - +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_one_policy { @@ -23,13 +28,13 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration template typename std::enable_if::value, void>::type - operator()(pstl::execution::unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, + operator()(__pstl::execution::unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, Iterator2 actual_e) { } template typename std::enable_if::value, void>::type - operator()(pstl::execution::parallel_unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, Iterator2 actual_e) { } Index: test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp +++ test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_reverse_copy.cpp ---------------------------------------------===// +//===-- reverse_copy.pass.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" #include - +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct wrapper @@ -63,12 +68,12 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration template typename std::enable_if::value, void>::type - operator()(pstl::execution::unsequenced_policy, Iterator1 actual_b, Iterator1 actual_e) + operator()(__pstl::execution::unsequenced_policy, Iterator1 actual_b, Iterator1 actual_e) { } template typename std::enable_if::value, void>::type - operator()(pstl::execution::parallel_unsequenced_policy, Iterator1 actual_b, Iterator1 actual_e) + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator1 actual_b, Iterator1 actual_e) { } #endif Index: test/std/algorithms/alg.modifying.operations/copy_move.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/copy_move.pass.cpp +++ test/std/algorithms/alg.modifying.operations/copy_move.pass.cpp @@ -9,13 +9,19 @@ // Tests for copy, move and copy_n -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct run_copy { @@ -24,7 +30,7 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, + operator()(__pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size size, Size n, T trash) { @@ -32,7 +38,7 @@ template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size size, Size n, T trash) { @@ -77,7 +83,7 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, + operator()(__pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size size, Size n, T trash) { @@ -85,7 +91,7 @@ template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size size, Size n, T trash) { @@ -120,7 +126,7 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, + operator()(__pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size size, Size n, Wrapper trash) { @@ -128,7 +134,7 @@ template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size size, Size n, Wrapper trash) { Index: test/std/algorithms/alg.modifying.operations/fill.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/fill.pass.cpp +++ test/std/algorithms/alg.modifying.operations/fill.pass.cpp @@ -9,11 +9,20 @@ // Tests for fill/fill_n +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_fill { Index: test/std/algorithms/alg.modifying.operations/generate.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/generate.pass.cpp +++ test/std/algorithms/alg.modifying.operations/generate.pass.cpp @@ -8,13 +8,21 @@ //===----------------------------------------------------------------------===// // Tests for generate -#include +#include "support/pstl_test_config.h" +#include +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct Generator_count Index: test/std/algorithms/alg.modifying.operations/remove.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/remove.pass.cpp +++ test/std/algorithms/alg.modifying.operations/remove.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_remove.cpp ---------------------------------------------------===// +//===-- remove.pass.cpp ---------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,13 +8,20 @@ //===----------------------------------------------------------------------===// // Test for remove, remove_if -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct run_remove { Index: test/std/algorithms/alg.modifying.operations/remove_copy.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/remove_copy.pass.cpp +++ test/std/algorithms/alg.modifying.operations/remove_copy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_remove_copy.cpp ----------------------------------------------===// +//===-- remove_copy.pass.cpp ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,11 +9,21 @@ // Tests for remove_copy +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" + +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct run_remove_copy { Index: test/std/algorithms/alg.modifying.operations/replace.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/replace.pass.cpp +++ test/std/algorithms/alg.modifying.operations/replace.pass.cpp @@ -7,13 +7,21 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; // This class is needed to check the self-copying struct copy_int Index: test/std/algorithms/alg.modifying.operations/replace_copy.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/replace_copy.pass.cpp +++ test/std/algorithms/alg.modifying.operations/replace_copy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_replace_copy.cpp ---------------------------------------------===// +//===-- replace_copy.pass.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,13 +9,21 @@ // Tests for replace_copy and replace_copy_if -#include "pstl_test_config.h" +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_replace_copy { Index: test/std/algorithms/alg.modifying.operations/rotate.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/rotate.pass.cpp +++ test/std/algorithms/alg.modifying.operations/rotate.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_rotate.cpp ---------------------------------------------------===// +//===-- rotate.pass.cpp ---------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" #include - +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct wrapper @@ -76,13 +81,13 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specializations to skip testing in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, Iterator data_b, Iterator data_e, Iterator actual_b, + operator()(__pstl::execution::unsequenced_policy, Iterator data_b, Iterator data_e, Iterator actual_b, Iterator actual_e, Size shift) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, Iterator data_b, Iterator data_e, Iterator actual_b, + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator data_b, Iterator data_e, Iterator actual_b, Iterator actual_e, Size shift) { } @@ -112,7 +117,7 @@ template typename std::enable_if< is_same_iterator_category::value && - !std::is_same::value && + !std::is_same::value && std::is_same::value_type, wrapper>::value, bool>::type check_move(ExecutionPolicy&& exec, Iterator b, Iterator e, Size shift) @@ -128,7 +133,7 @@ template typename std::enable_if< !(is_same_iterator_category::value && - !std::is_same::value && + !std::is_same::value && std::is_same::value_type, wrapper>::value), bool>::type check_move(ExecutionPolicy&& exec, Iterator b, Iterator e, Size shift) Index: test/std/algorithms/alg.modifying.operations/rotate_copy.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/rotate_copy.pass.cpp +++ test/std/algorithms/alg.modifying.operations/rotate_copy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_rotate_copy.cpp ----------------------------------------------===// +//===-- rotate_copy.pass.cpp ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" #include - +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct wrapper; @@ -71,13 +76,13 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration template typename std::enable_if::value, void>::type - operator()(pstl::execution::unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, + operator()(__pstl::execution::unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, Iterator2 actual_e, std::size_t shift) { } template typename std::enable_if::value, void>::type - operator()(pstl::execution::parallel_unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator1 data_b, Iterator1 data_e, Iterator2 actual_b, Iterator2 actual_e, std::size_t shift) { } Index: test/std/algorithms/alg.modifying.operations/swap_ranges.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/swap_ranges.pass.cpp +++ test/std/algorithms/alg.modifying.operations/swap_ranges.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_swap_ranges.cpp ----------------------------------------------===// +//===-- swap_ranges.pass.cpp ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" #include - +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct wrapper Index: test/std/algorithms/alg.modifying.operations/transform_binary.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/transform_binary.pass.cpp +++ test/std/algorithms/alg.modifying.operations/transform_binary.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_transform_binary.cpp -----------------------------------------===// +//===-- transform_binary.pass.cpp -----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,20 @@ // //===----------------------------------------------------------------------===// +#include "support/pstl_test_config.h" + +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template class TheOperation Index: test/std/algorithms/alg.modifying.operations/transform_unary.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/transform_unary.pass.cpp +++ test/std/algorithms/alg.modifying.operations/transform_unary.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_transform_unary.cpp ------------------------------------------===// +//===-- transform_unary.pass.cpp ------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,20 @@ // //===----------------------------------------------------------------------===// +#include "support/pstl_test_config.h" + +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template void Index: test/std/algorithms/alg.modifying.operations/unique.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/unique.pass.cpp +++ test/std/algorithms/alg.modifying.operations/unique.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_unique.cpp ---------------------------------------------------===// +//===-- unique.pass.cpp ---------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,13 +8,19 @@ //===----------------------------------------------------------------------===// // Test for unique -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct run_unique { @@ -22,28 +28,28 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, + operator()(__pstl::execution::unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, ForwardIt last2, Generator generator) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, + operator()(__pstl::execution::parallel_unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, ForwardIt last2, Generator generator) { } template void - operator()(pstl::execution::unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, + operator()(__pstl::execution::unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, ForwardIt last2, BinaryPred pred, Generator generator) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, + operator()(__pstl::execution::parallel_unsequenced_policy, ForwardIt first1, ForwardIt last1, ForwardIt first2, ForwardIt last2, BinaryPred pred, Generator generator) { } Index: test/std/algorithms/alg.modifying.operations/unique_copy_equal.pass.cpp =================================================================== --- test/std/algorithms/alg.modifying.operations/unique_copy_equal.pass.cpp +++ test/std/algorithms/alg.modifying.operations/unique_copy_equal.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_unique_copy_equal.cpp ----------------------------------------===// +//===-- unique_copy_equal.pass.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,14 +7,22 @@ // //===----------------------------------------------------------------------===// -// Tests for unique_copy -#include "pstl_test_config.h" +// Tests for unique_copy that uses == as equivalence relationship +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct run_unique_copy { @@ -22,7 +30,7 @@ template void - operator()(pstl::execution::parallel_policy, InputIterator first, InputIterator last, OutputIterator out_first, + operator()(__pstl::execution::parallel_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size n, Predicate pred, T trash) { @@ -31,7 +39,7 @@ template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator2 expected_first, OutputIterator2 expected_last, Size n, Predicate pred, T trash) { Index: test/std/algorithms/alg.nonmodifying/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.nonmodifying/CMakeLists.txt @@ -0,0 +1,22 @@ +set(PASS_SOURCES + adjacent_find.pass.cpp + all_of.pass.cpp; + any_of.pass.cpp; + count.pass.cpp; + equal.pass.cpp; + find.pass.cpp; + find_end.pass.cpp; + find_first_of.pass.cpp; + find_if.pass.cpp; + for_each.pass.cpp; + mismatch.pass.cpp; + none_of.pass.cpp; + nth_element.pass.cpp; + search_n.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp +++ test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_adjacent_find.cpp --------------------------------------------===// +//===-- adjacent_find.pass.cpp --------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,11 +9,19 @@ // Tests for adjacent_find +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_adjacent_find { Index: test/std/algorithms/alg.nonmodifying/all_of.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/all_of.pass.cpp +++ test/std/algorithms/alg.nonmodifying/all_of.pass.cpp @@ -7,11 +7,19 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +// UNSUPPORTED: c++98, c++03, c++11, c++14 +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" /* TODO: consider implementing the following tests for a better code coverage @@ -22,7 +30,7 @@ - check that algorithm does not require anything more than is described in its requirements section */ -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_all_of { Index: test/std/algorithms/alg.nonmodifying/any_of.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/any_of.pass.cpp +++ test/std/algorithms/alg.nonmodifying/any_of.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_any_of.cpp ---------------------------------------------------===// +//===-- any_of.pass.cpp ---------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,17 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" /* TODO: consider implementing the following tests for a better code coverage @@ -22,7 +28,7 @@ - check that algorithm does not require anything more than is described in its requirements section */ -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_any_of { Index: test/std/algorithms/alg.nonmodifying/count.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/count.pass.cpp +++ test/std/algorithms/alg.nonmodifying/count.pass.cpp @@ -8,13 +8,19 @@ //===----------------------------------------------------------------------===// // Tests for count and count_if -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_count { Index: test/std/algorithms/alg.nonmodifying/equal.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/equal.pass.cpp +++ test/std/algorithms/alg.nonmodifying/equal.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_equal.cpp ----------------------------------------------------===// +//===-- equal.pass.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,19 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; #define CPP14_ENABLED 0 Index: test/std/algorithms/alg.nonmodifying/find.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/find.pass.cpp +++ test/std/algorithms/alg.nonmodifying/find.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_find.cpp -----------------------------------------------------===// +//===-- find.pass.cpp -----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,26 +8,31 @@ //===----------------------------------------------------------------------===// // Tests for find -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" -struct test_find -{ -#if __PSTL_ICC_17_VC141_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN || \ +using namespace Parallel_TestUtils; + +struct test_find { +#if __PSTL_ICC_17_VC141_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN || \ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, Iterator first, Iterator last, Value value) + operator()(__pstl::execution::unsequenced_policy, Iterator first, Iterator last, Value value) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, Iterator first, Iterator last, Value value) + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator first, Iterator last, Value value) { } #endif Index: test/std/algorithms/alg.nonmodifying/find_end.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/find_end.pass.cpp +++ test/std/algorithms/alg.nonmodifying/find_end.pass.cpp @@ -7,13 +7,19 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_one_policy { Index: test/std/algorithms/alg.nonmodifying/find_first_of.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/find_first_of.pass.cpp +++ test/std/algorithms/alg.nonmodifying/find_first_of.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_find_first_of.cpp --------------------------------------------===// +//===-- find_first_of.pass.cpp --------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,19 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_one_policy { Index: test/std/algorithms/alg.nonmodifying/find_if.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/find_if.pass.cpp +++ test/std/algorithms/alg.nonmodifying/find_if.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_find_if.cpp --------------------------------------------------===// +//===-- find_if.pass.cpp --------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,13 +8,20 @@ //===----------------------------------------------------------------------===// // Tests for find_if and find_if_not -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_find_if { Index: test/std/algorithms/alg.nonmodifying/for_each.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/for_each.pass.cpp +++ test/std/algorithms/alg.nonmodifying/for_each.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_for_each.cpp -------------------------------------------------===// +//===-- for_each.pass.cpp -------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,21 @@ // //===----------------------------------------------------------------------===// +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +#include + +using namespace Parallel_TestUtils; template struct Gen @@ -44,17 +54,19 @@ typedef typename std::iterator_traits::value_type T; // Try for_each - std::for_each(expected_first, expected_last, Flip(1)); + std::for_each(__pstl::execution::seq, expected_first, expected_last, Flip(1)); for_each(exec, first, last, Flip(1)); EXPECT_EQ_N(expected_first, first, n, "wrong effect from for_each"); // Try for_each_n - std::for_each_n(pstl::execution::seq, expected_first, n, Flip(1)); + std::for_each_n(__pstl::execution::seq, expected_first, n, Flip(1)); + std::for_each_n(__pstl::execution::seq, expected_first, n, Flip(1)); for_each_n(exec, first, n, Flip(1)); EXPECT_EQ_N(expected_first, first, n, "wrong effect from for_each_n"); } }; + template void test() Index: test/std/algorithms/alg.nonmodifying/mismatch.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/mismatch.pass.cpp +++ test/std/algorithms/alg.nonmodifying/mismatch.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_mismatch.cpp -------------------------------------------------===// +//===-- mismatch.pass.cpp -------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,16 +7,20 @@ // //===----------------------------------------------------------------------===// -// Tests for the rest algorithms; temporary approach to check compiling +// test mismatch +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "pstl/numeric" -#include "pstl/memory" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -#include "utils.h" +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_mismatch { @@ -41,7 +45,7 @@ using namespace std; typedef typename iterator_traits::value_type T; { - const auto expected = mismatch(pstl::execution::seq, first1, last1, first2, last2, std::equal_to()); + const auto expected = mismatch(__pstl::execution::seq, first1, last1, first2, last2, std::equal_to()); const auto res1 = mismatch(exec, first1, last1, first2, last2, std::equal_to()); EXPECT_TRUE(expected == res1, "wrong return result from mismatch"); const auto res2 = mismatch(exec, first1, last1, first2, last2); Index: test/std/algorithms/alg.nonmodifying/none_of.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/none_of.pass.cpp +++ test/std/algorithms/alg.nonmodifying/none_of.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_none_of.cpp --------------------------------------------------===// +//===-- none_of.pass.cpp --------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,17 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" /* TODO: consider implementing the following tests for a better code coverage @@ -22,7 +28,7 @@ - check that algorithm does not require anything more than is described in its requirements section */ -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_none_of { Index: test/std/algorithms/alg.nonmodifying/nth_element.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/nth_element.pass.cpp +++ test/std/algorithms/alg.nonmodifying/nth_element.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_nth_element.cpp ----------------------------------------------===// +//===-- nth_element.pass.cpp ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,16 +7,19 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" -#include -#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -#include "utils.h" +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; // User defined type with minimal requirements template @@ -71,13 +74,13 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration template typename std::enable_if::value, void>::type - operator()(pstl::execution::unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, + operator()(__pstl::execution::unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, Iterator1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) { } template typename std::enable_if::value, void>::type - operator()(pstl::execution::parallel_unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator1 first1, Iterator1 last1, Iterator1 first2, Iterator1 last2, Size n, Size m, Generator1 generator1, Generator2 generator2, Compare comp) { } Index: test/std/algorithms/alg.nonmodifying/search_n.pass.cpp =================================================================== --- test/std/algorithms/alg.nonmodifying/search_n.pass.cpp +++ test/std/algorithms/alg.nonmodifying/search_n.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_search_n.cpp -------------------------------------------------===// +//===-- search.pass.cpp -------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_one_policy { Index: test/std/algorithms/alg.sorting/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.sorting/CMakeLists.txt @@ -0,0 +1,17 @@ +add_subdirectory(alg.heap.operations) +add_subdirectory(alg.lex.comparison) +add_subdirectory(alg.min.max) +add_subdirectory(alg.set.operations) + +set(PASS_SOURCES + is_sorted.pass.cpp; + partial_sort.pass.cpp; + partial_sort_copy.pass.cpp; + sort.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.sorting/alg.heap.operations/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.sorting/alg.heap.operations/CMakeLists.txt @@ -0,0 +1,9 @@ +set(PASS_SOURCES + is_heap.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.sorting/alg.heap.operations/is_heap.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/alg.heap.operations/is_heap.pass.cpp +++ test/std/algorithms/alg.sorting/alg.heap.operations/is_heap.pass.cpp @@ -8,14 +8,21 @@ //===----------------------------------------------------------------------===// // Tests for is_heap, is_heap_until -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" -#include +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct WithCmpOp { @@ -36,12 +43,12 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN //dummy specialization by policy type, in case of broken configuration template typename std::enable_if::value, void>::type - operator()(pstl::execution::unsequenced_policy, Iterator first, Iterator last, Predicate pred) + operator()(__pstl::execution::unsequenced_policy, Iterator first, Iterator last, Predicate pred) { } template typename std::enable_if::value, void>::type - operator()(pstl::execution::parallel_unsequenced_policy, Iterator first, Iterator last, Predicate pred) + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator first, Iterator last, Predicate pred) { } #endif Index: test/std/algorithms/alg.sorting/alg.lex.comparison/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.sorting/alg.lex.comparison/CMakeLists.txt @@ -0,0 +1,9 @@ +set(PASS_SOURCES + lexicographical_compare.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp +++ test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_lexicographical_compare.cpp ----------------------------------===// +//===-- lexicographical_compare.pass.cpp ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" -#include -#include +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_one_policy { Index: test/std/algorithms/alg.sorting/alg.min.max/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.sorting/alg.min.max/CMakeLists.txt @@ -0,0 +1,9 @@ +set(PASS_SOURCES + minmax_element.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp +++ test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_minmax_element.cpp -------------------------------------------===// +//===-- minmax_element.pass.cpp -------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,15 +9,23 @@ // Tests for min_element, max_element, minmax_element +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" #include #include #include -using namespace TestUtils; +using namespace Parallel_TestUtils; struct check_minelement { @@ -68,19 +76,19 @@ template struct sequence_wrapper { - TestUtils::Sequence seq; + Parallel_TestUtils::Sequence seq; const T min_value; const T max_value; static const std::size_t bits = 30; // We assume that T can handle signed 2^bits+1 value - // TestUtils::HashBits returns value between 0 and (1< T { return T(TestUtils::HashBits(i, bits)); }); + seq.fill([](std::size_t i) -> T { return T(Parallel_TestUtils::HashBits(i, bits)); }); } // sets first one at position `at` and bunch of them farther @@ -92,7 +100,7 @@ seq[at] = value; //Producing serveral red herrings - for (std::size_t i = at + 1; i < seq.size(); i += 1 + TestUtils::HashBits(i, 5)) + for (std::size_t i = at + 1; i < seq.size(); i += 1 + Parallel_TestUtils::HashBits(i, 5)) seq[i] = value; } }; @@ -118,12 +126,12 @@ { wseq.pattern_fill(); wseq.set_desired_value(*it, wseq.min_value); - TestUtils::invoke_on_all_policies(check_minelement(), wseq.seq.cbegin(), wseq.seq.cend()); - TestUtils::invoke_on_all_policies(check_minelement(), wseq.seq.begin(), wseq.seq.end()); + Parallel_TestUtils::invoke_on_all_policies(check_minelement(), wseq.seq.cbegin(), wseq.seq.cend()); + Parallel_TestUtils::invoke_on_all_policies(check_minelement(), wseq.seq.begin(), wseq.seq.end()); wseq.set_desired_value(*it, wseq.max_value); - TestUtils::invoke_on_all_policies(check_maxelement(), wseq.seq.cbegin(), wseq.seq.cend()); - TestUtils::invoke_on_all_policies(check_maxelement(), wseq.seq.begin(), wseq.seq.end()); + Parallel_TestUtils::invoke_on_all_policies(check_maxelement(), wseq.seq.cbegin(), wseq.seq.cend()); + Parallel_TestUtils::invoke_on_all_policies(check_maxelement(), wseq.seq.begin(), wseq.seq.end()); if (targets.size() > 1) { @@ -134,14 +142,14 @@ wseq.pattern_fill(); wseq.set_desired_value(*it, wseq.min_value); // setting minimum element wseq.set_desired_value(*rit, wseq.max_value); // setting maximum element - TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.cbegin(), wseq.seq.cend()); - TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.begin(), wseq.seq.end()); + Parallel_TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.cbegin(), wseq.seq.cend()); + Parallel_TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.begin(), wseq.seq.end()); } } else { // we must check this corner case; it can not be tested in loop above - TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.cbegin(), wseq.seq.cend()); - TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.begin(), wseq.seq.end()); + Parallel_TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.cbegin(), wseq.seq.cend()); + Parallel_TestUtils::invoke_on_all_policies(check_minmaxelement(), wseq.seq.begin(), wseq.seq.end()); } } } @@ -175,7 +183,7 @@ int32_t main() { - using TestUtils::float64_t; + using Parallel_TestUtils::float64_t; const std::size_t N = 100000; for (std::size_t n = 0; n < N; n = n < 16 ? n + 1 : size_t(3.14159 * n)) @@ -186,6 +194,6 @@ test_algo_basic_single(run_for_rnd_fw>()); - std::cout << TestUtils::done() << std::endl; + std::cout << Parallel_TestUtils::done() << std::endl; return 0; } Index: test/std/algorithms/alg.sorting/alg.set.operations/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/algorithms/alg.sorting/alg.set.operations/CMakeLists.txt @@ -0,0 +1,10 @@ +set(PASS_SOURCES + includes.pass.cpp; + set.pass.cpp; +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/algorithms/alg.sorting/alg.set.operations/includes.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/alg.set.operations/includes.pass.cpp +++ test/std/algorithms/alg.sorting/alg.set.operations/includes.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_includes.cpp -------------------------------------------------===// +//===-- includes.pass.cpp -------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,13 +9,21 @@ // Tests for partial_sort -#include +#include "support/pstl_test_config.h" + +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct Num @@ -42,7 +50,7 @@ struct test_one_policy { template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp) { @@ -54,7 +62,7 @@ } template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp) { Index: test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp +++ test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_set.cpp ------------------------------------------------------===// +//===-- set.pass.cpp ------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,14 +9,22 @@ // Tests for partial_sort +#include "support/pstl_test_config.h" + #include #include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct Num @@ -51,7 +59,7 @@ struct test_one_policy { template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp) { @@ -94,7 +102,7 @@ } template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp) { Index: test/std/algorithms/alg.sorting/is_sorted.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/is_sorted.pass.cpp +++ test/std/algorithms/alg.sorting/is_sorted.pass.cpp @@ -9,11 +9,19 @@ // Tests for is_sorted, is_sorted_until +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_is_sorted { Index: test/std/algorithms/alg.sorting/partial_sort.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/partial_sort.pass.cpp +++ test/std/algorithms/alg.sorting/partial_sort.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_partial_sort.cpp ---------------------------------------------===// +//===-- partial_sort.pass.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,13 +9,22 @@ // Tests for partial_sort -#include +// Tests for copy_if and remove_copy_if +#include "support/pstl_test_config.h" +#include +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; static std::atomic count_val; static std::atomic count_comp; Index: test/std/algorithms/alg.sorting/partial_sort_copy.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/partial_sort_copy.pass.cpp +++ test/std/algorithms/alg.sorting/partial_sort_copy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_partial_sort_copy.cpp ----------------------------------------===// +//===-- partial_sort_copy.pass.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,14 +9,20 @@ // Tests for partial_sort_copy -#include -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct Num @@ -57,28 +63,28 @@ __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN // dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, + operator()(__pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, const T& trash, Compare compare) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, const T& trash, Compare compare) { } template void - operator()(pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, + operator()(__pstl::execution::unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, const T& trash) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, + operator()(__pstl::execution::parallel_unsequenced_policy, InputIterator first, InputIterator last, Size n1, Size n2, const T& trash) { } Index: test/std/algorithms/alg.sorting/sort.pass.cpp =================================================================== --- test/std/algorithms/alg.sorting/sort.pass.cpp +++ test/std/algorithms/alg.sorting/sort.pass.cpp @@ -9,11 +9,20 @@ // Tests for sort and stable_sort +#include "support/pstl_test_config.h" + +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; #define _CRT_SECURE_NO_WARNINGS #include Index: test/std/numerics/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/numerics/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(numeric.ops) Index: test/std/numerics/numeric.ops/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/numerics/numeric.ops/CMakeLists.txt @@ -0,0 +1,13 @@ +set(PASS_SOURCES + adjacent_difference.pass.cpp + reduce.pass.cpp + scan.pass.cpp + transform_reduce.pass.cpp + transform_scan.pass.cpp +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/numerics/numeric.ops/adjacent_difference.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/adjacent_difference.pass.cpp +++ test/std/numerics/numeric.ops/adjacent_difference.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_adjacent_difference.cpp --------------------------------------===// +//===-- adjacent_difference.pass.cpp --------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,16 +7,20 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" - -#include +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" -#include "pstl/algorithm" #include "pstl/numeric" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; template struct wrapper Index: test/std/numerics/numeric.ops/reduce.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/reduce.pass.cpp +++ test/std/numerics/numeric.ops/reduce.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_reduce.cpp ---------------------------------------------------===// +//===-- reduce.pass.cpp ---------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,19 @@ // //===----------------------------------------------------------------------===// -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/numeric" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; struct test_long_forms_for_one_policy { @@ -54,12 +60,12 @@ #if __PSTL_ICC_16_VC14_TEST_PAR_TBB_RT_RELEASE_64_BROKEN //dummy specialization by policy type, in case of broken configuration template void - operator()(pstl::execution::parallel_policy, Iterator first, Iterator last, Sum init, Sum expected) + operator()(__pstl::execution::parallel_policy, Iterator first, Iterator last, Sum init, Sum expected) { } template void - operator()(pstl::execution::parallel_unsequenced_policy, Iterator first, Iterator last, Sum init, Sum expected) + operator()(__pstl::execution::parallel_unsequenced_policy, Iterator first, Iterator last, Sum init, Sum expected) { } #endif Index: test/std/numerics/numeric.ops/scan.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/scan.pass.cpp +++ test/std/numerics/numeric.ops/scan.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_scan.cpp -----------------------------------------------------===// +//===-- scan.pass.cpp -----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,12 +7,19 @@ // //===----------------------------------------------------------------------===// +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/numeric" -#include "utils.h" -#include "pstl_test_config.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; // We provide the no execution policy versions of the exclusive_scan and inclusive_scan due checking correctness result of the versions with execution policies. //TODO: to add a macro for availability of ver implementations @@ -132,7 +139,7 @@ { template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, Iterator1 in_first, Iterator1 in_last, Iterator2 out_first, Iterator2 out_last, Iterator3 expected_first, Iterator3 expected_last, Size n, T init, BinaryOp binary_op, T trash) { @@ -149,7 +156,7 @@ template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, Iterator1 in_first, Iterator1 in_last, Iterator2 out_first, Iterator2 out_last, Iterator3 expected_first, Iterator3 expected_last, Size n, T init, BinaryOp binary_op, T trash) { Index: test/std/numerics/numeric.ops/transform_reduce.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/transform_reduce.pass.cpp +++ test/std/numerics/numeric.ops/transform_reduce.pass.cpp @@ -9,11 +9,21 @@ // Tests for inner_product +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/numeric" -#include "utils.h" +// TODO break this dependency +#include "pstl/internal/numeric_impl.h" //for usage a serial algo version +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; // Equal for all types template Index: test/std/numerics/numeric.ops/transform_scan.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/transform_scan.pass.cpp +++ test/std/numerics/numeric.ops/transform_scan.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_transform_scan.cpp -------------------------------------------===// +//===-- transform_scan.pass.cpp -------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,12 +7,19 @@ // //===----------------------------------------------------------------------===// +#include "support/pstl_test_config.h" + +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/numeric" -#include "utils.h" -#include "pstl_test_config.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; // Most of the framework required for testing inclusive and exclusive transform-scans is identical, // so the tests for both are in this file. Which is being tested is controlled by the global @@ -33,16 +40,16 @@ { template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator expected_first, OutputIterator expected_last, Size n, UnaryOp unary_op, T init, BinaryOp binary_op, T trash) { using namespace std; - auto orr1 = inclusive ? transform_inclusive_scan(pstl::execution::seq, first, last, expected_first, binary_op, + auto orr1 = inclusive ? transform_inclusive_scan(__pstl::execution::seq, first, last, expected_first, binary_op, unary_op, init) - : transform_exclusive_scan(pstl::execution::seq, first, last, expected_first, init, + : transform_exclusive_scan(__pstl::execution::seq, first, last, expected_first, init, binary_op, unary_op); auto orr2 = inclusive ? transform_inclusive_scan(exec, first, last, out_first, binary_op, unary_op, init) : transform_exclusive_scan(exec, first, last, out_first, init, binary_op, unary_op); @@ -52,7 +59,7 @@ // Checks inclusive scan if init is not provided if (inclusive && n > 0) { - orr1 = transform_inclusive_scan(pstl::execution::seq, first, last, expected_first, binary_op, unary_op); + orr1 = transform_inclusive_scan(__pstl::execution::seq, first, last, expected_first, binary_op, unary_op); orr2 = transform_inclusive_scan(exec, first, last, out_first, binary_op, unary_op); EXPECT_TRUE(out_last == orr2, "transform...scan returned wrong iterator"); check_and_reset(expected_first, out_first, n, trash); @@ -61,7 +68,7 @@ template - typename std::enable_if::value, void>::type + typename std::enable_if::value, void>::type operator()(Policy&& exec, InputIterator first, InputIterator last, OutputIterator out_first, OutputIterator out_last, OutputIterator expected_first, OutputIterator expected_last, Size n, UnaryOp unary_op, T init, BinaryOp binary_op, T trash) Index: test/std/utilities/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/utilities/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(memory) Index: test/std/utilities/memory/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/utilities/memory/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(specialized.algorithms) Index: test/std/utilities/memory/specialized.algorithms/CMakeLists.txt =================================================================== --- /dev/null +++ test/std/utilities/memory/specialized.algorithms/CMakeLists.txt @@ -0,0 +1,11 @@ +set(PASS_SOURCES + uninitialized_copy_move.pass.cpp + uninitialized_fill_destroy.pass.cpp + uninitialized_construct.pass.cpp +) + +# TODO add more tests + +foreach(test_source ${PASS_SOURCES}) + add_pass_test(${test_source}) +endforeach(test_source ${PASS_SOURCES}) Index: test/std/utilities/memory/specialized.algorithms/uninitialized_construct.pass.cpp =================================================================== --- test/std/utilities/memory/specialized.algorithms/uninitialized_construct.pass.cpp +++ test/std/utilities/memory/specialized.algorithms/uninitialized_construct.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_uninitialized_construct.cpp ----------------------------------===// +//===-- uninitialized_construct.pass.cpp ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,16 +7,23 @@ // //===----------------------------------------------------------------------===// -// Tests for uninitialized_default_construct, uninitialized_default_construct_n, -// uninitialized_value_construct, uninitialized_value_construct_n +// Tests for uninitialized_default_consruct, uninitialized_default_consruct_n, +// uninitialized_value_consruct, uninitialized_value_consruct_n -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/memory" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; // function of checking correctness for uninitialized.construct.value template Index: test/std/utilities/memory/specialized.algorithms/uninitialized_copy_move.pass.cpp =================================================================== --- test/std/utilities/memory/specialized.algorithms/uninitialized_copy_move.pass.cpp +++ test/std/utilities/memory/specialized.algorithms/uninitialized_copy_move.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_uninitialized_copy_move.cpp ----------------------------------===// +//===-- uninitialized_copy_move.pass.cpp ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,13 +9,20 @@ // Tests for uninitialized_copy, uninitialized_copy_n, uninitialized_move, uninitialized_move_n -#include "pstl_test_config.h" +#include "support/pstl_test_config.h" +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/memory" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS -using namespace TestUtils; +#include "support/parallel_utils.h" + +using namespace Parallel_TestUtils; // function of checking correctness for uninitialized.construct.value template Index: test/std/utilities/memory/specialized.algorithms/uninitialized_fill_destroy.pass.cpp =================================================================== --- test/std/utilities/memory/specialized.algorithms/uninitialized_fill_destroy.pass.cpp +++ test/std/utilities/memory/specialized.algorithms/uninitialized_fill_destroy.pass.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-- test_uninitialized_fill_destroy.cpp -------------------------------===// +//===-- uninitialized_fill_destroy.pass.cpp -------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,12 +9,20 @@ // Tests for the destroy, destroy_n, uninitialized_fill, uninitialized_fill_n algorithms +#include "support/pstl_test_config.h" + +#include +#ifdef PSTL_STANDALONE_TESTS #include "pstl/execution" #include "pstl/memory" -#include "pstl/algorithm" -#include "utils.h" +#else +#include +#include +#endif // PSTL_STANDALONE_TESTS + +#include "support/parallel_utils.h" -using namespace TestUtils; +using namespace Parallel_TestUtils; struct test_uninitialized_fill_destroy { Index: test/support/parallel_utils.h =================================================================== --- test/support/parallel_utils.h +++ test/support/parallel_utils.h @@ -1,9 +1,10 @@ // -*- C++ -*- -//===-- utils.h -----------------------------------------------------------===// +//===-- parallel_utils.h -----------------------------------------------------------===// // -// 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 +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// @@ -21,7 +22,7 @@ #include "pstl_test_config.h" -namespace TestUtils +namespace Parallel_TestUtils { typedef double float64_t; @@ -38,15 +39,16 @@ class Sequence; // Handy macros for error reporting -#define EXPECT_TRUE(condition, message) TestUtils::expect(condition, __FILE__, __LINE__, message) -#define EXPECT_FALSE(condition, message) TestUtils::expect(condition, __FILE__, __LINE__, message) +#define EXPECT_TRUE(condition, message) Parallel_TestUtils::expect(condition, __FILE__, __LINE__, message) +#define EXPECT_FALSE(condition, message) Parallel_TestUtils::expect(condition, __FILE__, __LINE__, message) // Check that expected and actual are equal and have the same type. -#define EXPECT_EQ(expected, actual, message) TestUtils::expect_equal(expected, actual, __FILE__, __LINE__, message) +#define EXPECT_EQ(expected, actual, message) \ + Parallel_TestUtils::expect_equal(expected, actual, __FILE__, __LINE__, message) // Check that sequences started with expected and actual and have had size n are equal and have the same type. #define EXPECT_EQ_N(expected, actual, n, message) \ - TestUtils::expect_equal(expected, actual, n, __FILE__, __LINE__, message) + Parallel_TestUtils::expect_equal(expected, actual, n, __FILE__, __LINE__, message) // Issue error message from outstr, adding a newline. // Real purpose of this routine is to have a place to hang a breakpoint. Index: test/support/pstl_test_config.h =================================================================== --- test/support/pstl_test_config.h +++ test/support/pstl_test_config.h @@ -1,9 +1,10 @@ // -*- C++ -*- //===-- pstl_test_config.h ------------------------------------------------===// // -// 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 +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===//