LADSoft / OrangeC

OrangeC Compiler And Tool Chain
http://ladsoft.tripod.com/orange_c_compiler.html
Other
291 stars 39 forks source link

Adding CPU targeting and CPU specific optimizations #945

Open chuggafan opened 1 year ago

chuggafan commented 1 year ago

With the rise of the C23 standard and facilities such as std_count_ones, we can and should at the very least in the backend optimize all of those operations to effectively singular instructions, popular instructions that are extremely common include: popcnt, tzcnt, lzcnt, bsr, bsfand more.

In theory what we can do is target available CPU instructions to deliver these types of functions in a more optimized manner (thus allowing the compiler to operate it).

Personally I don't think this is a priority at this point in time, but I do think this is a "nice to have" especially if we ever want to use these features ourselves.

LADSoft commented 1 year ago

yeah we can optimize such things later... it is just for now it didn't make sense to write a bunch of assembly code that I'm going to translate to C when we do x64 anyway,,,