Skip to content

Commit

Permalink
Merge branch 'arm_soft_fp_abi' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
xianyi committed Jun 23, 2017
2 parents 639000e + b5c96fc commit 482015f
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 17 deletions.
27 changes: 16 additions & 11 deletions Makefile.arm
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
# ifeq logical or
#ifeq logical or
ifeq ($(CORE), $(filter $(CORE),CORTEXA9 CORTEXA15))
ifeq ($(OSNAME), Android)
CCOMMON_OPT += -marm -mfpu=neon -mfloat-abi=hard -march=armv7-a
FCOMMON_OPT += -marm -mfpu=neon -mfloat-abi=hard -march=armv7-a
CCOMMON_OPT += -mfpu=neon -march=armv7-a
FCOMMON_OPT += -mfpu=neon -march=armv7-a
else
CCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a
FCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a
CCOMMON_OPT += -mfpu=vfpv3 -march=armv7-a
FCOMMON_OPT += -mfpu=vfpv3 -march=armv7-a
endif
endif

ifeq ($(CORE), ARMV7)
ifeq ($(OSNAME), Android)
CCOMMON_OPT += -marm -mfpu=neon -mfloat-abi=hard -march=armv7-a -Wl,--no-warn-mismatch
FCOMMON_OPT += -marm -mfpu=neon -mfloat-abi=hard -march=armv7-a -Wl,--no-warn-mismatch
ifeq ($(ARM_SOFTFP_ABI), 1)
CCOMMON_OPT += -mfpu=neon -march=armv7-a
FCOMMON_OPT += -mfpu=neon -march=armv7-a
else
CCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a
FCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a
CCOMMON_OPT += -mfpu=neon -march=armv7-a -Wl,--no-warn-mismatch
FCOMMON_OPT += -mfpu=neon -march=armv7-a -Wl,--no-warn-mismatch
endif
else
CCOMMON_OPT += -mfpu=vfpv3 -march=armv7-a
FCOMMON_OPT += -mfpu=vfpv3 -march=armv7-a
endif
endif

ifeq ($(CORE), ARMV6)
CCOMMON_OPT += -marm -mfpu=vfp -mfloat-abi=hard -march=armv6
FCOMMON_OPT += -marm -mfpu=vfp -mfloat-abi=hard -march=armv6
CCOMMON_OPT += -mfpu=vfp -march=armv6
FCOMMON_OPT += -mfpu=vfp -march=armv6
endif


Expand Down
11 changes: 11 additions & 0 deletions Makefile.system
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,17 @@ endif
ifeq ($(ARCH), arm)
NO_BINARY_MODE = 1
BINARY_DEFINED = 1

CCOMMON_OPT += -marm
FCOMMON_OPT += -marm

ifeq ($(ARM_SOFTFP_ABI), 1)
CCOMMON_OPT += -mfloat-abi=softfp -DARM_SOFTFP_ABI
FCOMMON_OPT += -mfloat-abi=softfp -DARM_SOFTFP_ABI
else
CCOMMON_OPT += -mfloat-abi=hard
FCOMMON_OPT += -mfloat-abi=hard
endif
endif

ifeq ($(ARCH), arm64)
Expand Down
5 changes: 5 additions & 0 deletions common_arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ static inline int blas_quickdivide(blasint x, blasint y){

#define PROFCODE

#ifdef __ARM_PCS
//-mfloat-abi=softfp
#define SOFT_FLOAT_ABI
#endif

#endif


Expand Down
18 changes: 16 additions & 2 deletions kernel/arm/axpy_vfp.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#define STACKSIZE 256

#ifndef ARM_SOFTFP_ABI
//hard
#define OLD_INC_X [fp, #0 ]
#define OLD_Y [fp, #4 ]
#define OLD_INC_Y [fp, #8 ]


#else
#define OLD_X [fp, #0 ]
#define OLD_INC_X [fp, #4 ]
#define OLD_Y [fp, #8 ]
#define OLD_INC_Y [fp, #12 ]
#endif

#define N r0
#define Y r1
#define INC_X r2
Expand Down Expand Up @@ -363,6 +370,13 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add fp, sp, #8
sub sp, sp, #STACKSIZE // reserve stack

#ifdef ARM_SOFTFP_ABI
#ifndef DOUBLE
vmov s0, r3 //move alpha to s0
ldr X, OLD_X
#endif
#endif

ldr INC_X , OLD_INC_X
ldr Y, OLD_Y
ldr INC_Y , OLD_INC_Y
Expand Down
24 changes: 23 additions & 1 deletion kernel/arm/gemv_n_vfpv3.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#define STACKSIZE 256

#ifndef ARM_SOFTFP_ABI
//hard
#define OLD_LDA [fp, #0 ]
#define X [fp, #4 ]
#define OLD_INC_X [fp, #8 ]
#define Y [fp, #12 ]
#define OLD_INC_Y [fp, #16 ]
#define OLD_A r3
#else
#define OLD_A_SOFTFP [fp, #0 ]
#define OLD_LDA [fp, #4 ]
#define X [fp, #8 ]
#define OLD_INC_X [fp, #12 ]
#define Y [fp, #16 ]
#define OLD_INC_Y [fp, #20 ]
#define OLD_ALPHA r3
#define OLD_A r3
#endif

#define OLD_M r0

#define AO1 r0
Expand Down Expand Up @@ -552,9 +565,18 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmp N, #0
ble gemvn_kernel_L999

#ifndef DOUBLE
#ifdef ARM_SOFTFP_ABI

vmov s0, OLD_ALPHA
ldr OLD_A, OLD_A_SOFTFP
#endif
#endif

str OLD_A, A
str OLD_M, M



ldr INC_X , OLD_INC_X
ldr INC_Y , OLD_INC_Y

Expand Down
20 changes: 20 additions & 0 deletions kernel/arm/gemv_t_vfp.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#define STACKSIZE 256

#ifndef ARM_SOFTFP_ABI
//hard abi
#define OLD_LDA [fp, #0 ]
#define X [fp, #4 ]
#define OLD_INC_X [fp, #8 ]
#define Y [fp, #12 ]
#define OLD_INC_Y [fp, #16 ]
#define OLD_A r3
#else
#define OLD_A_SOFTFP [fp, #0 ]
#define OLD_LDA [fp, #4 ]
#define X [fp, #8 ]
#define OLD_INC_X [fp, #12 ]
#define Y [fp, #16 ]
#define OLD_INC_Y [fp, #20 ]
#define OLD_ALPHA r3
#define OLD_A r3
#endif

#define OLD_N r1

#define M r0
Expand Down Expand Up @@ -505,6 +518,13 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmp OLD_N, #0
ble gemvt_kernel_L999

#ifndef DOUBLE
#ifdef ARM_SOFTFP_ABI
vmov s0, OLD_ALPHA
ldr OLD_A, OLD_A_SOFTFP
#endif
#endif

str OLD_A, A
str OLD_N, N

Expand Down
3 changes: 3 additions & 0 deletions kernel/arm/nrm2_vfpv3.S
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ nrm2_kernel_L999:
#else
vsqrt.f32 s1, s1
vmul.f32 s0, s0, s1
#ifdef ARM_SOFTFP_ABI
vmov r0, s0
#endif
#endif

bx lr
Expand Down
8 changes: 7 additions & 1 deletion kernel/arm/sdot_vfp.S
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,16 @@ sdot_kernel_L999:

vadd.f64 d0 , d0, d1 // set return value

#ifdef ARM_SOFTFP_ABI
vmov r0, r1, d0
#endif

#else

vadd.f32 s0 , s0, s1 // set return value

#ifdef ARM_SOFTFP_ABI
vmov r0, s0
#endif
#endif
sub sp, fp, #24
pop {r4 - r9, fp}
Expand Down
24 changes: 22 additions & 2 deletions kernel/arm/sgemm_kernel_4x4_vfpv3.S
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define OLD_M r0
#define OLD_N r1
#define OLD_K r2

#ifdef ARM_SOFTFP_ABI
#define OLD_ALPHA r3
//#define OLD_A
#else //hard
#define OLD_A r3
#define OLD_ALPHA s0
#endif

/******************************************************
* [fp, #-128] - [fp, #-64] is reserved
Expand All @@ -71,18 +77,28 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define M [fp, #-256 ]
#define N [fp, #-260 ]
#define K [fp, #-264 ]

#ifndef ARM_SOFTFP_ABI
#define A [fp, #-268 ]
#endif

#define FP_ZERO [fp, #-240]
#define FP_ZERO_0 [fp, #-240]
#define FP_ZERO_1 [fp, #-236]

#define ALPHA [fp, #-280]

#ifdef ARM_SOFTFP_ABI
#define A [fp, #4 ]
#define B [fp, #8 ]
#define C [fp, #12 ]
#define OLD_LDC [fp, #16 ]
#else //hard
#define B [fp, #4 ]
#define C [fp, #8 ]
#define OLD_LDC [fp, #12 ]

#endif

#define I r0
#define J r1
#define L r2
Expand Down Expand Up @@ -854,9 +870,13 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
str OLD_M, M
str OLD_N, N
str OLD_K, K

#ifdef ARM_SOFTFP_ABI
str OLD_ALPHA, ALPHA
#else //hard
str OLD_A, A
vstr OLD_ALPHA, ALPHA

#endif
sub r3, fp, #128
vstm r3, { s8 - s31} // store floating point registers

Expand Down

0 comments on commit 482015f

Please sign in to comment.