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 22
64 ; CHECK-NEXT: .ascii "call-indirect-overlong"
65 ; CHECK-NEXT: .int8 43
66 ; CHECK-NEXT: .int8 19
67 ; CHECK-NEXT: .ascii "nontrapping-fptoint"
68 ; CHECK-NEXT: .int8 43
69 ; CHECK-NEXT: .int8 15
70 ; CHECK-NEXT: .ascii "reference-types"
72 ; Features in function attributes + features specified by -mattr= option:
73 ; +atomics, +nontrapping-fptoint, +reference-types, +simd128
74 ; SIMD128-LABEL: .custom_section.target_features,"",@
75 ; SIMD128-NEXT: .int8 5
76 ; SIMD128-NEXT: .int8 43
77 ; SIMD128-NEXT: .int8 7
78 ; SIMD128-NEXT: .ascii "atomics"
79 ; SIMD128-NEXT: .int8 43
80 ; SIMD128-NEXT: .int8 22
81 ; SIMD128-NEXT: .ascii "call-indirect-overlong"
82 ; SIMD128-NEXT: .int8 43
83 ; SIMD128-NEXT: .int8 19
84 ; SIMD128-NEXT: .ascii "nontrapping-fptoint"
85 ; SIMD128-NEXT: .int8 43
86 ; SIMD128-NEXT: .int8 15
87 ; SIMD128-NEXT: .ascii "reference-types"
88 ; SIMD128-NEXT: .int8 43
89 ; SIMD128-NEXT: .int8 7
90 ; SIMD128-NEXT: .ascii "simd128"