This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi all, This is initial patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Per Joseph's suggestion it optimizes (float)lhs CMP rhs (double)lhs CMP rhs to lhs CMP (typeof(x))rhs whenever typeof(x) can be precisely represented by floating-point type (e.g. short by float or int by double) and rhs can be precisely represented by typeof(x). Bootstrapped/regtested on x64. Ok for trunk? I'd like to extend this further in follow-up patches: 1) fold always-false/always-true comparisons e.g. short x; (float)x > INT16_MAX; // Always false 2) get rid of cast in comparisons with zero regardless of typeof(lhs) when -fno-trapping-math: (float_or_double)lhs CMP 0 -Y
Attachment:
pr57371-1.patch
Description: Binary data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |