xref: /llvm-project/llvm/test/Transforms/Inline/RISCV/inline-target-features.ll (revision 05a7b22a0132bebe99aabee591d3acc99d793ae1)
1; RUN: opt < %s -mtriple=riscv64-unknown-linux-gnu -S -passes=inline | FileCheck %s
2; RUN: opt < %s -mtriple=riscv64-unknown-linux-gnu -S -passes='cgscc(inline)' | FileCheck %s
3; Check that we only inline when we have compatible target attributes.
4
5target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
6target triple = "riscv64-unknown-linux-gnu"
7
8define i32 @foo() #0 {
9entry:
10  %call = call i32 (...) @baz()
11  ret i32 %call
12; CHECK-LABEL: foo
13; CHECK: call i32 (...) @baz()
14}
15declare i32 @baz(...) #0
16
17define i32 @bar() #1 {
18entry:
19  %call = call i32 @foo()
20  ret i32 %call
21; CHECK-LABEL: bar
22; CHECK: call i32 (...) @baz()
23}
24
25define i32 @qux() #0 {
26entry:
27  %call = call i32 @bar()
28  ret i32 %call
29; CHECK-LABEL: qux
30; CHECK: call i32 @bar()
31}
32
33attributes #0 = { "target-cpu"="generic-rv64" "target-features"="+f,+d" }
34attributes #1 = { "target-cpu"="generic-rv64" "target-features"="+f,+d,+m,+v" }
35