"Amker.Cheng" <amker.ch...@gmail.com> writes: > I found although there are standard pattern names such as "ceilm2/floorm2", > there is no insn pattern in mips.md for such float insns on mips target. > further more, there is no ceil/floor rtl code in rtl.def either. > > based on these facts, I assuming those float insns are not supported by gcc, > but don't know why, seems not difficult to add such insns.
You're right that gcc does not currently have a way to represent those instructions directly in RTL. In current gcc it would have to be done using an unspec. E.g., see ceildf2 and ceildf2_fpr in rs6000.md. You're also right that it would not be difficult to add direct RTL support. I'm not sure how useful that would be, since I don't see a lot of additional optimization opportunity. An unspec will handle scheduling correctly, the only benefit I see of direct RTL exposure would be that you could do optimizations like floor(ceil(x)) => ceil(x), but that seems unlikely to occur in real code. Ian