# non-standard machine value types

**URL:** <https://discourse.llvm.org/t/non-standard-machine-value-types/36908>\
**Category:** LLVM Dev List Archives\
**Created:** [June 4, 2015, 6:48am UTC](https://discourse.llvm.org/t/non-standard-machine-value-types/36908 "2015-06-04T06:48:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Volodymyr\_Arbatov](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@Volodymyr\_Arbatov](https://discourse.llvm.org/u/Volodymyr_Arbatov)\
**Post date:** [June 4, 2015, 6:48am UTC](https://discourse.llvm.org/t/non-standard-machine-value-types/36908/1 "2015-06-04T06:48:06Z")

</div>

Hi all.

I’m looking for a ways of defining register files with non-standard machine value type in tablegen. The value types not covered by SimpleValueType enum. For example (from the top of my head) 25 bit integers, or 8 way 18 bit integers. These types going to be used with intrinsics so I also need appropriate C custom types defined.

I wonder if I can describe those in tablegen files or do I need to extend llvm. What is the right way of supporting such types?

I’m not familiar will llvm internals so far, so any help and pointers appreciated.

Thanks,  
Volodymyr.

---

<div class="post-metadata">

**Author:** ![arsenm](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/arsenm/32/449_2.png) [@arsenm](https://discourse.llvm.org/u/arsenm)\
**Post date:** [June 4, 2015, 7:06am UTC](https://discourse.llvm.org/t/non-standard-machine-value-types/36908/2 "2015-06-04T07:06:58Z")

</div>

You would need an MVT type defined for every legal type you have, so you would need to add those. However, LLVM has a pretty widely spread assumption of 8-bit bytes, so that will be far more problematic for your target. Fixing that would be a large project.

-Matt

---

<div class="post-metadata">

**Author:** ![Patrik\_Hagglund](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@Patrik\_Hagglund](https://discourse.llvm.org/u/Patrik_Hagglund)\
**Post date:** [June 10, 2015, 7:32am UTC](https://discourse.llvm.org/t/non-standard-machine-value-types/36908/3 "2015-06-10T07:32:54Z")

</div>

We maintain a set of patches for enabling 24/40-bit MVTs, and also a set of patches to support 16-bit bytes. I can provide them upon request. (Only llvm, no clang patches yet.)

/Patrik Hägglund

---

<div class="post-metadata">

**Author:** ![Volodymyr\_Arbatov](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@Volodymyr\_Arbatov](https://discourse.llvm.org/u/Volodymyr_Arbatov)\
**Post date:** [June 11, 2015, 7:56am UTC](https://discourse.llvm.org/t/non-standard-machine-value-types/36908/4 "2015-06-11T07:56:36Z")

</div>

Users can extend our architecture with own register files and own instructions. They are not limited to a narrow set of bit widths. I think, to support such extensions, I’ll need to handle MVTs dynamically. Perhaps, use standard MVTs whenever is possible and reserve a range for extensions.

Still, it’s interesting to see your set of 24/40-bit MVTs related patches, this might be a good example on how to extend MVTs. Is it publicly available?

Thanks,  
Volodymyr.
