https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70317
Bug ID: 70317 Summary: [6 Regression] folding x<=x to true for large vectors, ignoring nans Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- typedef double vecf __attribute__((vector_size(256))); auto f(vecf x){ return x <= x; } g++ x.c -O3 -S -fdump-tree-all the .optimized dump has: <retval> = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; This is because the corresponding match.pd pattern uses: HONOR_NANS (TYPE_MODE (TREE_TYPE (@0))) instead of HONOR_NANS (@0) (don't know if I missed it when I redefined HONOR_NANS or if it was added later) By the way, the pattern canonicalizes x==x, x<=x and x>=x to x==x, but ORDERED_EXPR would be a nicer alternative IMHO (if we really prefer x==x, then we should also canonicalize x ord x to x == x).