https://bugs.llvm.org/show_bug.cgi?id=47267

            Bug ID: 47267
           Summary: Unable to perform a constexpr float to uint bitcast
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

The float<->uint style casts are unable to be performed as constexpr:

static __inline__ unsigned int __attribute__((__always_inline__))
_castf32_u32(float __A) {
  unsigned int D;
  __builtin_memcpy(&D, &__A, sizeof(__A));
  return D;
}

It fails with:

cannot constant evaluate 'memcpy' from object of type 'float' to object of type
'unsigned int'

  __builtin_memcpy(&D, &__A, sizeof(__A));

Are there any workarounds to this? Or could we relax this restriction under any
circumstances?

This is part of the work to make more of the x86 intrinsics constexpr.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to