Skip to content

Commit 8ebbda7

Browse files
ghehglanza
authored andcommitted
[CIR][CIRGen][Builtin][Neon] Lower neon vst1q_lane and vst1_lane (#935)
as title. Also changed [neon-ldst.c](https://github.com/llvm/clangir/compare/main...ghehg:clangir-llvm-ghehg:macM3?expand=1#diff-ea4814b6503bff2b7bc4afc6400565e6e89e5785bfcda587dc8401d8de5d3a22) to make it have the same RUN options as OG [clang/test/CodeGen/aarch64-neon-intrinsics.c](https://github.com/llvm/clangir/blob/main/clang/test/CodeGen/aarch64-neon-intrinsics.c) Those options help us to avoid checking load/store pairs thus make the test less verbose and easier to compare against OG. Co-authored-by: Guojin He <[email protected]>
1 parent 68904d7 commit 8ebbda7

File tree

2 files changed

+300
-108
lines changed

2 files changed

+300
-108
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,9 @@ static mlir::cir::VectorType GetNeonType(CIRGenFunction *CGF,
19471947
CGF->getCIRGenModule().FloatTy,
19481948
V1Ty ? 1 : (2 << IsQuad));
19491949
case NeonTypeFlags::Float64:
1950-
llvm_unreachable("NYI");
1950+
return mlir::cir::VectorType::get(CGF->getBuilder().getContext(),
1951+
CGF->getCIRGenModule().DoubleTy,
1952+
V1Ty ? 1 : (1 << IsQuad));
19511953
}
19521954
llvm_unreachable("Unknown vector element type!");
19531955
}
@@ -3437,8 +3439,14 @@ CIRGenFunction::buildAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
34373439
llvm_unreachable("NYI");
34383440
}
34393441
case NEON::BI__builtin_neon_vst1_lane_v:
3440-
case NEON::BI__builtin_neon_vst1q_lane_v:
3441-
llvm_unreachable("NYI");
3442+
case NEON::BI__builtin_neon_vst1q_lane_v: {
3443+
Ops[1] = builder.createBitcast(Ops[1], Ty);
3444+
Ops[1] = builder.create<mlir::cir::VecExtractOp>(Ops[1].getLoc(), Ops[1],
3445+
Ops[2]);
3446+
(void)builder.createAlignedStore(getLoc(E->getExprLoc()), Ops[1], Ops[0],
3447+
PtrOp0.getAlignment());
3448+
return Ops[1];
3449+
}
34423450
case NEON::BI__builtin_neon_vstl1_lane_s64:
34433451
case NEON::BI__builtin_neon_vstl1q_lane_s64: {
34443452
llvm_unreachable("NYI");

0 commit comments

Comments
 (0)