|
142 | 142 | ; select(c, true, c) = c | true = true when c is boolean |
143 | 143 | ; But this is the same as select(c, 1, c) = c ? 1 : c which is just 1 when c is true, c when false |
144 | 144 |
|
145 | | -; Gamma distributes over operations (hoisting) - ONE-DIRECTIONAL |
146 | | -; Push operations INTO Gamma, not out (pulling out creates Op(Gamma, Gamma) which explodes) |
147 | | -; These rules combine two Gammas with same condition into a single Gamma |
148 | | -; Integer operations use GammaI |
149 | | -(rule ((= e (Add (GammaI c a b) (GammaI c x y)))) |
150 | | - ((union e (GammaI c (Add a x) (Add b y))))) |
151 | | -(rule ((= e (Sub (GammaI c a b) (GammaI c x y)))) |
152 | | - ((union e (GammaI c (Sub a x) (Sub b y))))) |
153 | | -(rule ((= e (Mul (GammaI c a b) (GammaI c x y)))) |
154 | | - ((union e (GammaI c (Mul a x) (Mul b y))))) |
155 | | -(rule ((= e (BitAnd (GammaI c a b) (GammaI c x y)))) |
156 | | - ((union e (GammaI c (BitAnd a x) (BitAnd b y))))) |
157 | | -(rule ((= e (BitOr (GammaI c a b) (GammaI c x y)))) |
158 | | - ((union e (GammaI c (BitOr a x) (BitOr b y))))) |
159 | | -(rule ((= e (BitXor (GammaI c a b) (GammaI c x y)))) |
160 | | - ((union e (GammaI c (BitXor a x) (BitXor b y))))) |
| 145 | +; DISABLED: Gamma distribution INTO — creates new Op nodes inside both arms, |
| 146 | +; forming cycles with the hoisting rules below (which pull common factors OUT). |
| 147 | +; The hoisting rules (lines 166+) are the simplifying direction and are kept. |
| 148 | +; (rule ((= e (Add (GammaI c a b) (GammaI c x y)))) |
| 149 | +; ((union e (GammaI c (Add a x) (Add b y))))) |
| 150 | +; (rule ((= e (Sub (GammaI c a b) (GammaI c x y)))) |
| 151 | +; ((union e (GammaI c (Sub a x) (Sub b y))))) |
| 152 | +; (rule ((= e (Mul (GammaI c a b) (GammaI c x y)))) |
| 153 | +; ((union e (GammaI c (Mul a x) (Mul b y))))) |
| 154 | +; (rule ((= e (BitAnd (GammaI c a b) (GammaI c x y)))) |
| 155 | +; ((union e (GammaI c (BitAnd a x) (BitAnd b y))))) |
| 156 | +; (rule ((= e (BitOr (GammaI c a b) (GammaI c x y)))) |
| 157 | +; ((union e (GammaI c (BitOr a x) (BitOr b y))))) |
| 158 | +; (rule ((= e (BitXor (GammaI c a b) (GammaI c x y)))) |
| 159 | +; ((union e (GammaI c (BitXor a x) (BitXor b y))))) |
161 | 160 |
|
162 | 161 | ; Hoist common operations out of Gamma - ONE-DIRECTIONAL |
163 | 162 | ; (c ? (x + a) : (x + b)) => x + (c ? a : b) |
|
409 | 408 | ; ============================================================================= |
410 | 409 | ; Floating-Point Gamma Distribution - ONE-DIRECTIONAL |
411 | 410 | ; ============================================================================= |
412 | | -; Distribution INTO GammaF (combining two conditional float values) |
413 | | -(rule ((= e (FAdd (GammaF c a b) (GammaF c x y)))) |
414 | | - ((union e (GammaF c (FAdd a x) (FAdd b y))))) |
415 | | -(rule ((= e (FSub (GammaF c a b) (GammaF c x y)))) |
416 | | - ((union e (GammaF c (FSub a x) (FSub b y))))) |
417 | | -(rule ((= e (FMul (GammaF c a b) (GammaF c x y)))) |
418 | | - ((union e (GammaF c (FMul a x) (FMul b y))))) |
| 411 | +; DISABLED: Distribution INTO GammaF — creates new FOp nodes inside both arms, |
| 412 | +; forming cycles with the hoisting rules below. |
| 413 | +; (rule ((= e (FAdd (GammaF c a b) (GammaF c x y)))) |
| 414 | +; ((union e (GammaF c (FAdd a x) (FAdd b y))))) |
| 415 | +; (rule ((= e (FSub (GammaF c a b) (GammaF c x y)))) |
| 416 | +; ((union e (GammaF c (FSub a x) (FSub b y))))) |
| 417 | +; (rule ((= e (FMul (GammaF c a b) (GammaF c x y)))) |
| 418 | +; ((union e (GammaF c (FMul a x) (FMul b y))))) |
419 | 419 |
|
420 | 420 | ; Hoisting common factors OUT of GammaF - ONE-DIRECTIONAL |
421 | 421 | (rule ((= e (GammaF c (FAdd x a) (FAdd x b)))) |
|
0 commit comments