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

@@ -502,6 +502,27 @@ class ConstantInt(Literal):
return str(self.value)
class ConstantBits(Literal):
"""
A bitwise value of an immediate operand.
This is used to create bitwise exact floating point constants using
`ieee32.bits(0x80000000)`.
"""
def __init__(self, kind, bits):
# type: (ImmediateKind, int) -> None
v = '{}::with_bits({:#x})'.format(kind.rust_type, bits)
super(ConstantBits, self).__init__(kind, v)
def __str__(self):
# type: () -> str
"""
Get the Rust expression form of this constant.
"""
return str(self.value)
class Enumerator(Literal):
"""
A value of an enumerated immediate operand.