From: Bob Wilson Date: Wed, 15 Dec 2010 23:36:44 +0000 (+0000) Subject: Implement builtins for Neon half-precision float conversions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46e392ae6d09979b087d7b1aca3b816ba4199b89;p=clang Implement builtins for Neon half-precision float conversions. Also tweak the VCVT_F32_F16 entry in arm_neon.td to be more consistent with the other floating-point conversion builtins. Radar 8068427. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121916 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td index d366d6938e..880a0da6bc 100644 --- a/include/clang/Basic/arm_neon.td +++ b/include/clang/Basic/arm_neon.td @@ -303,7 +303,7 @@ def VCVT_F16 : SInst<"vcvt_f16", "hk", "f">; def VCVT_N_S32 : SInst<"vcvt_n_s32", "xdi", "fQf">; def VCVT_N_U32 : SInst<"vcvt_n_u32", "udi", "fQf">; def VCVT_F32 : SInst<"vcvt_f32", "fd", "iUiQiQUi">; -def VCVT_F32_F16 : SInst<"vcvt_f32_f16", "kh", "f">; +def VCVT_F32_F16 : SInst<"vcvt_f32_f16", "fd", "h">; def VCVT_N_F32 : SInst<"vcvt_n_f32", "fdi", "iUiQiQUi">; def VMOVN : IInst<"vmovn", "hk", "silUsUiUl">; def VMOVL : SInst<"vmovl", "wd", "csiUcUsUi">; diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 19c3fbb1fa..3fc5efd7f3 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -1226,7 +1226,16 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcnt, &Ty, 1); return EmitNeonCall(F, Ops, "vcnt"); } - // FIXME: intrinsics for f16<->f32 convert missing from ARM target. + case ARM::BI__builtin_neon_vcvt_f16_v: { + assert((type & 0x7) == 7 && !quad && "unexpected vcvt_f16_v builtin"); + Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcvtfp2hf); + return EmitNeonCall(F, Ops, "vcvt"); + } + case ARM::BI__builtin_neon_vcvt_f32_f16: { + assert((type & 0x7) == 7 && !quad && "unexpected vcvt_f32_f16 builtin"); + Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcvthf2fp); + return EmitNeonCall(F, Ops, "vcvt"); + } case ARM::BI__builtin_neon_vcvt_f32_v: case ARM::BI__builtin_neon_vcvtq_f32_v: { Ops[0] = Builder.CreateBitCast(Ops[0], Ty);