1 ; RUN: llc < %s | FileCheck %s --check-prefixes CHECK,ATTRS
2 ; RUN: llc < %s -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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
10 target triple = "wasm32-unknown-unknown"
12 define void @foo(i32* %p1, float %f2) #0 {
13 %a = atomicrmw min i32* undef, i32 42 seq_cst
14 %v = fptoui float %f2 to i32
15 store i32 %v, i32* %p1
19 define void @bar(i32* %p1, float %f2) #1 {
20 %a = atomicrmw min i32* undef, i32 42 seq_cst
21 %v = fptoui float %f2 to i32
22 store i32 %v, i32* %p1
26 attributes #0 = { "target-features"="+atomics" }
27 attributes #1 = { "target-features"="+nontrapping-fptoint" }
32 ; Expanded atomicrmw min
34 ; ATTRS: i32.atomic.rmw.cmpxchg
35 ; SIMD128-NOT: i32.atomic.rmw.cmpxchg
39 ; ATTRS: i32.trunc_sat_f32_u
40 ; SIMD128-NOT: i32.trunc_sat_f32_u
43 ; `bar` should be the same as `foo`
46 ; Expanded atomicrmw min
48 ; ATTRS: i32.atomic.rmw.cmpxchg
49 ; SIMD128-NOT: i32.atomic.rmw.cmpxchg
53 ; ATTRS: i32.trunc_sat_f32_u
54 ; SIMD128-NOT: i32.trunc_sat_f32_u
57 ; CHECK-LABEL: .custom_section.target_features,"",@
59 ; +atomics, +nontrapping-fptoint
61 ; ATTRS-NEXT: .int8 43
63 ; ATTRS-NEXT: .ascii "atomics"
64 ; ATTRS-NEXT: .int8 43
65 ; ATTRS-NEXT: .int8 19
66 ; ATTRS-NEXT: .ascii "nontrapping-fptoint"
69 ; SIMD128-NEXT: .int8 2
70 ; SIMD128-NEXT: .int8 45
71 ; SIMD128-NEXT: .int8 7
72 ; SIMD128-NEXT: .ascii "atomics"
73 ; SIMD128-NEXT: .int8 43
74 ; SIMD128-NEXT: .int8 7
75 ; SIMD128-NEXT: .ascii "simd128"
77 ; +atomics, +nontrapping-fptoint, +sign-ext, +simd128
78 ; BLEEDING-EDGE-NEXT: .int8 5
79 ; BLEEDING-EDGE-NEXT: .int8 43
80 ; BLEEDING-EDGE-NEXT: .int8 7
81 ; BLEEDING-EDGE-NEXT: .ascii "atomics"
82 ; BLEEDING-EDGE-NEXT: .int8 43
83 ; BLEEDING-EDGE-NEXT: .int8 15
84 ; BLEEDING-EDGE-NEXT: .ascii "mutable-globals"
85 ; BLEEDING-EDGE-NEXT: .int8 43
86 ; BLEEDING-EDGE-NEXT: .int8 19
87 ; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint"
88 ; BLEEDING-EDGE-NEXT: .int8 43
89 ; BLEEDING-EDGE-NEXT: .int8 8
90 ; BLEEDING-EDGE-NEXT: .ascii "sign-ext"
91 ; BLEEDING-EDGE-NEXT: .int8 43
92 ; BLEEDING-EDGE-NEXT: .int8 7
93 ; BLEEDING-EDGE-NEXT: .ascii "simd128"