[clang] [llvm] [Arm] Generate explicit bitcasts in NeonEmitter (PR #121802)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 06:49:04 PST 2025


================
@@ -1382,14 +1382,15 @@ void Intrinsic::emitBodyAsBuiltinCall() {
     Type CastToType = T;
 
     // Check if an explicit cast is needed.
-    if (CastToType.isVector() &&
-        (LocalCK == ClassB || (T.isHalf() && !T.isScalarForMangling()))) {
-      CastToType.makeInteger(8, true);
-      Arg = "(" + CastToType.str() + ")" + Arg;
-    } else if (CastToType.isVector() && LocalCK == ClassI) {
-      if (CastToType.isInteger())
-        CastToType.makeSigned();
-      Arg = "(" + CastToType.str() + ")" + Arg;
+    if (CastToType.isVector()) {
----------------
CarolineConcatto wrote:

Why are we not also using bit cast for tuple types in line 1377. When I looks at arm_neon.h I can see this:
 __ret = (uint8x16_t) __builtin_neon_vqtbx4q_v(__builtin_bit_cast(int8x16_t, __p0), (int8x16_t)__p1.val[0], (int8x16_t)__p1.val[1], (int8x16_t)__p1.val[2], (int8x16_t)__p1.val[3]

Only p0 is using bit cast, while the others still use cast.

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


More information about the llvm-commits mailing list