18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/arch/arm/lib/muldi3.S
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Author:     Nicolas Pitre
68c2ecf20Sopenharmony_ci *  Created:    Oct 19, 2005
78c2ecf20Sopenharmony_ci *  Copyright:  Monta Vista Software, Inc.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/linkage.h>
118c2ecf20Sopenharmony_ci#include <asm/assembler.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifdef __ARMEB__
148c2ecf20Sopenharmony_ci#define xh r0
158c2ecf20Sopenharmony_ci#define xl r1
168c2ecf20Sopenharmony_ci#define yh r2
178c2ecf20Sopenharmony_ci#define yl r3
188c2ecf20Sopenharmony_ci#else
198c2ecf20Sopenharmony_ci#define xl r0
208c2ecf20Sopenharmony_ci#define xh r1
218c2ecf20Sopenharmony_ci#define yl r2
228c2ecf20Sopenharmony_ci#define yh r3
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciENTRY(__muldi3)
268c2ecf20Sopenharmony_ciENTRY(__aeabi_lmul)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	mul	xh, yl, xh
298c2ecf20Sopenharmony_ci	mla	xh, xl, yh, xh
308c2ecf20Sopenharmony_ci	mov	ip, xl, lsr #16
318c2ecf20Sopenharmony_ci	mov	yh, yl, lsr #16
328c2ecf20Sopenharmony_ci	bic	xl, xl, ip, lsl #16
338c2ecf20Sopenharmony_ci	bic	yl, yl, yh, lsl #16
348c2ecf20Sopenharmony_ci	mla	xh, yh, ip, xh
358c2ecf20Sopenharmony_ci	mul	yh, xl, yh
368c2ecf20Sopenharmony_ci	mul	xl, yl, xl
378c2ecf20Sopenharmony_ci	mul	ip, yl, ip
388c2ecf20Sopenharmony_ci	adds	xl, xl, yh, lsl #16
398c2ecf20Sopenharmony_ci	adc	xh, xh, yh, lsr #16
408c2ecf20Sopenharmony_ci	adds	xl, xl, ip, lsl #16
418c2ecf20Sopenharmony_ci	adc	xh, xh, ip, lsr #16
428c2ecf20Sopenharmony_ci	ret	lr
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciENDPROC(__muldi3)
458c2ecf20Sopenharmony_ciENDPROC(__aeabi_lmul)
46