aboutsummaryrefslogtreecommitdiffstats
path: root/common/opthelpers.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename noinline to NOINLINEChris Robinson2023-09-171-3/+3
| | | | To avoid clashes with compilers that use it as a keyword already
* Don't inline some big functionsChris Robinson2023-09-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is very dumb. Template functions are implicitly marked inline according to C++, and contrary to popular belief, "inline" *does* influence the compiler's decision to inline a function. A function the compiler may not have decided to inline normally may be inlined anyway, or issue a warning if it still decides not to inline, if explicitly or implicitly marked as such (or does inline it as requested, but then decides to not inline different functions it normally would because of a cumulative code size increase or something). Furthermore, once a function becomes inline due to being a template function, there's no way to undo it. Marking an inline function "noinline" pushes the problem the other way, causing the compiler to not inline a function it may have decided was beneficial to inline. There's no way to declare a template function to be inlined based solely on compiler heuristics, it will always be influenced by the implicit "inline" or explicit "noinline". That's what's happening here. A number of functions had been combined into a smaller number of large-ish template functions to reduce code duplication and ease maintanence, causing them to be implicitly inline as a side-effect. GCC then manages to inline these larger functions as implicitly requested, but in doing so prevents other smaller functions (which are explicitly marked inline) from being inlined due to excessive code increase and issue a warning. The "noinline" is a heavy-handed method of un-pessimizing the optimization pass, on the assumption the compiler apparently doesn't actually want to inline the template functions, but does so because they're technically marked inline. There's no good option here until it gets acknowledged that inline does mean something beyond allowing multiple definitions, and that template (and other types of) function definitions sometimes (if not most often) want to allow multiple definitions but don't want an artificial/detrimental boost in inline prioritization. /rant
* Use a macro for when __has_cpp_attribute is unsupportedChris Robinson2023-03-101-4/+10
| | | | And the standard macro is __has_cpp_attribute, not __has_attribute.
* Use macros for the likely/unlikely attributesChris Robinson2023-03-011-0/+11
| | | | | The syntax parser for GCC 8 (and earlier?) fails when these attributes are in certain places.
* Ensure the mixer helpers are properly inlinedChris Robinson2023-01-131-1/+1
|
* Avoid unreachable() in assume_alignedChris Robinson2022-12-181-4/+6
| | | | | Another test to attempt to workaround MSVC build problems. Also, don't assume bit-wise value alignment for pointers as a default fallback.
* Revert "Change the order of compiler checks in assume_aligned"Chris Robinson2022-12-181-7/+5
| | | | This reverts commit 14d7809a89ea51ca663a7ebf09e7bc135b904d5d.
* Change the order of compiler checks in assume_alignedChris Robinson2022-12-181-5/+7
| | | | Testing to see if this works around issues with MSVC builds
* Implement an al::unreachable wrapper/helperChris Robinson2022-12-131-8/+19
|
* Avoid using a macro to wrap standard attributesChris Robinson2022-12-061-8/+0
|
* Avoid LIKELY/UNLIKELY macrosChris Robinson2022-12-051-6/+4
|
* Use standard likely/unlikely attributes when availableChris Robinson2022-12-051-25/+11
|
* Added missing header file for std::assume_aligned. (C++20) (#724)Hongtae Kim2022-07-051-1/+1
|
* Add missing includeChris Robinson2022-03-301-0/+1
|
* Move assume_aligned to opthelpers.h and define force_inlineChris Robinson2022-03-301-4/+38
|
* Slightly improve code flow for ASSUMEChris Robinson2022-03-291-1/+1
|
* Forward the (un)likely expression being cast to boolChris Robinson2022-02-241-4/+7
|
* Avoid using an if_constexpr macroChris Robinson2022-02-221-6/+0
| | | | | It doesn't actually use if constexpr, and compilers are smart enough to optimize. Some functions can use templates instead.
* Make a couple more operator bools explicitChris Robinson2022-02-201-4/+10
|
* Simplify and combine a couple macrosChris Robinson2021-12-181-8/+8
|
* Make simpler likely/unlikely functions and use them in some placesChris Robinson2021-10-031-0/+4
|
* Fix __cplusplus value checkChris Robinson2021-01-221-1/+1
|
* Use if constexpr when possibleChris Robinson2021-01-221-0/+6
|
* Reorder definitions to keep them near each otherChris Robinson2020-12-051-13/+13
|
* Modify LIKELY and UNLIKELY to not need extra parenthesisChris Robinson2019-08-041-2/+2
|
* Use false instead of 0 for a booleanChris Robinson2019-03-241-2/+2
|
* Move some macros to a common headerChris Robinson2019-01-071-0/+39