dnsampaio created this revision. dnsampaio added reviewers: pablooliveira, olista01, LukeGeeson. Herald added subscribers: cfe-commits, kristof.beyls, javed.absar. Herald added a project: clang.
Implements the intrinsics define on the ACLE to extract half precision fp scalar elements from float16x4_t and float16x8_t vector types. a.k.a: vduph_lane_f16 vduph_laneq_f16 Repository: rC Clang https://reviews.llvm.org/D60272 Files: lib/CodeGen/CGBuiltin.cpp test/CodeGen/aarch64-v8.2a-neon-intrinsics.c Index: test/CodeGen/aarch64-v8.2a-neon-intrinsics.c =================================================================== --- test/CodeGen/aarch64-v8.2a-neon-intrinsics.c +++ test/CodeGen/aarch64-v8.2a-neon-intrinsics.c @@ -1618,3 +1618,16 @@ return vtrn2q_f16(a, b); } +// CHECK-LABEL: @test_vduph_laneq_f16( +// CHECK: [[V:%.*]] = extractelement <8 x half> [[V2:%.*]], i32 7 +// CHECK-NEXT: ret half [[V]] +float16_t test_vduph_laneq_f16 (float16x8_t vec) { + return vduph_laneq_f16 (vec, 7); +} + +// CHECK-LABEL: @test_vduph_lane_f16( +// CHECK: [[V:%.*]] = extractelement <4 x half> [[V2:%.*]], i32 3 +// CHECK-NEXT: ret half [[V]] +float16_t test_vduph_lane_f16 (float16x4_t vec) { + return vduph_lane_f16 (vec, 3); +} Index: lib/CodeGen/CGBuiltin.cpp =================================================================== --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -7810,6 +7810,14 @@ : Intrinsic::aarch64_neon_sqsub; return EmitNeonCall(CGM.getIntrinsic(AccInt, Int64Ty), Ops, "vqdmlXl"); } + case NEON::BI__builtin_neon_vduph_lane_f16:{ + return Builder.CreateExtractElement(Ops[0], EmitScalarExpr(E->getArg(1)), + "vget_lane"); + } + case NEON::BI__builtin_neon_vduph_laneq_f16:{ + return Builder.CreateExtractElement(Ops[0], EmitScalarExpr(E->getArg(1)), + "vgetq_lane"); + } } llvm::VectorType *VTy = GetNeonType(this, Type);
Index: test/CodeGen/aarch64-v8.2a-neon-intrinsics.c =================================================================== --- test/CodeGen/aarch64-v8.2a-neon-intrinsics.c +++ test/CodeGen/aarch64-v8.2a-neon-intrinsics.c @@ -1618,3 +1618,16 @@ return vtrn2q_f16(a, b); } +// CHECK-LABEL: @test_vduph_laneq_f16( +// CHECK: [[V:%.*]] = extractelement <8 x half> [[V2:%.*]], i32 7 +// CHECK-NEXT: ret half [[V]] +float16_t test_vduph_laneq_f16 (float16x8_t vec) { + return vduph_laneq_f16 (vec, 7); +} + +// CHECK-LABEL: @test_vduph_lane_f16( +// CHECK: [[V:%.*]] = extractelement <4 x half> [[V2:%.*]], i32 3 +// CHECK-NEXT: ret half [[V]] +float16_t test_vduph_lane_f16 (float16x4_t vec) { + return vduph_lane_f16 (vec, 3); +} Index: lib/CodeGen/CGBuiltin.cpp =================================================================== --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -7810,6 +7810,14 @@ : Intrinsic::aarch64_neon_sqsub; return EmitNeonCall(CGM.getIntrinsic(AccInt, Int64Ty), Ops, "vqdmlXl"); } + case NEON::BI__builtin_neon_vduph_lane_f16:{ + return Builder.CreateExtractElement(Ops[0], EmitScalarExpr(E->getArg(1)), + "vget_lane"); + } + case NEON::BI__builtin_neon_vduph_laneq_f16:{ + return Builder.CreateExtractElement(Ops[0], EmitScalarExpr(E->getArg(1)), + "vgetq_lane"); + } } llvm::VectorType *VTy = GetNeonType(this, Type);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits