1# Copyright 2020 Google LLC 2# 3# This source code is licensed under the BSD-style license found in the 4# LICENSE file in the root directory of this source tree. 5 6#include <xnnpack/assembly.h> 7 8# void xnn_f32_vrelu_ukernel__wasm32_shr_x2( 9# size_t n, 0 10# const float* x, 1 11# float* y, 2 12# const union params) 3 unused 13 14# locals 15# float value0 4 16# float value1 5 17# float mask0 6 18# float mask1 7 19 20 21BEGIN_FUNCTION xnn_f32_vrelu_ukernel__wasm32_shr_x2 22 .functype xnn_f32_vrelu_ukernel__wasm32_shr_x2 (i32, i32, i32, i32) -> () 23 .local i32, i32, i32, i32 24 25 local.get 0 26 i32.const 8 # count >= 8 27 i32.ge_s 28 if 29 loop 30 local.get 1 # src 31 i32.load 0 # load float from src 32 local.set 4 33 local.get 1 # src 34 i32.load 4 # load 2nd float from src + 4 35 local.set 5 36 37 local.get 1 # src += 8 38 i32.const 8 39 i32.add 40 local.set 1 41 42 local.get 4 # (v >> 31) - 1) & v 43 i32.const 31 44 i32.shr_u 45 local.set 6 46 local.get 5 # 2nd mask 47 i32.const 31 48 i32.shr_u 49 local.set 7 50 51 local.get 6 52 i32.const -1 53 i32.add 54 local.set 6 55 local.get 7 56 i32.const -1 57 i32.add 58 local.set 7 59 60 local.get 4 61 local.get 6 62 i32.and 63 local.set 4 64 local.get 5 65 local.get 7 66 i32.and 67 local.set 5 68 69 local.get 2 # dst 70 local.get 4 71 i32.store 0 # store float 72 local.get 2 # dst 73 local.get 5 74 i32.store 4 # store 2nd float 75 76 local.get 2 # dst += 8 77 i32.const 8 78 i32.add 79 local.set 2 80 81 local.get 0 82 i32.const -8 83 i32.add # count -= 8 84 local.set 0 85 86 local.get 0 87 i32.const 8 # count >= 8 88 i32.ge_s 89 br_if 0 # loop 90 end_loop 91 end_if 92 93 local.get 0 94 i32.const 4 # if count >= 4 95 i32.ge_s 96 if 97 local.get 1 # src 98 i32.load 0 # load float from src 99 local.set 4 100 101 local.get 4 # (v >> 31) - 1) & v 102 i32.const 31 103 i32.shr_u 104 local.set 5 105 106 local.get 5 107 i32.const -1 108 i32.add 109 local.set 5 110 111 local.get 4 112 local.get 5 113 i32.and 114 local.set 4 115 116 local.get 2 # dst 117 local.get 4 118 i32.store 0 # store float 119 end_if 120END_FUNCTION xnn_f32_vrelu_ukernel__wasm32_shr_x2 121