This patch creates the __builtin_get_cpu_cache_line_size to wrap the cpu cache line size API from D74918.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
130 ms | Clang.SemaCXX::Unknown Unit Message ("") |
Event Timeline
What should the behavior of the builtin be if the calling function has its own target cpu like attribute((target("arch=sandybridge"))) and that CPU has a different size than the CPU that was passed on the command line?
clang/include/clang/Basic/Builtins.def | ||
---|---|---|
1483 | Can this be "zv" and drop the "tu" from the second string? |
@craig.topper thanks for the comments! I'm going to hold off on updating this until we figure out what's happening with D74918, though.
I don't think there's a particularly good reason to expose this as a builtin, unless it's to be used by the standard library implementation. (Which again I do not think we should implement.)
@jyknight yes, the current plan is to use it in libc++'s implementation. I can put that implementation (which uses this builtin) up for review before this lands. That way we can discuss the implementation before adding a (possibly unneeded) builtin. Sound good?
@craig.topper I'm not sure what should happen. It should probably just use that CPU (although that's not a great solution). Is there a way to detect if an attribute was used to change the target in which case we could error? What do you think should happen?
I'm not sure what should happen as I'm not familiar with the library feature being implemented. As implemented here, the target attribute will be ignored and it will just follow the command line. Why do you say that following the attribute is not a great solution?
clang/test/SemaCXX/builtin-cache-line-size.cpp | ||
---|---|---|
1 | This say i368 which is not a valid cpu. Did you mean i386? Also x86 uses use -march not -mcpu. I don't think -mcpu does anything. |
Can this be "zv" and drop the "tu" from the second string?