brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 75612ba Raw
109 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 22; RUN: llc < %s -verify-machineinstrs -mattr=+simd128 | FileCheck %s3 4; Test that SIMD shifts can be lowered correctly even when shift5; values are exported from outside blocks.6 7target triple = "wasm32-unknown-unknown"8 9define void @shl_loop(ptr %a, i8 %shift, i32 %count) {10; CHECK-LABEL: shl_loop:11; CHECK:         .functype shl_loop (i32, i32, i32) -> ()12; CHECK-NEXT:    .local i3213; CHECK-NEXT:  # %bb.0: # %entry14; CHECK-NEXT:  .LBB0_1: # %body15; CHECK-NEXT:    # =>This Inner Loop Header: Depth=116; CHECK-NEXT:    loop # label0:17; CHECK-NEXT:    local.get 018; CHECK-NEXT:    i32.const 1619; CHECK-NEXT:    i32.add20; CHECK-NEXT:    local.tee 321; CHECK-NEXT:    local.get 022; CHECK-NEXT:    v128.load 0:p2align=023; CHECK-NEXT:    local.get 124; CHECK-NEXT:    i8x16.shl25; CHECK-NEXT:    v128.store 026; CHECK-NEXT:    local.get 327; CHECK-NEXT:    local.set 028; CHECK-NEXT:    local.get 229; CHECK-NEXT:    i32.const -130; CHECK-NEXT:    i32.add31; CHECK-NEXT:    local.tee 232; CHECK-NEXT:    i32.eqz33; CHECK-NEXT:    br_if 0 # 0: up to label034; CHECK-NEXT:  # %bb.2: # %exit35; CHECK-NEXT:    end_loop36; CHECK-NEXT:    # fallthrough-return37entry:38 %t1 = insertelement <16 x i8> undef, i8 %shift, i32 039 %vshift = shufflevector <16 x i8> %t1, <16 x i8> undef, <16 x i32> zeroinitializer40 br label %body41body:42 %out = phi ptr [%a, %entry], [%b, %body]43 %i = phi i32 [0, %entry], [%next, %body]44 %v = load <16 x i8>, ptr %out, align 145 %r = shl <16 x i8> %v, %vshift46 %b = getelementptr inbounds i8, ptr %out, i32 1647 store <16 x i8> %r, ptr %b48 %next = add i32 %i, 149 %i.cmp = icmp eq i32 %next, %count50 br i1 %i.cmp, label %body, label %exit51exit:52 ret void53}54 55; Test that SIMD shifts can be lowered correctly when shift value56; is a phi inside loop body.57 58define void @shl_phi_loop(ptr %a, i8 %shift, i32 %count) {59; CHECK-LABEL: shl_phi_loop:60; CHECK:         .functype shl_phi_loop (i32, i32, i32) -> ()61; CHECK-NEXT:    .local i3262; CHECK-NEXT:  # %bb.0: # %entry63; CHECK-NEXT:  .LBB1_1: # %body64; CHECK-NEXT:    # =>This Inner Loop Header: Depth=165; CHECK-NEXT:    loop # label1:66; CHECK-NEXT:    local.get 067; CHECK-NEXT:    i32.const 1668; CHECK-NEXT:    i32.add69; CHECK-NEXT:    local.tee 370; CHECK-NEXT:    local.get 071; CHECK-NEXT:    v128.load 0:p2align=072; CHECK-NEXT:    local.get 173; CHECK-NEXT:    i8x16.shl74; CHECK-NEXT:    v128.store 075; CHECK-NEXT:    local.get 176; CHECK-NEXT:    i32.const 177; CHECK-NEXT:    i32.and78; CHECK-NEXT:    local.set 179; CHECK-NEXT:    local.get 380; CHECK-NEXT:    local.set 081; CHECK-NEXT:    local.get 282; CHECK-NEXT:    i32.const -183; CHECK-NEXT:    i32.add84; CHECK-NEXT:    local.tee 285; CHECK-NEXT:    i32.eqz86; CHECK-NEXT:    br_if 0 # 0: up to label187; CHECK-NEXT:  # %bb.2: # %exit88; CHECK-NEXT:    end_loop89; CHECK-NEXT:    # fallthrough-return90entry:91 br label %body92body:93 %out = phi ptr [%a, %entry], [%b, %body]94 %i = phi i32 [0, %entry], [%next, %body]95 %t1 = phi i8 [%shift, %entry], [%sand, %body]96 %t2 = insertelement <16 x i8> undef, i8 %t1, i32 097 %vshift = shufflevector <16 x i8> %t2, <16 x i8> undef, <16 x i32> zeroinitializer98 %v = load <16 x i8>, ptr %out, align 199 %r = shl <16 x i8> %v, %vshift100 %b = getelementptr inbounds i8, ptr %out, i32 16101 store <16 x i8> %r, ptr %b102 %sand = and i8 %t1, 1103 %next = add i32 %i, 1104 %i.cmp = icmp eq i32 %next, %count105 br i1 %i.cmp, label %body, label %exit106exit:107 ret void108}109