Skip to content

Commit e97a55c

Browse files
committed
[MLIR][LLVMIR] Translation: honor target-features fn attribute
1 parent 94c937d commit e97a55c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,8 @@ static void convertFunctionAttributes(LLVMFuncOp func,
16061606
llvmFunc->addFnAttr(llvm::Attribute::NoUnwind);
16071607
if (func.getWillReturnAttr())
16081608
llvmFunc->addFnAttr(llvm::Attribute::WillReturn);
1609+
if (TargetFeaturesAttr targetFeatAttr = func.getTargetFeaturesAttr())
1610+
llvmFunc->addFnAttr("target-features", targetFeatAttr.getFeaturesString());
16091611
convertFunctionMemoryAttributes(func, llvmFunc);
16101612
}
16111613

mlir/test/Target/LLVMIR/llvmir.mlir

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,6 +2367,18 @@ llvm.func @readwrite_func() attributes {
23672367

23682368
// -----
23692369

2370+
//
2371+
// target-features attribute.
2372+
//
2373+
2374+
// CHECK-LABEL: @tf
2375+
// CHECK-SAME: #[[TargetFeat:.*]]
2376+
llvm.func @tf(!llvm.ptr) attributes {target_features = #llvm.target_features<["+fix-cortex-a53-835769", "+fp-armv8", "+neon", "+outline-atomics", "+v8a"]>}
2377+
2378+
// CHECK: attributes #[[TargetFeat]] = { "target-features"="+fix-cortex-a53-835769,+fp-armv8,+neon,+outline-atomics,+v8a" }
2379+
2380+
// -----
2381+
23702382
//
23712383
// arm_streaming attribute.
23722384
//

0 commit comments

Comments
 (0)