Stream: cranelift

Topic: i128 support


view this post on Zulip kmeakin (Jul 21 2023 at 21:27):

I want to extend the cprop.isle rules to cover i128. But iconst.i128 isn't supported. Is it not possible to have i128 constants in CLIF?

view this post on Zulip fitzgen (he/him) (Jul 21 2023 at 21:40):

iconst.i128 indeed doesn't exist right now. the way to create constants is to do two iconst.i64s and then iconcat, or if the high bits are just sign/zero bits, then iconst.i64 followed by an extend

view this post on Zulip fitzgen (he/him) (Jul 21 2023 at 21:41):

there was talk in some issue, I forget which and don't have it on hand at the moment, about creating a const ISLE helper to automatically do this if necessary, or else just use an iconst when possible

view this post on Zulip Afonso Bordado (Jul 21 2023 at 21:41):

We had an issue a while back about emitting the various constants from a single helper which would be really usefull to have, and would probably allow us to enable most of the integer optimizations again

Feature In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term tha...

view this post on Zulip fitzgen (he/him) (Jul 21 2023 at 21:41):

yes, that one, thanks @Afonso Bordado

view this post on Zulip Chris Fallin (Jul 21 2023 at 21:44):

To add the reasoning here for completeness: we don't have iconst.i128 because InstructionData is currently 16 bytes (128 bits) total, and that has to include the enum discriminant and opcode as well as the payload. We could just create a new enum variant with an i128 but the increased size would penalize compile time and memory usage by a measurable amount

view this post on Zulip Chris Fallin (Jul 21 2023 at 21:44):

There was talk last time this came up about creating a side-table; that's the route I'd suggest if anyone tackles this

view this post on Zulip Chris Fallin (Jul 21 2023 at 21:44):

or using the existing constant machinery for vconst

view this post on Zulip kmeakin (Jul 22 2023 at 21:22):

Hmm, I could try adding a side-table for i128 constants, but I'm not sure where to start


Last updated: Oct 23 2024 at 20:03 UTC