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 4 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. 8 9target triple = "wasm32-unknown-unknown" 10 11define void @fn_atomics(i32* %p1, float %f2) #0 { 12 %a = atomicrmw min i32* undef, i32 42 seq_cst 13 %v = fptoui float %f2 to i32 14 store i32 %v, i32* %p1 15 ret void 16} 17 18define void @fn_nontrapping_fptoint(i32* %p1, float %f2) #1 { 19 %a = atomicrmw min i32* undef, i32 42 seq_cst 20 %v = fptoui float %f2 to i32 21 store i32 %v, i32* %p1 22 ret void 23} 24 25define void @fn_reference_types() #2 { 26 ret void 27} 28 29attributes #0 = { "target-features"="+atomics" } 30attributes #1 = { "target-features"="+nontrapping-fptoint" } 31attributes #2 = { "target-features"="+reference-types" } 32 33; CHECK-LABEL: fn_atomics: 34 35; Expanded atomicrmw min 36; ATTRS: loop 37; CHECK: i32.atomic.rmw.cmpxchg 38; ATTRS: end_loop 39 40; nontrapping fptoint 41; CHECK: i32.trunc_sat_f32_u 42; ATTRS: i32.store 43 44; `fn_nontrapping_fptoint` should be the same as `fn_atomics` 45; CHECK-LABEL: fn_nontrapping_fptoint: 46 47; Expanded atomicrmw min 48; ATTRS: loop 49; CHECK: i32.atomic.rmw.cmpxchg 50; ATTRS: end_loop 51 52; nontrapping fptoint 53; CHECK: i32.trunc_sat_f32_u 54; ATTRS: i32.store 55 56; CHECK-LABEL: .custom_section.target_features,"",@ 57 58; +atomics, +nontrapping-fptoint, +reference-types 59; ATTRS-NEXT: .int8 3 60; ATTRS-NEXT: .int8 43 61; ATTRS-NEXT: .int8 7 62; ATTRS-NEXT: .ascii "atomics" 63; ATTRS-NEXT: .int8 43 64; ATTRS-NEXT: .int8 19 65; ATTRS-NEXT: .ascii "nontrapping-fptoint" 66; ATTRS-NEXT: .int8 43 67; ATTRS-NEXT: .int8 15 68; ATTRS-NEXT: .ascii "reference-types" 69 70; +atomics, +nontrapping-fptoint, +reference-types, +simd128 71; SIMD128-NEXT: .int8 4 72; SIMD128-NEXT: .int8 43 73; SIMD128-NEXT: .int8 7 74; SIMD128-NEXT: .ascii "atomics" 75; SIMD128-NEXT: .int8 43 76; SIMD128-NEXT: .int8 19 77; SIMD128-NEXT: .ascii "nontrapping-fptoint" 78; SIMD128-NEXT: .int8 43 79; SIMD128-NEXT: .int8 15 80; SIMD128-NEXT: .ascii "reference-types" 81; SIMD128-NEXT: .int8 43 82; SIMD128-NEXT: .int8 7 83; SIMD128-NEXT: .ascii "simd128" 84 85; +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint, 86; +reference-types, +sign-ext, +simd128, +tail-call 87; BLEEDING-EDGE-NEXT: .int8 8 88; BLEEDING-EDGE-NEXT: .int8 43 89; BLEEDING-EDGE-NEXT: .int8 7 90; BLEEDING-EDGE-NEXT: .ascii "atomics" 91; BLEEDING-EDGE-NEXT: .int8 43 92; BLEEDING-EDGE-NEXT: .int8 11 93; BLEEDING-EDGE-NEXT: .ascii "bulk-memory" 94; BLEEDING-EDGE-NEXT: .int8 43 95; BLEEDING-EDGE-NEXT: .int8 15 96; BLEEDING-EDGE-NEXT: .ascii "mutable-globals" 97; BLEEDING-EDGE-NEXT: .int8 43 98; BLEEDING-EDGE-NEXT: .int8 19 99; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint" 100; BLEEDING-EDGE-NEXT: .int8 43 101; BLEEDING-EDGE-NEXT: .int8 15 102; BLEEDING-EDGE-NEXT: .ascii "reference-types" 103; BLEEDING-EDGE-NEXT: .int8 43 104; BLEEDING-EDGE-NEXT: .int8 8 105; BLEEDING-EDGE-NEXT: .ascii "sign-ext" 106; BLEEDING-EDGE-NEXT: .int8 43 107; BLEEDING-EDGE-NEXT: .int8 7 108; BLEEDING-EDGE-NEXT: .ascii "simd128" 109; BLEEDING-EDGE-NEXT: .int8 43 110; BLEEDING-EDGE-NEXT: .int8 9 111; BLEEDING-EDGE-NEXT: .ascii "tail-call" 112 113; CHECK-NEXT: .text 114