[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 23:55:38 PDT 2023


================
@@ -138,13 +138,14 @@ void g27(void) { // PR8073
 void g28(void) {
   typedef long long v1i64 __attribute((vector_size(8)));
   typedef short v12i16 __attribute((vector_size(24)));
+  typedef unsigned char v24u8 __attribute((vector_size(24)));
   typedef long double v2f80 __attribute((vector_size(24)));
   // CHECK: @g28.a = internal global <1 x i64> <i64 10>
-  // CHECK: @g28.b = internal global <12 x i16> <i16 0, i16 0, i16 0, i16 -32768, i16 16383, i16 0, i16 0, i16 0, i16 0, i16 -32768, i16 16384, i16 0>
+  // CHECK: @g28.b = internal global <24 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 -128, i8 -1, i8 63, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 -128, i8 0, i8 64, i8 undef, i8 undef, i8 undef, i8 undef>, align 32
----------------
zygoloid wrote:

I think the correct output here would be:
```suggestion
  // CHECK: @g28.b = internal global <24 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 -128, i8 -1, i8 63, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 -128, i8 0, i8 64, i8 undef, i8 undef>, align 32
```

https://github.com/llvm/llvm-project/pull/66894


More information about the cfe-commits mailing list