Debian Codegraph @

rpython/jit/backend/riscv/rounding_modes.py

raw symbols SCIP
1 #!/usr/bin/env python
2
3
4 class RoundingMode(object):
5 _immutable_ = True
6
7 def __init__(self, value, literal):
8 self.value = value
9 self.literal = literal
10
11 def __int__(self):
12 return self.value
13
14 def __repr__(self):
15 return self.literal
16
17
18 RNE = RoundingMode(0b000, 'rne') # Round to nearest, ties to even
19 RTZ = RoundingMode(0b001, 'rtz') # Round towards zero
20 RDN = RoundingMode(0b010, 'rdn') # Round down (towards -inf)
21 RUP = RoundingMode(0b011, 'rup') # Round up (towards +inf)
22 RMM = RoundingMode(0b100, 'rmm') # Round to nearest, ties to maximum magnitude
23 DYN = RoundingMode(0b111, 'dyn') # Use the rounding mode register
24
25
26 all_rounding_modes = [RNE, RTZ, RDN, RUP, RMM, DYN]