Skip to content

Commit e0e0345

Browse files
committed
[CIR][AArch64] Implement NEON builtin vcvtq_f64_v
Adds support for vcvtq_f64_v and vcvt_f64_v builtins which convert integer vectors to double-precision floating-point vectors. The implementation uses cir.cast with int_to_float kind, which automatically selects signed or unsigned conversion based on the source type.
1 parent b57d53b commit e0e0345

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,8 +4273,12 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
42734273
llvm_unreachable("NEON::BI__builtin_neon_vrndq_v NYI");
42744274
}
42754275
case NEON::BI__builtin_neon_vcvt_f64_v:
4276-
case NEON::BI__builtin_neon_vcvtq_f64_v:
4277-
llvm_unreachable("NEON::BI__builtin_neon_vcvtq_f64_v NYI");
4276+
case NEON::BI__builtin_neon_vcvtq_f64_v: {
4277+
Ops[0] = builder.createBitcast(Ops[0], ty);
4278+
ty = GetNeonType(
4279+
this, NeonTypeFlags(NeonTypeFlags::Float64, false, Type.isQuad()));
4280+
return builder.createCast(cir::CastKind::int_to_float, Ops[0], ty);
4281+
}
42784282
case NEON::BI__builtin_neon_vcvt_f64_f32: {
42794283
llvm_unreachable("NEON::BI__builtin_neon_vcvt_f64_f32 NYI");
42804284
}

clang/test/CIR/CodeGen/AArch64/neon.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19443,3 +19443,17 @@ int8x8_t test_vtbl1_s8(int8x8_t a, int8x8_t b) {
1944319443
// OGCG: {{%.*}} = shufflevector <8 x i8> {{%.*}}, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
1944419444
// OGCG: {{%.*}} = call <8 x i8> @llvm.aarch64.neon.tbl1.v8i8(<16 x i8> {{%.*}}, <8 x i8> {{%.*}})
1944519445
}
19446+
19447+
// CHECK-LABEL: test_vcvtq_f64_s64
19448+
float64x2_t test_vcvtq_f64_s64(int64x2_t a) {
19449+
return vcvtq_f64_s64(a);
19450+
19451+
// CIR-LABEL: vcvtq_f64_s64
19452+
// CIR: {{%.*}} = cir.cast int_to_float {{%.*}} : !cir.vector<!s64i x 2> -> !cir.vector<!cir.double x 2>
19453+
19454+
// LLVM-LABEL: @test_vcvtq_f64_s64
19455+
// LLVM: {{%.*}} = sitofp <2 x i64> {{%.*}} to <2 x double>
19456+
19457+
// OGCG-LABEL: @test_vcvtq_f64_s64
19458+
// OGCG: {{%.*}} = sitofp <2 x i64> {{%.*}} to <2 x double>
19459+
}

0 commit comments

Comments
 (0)