162306a36Sopenharmony_ci/* libgcc1 routines for 68000 w/o floating-point hardware. 262306a36Sopenharmony_ci Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc. 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciThis file is part of GNU CC. 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciGNU CC is free software; you can redistribute it and/or modify it 762306a36Sopenharmony_ciunder the terms of the GNU General Public License as published by the 862306a36Sopenharmony_ciFree Software Foundation; either version 2, or (at your option) any 962306a36Sopenharmony_cilater version. 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciIn addition to the permissions in the GNU General Public License, the 1262306a36Sopenharmony_ciFree Software Foundation gives you unlimited permission to link the 1362306a36Sopenharmony_cicompiled version of this file with other programs, and to distribute 1462306a36Sopenharmony_cithose programs without any restriction coming from the use of this 1562306a36Sopenharmony_cifile. (The General Public License restrictions do apply in other 1662306a36Sopenharmony_cirespects; for example, they cover modification of the file, and 1762306a36Sopenharmony_cidistribution when not linked into another program.) 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciThis file is distributed in the hope that it will be useful, but 2062306a36Sopenharmony_ciWITHOUT ANY WARRANTY; without even the implied warranty of 2162306a36Sopenharmony_ciMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2262306a36Sopenharmony_ciGeneral Public License for more details. */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci/* As a special exception, if you link this library with files 2562306a36Sopenharmony_ci compiled with GCC to produce an executable, this does not cause 2662306a36Sopenharmony_ci the resulting executable to be covered by the GNU General Public License. 2762306a36Sopenharmony_ci This exception does not however invalidate any other reasons why 2862306a36Sopenharmony_ci the executable file might be covered by the GNU General Public License. */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* Use this one for any 680x0; assumes no floating point hardware. 3162306a36Sopenharmony_ci The trailing " '" appearing on some lines is for ANSI preprocessors. Yuk. 3262306a36Sopenharmony_ci Some of this code comes from MINIX, via the folks at ericsson. 3362306a36Sopenharmony_ci D. V. Henkel-Wallace (gumby@cygnus.com) Fete Bastille, 1992 3462306a36Sopenharmony_ci*/ 3562306a36Sopenharmony_ci#include <linux/export.h> 3662306a36Sopenharmony_ci/* These are predefined by new versions of GNU cpp. */ 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#ifndef __USER_LABEL_PREFIX__ 3962306a36Sopenharmony_ci#define __USER_LABEL_PREFIX__ _ 4062306a36Sopenharmony_ci#endif 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#ifndef __REGISTER_PREFIX__ 4362306a36Sopenharmony_ci#define __REGISTER_PREFIX__ 4462306a36Sopenharmony_ci#endif 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#ifndef __IMMEDIATE_PREFIX__ 4762306a36Sopenharmony_ci#define __IMMEDIATE_PREFIX__ # 4862306a36Sopenharmony_ci#endif 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* ANSI concatenation macros. */ 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define CONCAT1(a, b) CONCAT2(a, b) 5362306a36Sopenharmony_ci#define CONCAT2(a, b) a ## b 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci/* Use the right prefix for global labels. */ 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* Use the right prefix for registers. */ 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci/* Use the right prefix for immediate values. */ 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x) 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#define d0 REG (d0) 6862306a36Sopenharmony_ci#define d1 REG (d1) 6962306a36Sopenharmony_ci#define d2 REG (d2) 7062306a36Sopenharmony_ci#define d3 REG (d3) 7162306a36Sopenharmony_ci#define d4 REG (d4) 7262306a36Sopenharmony_ci#define d5 REG (d5) 7362306a36Sopenharmony_ci#define d6 REG (d6) 7462306a36Sopenharmony_ci#define d7 REG (d7) 7562306a36Sopenharmony_ci#define a0 REG (a0) 7662306a36Sopenharmony_ci#define a1 REG (a1) 7762306a36Sopenharmony_ci#define a2 REG (a2) 7862306a36Sopenharmony_ci#define a3 REG (a3) 7962306a36Sopenharmony_ci#define a4 REG (a4) 8062306a36Sopenharmony_ci#define a5 REG (a5) 8162306a36Sopenharmony_ci#define a6 REG (a6) 8262306a36Sopenharmony_ci#define fp REG (fp) 8362306a36Sopenharmony_ci#define sp REG (sp) 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci .text 8662306a36Sopenharmony_ci .proc 8762306a36Sopenharmony_ci .globl SYM (__mulsi3) 8862306a36Sopenharmony_ciSYM (__mulsi3): 8962306a36Sopenharmony_ci movew sp@(4), d0 /* x0 -> d0 */ 9062306a36Sopenharmony_ci muluw sp@(10), d0 /* x0*y1 */ 9162306a36Sopenharmony_ci movew sp@(6), d1 /* x1 -> d1 */ 9262306a36Sopenharmony_ci muluw sp@(8), d1 /* x1*y0 */ 9362306a36Sopenharmony_ci#if !(defined(__mcf5200__) || defined(__mcoldfire__)) 9462306a36Sopenharmony_ci addw d1, d0 9562306a36Sopenharmony_ci#else 9662306a36Sopenharmony_ci addl d1, d0 9762306a36Sopenharmony_ci#endif 9862306a36Sopenharmony_ci swap d0 9962306a36Sopenharmony_ci clrw d0 10062306a36Sopenharmony_ci movew sp@(6), d1 /* x1 -> d1 */ 10162306a36Sopenharmony_ci muluw sp@(10), d1 /* x1*y1 */ 10262306a36Sopenharmony_ci addl d1, d0 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci rts 10562306a36Sopenharmony_ci EXPORT_SYMBOL(__mulsi3) 106