mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
netlist: add nvcc support to netlist makefile. (nw)
Also converted some by-ref calls to pass by value.
This commit is contained in:
parent
a43a2dc2f7
commit
0bd20c8d14
@ -23,7 +23,7 @@ endif
|
|||||||
|
|
||||||
# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
|
# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
|
||||||
|
|
||||||
CFLAGS = $(LTO) -g -O3 -std=c++11 -march=native -I../.. -Wall -Wpedantic -Wsign-compare -Wextra -Wno-unused-parameter $(CEXTRAFLAGS)
|
CFLAGS = $(LTO) -g -O3 -std=c++11 -I../.. $(CEXTRAFLAGS)
|
||||||
LDFLAGS = $(LTO) -g -O3 -std=c++11 $(LDEXTRAFLAGS)
|
LDFLAGS = $(LTO) -g -O3 -std=c++11 $(LDEXTRAFLAGS)
|
||||||
LIBS = -lpthread -ldl
|
LIBS = -lpthread -ldl
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ ALL_OBJS = $(OBJS) $(PMAIN) $(NLOBJ)/prg/nltool.o $(NLOBJ)/prg/nlwav.o
|
|||||||
SOURCES = $(patsubst $(OBJ)%, $(SRC)%, $(ALL_OBJS:.o=.cpp))
|
SOURCES = $(patsubst $(OBJ)%, $(SRC)%, $(ALL_OBJS:.o=.cpp))
|
||||||
ALLFILES = $(SOURCES) $(VSBUILDS) $(DOCS)
|
ALLFILES = $(SOURCES) $(VSBUILDS) $(DOCS)
|
||||||
|
|
||||||
MAKEFILE_TARGETS_WITHOUT_INCLUDE := clean doc clang mingw
|
MAKEFILE_TARGETS_WITHOUT_INCLUDE := clean doc clang mingw nvcc
|
||||||
|
|
||||||
|
|
||||||
# git archive HEAD --prefix=project-name-version/ \
|
# git archive HEAD --prefix=project-name-version/ \
|
||||||
@ -201,14 +201,21 @@ maketree: $(sort $(OBJDIRS))
|
|||||||
# Special targets
|
# Special targets
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
.PHONY: clang clang-5 mingw doc
|
.PHONY: clang clang-5 mingw doc native
|
||||||
|
|
||||||
|
native:
|
||||||
|
$(MAKE) CEXTRAFLAGS="-march=native -Wall -Wpedantic -Wsign-compare -Wextra -Wno-unused-parameter"
|
||||||
|
|
||||||
clang:
|
clang:
|
||||||
$(MAKE) CC=clang++ LD=clang++ CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wweak-template-vtables -Wno-exit-time-destructors"
|
$(MAKE) CC=clang++ LD=clang++ CEXTRAFLAGS="-march=native -Wno-unused-parameter -Weverything -Werror -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wweak-template-vtables -Wno-exit-time-destructors"
|
||||||
|
|
||||||
clang-5:
|
clang-5:
|
||||||
$(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-inconsistent-missing-destructor-override -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
|
$(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-inconsistent-missing-destructor-override -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
|
||||||
|
|
||||||
|
nvcc:
|
||||||
|
$(MAKE) CC=/usr/local/cuda-9.0/bin/nvcc LD=/usr/local/cuda-9.2/bin/nvcc \
|
||||||
|
CEXTRAFLAGS="-x cu -DNVCCBUILD=1 --expt-extended-lambda --expt-relaxed-constexpr --default-stream per-thread --restrict"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Mostly done: -Wno-weak-vtables -Wno-cast-align
|
# Mostly done: -Wno-weak-vtables -Wno-cast-align
|
||||||
# FIXME: -Wno-weak-vtables -Wno-missing-variable-declarations -Wno-conversion -Wno-exit-time-destructors
|
# FIXME: -Wno-weak-vtables -Wno-missing-variable-declarations -Wno-conversion -Wno-exit-time-destructors
|
||||||
|
@ -434,8 +434,8 @@ namespace netlist
|
|||||||
setup_t & setup();
|
setup_t & setup();
|
||||||
const setup_t & setup() const;
|
const setup_t & setup() const;
|
||||||
|
|
||||||
C14CONSTEXPR netlist_t & exec() NL_NOEXCEPT { return m_netlist; }
|
netlist_t & exec() NL_NOEXCEPT { return m_netlist; }
|
||||||
constexpr const netlist_t & exec() const NL_NOEXCEPT { return m_netlist; }
|
const netlist_t & exec() const NL_NOEXCEPT { return m_netlist; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~netlist_ref() = default; // prohibit polymorphic destruction
|
~netlist_ref() = default; // prohibit polymorphic destruction
|
||||||
|
@ -40,24 +40,26 @@ namespace netlist
|
|||||||
|
|
||||||
constexpr ptime(const ptime &rhs) noexcept = default;
|
constexpr ptime(const ptime &rhs) noexcept = default;
|
||||||
constexpr ptime(ptime &&rhs) noexcept = default;
|
constexpr ptime(ptime &&rhs) noexcept = default;
|
||||||
|
constexpr explicit ptime(const internal_type &time) noexcept : m_time(time) {}
|
||||||
|
constexpr explicit ptime(internal_type &&time) noexcept : m_time(time) {}
|
||||||
C14CONSTEXPR ptime &operator=(const ptime &rhs) noexcept = default;
|
C14CONSTEXPR ptime &operator=(const ptime &rhs) noexcept = default;
|
||||||
C14CONSTEXPR ptime &operator=(ptime &&rhs) noexcept = default;
|
C14CONSTEXPR ptime &operator=(ptime &&rhs) noexcept = default;
|
||||||
|
|
||||||
constexpr explicit ptime(const double t) = delete;
|
constexpr explicit ptime(const double t) = delete;
|
||||||
//: m_time((internal_type) ( t * (double) resolution)) { }
|
//: m_time((internal_type) ( t * (double) resolution)) { }
|
||||||
constexpr explicit ptime(const internal_type &nom, const internal_type &den) noexcept
|
constexpr explicit ptime(const internal_type nom, const internal_type den) noexcept
|
||||||
: m_time(nom * (RES / den)) { }
|
: m_time(nom * (RES / den)) { }
|
||||||
|
|
||||||
C14CONSTEXPR ptime &operator+=(const ptime &rhs) noexcept { m_time += rhs.m_time; return *this; }
|
C14CONSTEXPR ptime &operator+=(const ptime rhs) noexcept { m_time += rhs.m_time; return *this; }
|
||||||
C14CONSTEXPR ptime &operator-=(const ptime &rhs) noexcept { m_time -= rhs.m_time; return *this; }
|
C14CONSTEXPR ptime &operator-=(const ptime rhs) noexcept { m_time -= rhs.m_time; return *this; }
|
||||||
C14CONSTEXPR ptime &operator*=(const mult_type &factor) noexcept { m_time *= static_cast<internal_type>(factor); return *this; }
|
C14CONSTEXPR ptime &operator*=(const mult_type factor) noexcept { m_time *= static_cast<internal_type>(factor); return *this; }
|
||||||
|
|
||||||
friend C14CONSTEXPR ptime operator-(ptime lhs, const ptime &rhs) noexcept
|
friend C14CONSTEXPR ptime operator-(ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return lhs -= rhs;
|
return lhs -= rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend C14CONSTEXPR ptime operator+(ptime lhs, const ptime &rhs) noexcept
|
friend C14CONSTEXPR ptime operator+(ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return lhs += rhs;
|
return lhs += rhs;
|
||||||
}
|
}
|
||||||
@ -67,37 +69,37 @@ namespace netlist
|
|||||||
return lhs *= factor;
|
return lhs *= factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr mult_type operator/(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr mult_type operator/(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return static_cast<mult_type>(lhs.m_time / rhs.m_time);
|
return static_cast<mult_type>(lhs.m_time / rhs.m_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator<(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr bool operator<(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return (lhs.m_time < rhs.m_time);
|
return (lhs.m_time < rhs.m_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator>(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr bool operator>(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return (rhs < lhs);
|
return (rhs < lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator<=(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr bool operator<=(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return !(lhs > rhs);
|
return !(lhs > rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator>=(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr bool operator>=(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return !(lhs < rhs);
|
return !(lhs < rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator==(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr bool operator==(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return lhs.m_time == rhs.m_time;
|
return lhs.m_time == rhs.m_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator!=(const ptime &lhs, const ptime &rhs) noexcept
|
friend constexpr bool operator!=(const ptime lhs, const ptime rhs) noexcept
|
||||||
{
|
{
|
||||||
return !(lhs == rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
@ -105,17 +107,17 @@ namespace netlist
|
|||||||
constexpr internal_type as_raw() const noexcept { return m_time; }
|
constexpr internal_type as_raw() const noexcept { return m_time; }
|
||||||
constexpr double as_double() const noexcept
|
constexpr double as_double() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast<double>(m_time) / static_cast<double>(RES);
|
return static_cast<double>(m_time) * inv_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for save states ....
|
// for save states ....
|
||||||
C14CONSTEXPR internal_type *get_internaltype_ptr() noexcept { return &m_time; }
|
C14CONSTEXPR internal_type *get_internaltype_ptr() noexcept { return &m_time; }
|
||||||
|
|
||||||
static constexpr ptime from_nsec(const internal_type &ns) noexcept { return ptime(ns, UINT64_C(1000000000)); }
|
static constexpr ptime from_nsec(const internal_type ns) noexcept { return ptime(ns, UINT64_C(1000000000)); }
|
||||||
static constexpr ptime from_usec(const internal_type &us) noexcept { return ptime(us, UINT64_C(1000000)); }
|
static constexpr ptime from_usec(const internal_type us) noexcept { return ptime(us, UINT64_C(1000000)); }
|
||||||
static constexpr ptime from_msec(const internal_type &ms) noexcept { return ptime(ms, UINT64_C(1000)); }
|
static constexpr ptime from_msec(const internal_type ms) noexcept { return ptime(ms, UINT64_C(1000)); }
|
||||||
static constexpr ptime from_hz(const internal_type &hz) noexcept { return ptime(1 , hz); }
|
static constexpr ptime from_hz(const internal_type hz) noexcept { return ptime(1 , hz); }
|
||||||
static constexpr ptime from_raw(const internal_type &raw) noexcept { return ptime(raw); }
|
static constexpr ptime from_raw(const internal_type raw) noexcept { return ptime(raw); }
|
||||||
static constexpr ptime from_double(const double t) noexcept { return ptime(static_cast<internal_type>( t * static_cast<double>(RES)), RES); }
|
static constexpr ptime from_double(const double t) noexcept { return ptime(static_cast<internal_type>( t * static_cast<double>(RES)), RES); }
|
||||||
|
|
||||||
static constexpr ptime zero() noexcept { return ptime(0, RES); }
|
static constexpr ptime zero() noexcept { return ptime(0, RES); }
|
||||||
@ -123,8 +125,7 @@ namespace netlist
|
|||||||
static constexpr ptime never() noexcept { return ptime(plib::numeric_limits<internal_type>::max(), RES); }
|
static constexpr ptime never() noexcept { return ptime(plib::numeric_limits<internal_type>::max(), RES); }
|
||||||
static constexpr internal_type resolution() noexcept { return RES; }
|
static constexpr internal_type resolution() noexcept { return RES; }
|
||||||
private:
|
private:
|
||||||
constexpr explicit ptime(const internal_type &time) : m_time(time) {}
|
static constexpr const double inv_res = 1.0 / static_cast<double>(RES);
|
||||||
constexpr explicit ptime(internal_type &&time) : m_time(time) {}
|
|
||||||
internal_type m_time;
|
internal_type m_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +47,13 @@
|
|||||||
*
|
*
|
||||||
*============================================================*/
|
*============================================================*/
|
||||||
|
|
||||||
|
#ifndef NVCCBUILD
|
||||||
|
#define NVCCBUILD (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if NVCCBUILD
|
||||||
|
#define C14CONSTEXPR
|
||||||
|
#else
|
||||||
#if __cplusplus == 201103L
|
#if __cplusplus == 201103L
|
||||||
#define C14CONSTEXPR
|
#define C14CONSTEXPR
|
||||||
#elif __cplusplus == 201402L
|
#elif __cplusplus == 201402L
|
||||||
@ -58,6 +65,7 @@
|
|||||||
#else
|
#else
|
||||||
#error "C++ version not supported"
|
#error "C++ version not supported"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PHAS_INT128
|
#ifndef PHAS_INT128
|
||||||
#define PHAS_INT128 (0)
|
#define PHAS_INT128 (0)
|
||||||
|
Loading…
Reference in New Issue
Block a user