1// 2// MNNReluWithSlopeChannel.S 3// MNN 4// 5// Created by MNN on 2019/02/04. 6// Copyright © 2018, Alibaba Group Holding Limited 7// 8 9#ifdef __arm__ 10#ifndef __aarch64__ 11#include "MNNAsmGlobal.h" 12 13.text 14.align 5 15 16asm_function MNNReluWithSlopeChannel 17//void MNNReluWithSlopeChannel(float* dst, const float* src, const float* slope, size_t sizeQuad, size_t depthQuad) 18 19//Auto Load: 20//r0:dst, r1:src, r2:slope, r3:sizeQuad 21 22//Load from sp 23//r4:depthQuad 24 25push {r4,r5, lr} 26ldr r4, [sp, #12] 27 28cmp r4, #0 29beq PReluEnd 30cmp r3, #0 31beq PReluEnd 32 33 34PReluZLoop: 35vld1.32 {q15}, [r2]! 36mov r5, r3 37cmp r5, #3 38ble PReluL1 39 40PReluL4Loop: 41vld1.32 {q0, q1}, [r1]! 42 43vcle.f32 q12, q0, #0 44vcle.f32 q13, q1, #0 45 46vld1.32 {q2, q3}, [r1]! 47 48vmul.f32 q8, q0, q15 49vmul.f32 q9, q1, q15 50vbit.32 q0, q8, q12 51vbit.32 q1, q9, q13 52 53vmul.f32 q8, q2, q15 54vmul.f32 q9, q3, q15 55 56vst1.32 {q0, q1}, [r0]! 57 58vcle.f32 q12, q2, #0 59vcle.f32 q13, q3, #0 60vbit.32 q2, q8, q12 61vbit.32 q3, q9, q13 62 63vst1.32 {q2, q3}, [r0]! 64sub r5, r5, #4 65cmp r5, #4 66bge PReluL4Loop 67 68PReluL1: 69cmp r5, #0 70 71beq PReluL1End 72 73PReluL1Loop: 74vld1.32 {q0}, [r1]! 75vcle.f32 q2, q0, #0 76vmul.f32 q1, q0, q15 77vbit.32 q0, q1, q2 78vst1.32 {q0}, [r0]! 79subs r5, r5, #1 80bne PReluL1Loop 81 82PReluL1End: 83 84subs r4, r4, #1 85bne PReluZLoop 86 87 88PReluEnd: 89 90pop {r4, r5, pc} 91 92#endif 93#endif 94