1 ; RUN: llc -mcpu=mvp < %s | FileCheck %s
2 ; RUN: llc -mcpu=mvp -mattr=+simd128 < %s | FileCheck %s --check-prefixes SIMD128
4 ; Test that codegen emits target features from the command line or
5 ; function attributes correctly and that features are enabled for the
6 ; entire module if they are enabled for any function in the module.
8 target triple = "wasm32-unknown-unknown"
10 define void @fn_atomics(ptr %p1, float %f2) #0 {
11 %a = atomicrmw min ptr undef, i32 42 seq_cst
12 %v = fptoui float %f2 to i32
17 define void @fn_nontrapping_fptoint(ptr %p1, float %f2) #1 {
18 %a = atomicrmw min ptr undef, i32 42 seq_cst
19 %v = fptoui float %f2 to i32
24 define void @fn_reference_types() #2 {
28 attributes #0 = { "target-features"="+atomics" }
29 attributes #1 = { "target-features"="+nontrapping-fptoint" }
30 attributes #2 = { "target-features"="+reference-types" }
32 ; CHECK-LABEL: fn_atomics:
34 ; Expanded atomicrmw min
36 ; CHECK: i32.atomic.rmw.cmpxchg
40 ; CHECK: i32.trunc_sat_f32_u
43 ; `fn_nontrapping_fptoint` should be the same as `fn_atomics`
44 ; CHECK-LABEL: fn_nontrapping_fptoint:
46 ; Expanded atomicrmw min
48 ; CHECK: i32.atomic.rmw.cmpxchg
52 ; CHECK: i32.trunc_sat_f32_u
55 ; Features in function attributes:
56 ; +atomics, +nontrapping-fptoint, +reference-types
57 ; CHECK-LABEL: .custom_section.target_features,"",@
59 ; CHECK-NEXT: .int8 43
61 ; CHECK-NEXT: .ascii "atomics"
62 ; CHECK-NEXT: .int8 43
63 ; CHECK-NEXT: .int8 19
64 ; CHECK-NEXT: .ascii "nontrapping-fptoint"
65 ; CHECK-NEXT: .int8 43
66 ; CHECK-NEXT: .int8 15
67 ; CHECK-NEXT: .ascii "reference-types"
69 ; Features in function attributes + features specified by -mattr= option:
70 ; +atomics, +nontrapping-fptoint, +reference-types, +simd128
71 ; SIMD128-LABEL: .custom_section.target_features,"",@
72 ; SIMD128-NEXT: .int8 4
73 ; SIMD128-NEXT: .int8 43
74 ; SIMD128-NEXT: .int8 7
75 ; SIMD128-NEXT: .ascii "atomics"
76 ; SIMD128-NEXT: .int8 43
77 ; SIMD128-NEXT: .int8 19
78 ; SIMD128-NEXT: .ascii "nontrapping-fptoint"
79 ; SIMD128-NEXT: .int8 43
80 ; SIMD128-NEXT: .int8 15
81 ; SIMD128-NEXT: .ascii "reference-types"
82 ; SIMD128-NEXT: .int8 43
83 ; SIMD128-NEXT: .int8 7
84 ; SIMD128-NEXT: .ascii "simd128"