1
2
3
4
5 package s390x
6
7 import (
8 "fmt"
9 )
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 type CCMask uint8
27
28 const (
29 Never CCMask = 0
30
31
32 Equal CCMask = 1 << 3
33 Less CCMask = 1 << 2
34 Greater CCMask = 1 << 1
35 Unordered CCMask = 1 << 0
36
37
38 EqualOrUnordered CCMask = Equal | Unordered
39 LessOrEqual CCMask = Less | Equal
40 LessOrGreater CCMask = Less | Greater
41 LessOrUnordered CCMask = Less | Unordered
42 GreaterOrEqual CCMask = Greater | Equal
43 GreaterOrUnordered CCMask = Greater | Unordered
44
45
46 NotEqual CCMask = Always ^ Equal
47 NotLess CCMask = Always ^ Less
48 NotGreater CCMask = Always ^ Greater
49 NotUnordered CCMask = Always ^ Unordered
50
51
52 Always CCMask = Equal | Less | Greater | Unordered
53
54
55 Carry CCMask = GreaterOrUnordered
56 NoCarry CCMask = LessOrEqual
57 Borrow CCMask = NoCarry
58 NoBorrow CCMask = Carry
59 )
60
61
62 func (c CCMask) Inverse() CCMask {
63 return c ^ Always
64 }
65
66
67
68 func (c CCMask) ReverseComparison() CCMask {
69 r := c & EqualOrUnordered
70 if c&Less != 0 {
71 r |= Greater
72 }
73 if c&Greater != 0 {
74 r |= Less
75 }
76 return r
77 }
78
79 func (c CCMask) String() string {
80 switch c {
81
82 case Never:
83 return "Never"
84
85
86 case Equal:
87 return "Equal"
88 case Less:
89 return "Less"
90 case Greater:
91 return "Greater"
92 case Unordered:
93 return "Unordered"
94
95
96 case EqualOrUnordered:
97 return "EqualOrUnordered"
98 case LessOrEqual:
99 return "LessOrEqual"
100 case LessOrGreater:
101 return "LessOrGreater"
102 case LessOrUnordered:
103 return "LessOrUnordered"
104 case GreaterOrEqual:
105 return "GreaterOrEqual"
106 case GreaterOrUnordered:
107 return "GreaterOrUnordered"
108
109
110 case NotEqual:
111 return "NotEqual"
112 case NotLess:
113 return "NotLess"
114 case NotGreater:
115 return "NotGreater"
116 case NotUnordered:
117 return "NotUnordered"
118
119
120 case Always:
121 return "Always"
122 }
123
124
125 return fmt.Sprintf("Invalid (%#x)", c)
126 }
127
128 func (CCMask) CanBeAnSSAAux() {}
129
View as plain text