if N == 1 or N >= M:
continue
+ cond = 'true'
+ if N == 8:
+ cond = 'options->support_8bit_alu'
+ elif N == 16:
+ cond = 'options->support_16bit_alu'
x2xM = '{0}2{0}{1}'.format(t[0], M)
x2xN = '{0}2{0}{1}'.format(t[0], N)
aN = 'a@' + str(N)
bP = 'b@' + str(P)
optimizations += [
- ((xeq, (x2xM, aN), (x2xM, bP)), (xeq, a, (x2xN, b))),
- ((xne, (x2xM, aN), (x2xM, bP)), (xne, a, (x2xN, b))),
- ((xge, (x2xM, aN), (x2xM, bP)), (xge, a, (x2xN, b))),
- ((xlt, (x2xM, aN), (x2xM, bP)), (xlt, a, (x2xN, b))),
- ((xge, (x2xM, bP), (x2xM, aN)), (xge, (x2xN, b), a)),
- ((xlt, (x2xM, bP), (x2xM, aN)), (xlt, (x2xN, b), a)),
+ ((xeq, (x2xM, aN), (x2xM, bP)), (xeq, a, (x2xN, b)), cond),
+ ((xne, (x2xM, aN), (x2xM, bP)), (xne, a, (x2xN, b)), cond),
+ ((xge, (x2xM, aN), (x2xM, bP)), (xge, a, (x2xN, b)), cond),
+ ((xlt, (x2xM, aN), (x2xM, bP)), (xlt, a, (x2xN, b)), cond),
+ ((xge, (x2xM, bP), (x2xM, aN)), (xge, (x2xN, b), a), cond),
+ ((xlt, (x2xM, bP), (x2xM, aN)), (xlt, (x2xN, b), a), cond),
]
# The next bit doesn't work on floats because the range checks would
# and a check that the constant fits in the smaller bit size.
optimizations += [
((xeq, (x2xM, aN), '#b'),
- ('iand', (xeq, a, (x2xN, b)), (xeq, (x2xM, (x2xN, b)), b))),
+ ('iand', (xeq, a, (x2xN, b)), (xeq, (x2xM, (x2xN, b)), b)), cond),
((xne, (x2xM, aN), '#b'),
- ('ior', (xne, a, (x2xN, b)), (xne, (x2xM, (x2xN, b)), b))),
+ ('ior', (xne, a, (x2xN, b)), (xne, (x2xM, (x2xN, b)), b)), cond),
((xlt, (x2xM, aN), '#b'),
('iand', (xlt, xN_min, b),
- ('ior', (xlt, xN_max, b), (xlt, a, (x2xN, b))))),
+ ('ior', (xlt, xN_max, b), (xlt, a, (x2xN, b)))), cond),
((xlt, '#a', (x2xM, bN)),
('iand', (xlt, a, xN_max),
- ('ior', (xlt, a, xN_min), (xlt, (x2xN, a), b)))),
+ ('ior', (xlt, a, xN_min), (xlt, (x2xN, a), b))), cond),
((xge, (x2xM, aN), '#b'),
('iand', (xge, xN_max, b),
- ('ior', (xge, xN_min, b), (xge, a, (x2xN, b))))),
+ ('ior', (xge, xN_min, b), (xge, a, (x2xN, b)))), cond),
((xge, '#a', (x2xM, bN)),
('iand', (xge, a, xN_min),
- ('ior', (xge, a, xN_max), (xge, (x2xN, a), b)))),
+ ('ior', (xge, a, xN_max), (xge, (x2xN, a), b))), cond),
]
def fexp2i(exp, bits):