@@ -1654,7 +1654,9 @@ static const std::pair<unsigned, unsigned> NEONEquivalentIntrinsicMap[] = {
1654
1654
static const ARMVectorIntrinsicInfo AArch64SVEIntrinsicMap[] = {
1655
1655
#define GET_SVE_LLVM_INTRINSIC_MAP
1656
1656
#include " clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def"
1657
+
1657
1658
#include " clang/Basic/arm_sve_builtin_cg.inc"
1659
+
1658
1660
#undef GET_SVE_LLVM_INTRINSIC_MAP
1659
1661
};
1660
1662
@@ -1670,6 +1672,7 @@ static const ARMVectorIntrinsicInfo AArch64SVEIntrinsicMap[] = {
1670
1672
static const ARMVectorIntrinsicInfo AArch64SMEIntrinsicMap[] = {
1671
1673
#define GET_SME_LLVM_INTRINSIC_MAP
1672
1674
#include " clang/Basic/arm_sme_builtin_cg.inc"
1675
+
1673
1676
#undef GET_SME_LLVM_INTRINSIC_MAP
1674
1677
};
1675
1678
@@ -2226,19 +2229,12 @@ static mlir::Value vecReduceIntValue(CIRGenFunction &cgf, mlir::Value val,
2226
2229
loc, val, builder.getConstInt (loc, cgf.SizeTy , 0 ));
2227
2230
}
2228
2231
2229
- static mlir::Value emitNeonCall (CIRGenBuilderTy &builder,
2232
+ static void prepareNeonCallArgs (CIRGenBuilderTy &builder,
2230
2233
llvm::SmallVector<mlir::Type> argTypes,
2231
2234
llvm::SmallVectorImpl<mlir::Value> &args,
2232
- llvm::StringRef intrinsicName,
2233
- mlir::Type funcResTy, mlir::Location loc,
2234
- bool isConstrainedFPIntrinsic = false ,
2235
- unsigned shift = 0 , bool rightshift = false ) {
2236
- // TODO: Consider removing the following unreachable when we have
2237
- // emitConstrainedFPCall feature implemented
2238
- assert (!cir::MissingFeatures::emitConstrainedFPCall ());
2239
- if (isConstrainedFPIntrinsic)
2240
- llvm_unreachable (" isConstrainedFPIntrinsic NYI" );
2241
-
2235
+ mlir::Location loc,
2236
+ bool isConstrainedFPIntrinsic, unsigned shift,
2237
+ bool rightshift) {
2242
2238
for (unsigned j = 0 ; j < argTypes.size (); ++j) {
2243
2239
if (isConstrainedFPIntrinsic) {
2244
2240
assert (!cir::MissingFeatures::emitConstrainedFPCall ());
@@ -2251,6 +2247,24 @@ static mlir::Value emitNeonCall(CIRGenBuilderTy &builder,
2251
2247
args[j] = builder.createBitcast (args[j], argTypes[j]);
2252
2248
}
2253
2249
}
2250
+ }
2251
+
2252
+ static mlir::Value emitNeonCall (CIRGenBuilderTy &builder,
2253
+ llvm::SmallVector<mlir::Type> argTypes,
2254
+ llvm::SmallVectorImpl<mlir::Value> &args,
2255
+ llvm::StringRef intrinsicName,
2256
+ mlir::Type funcResTy, mlir::Location loc,
2257
+ bool isConstrainedFPIntrinsic = false ,
2258
+ unsigned shift = 0 , bool rightshift = false ) {
2259
+ // TODO: Consider removing the following unreachable when we have
2260
+ // emitConstrainedFPCall feature implemented
2261
+ assert (!cir::MissingFeatures::emitConstrainedFPCall ());
2262
+ if (isConstrainedFPIntrinsic)
2263
+ llvm_unreachable (" isConstrainedFPIntrinsic NYI" );
2264
+
2265
+ prepareNeonCallArgs (builder, std::move (argTypes), args, loc,
2266
+ isConstrainedFPIntrinsic, shift, rightshift);
2267
+
2254
2268
if (isConstrainedFPIntrinsic) {
2255
2269
assert (!cir::MissingFeatures::emitConstrainedFPCall ());
2256
2270
return nullptr ;
@@ -2261,6 +2275,8 @@ static mlir::Value emitNeonCall(CIRGenBuilderTy &builder,
2261
2275
.getResult ();
2262
2276
}
2263
2277
2278
+ // This one is similar to the function above, except for creating an operation
2279
+ // from template instead of creating a LLVMIntrinsicCallOp
2264
2280
template <typename Operation>
2265
2281
static mlir::Value
2266
2282
emitNeonCall (CIRGenBuilderTy &builder, llvm::SmallVector<mlir::Type> argTypes,
@@ -2273,18 +2289,9 @@ emitNeonCall(CIRGenBuilderTy &builder, llvm::SmallVector<mlir::Type> argTypes,
2273
2289
if (isConstrainedFPIntrinsic)
2274
2290
llvm_unreachable (" isConstrainedFPIntrinsic NYI" );
2275
2291
2276
- for (unsigned j = 0 ; j < argTypes.size (); ++j) {
2277
- if (isConstrainedFPIntrinsic) {
2278
- assert (!cir::MissingFeatures::emitConstrainedFPCall ());
2279
- }
2280
- if (shift > 0 && shift == j) {
2281
- args[j] = emitNeonShiftVector (builder, args[j],
2282
- mlir::cast<cir::VectorType>(argTypes[j]),
2283
- loc, rightshift);
2284
- } else {
2285
- args[j] = builder.createBitcast (args[j], argTypes[j]);
2286
- }
2287
- }
2292
+ prepareNeonCallArgs (builder, std::move (argTypes), args, loc,
2293
+ isConstrainedFPIntrinsic, shift, rightshift);
2294
+
2288
2295
if (isConstrainedFPIntrinsic) {
2289
2296
assert (!cir::MissingFeatures::emitConstrainedFPCall ());
2290
2297
return nullptr ;
0 commit comments