[clang] [CIR][AArch64] Implement vget_lane_bf16 and vgetq_lane_bf16 builtins (PR #186866)

Andrzej WarzyƄski via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 26 12:54:56 PDT 2026


================
@@ -34,3 +26,19 @@ bfloat16_t test_vduph_laneq_bf16(bfloat16x8_t v) {
   // LLVM: ret bfloat [[VGETQ_LANE]]
   return vduph_laneq_bf16(v, 7);
 }
+
+// ALL-LABEL: @test_vget_lane_bf16(
+bfloat16_t test_vget_lane_bf16(bfloat16x4_t v) {
+  // CIR: cir.vec.extract %{{.*}}[%{{.*}} : !s32i] : !cir.vector<4 x !cir.bf16>
+  // LLVM: [[VGET_LANE:%.*]] = extractelement <4 x bfloat> %{{.*}}, i32 1
+  // LLVM: ret bfloat [[VGET_LANE]]
+  return vget_lane_bf16(v, 1);
+}
+
+// ALL-LABEL: @test_vgetq_lane_bf16(
+bfloat16_t test_vgetq_lane_bf16(bfloat16x8_t v) {
+  // CIR: cir.vec.extract %{{.*}}[%{{.*}} : !s32i] : !cir.vector<8 x !cir.bf16>
+  // LLVM: [[VGETQ_LANE:%.*]] = extractelement <8 x bfloat> %{{.*}}, i32 7
----------------
banach-space wrote:

Could you add `LLVM-SAME` to match the input arguments? Similar comment for the other test.

You will find examples in this file https://github.com/llvm/llvm-project/blob/main/clang/test/CodeGen/AArch64/neon/intrinsics.c

https://github.com/llvm/llvm-project/pull/186866


More information about the cfe-commits mailing list