Add legalization patterns for fabs and fneg.

These sign bit manipulations need to use a -0.0 floating point constant
which we didn't have a way of materializing previously.

Add a ieee32.bits(0x...) syntax to the Python AST nodes that creates am
f32 immediate value with the exact requested bitwise representation.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-25 12:12:47 -07:00
parent ba1c50d6c1
commit 8deca67968
5 changed files with 75 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ try:
from typing import Union, Dict, TYPE_CHECKING, Iterable # noqa
OperandSpec = Union['OperandKind', ValueType, TypeVar]
if TYPE_CHECKING:
from .ast import Enumerator, ConstantInt, Literal # noqa
from .ast import Enumerator, ConstantInt, ConstantBits, Literal # noqa
except ImportError:
pass
@@ -123,6 +123,15 @@ class ImmediateKind(OperandKind):
.format(self.name, value))
return ConstantInt(self, value)
def bits(self, bits):
# type: (int) -> ConstantBits
"""
Create an AST literal node for the given bitwise representation of this
immediate operand kind.
"""
from .ast import ConstantBits # noqa
return ConstantBits(self, bits)
def rust_enumerator(self, value):
# type: (str) -> str
"""