1 comment:
File src/cpu/x86/cache/cache.c:
Patch Set #12, Line 24: CONFIG(X86_CLFLUSH_CAR)
I'm curious, does the compiler optimize it differently? […]
I'm not sure if the compiler can infer that cpuid_edx has no side-effect, so it may not be able to optimize out the code as-is.
In any case, I'd write this function as follows:
bool clflush_supported(void)
{
/* CLFLUSH while operating in CAR might not be supported by platforms */
if (ENV_CACHE_AS_RAM && !CONFIG(X86_CLFLUSH_CAR))
return false;
return !!(cpuid_edx(1) >> CPUID_FEATURE_CLFLUSH_BIT);
}
To view, visit change 37196. To unsubscribe, or for help writing mail filters, visit settings.