Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/divnode.cpp @ 1154:174ade00803b
6910484: incorrect integer optimization (loosing and op-r in a given example)
Summary: Remove AND operation only if mask is equal to shift.
Reviewed-by: never
author | kvn |
---|---|
date | Fri, 08 Jan 2010 09:51:24 -0800 |
parents | cecd04fc6f93 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1153:bea7a22a6f79 | 1154:174ade00803b |
---|---|
112 // I can avoid rounding. | 112 // I can avoid rounding. |
113 const TypeInt *andconi_t = phase->type( dividend->in(2) )->isa_int(); | 113 const TypeInt *andconi_t = phase->type( dividend->in(2) )->isa_int(); |
114 if( andconi_t && andconi_t->is_con() ) { | 114 if( andconi_t && andconi_t->is_con() ) { |
115 jint andconi = andconi_t->get_con(); | 115 jint andconi = andconi_t->get_con(); |
116 if( andconi < 0 && is_power_of_2(-andconi) && (-andconi) >= d ) { | 116 if( andconi < 0 && is_power_of_2(-andconi) && (-andconi) >= d ) { |
117 dividend = dividend->in(1); | 117 if( (-andconi) == d ) // Remove AND if it clears bits which will be shifted |
118 dividend = dividend->in(1); | |
118 needs_rounding = false; | 119 needs_rounding = false; |
119 } | 120 } |
120 } | 121 } |
121 } | 122 } |
122 | 123 |
354 // I can avoid rounding. | 355 // I can avoid rounding. |
355 const TypeLong *andconl_t = phase->type( dividend->in(2) )->isa_long(); | 356 const TypeLong *andconl_t = phase->type( dividend->in(2) )->isa_long(); |
356 if( andconl_t && andconl_t->is_con() ) { | 357 if( andconl_t && andconl_t->is_con() ) { |
357 jlong andconl = andconl_t->get_con(); | 358 jlong andconl = andconl_t->get_con(); |
358 if( andconl < 0 && is_power_of_2_long(-andconl) && (-andconl) >= d ) { | 359 if( andconl < 0 && is_power_of_2_long(-andconl) && (-andconl) >= d ) { |
359 dividend = dividend->in(1); | 360 if( (-andconl) == d ) // Remove AND if it clears bits which will be shifted |
361 dividend = dividend->in(1); | |
360 needs_rounding = false; | 362 needs_rounding = false; |
361 } | 363 } |
362 } | 364 } |
363 } | 365 } |
364 | 366 |