261 //------------------------------BoolTest--------------------------------------- |
261 //------------------------------BoolTest--------------------------------------- |
262 // Convert condition codes to a boolean test value (0 or -1). |
262 // Convert condition codes to a boolean test value (0 or -1). |
263 // We pick the values as 3 bits; the low order 2 bits we compare against the |
263 // We pick the values as 3 bits; the low order 2 bits we compare against the |
264 // condition codes, the high bit flips the sense of the result. |
264 // condition codes, the high bit flips the sense of the result. |
265 struct BoolTest VALUE_OBJ_CLASS_SPEC { |
265 struct BoolTest VALUE_OBJ_CLASS_SPEC { |
266 enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, illegal = 8 }; |
266 enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, illegal = 8 }; |
267 mask _test; |
267 mask _test; |
268 BoolTest( mask btm ) : _test(btm) {} |
268 BoolTest( mask btm ) : _test(btm) {} |
269 const Type *cc2logical( const Type *CC ) const; |
269 const Type *cc2logical( const Type *CC ) const; |
270 // Commute the test. I use a small table lookup. The table is created as |
270 // Commute the test. I use a small table lookup. The table is created as |
271 // a simple char array where each element is the ASCII version of a 'mask' |
271 // a simple char array where each element is the ASCII version of a 'mask' |
272 // enum from above. |
272 // enum from above. |
273 mask commute( ) const { return mask("038147858"[_test]-'0'); } |
273 mask commute( ) const { return mask("032147658"[_test]-'0'); } |
274 mask negate( ) const { return mask(_test^4); } |
274 mask negate( ) const { return mask(_test^4); } |
275 bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le); } |
275 bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); } |
276 #ifndef PRODUCT |
276 #ifndef PRODUCT |
277 void dump_on(outputStream *st) const; |
277 void dump_on(outputStream *st) const; |
278 #endif |
278 #endif |
279 }; |
279 }; |
280 |
280 |