Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][CIRGen][Builtin][Neon] Lower neon_vaddvq_s64/s32, neon_vaddv_s32/u32, #1240

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2678,19 +2678,17 @@ static mlir::Value emitCommonNeonSISDBuiltinExpr(
case NEON::BI__builtin_neon_vaddlvq_u32:
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.uaddlv", resultTy,
loc);
case NEON::BI__builtin_neon_vaddv_s32:
llvm_unreachable(" neon_vaddv_s32 NYI ");
case NEON::BI__builtin_neon_vaddv_u32:
llvm_unreachable(" neon_vaddv_u32 NYI ");
case NEON::BI__builtin_neon_vaddv_f32:
case NEON::BI__builtin_neon_vaddvq_f32:
case NEON::BI__builtin_neon_vaddvq_f64:
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.faddv", resultTy,
loc);
case NEON::BI__builtin_neon_vaddv_s32:
case NEON::BI__builtin_neon_vaddvq_s32:
llvm_unreachable(" neon_vaddvq_s32 NYI ");
case NEON::BI__builtin_neon_vaddvq_s64:
llvm_unreachable(" neon_vaddvq_s64 NYI ");
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.saddv", resultTy,
loc);
case NEON::BI__builtin_neon_vaddv_u32:
case NEON::BI__builtin_neon_vaddvq_u32:
case NEON::BI__builtin_neon_vaddvq_u64:
return emitNeonCall(builder, {argTy}, ops, "aarch64.neon.uaddv", resultTy,
Expand Down
24 changes: 24 additions & 0 deletions clang/test/CIR/CodeGen/AArch64/neon-arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,3 +952,27 @@ uint64_t test_vaddvq_u64(uint64x2_t a) {
// LLVM: [[VADDVQ_U64_I:%.*]] = call i64 @llvm.aarch64.neon.uaddv.i64.v2i64(<2 x i64> {{%.*}})
// LLVM: ret i64 [[VADDVQ_U64_I]]
}

int32_t test_vaddvq_s32(int32x4_t a) {
return vaddvq_s32(a);

// CIR-LABEL: vaddvq_s32
// CIR: cir.llvm.intrinsic "aarch64.neon.saddv" {{%.*}} : (!cir.vector<!s32i x 4>) -> !s32i

// LLVM-LABEL: test_vaddvq_s32
// LLVM-SAME: (<4 x i32> [[a:%.*]])
// LLVM: [[VADDVQ_S32_I:%.*]] = call i32 @llvm.aarch64.neon.saddv.i32.v4i32(<4 x i32> [[a]])
// LLVM: ret i32 [[VADDVQ_S32_I]]
}

int64_t test_vaddvq_s64(int64x2_t a) {
return vaddvq_s64(a);

// CIR-LABEL: vaddvq_s64
// CIR: cir.llvm.intrinsic "aarch64.neon.saddv" {{%.*}} : (!cir.vector<!s64i x 2>) -> !s64i

// LLVM-LABEL: test_vaddvq_s64
// LLVM-SAME: (<2 x i64> [[a:%.*]])
// LLVM: [[VADDVQ_S64_I:%.*]] = call i64 @llvm.aarch64.neon.saddv.i64.v2i64(<2 x i64> [[a]])
// LLVM: ret i64 [[VADDVQ_S64_I]]
}
34 changes: 22 additions & 12 deletions clang/test/CIR/CodeGen/AArch64/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -18967,19 +18967,29 @@ float64x1_t test_vmax_f64(float64x1_t a, float64x1_t b) {
// return vmaxv_u32(a);
// }

// NYI-LABEL: @test_vaddv_s32(
// NYI: [[VADDV_S32_I:%.*]] = call i32 @llvm.aarch64.neon.saddv.i32.v2i32(<2 x i32> %a)
// NYI: ret i32 [[VADDV_S32_I]]
// int32_t test_vaddv_s32(int32x2_t a) {
// return vaddv_s32(a);
// }
int32_t test_vaddv_s32(int32x2_t a) {
return vaddv_s32(a);

// NYI-LABEL: @test_vaddv_u32(
// NYI: [[VADDV_U32_I:%.*]] = call i32 @llvm.aarch64.neon.uaddv.i32.v2i32(<2 x i32> %a)
// NYI: ret i32 [[VADDV_U32_I]]
// uint32_t test_vaddv_u32(uint32x2_t a) {
// return vaddv_u32(a);
// }
// CIR-LABEL: vaddv_s32
// CIR: cir.llvm.intrinsic "aarch64.neon.saddv" {{%.*}} : (!cir.vector<!s32i x 2>) -> !s32i

// LLVM-LABEL: test_vaddv_s32
// LLVM-SAME: (<2 x i32> [[a:%.*]])
// LLVM: [[VADDV_S32_I:%.*]] = call i32 @llvm.aarch64.neon.saddv.i32.v2i32(<2 x i32> [[a]])
// LLVM: ret i32 [[VADDV_S32_I]]
}

uint32_t test_vaddv_u32(uint32x2_t a) {
return vaddv_u32(a);

// CIR-LABEL: vaddv_u32
// CIR: cir.llvm.intrinsic "aarch64.neon.uaddv" {{%.*}} : (!cir.vector<!u32i x 2>) -> !u32i

// LLVM-LABEL: test_vaddv_u32
// LLVM-SAME: (<2 x i32> [[a:%.*]])
// LLVM: [[VADDV_U32_I:%.*]] = call i32 @llvm.aarch64.neon.uaddv.i32.v2i32(<2 x i32> [[a]])
// LLVM: ret i32 [[VADDV_U32_I]]
}

// NYI-LABEL: @test_vaddlv_s32(
// NYI: [[VADDLV_S32_I:%.*]] = call i64 @llvm.aarch64.neon.saddlv.i64.v2i32(<2 x i32> %a)
Expand Down
Loading