https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95738

            Bug ID: 95738
           Summary: Failure to optimize comparison of float after sign xor
                    to unsigned comparison
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

typedef int64_t v2i64 __attribute__((vector_size(16)));
typedef uint64_t v2u64 __attribute__((vector_size(16)));

v2i64 f(v2i64 a, v2i64 b)
{
    auto sign = (v2i64){(int64_t)0x8000000000000000u,
(int64_t)0x8000000000000000u};
    return (a ^ sign) > (b ^ sign);
}

This can be optimized to `(v2u64)a > (v2u64)b`. This transformation is done by
LLVM, but not by GCC.

Reply via email to