Issue #23: A bit of arithmetic
Summary
Topics: Wrap-around (modulo) arithmetic - Checked arithmetic and Removed support for Clang 4.0
New arithmetic instructions have been implemented for Viua. They should mostly work, but need further testing. However, the instructions implemented so far are not even a half of what is needed to fully support wrap-around, checked, and saturating arithmetic modes.
Wrap-around (modulo) arithmetic
Wrap-around arithmetic has been fully implemented for both signed and unsigned integers.
Viua now provides wrapadd
, wrapmul
, and wrapdiv
instructions.
The new instructions are tested for 8 bit integers, but should work for any other bit width (the algorithms are the same no matter what bit width is used for the integers).
Checked arithmetic
Viua now provides checked versions of addition, multiplication, and division for signed integers. There is no implementation yet for unsigned numbers, and division needs more testing.
Removed support for Clang 4.0
Compilation with Clang 4.0 was problematic.
The version of libstdc++
that Clang 4 could understand it didn't include the
headers (e.g. <optional>
) required to compile Viua.
But when the libstdc++
was updated - Clang 4 would no longer be able to compile the
standard library, since it was missing support for class template argument deduction (I think).
This resulted in the support for compilation with Clang 4 being simply pulled, and the Clang 4.0 entry removed from CI build matrix.
This does not mean that Clang cannot be used to compile Viua at all.
Clang 5 is a fine compiler and is able to understand all of Viua source code, and all the new C++
features used in newer libstdc++
versions.
Viua is not guaranteed to compile under Clang 4 and below, but with Clang 5 and above you should not
encounter any problems.