1 ; RUN: llc < %s | FileCheck %s --check-prefixes CHECK,ATTRS
2 ; RUN: llc < %s -mcpu=mvp -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128
3 ; RUN: llc < %s -mcpu=bleeding-edge | FileCheck %s --check-prefixes CHECK,BLEEDING-EDGE
5 ; Test that codegen emits target features from the command line or
6 ; function attributes correctly and that features are enabled for the
7 ; entire module if they are enabled for any function in the module.
9 target triple = "wasm32-unknown-unknown"
11 define void @fn_atomics(ptr %p1, float %f2) #0 {
12 %a = atomicrmw min ptr undef, i32 42 seq_cst
13 %v = fptoui float %f2 to i32
18 define void @fn_nontrapping_fptoint(ptr %p1, float %f2) #1 {
19 %a = atomicrmw min ptr undef, i32 42 seq_cst
20 %v = fptoui float %f2 to i32
25 define void @fn_reference_types() #2 {
29 attributes #0 = { "target-features"="+atomics" }
30 attributes #1 = { "target-features"="+nontrapping-fptoint" }
31 attributes #2 = { "target-features"="+reference-types" }
33 ; CHECK-LABEL: fn_atomics:
35 ; Expanded atomicrmw min
37 ; CHECK: i32.atomic.rmw.cmpxchg
41 ; CHECK: i32.trunc_sat_f32_u
44 ; `fn_nontrapping_fptoint` should be the same as `fn_atomics`
45 ; CHECK-LABEL: fn_nontrapping_fptoint:
47 ; Expanded atomicrmw min
49 ; CHECK: i32.atomic.rmw.cmpxchg
53 ; CHECK: i32.trunc_sat_f32_u
56 ; CHECK-LABEL: .custom_section.target_features,"",@
58 ; +atomics, +reference-types, +mutable-globals
60 ; ATTRS-NEXT: .int8 43
62 ; ATTRS-NEXT: .ascii "atomics"
63 ; ATTRS-NEXT: .int8 43
64 ; ATTRS-NEXT: .int8 15
65 ; ATTRS-NEXT: .ascii "mutable-globals"
66 ; ATTRS-NEXT: .int8 43
67 ; ATTRS-NEXT: .int8 19
68 ; ATTRS-NEXT: .ascii "nontrapping-fptoint"
69 ; ATTRS-NEXT: .int8 43
70 ; ATTRS-NEXT: .int8 15
71 ; ATTRS-NEXT: .ascii "reference-types"
72 ; ATTRS-NEXT: .int8 43
75 ; +atomics, +nontrapping-fptoint, +reference-types, +simd128
76 ; SIMD128-NEXT: .int8 4
77 ; SIMD128-NEXT: .int8 43
78 ; SIMD128-NEXT: .int8 7
79 ; SIMD128-NEXT: .ascii "atomics"
80 ; SIMD128-NEXT: .int8 43
81 ; SIMD128-NEXT: .int8 19
82 ; SIMD128-NEXT: .ascii "nontrapping-fptoint"
83 ; SIMD128-NEXT: .int8 43
84 ; SIMD128-NEXT: .int8 15
85 ; SIMD128-NEXT: .ascii "reference-types"
86 ; SIMD128-NEXT: .int8 43
87 ; SIMD128-NEXT: .int8 7
88 ; SIMD128-NEXT: .ascii "simd128"
90 ; +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint,
91 ; +reference-types, +sign-ext, +simd128, +tail-call
92 ; BLEEDING-EDGE-NEXT: .int8 8
93 ; BLEEDING-EDGE-NEXT: .int8 43
94 ; BLEEDING-EDGE-NEXT: .int8 7
95 ; BLEEDING-EDGE-NEXT: .ascii "atomics"
96 ; BLEEDING-EDGE-NEXT: .int8 43
97 ; BLEEDING-EDGE-NEXT: .int8 11
98 ; BLEEDING-EDGE-NEXT: .ascii "bulk-memory"
99 ; BLEEDING-EDGE-NEXT: .int8 43
100 ; BLEEDING-EDGE-NEXT: .int8 15
101 ; BLEEDING-EDGE-NEXT: .ascii "mutable-globals"
102 ; BLEEDING-EDGE-NEXT: .int8 43
103 ; BLEEDING-EDGE-NEXT: .int8 19
104 ; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint"
105 ; BLEEDING-EDGE-NEXT: .int8 43
106 ; BLEEDING-EDGE-NEXT: .int8 15
107 ; BLEEDING-EDGE-NEXT: .ascii "reference-types"
108 ; BLEEDING-EDGE-NEXT: .int8 43
109 ; BLEEDING-EDGE-NEXT: .int8 8
110 ; BLEEDING-EDGE-NEXT: .ascii "sign-ext"
111 ; BLEEDING-EDGE-NEXT: .int8 43
112 ; BLEEDING-EDGE-NEXT: .int8 7
113 ; BLEEDING-EDGE-NEXT: .ascii "simd128"
114 ; BLEEDING-EDGE-NEXT: .int8 43
115 ; BLEEDING-EDGE-NEXT: .int8 9
116 ; BLEEDING-EDGE-NEXT: .ascii "tail-call"