xref: /llvm-project/llvm/test/Transforms/Inline/WebAssembly/inline-target-features.ll (revision e5369823bc0655806469724335d0ca5a4c17d8c7)
1d53d9528SThomas Lively; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*e5369823SRoman Lebedev; RUN: opt < %s -mtriple=wasm32-unknown-unknown -S -passes=inline | FileCheck %s
3d53d9528SThomas Lively
4d53d9528SThomas Lively; Check that having functions can be inlined into callers only when
5d53d9528SThomas Lively; they have a subset of the caller's features.
6d53d9528SThomas Lively
7d53d9528SThomas Livelytarget datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
8d53d9528SThomas Livelytarget triple = "wasm32-unknown-unknown"
9d53d9528SThomas Lively
10d53d9528SThomas Livelydeclare void @foo()
11d53d9528SThomas Lively
12d53d9528SThomas Livelydefine internal void @uses_simd() #0 {
13d53d9528SThomas Lively; CHECK-LABEL: @uses_simd(
14d53d9528SThomas Lively; CHECK-NEXT:    tail call void @foo()
15d53d9528SThomas Lively; CHECK-NEXT:    ret void
16d53d9528SThomas Lively;
17d53d9528SThomas Lively  tail call void @foo()
18d53d9528SThomas Lively  ret void
19d53d9528SThomas Lively}
20d53d9528SThomas Lively
21d53d9528SThomas Livelydefine void @many_features() #1 {
22d53d9528SThomas Lively; CHECK-LABEL: @many_features(
23d53d9528SThomas Lively; CHECK-NEXT:    tail call void @foo()
24d53d9528SThomas Lively; CHECK-NEXT:    ret void
25d53d9528SThomas Lively;
26d53d9528SThomas Lively  tail call fastcc void @uses_simd()
27d53d9528SThomas Lively  ret void
28d53d9528SThomas Lively}
29d53d9528SThomas Lively
30d53d9528SThomas Livelydefine void @few_features() #2 {
31d53d9528SThomas Lively; CHECK-LABEL: @few_features(
32d53d9528SThomas Lively; CHECK-NEXT:    tail call fastcc void @uses_simd()
33d53d9528SThomas Lively; CHECK-NEXT:    ret void
34d53d9528SThomas Lively;
35d53d9528SThomas Lively  tail call fastcc void @uses_simd()
36d53d9528SThomas Lively  ret void
37d53d9528SThomas Lively}
38d53d9528SThomas Lively
39d53d9528SThomas Livelyattributes #0 = { "target-cpu"="mvp" "target-features"="+simd128"}
40d53d9528SThomas Livelyattributes #1 = { "target-cpu"="bleeding-edge" "target-features"="+simd128" }
41d53d9528SThomas Livelyattributes #2 = { "target-cpu"="mvp" "target-features"="+multivalue" }
42