Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/mathicgb/F4MatrixReducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,11 @@ namespace {
const Iter begin,
const Iter end
) {
// I have a matrix reduction that goes from 2.8s to 2.4s on MSVC 2012 by
// using entries instead of mEntries, even after removing restrict and
// const from entries. That does not make sense to me, but it is a fact
// none-the-less, so don't replace entries by mEntries unless you think
// it's worth a 14% slowdown of matrix reduction (the whole computation,
// not just this method).
ScalarProductSum* const MATHICGB_RESTRICT entries = mEntries.data();

#ifdef MATHICGB_DEBUG
// These asserts are separated out since otherwise they would also need
// to be duplicated due to the manual unrolling.
for (auto it = begin; it != end; ++it) {
MATHICGB_ASSERT(it.index() < colCount());
MATHICGB_ASSERT(entries + it.index() == &mEntries[it.index()]);
}
#endif
// I have a matrix reduction that goes from 2.601s to 2.480s on MSVC 2012
Expand All @@ -154,13 +145,13 @@ namespace {
if (std::distance(begin, end) % 2 == 1) {
// Replacing this by a goto into the middle of the following loop
// (similar to Duff's device) made the code slower on MSVC 2012.
multiplyAdd(it.scalar(), multiple, entries[it.index()]);
multiplyAdd(it.scalar(), multiple, mEntries[it.index()]);
++it;
}
while (it != end) {
multiplyAdd(it.scalar(), multiple, entries[it.index()]);
multiplyAdd(it.scalar(), multiple, mEntries[it.index()]);
++it;
multiplyAdd(it.scalar(), multiple, entries[it.index()]);
multiplyAdd(it.scalar(), multiple, mEntries[it.index()]);
++it;
}
}
Expand Down
38 changes: 0 additions & 38 deletions src/mathicgb/stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,9 @@
/// Tells the compiler to always assume that the expression X is true.
#define MATHICGB_ASSUME(X) __assume(X)

/// As MATHICGB_ASSUME, but might actually evaluate X at run-time if it has
/// side-effects. The point is that this can be used on compilers with no other
/// support for assuming things. So there is no difference on MS VC++.
#define MATHICGB_ASSUME_AND_MAY_EVALUATE(X) __assume(X)

/// Tells the compiler that this function returns a pointer that is not an alias
/// for any other point that is currently valid in the program - like malloc.
#define MATHICGB_RETURN_NO_ALIAS __declspec(restrict)

/// Tells the compiler that this function will never throw an exception.
#define MATHICGB_NOTHROW __declspec(nothrow)

/// Tells the compiler that this function has no effects except the return value
/// and the return value depends only on the arguments and first-level
/// indirections of the arguments. (this is the common denominator of GCC
/// and MS VC++ capabilities)
#define MATHICGB_PURE __declspec(noalias)

/// Tells the compiler that the return value of this function must be looked
/// at by the caller. For example this is appropriate for realloc.
#define MATHICGB_MUST_CHECK_RETURN_VALUE

/// Tells the compiler that the current line of code cannot be reached.
#define MATHICGB_UNREACHABLE __assume(false)

/// Tells the compiler that a variable that is a pointer (not a reference)
/// does not alias any other pointer that is used in the current scope.
#define MATHICGB_RESTRICT __restrict

#pragma warning (disable: 4996) // don't warn about e.g. std::fill on pointers
#pragma warning (disable: 4290) // VC++ ignores throw () specification.
#pragma warning (disable: 4127) // Warns about using "while (true)".
Expand Down Expand Up @@ -84,13 +58,7 @@
#define MATHICGB_NO_INLINE __attribute__((noinline))
#define MATHICGB_INLINE __attribute__((always_inline)) inline
#define MATHICGB_ASSUME(X) ((void)0)
#define MATHICGB_ASSUME_AND_MAY_EVALUATE(X) do {if(!(X)){MATHICGB_UNREACHABLE;}while(0)}
#define MATHICGB_RETURN_NO_ALIAS __attribute__(malloc)
#define MATHICGB_NOTHROW __attribute__(nothrow)
#define MATHICGB_PURE __attribute__(pure)
#define MATHICGB_MUST_CHECK_RETURN_VALUE __attribute__(warn_unused_result)
#define MATHICGB_UNREACHABLE __builtin_unreachable()
#define MATHICGB_RESTRICT __restrict

// if on x86 (32 bit) or x64 (64 bit)
#ifndef MATHICGB_USE_FAKE_ATOMIC
Expand All @@ -108,13 +76,7 @@
#define MATHICGB_NO_INLINE
#define MATHICGB_INLINE inline
#define MATHICGB_ASSUME(X) ((void)0)
#define MATHICGB_ASSUME_AND_MAY_EVALUATE(X) ((void)0)
#define MATHICGB_RETURN_NO_ALIAS
#define MATHICGB_NOTHROW
#define MATHICGB_PURE
#define MATHICGB_MUST_CHECK_RETURN_VALUE
#define MATHICGB_UNREACHABLE
#define MATHICGB_RESTRICT

#endif

Expand Down
Loading