Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Alt Impl] LLVM builtin arbitrary fixed precision int #1

Closed
mratsim opened this issue Sep 13, 2018 · 2 comments · Fixed by #69
Closed

[Alt Impl] LLVM builtin arbitrary fixed precision int #1

mratsim opened this issue Sep 13, 2018 · 2 comments · Fixed by #69

Comments

@mratsim
Copy link
Owner

mratsim commented Sep 13, 2018

http://llvm.org/doxygen/APInt_8h_source.html

//===----------------------------------------------------------------------===//
 //                              APInt Class
 //===----------------------------------------------------------------------===//
 
 /// Class for arbitrary precision integers.
 ///
 /// APInt is a functional replacement for common case unsigned integer type like
 /// "unsigned", "unsigned long" or "uint64_t", but also allows non-byte-width
 /// integer sizes and large integer value types such as 3-bits, 15-bits, or more
 /// than 64-bits of precision. APInt provides a variety of arithmetic operators
 /// and methods to manipulate integer values of any bit-width. It supports both
 /// the typical integer arithmetic and comparison operations as well as bitwise
 /// manipulation.
 ///
 /// The class has several invariants worth noting:
 ///   * All bit, byte, and word positions are zero-based.
 ///   * Once the bit width is set, it doesn't change except by the Truncate,
 ///     SignExtend, or ZeroExtend operations.
 ///   * All binary operators must be on APInt instances of the same bit width.
 ///     Attempting to use these operators on instances with different bit
 ///     widths will yield an assertion.
 ///   * The value is stored canonically as an unsigned value. For operations
 ///     where it makes a difference, there are both signed and unsigned variants
 ///     of the operation. For example, sdiv and udiv. However, because the bit
 ///     widths must be the same, operations such as Mul and Add produce the same
 ///     results regardless of whether the values are interpreted as signed or
 ///     not.
 ///   * In general, the class tries to follow the style of computation that LLVM
 ///     uses in its IR. This simplifies its use for LLVM.

And https://llvm.org/docs/LangRef.html#integer-type

@mratsim mratsim changed the title [Doc] LLVM builtin arbitrary fixed precision int [Alt Impl] LLVM builtin arbitrary fixed precision int Sep 13, 2018
@mratsim
Copy link
Owner Author

mratsim commented Jun 4, 2020

This has been made significantly easier with Clang _ExtInt:

http://blog.llvm.org/2020/04/the-new-clang-extint-feature-provides.html

@mratsim
Copy link
Owner Author

mratsim commented Jul 24, 2020

Superceded by inline asembly #69

@mratsim mratsim linked a pull request Jul 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant