[clang] [CIR][AArch64] Upstream addition NEON builtins (PR #202005)

Vicky Nguyen via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 22:02:26 PDT 2026


================
@@ -664,12 +664,20 @@ static mlir::Value emitCommonNeonBuiltinExpr(
     ops[0] = cgf.getBuilder().createBitcast(loc, ops[0], vTy);
     return emitNeonSplat(cgf.getBuilder(), loc, ops[0], ops[1], numElements);
   }
+  case NEON::BI__builtin_neon_vadd_v:
+  case NEON::BI__builtin_neon_vaddq_v: {
+    unsigned numBytes = (builtinID == NEON::BI__builtin_neon_vaddq_v) ? 16 : 8;
+    cir::VectorType byteTy =
+        cir::VectorType::get(cgf.getBuilder().getUInt8Ty(), numBytes);
+    ops[0] = cgf.getBuilder().createBitcast(ops[0], byteTy);
+    ops[1] = cgf.getBuilder().createBitcast(ops[1], byteTy);
+    mlir::Value result = cgf.getBuilder().createXor(loc, ops[0], ops[1]);
+    return cgf.getBuilder().createBitcast(result, ty);
+  }
   case NEON::BI__builtin_neon_vpadd_v:
   case NEON::BI__builtin_neon_vpaddq_v:
   case NEON::BI__builtin_neon_vabs_v:
   case NEON::BI__builtin_neon_vabsq_v:
-  case NEON::BI__builtin_neon_vadd_v:
-  case NEON::BI__builtin_neon_vaddq_v:
----------------
iamvickynguyen wrote:

Thank you! :pray:  I've moved the cases back

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


More information about the cfe-commits mailing list