As the title says, I’m proposing we add a
pow x, y op that computes x^y. For floating point operations, it seems like a justified mathematical operator. For integer types, I could imagine some concerns and would like to address them if needed.
Responding to the questions I anticipate as possible:
powfshouldn’t be std; it’s a special mathematical op/function call - yes, but it is almost certain that we are going to split std into multiple dialects including a math dialect, and then pow is fully justified
powfshouldn’t be added until there is the math dialect - this would be unfair to block all new ops in the dialect, effectively forcing whomever most needs the next op to be responsible for cleaning technical debt
powiwouldn’t make sense for negative integer exponents - we can work out these details over time. Even supporting just unsigned seems like enough reason to have the op, as people would want to do optimizations on unsigned powers. Another reason is to keep a
mathidialect mostly synced with a
Please let me know of any concerns. Thanks,