21 lines
850 B
Diff
21 lines
850 B
Diff
Link: http://www.sisyphus.ru/ru/srpm/Sisyphus/libbenchmark/patches/0
|
|
Subject: define DoNotOptimize for lcc, use "r" constraint
|
|
Bug: 148837
|
|
Tags: lcc
|
|
|
|
diff -rupN a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h
|
|
--- a/include/benchmark/benchmark.h 2024-02-13 15:37:58.922923927 +0300
|
|
+++ b/include/benchmark/benchmark.h 2024-02-14 14:09:52.466458111 +0300
|
|
@@ -483,6 +483,11 @@ inline BENCHMARK_ALWAYS_INLINE void DoNo
|
|
#endif
|
|
}
|
|
#endif
|
|
+#elif defined(__LCC__)
|
|
+template <class Tp>
|
|
+inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
|
|
+ asm volatile("" : : "r"(&reinterpret_cast<char const volatile&>(value)) : "memory");
|
|
+}
|
|
#elif defined(BENCHMARK_HAS_CXX11) && (__GNUC__ >= 5)
|
|
// Workaround for a bug with full argument copy overhead with GCC.
|
|
// See: #1340 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105519
|