Skip to content

Commit bc9038e

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 34858fc commit bc9038e

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
@@ -1949,7 +1949,9 @@ static mlir::cir::VectorType GetNeonType(CIRGenFunction *CGF,
19491949
CGF->getCIRGenModule().FloatTy,
19501950
V1Ty ? 1 : (2 << IsQuad));
19511951
case NeonTypeFlags::Float64:
1952-
llvm_unreachable("NYI");
1952+
return mlir::cir::VectorType::get(CGF->getBuilder().getContext(),
1953+
CGF->getCIRGenModule().DoubleTy,
1954+
V1Ty ? 1 : (1 << IsQuad));
19531955
}
19541956
llvm_unreachable("Unknown vector element type!");
19551957
}
@@ -3432,8 +3434,14 @@ CIRGenFunction::buildAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
34323434
llvm_unreachable("NYI");
34333435
}
34343436
case NEON::BI__builtin_neon_vst1_lane_v:
3435-
case NEON::BI__builtin_neon_vst1q_lane_v:
3436-
llvm_unreachable("NYI");
3437+
case NEON::BI__builtin_neon_vst1q_lane_v: {
3438+
Ops[1] = builder.createBitcast(Ops[1], Ty);
3439+
Ops[1] = builder.create<mlir::cir::VecExtractOp>(Ops[1].getLoc(), Ops[1],
3440+
Ops[2]);
3441+
(void)builder.createAlignedStore(getLoc(E->getExprLoc()), Ops[1], Ops[0],
3442+
PtrOp0.getAlignment());
3443+
return Ops[1];
3444+
}
34373445
case NEON::BI__builtin_neon_vstl1_lane_s64:
34383446
case NEON::BI__builtin_neon_vstl1q_lane_s64: {
34393447
llvm_unreachable("NYI");

0 commit comments

Comments
 (0)