I am trying to implement a legalization for imul.i64x2 that must be a custom legalization function. It needs to have logic to look at the ISA-specific flags to determine what legalization to use; I know, I know, this would be fixed by the new backend, but in the meantime I would like to implement this legalization. I cannot find a good transform group to put this custom legalization in: if I put it in x86_narrow, the legalization search stops too soon and things like i128 (in narrow) don't get legalized. If I put it in another transform group, e.g. expand, I have to add i64x2 as a type the group legalizes, which prevents other i64x2 operations from being legalized (all of these are currently in x86_narrow). What can I do?
- I could move all of the SIMD operations to
x86_expand but when I do this I run into conflicts with other operations (e.g. ineg)
- I could duplicate the logic from the shared
narrow imul legalizations to my custom function
- I could make transform groups smarter somehow, e.g. by registering custom functions for an instruction AND a type (not just an instruction) or by allowing custom functions to return a result indicating if they succeeded (if they do, we stop; if they don't, we continue looking in other groups)
Would appreciate some help thinking through this, @bnjbvr. CCing @iximeow and @whitequark as well since it could be remotely related to #1743.
I am trying to implement a legalization for
imul.i64x2that must be a custom legalization function. It needs to have logic to look at the ISA-specific flags to determine what legalization to use; I know, I know, this would be fixed by the new backend, but in the meantime I would like to implement this legalization. I cannot find a good transform group to put this custom legalization in: if I put it inx86_narrow, the legalization search stops too soon and things likei128(innarrow) don't get legalized. If I put it in another transform group, e.g.expand, I have to addi64x2as a type the group legalizes, which prevents otheri64x2operations from being legalized (all of these are currently inx86_narrow). What can I do?x86_expandbut when I do this I run into conflicts with other operations (e.g.ineg)narrowimullegalizations to my custom functionWould appreciate some help thinking through this, @bnjbvr. CCing @iximeow and @whitequark as well since it could be remotely related to #1743.