91 lines · plain
1; RUN: llc -mcpu=mvp < %s | FileCheck %s2; RUN: llc -mcpu=mvp -mattr=+simd128 < %s | FileCheck %s --check-prefixes SIMD1283 4; Test that codegen emits target features from the command line or5; function attributes correctly and that features are enabled for the6; entire module if they are enabled for any function in the module.7 8target triple = "wasm32-unknown-unknown"9 10define void @fn_atomics(ptr %p1, float %f2) #0 {11 %a = atomicrmw min ptr undef, i32 42 seq_cst12 %v = fptoui float %f2 to i3213 store i32 %v, ptr %p114 ret void15}16 17define void @fn_nontrapping_fptoint(ptr %p1, float %f2) #1 {18 %a = atomicrmw min ptr undef, i32 42 seq_cst19 %v = fptoui float %f2 to i3220 store i32 %v, ptr %p121 ret void22}23 24define void @fn_reference_types() #2 {25 ret void26}27 28attributes #0 = { "target-features"="+atomics" }29attributes #1 = { "target-features"="+nontrapping-fptoint" }30attributes #2 = { "target-features"="+reference-types" }31 32; CHECK-LABEL: fn_atomics:33 34; Expanded atomicrmw min35; CHECK: loop36; CHECK: i32.atomic.rmw.cmpxchg37; CHECK: end_loop38 39; nontrapping fptoint40; CHECK: i32.trunc_sat_f32_u41; CHECK: i32.store42 43; `fn_nontrapping_fptoint` should be the same as `fn_atomics`44; CHECK-LABEL: fn_nontrapping_fptoint:45 46; Expanded atomicrmw min47; CHECK: loop48; CHECK: i32.atomic.rmw.cmpxchg49; CHECK: end_loop50 51; nontrapping fptoint52; CHECK: i32.trunc_sat_f32_u53; CHECK: i32.store54 55; Features in function attributes:56; +atomics, +nontrapping-fptoint, +reference-types57; CHECK-LABEL: .custom_section.target_features,"",@58; CHECK-NEXT: .int8 459; CHECK-NEXT: .int8 4360; CHECK-NEXT: .int8 761; CHECK-NEXT: .ascii "atomics"62; CHECK-NEXT: .int8 4363; CHECK-NEXT: .int8 2264; CHECK-NEXT: .ascii "call-indirect-overlong"65; CHECK-NEXT: .int8 4366; CHECK-NEXT: .int8 1967; CHECK-NEXT: .ascii "nontrapping-fptoint"68; CHECK-NEXT: .int8 4369; CHECK-NEXT: .int8 1570; CHECK-NEXT: .ascii "reference-types"71 72; Features in function attributes + features specified by -mattr= option:73; +atomics, +nontrapping-fptoint, +reference-types, +simd12874; SIMD128-LABEL: .custom_section.target_features,"",@75; SIMD128-NEXT: .int8 576; SIMD128-NEXT: .int8 4377; SIMD128-NEXT: .int8 778; SIMD128-NEXT: .ascii "atomics"79; SIMD128-NEXT: .int8 4380; SIMD128-NEXT: .int8 2281; SIMD128-NEXT: .ascii "call-indirect-overlong"82; SIMD128-NEXT: .int8 4383; SIMD128-NEXT: .int8 1984; SIMD128-NEXT: .ascii "nontrapping-fptoint"85; SIMD128-NEXT: .int8 4386; SIMD128-NEXT: .int8 1587; SIMD128-NEXT: .ascii "reference-types"88; SIMD128-NEXT: .int8 4389; SIMD128-NEXT: .int8 790; SIMD128-NEXT: .ascii "simd128"91