Skip to content

Commit

Permalink
[CIR][CIRGen][Builtin][Neon] Lower neon_vaddlvq_u16 (#1176)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghehg authored Nov 27, 2024
1 parent 8dc68cd commit 888f00c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4259,7 +4259,10 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
llvm_unreachable("NEON::BI__builtin_neon_vaddlvq_u8 NYI");
}
case NEON::BI__builtin_neon_vaddlvq_u16: {
llvm_unreachable("NEON::BI__builtin_neon_vaddlvq_u16 NYI");
mlir::Type argTy = cir::VectorType::get(builder.getContext(), UInt16Ty, 8);
llvm::SmallVector<mlir::Value, 1> argOps = {emitScalarExpr(E->getArg(0))};
return emitNeonCall(builder, {argTy}, argOps, "aarch64.neon.uaddlv",
UInt32Ty, getLoc(E->getExprLoc()));
}
case NEON::BI__builtin_neon_vaddlv_s8: {
llvm_unreachable("NEON::BI__builtin_neon_vaddlv_s8 NYI");
Expand Down
11 changes: 11 additions & 0 deletions clang/test/CIR/CodeGen/AArch64/neon-arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,3 +882,14 @@ float64x2_t test_vabsq_f64(float64x2_t a) {
// LLVM: [[VABS_F:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[a]])
// LLVM: ret <2 x double> [[VABS_F]]
}

uint32_t test_vaddlvq_u16(uint16x8_t a) {
return vaddlvq_u16(a);

// CIR-LABEL: vaddlvq_u16
// CIR: cir.llvm.intrinsic "aarch64.neon.uaddlv" {{%.*}}: (!cir.vector<!u16i x 8>) -> !u32i

// LLVM: {{.*}}test_vaddlvq_u16(<8 x i16>{{.*}}[[A:%.*]])
// LLVM: [[VADDLV_I:%.*]] = call i32 @llvm.aarch64.neon.uaddlv.i32.v8i16(<8 x i16> [[A]])
// LLVM: ret i32 [[VADDLV_I]]
}

0 comments on commit 888f00c

Please sign in to comment.