📄 smartmac.h
字号:
; @(#)smartmac.h 1.2 90/10/14 20:56:14, AMD; start of smartmac.h file;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Copyright 1988, 1989, 1990 Advanced Micro Devices, Inc.;; This software is the property of Advanced Micro Devices, Inc (AMD) which; specifically grants the user the right to modify, use and distribute this; software provided this notice is not removed or altered. All other rights; are reserved by AMD.;; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR; USE OF THIS SOFTWARE.;; So that all may benefit from your experience, please report any problems; or suggestions about this software to the 29K Technical Support Center at; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.;; Advanced Micro Devices, Inc.; 29K Support Products; Mail Stop 573; 5900 E. Ben White Blvd.; Austin, TX 78741; 800-292-9263;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .title "AM29000 Smart Macro Package";; Floating point package for AMD 29000 family;; Copyright 1988 Advanced Micro Devices, Inc.;; All rights reserved;; Developed for AMD by Quantitative Technology Corporation; 8700 SW Creekside Place Suite D; Beaverton OR 97005; (503) 626-3081;; Version information :;; Version 1.0 - 1 June 1988 - Larry Westerman (smart_macros.h); ; Revision 1.4 89/02/01 18:26:03 jimh; Changed to relect the new symbols from Bob Perlman, and the new include file.s; ; Revision 1.3 89/01/31 10:13:34 jimh; Updated to use symbols from Bob Perlmans fpsymbol.h file. This is; an extensive change.; ; Revision 1.2 89/01/26 09:23:50 jimh; This version checked in previous to substituting Bob Perlman's floating; point symbols.; ; Revision 1.1 89/01/24 13:23:29 jim; Initial revision; Replaces smart_macros.h ver 1.11.; ; ; ;; NOTES:;; This package makes the following assumptions about the use of these; smart macros:;; 1. These macros will be after the entry code for a transcendental; routine. This entry code will move the original function arguments; (by value, if the target language is FORTRAN) into the global; registers t0/t1 and t2/t3 (t0 and t2 for single precision; routines).; 2. The sources of all operands will be one register from the; following list:; t0 or t2 - the source is one of the original input operands; rtn0 - the source is rtn0, which should be used as the; source for all constant values to be sent to the; AM29027 (when used); FP0 - FP7 - the source is one of the fp registers; 3. The destination of all operations will be a register from the; following list:; rtn0 - the destination is the function return value; FP0 - FP7 - the destination is one of the fp registers; 4. The additional registers available for temporary use are; t4, lrp, and slp. ;; These register definitions are all taken from the file "proregs.a"; which was supplied by AMD. NOTE that the FP0-FP7 registers, for the; Am29000 version of the file, overlap with the rtn0-rtn15 registers, so; that FP0 corresponds to rtn0/rtn1, FP1 to rtn2/rtn3, and so forth.; .equ ERROR,0 .equ NO_ERROR,1 .equ DOUBLE_FUNCTION,0 .equ SINGLE_FUNCTION,1 .equ T_OPERATION,0 .equ Q_OPERATION,1 .equ R_SOURCE_29000,0 .equ R_SOURCE_29027,1 .equ S_SOURCE_29000,0 .equ S_SOURCE_29027,1 .equ DESTINATION_29000, 0 .equ DESTINATION_29027, 1;; SMART MACRO : mfadd;; FUNCTION : single-precision floating point addition;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mfadd,destination,operand1,operand2 .if $narg!=3 .err .print "mfadd: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; For 29027 mode, perform full suite of checking ; initialize_previous_instruction .set CURRENT_INSTRUCTION, CP_S_S | CP_P_PLUS_T .set OPERATION_TYPE, T_OPERATION perform_single_operation destination,operand1,operand2 read_single_result destination ; ; Save the instruction for the next macro invocation ; .set PREVIOUS_INSTRUCTION, CURRENT_INSTRUCTION .else ; ; For 29000 mode, simply produce equivalent trap-inducing instruction ; fadd destination,operand1,operand2 .endif .endm ; end of mfadd macro definition;; SMART MACRO : mfsub;; FUNCTION : single-precision floating point subtraction;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mfsub,destination,operand1,operand2 .if $narg!=3 .err .print "mfsub: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; For 29027 mode, perform full suite of checking ; initialize_previous_instruction .set CURRENT_INSTRUCTION, CP_S_S | CP_P_MINUS_T .set OPERATION_TYPE, T_OPERATION perform_single_operation destination,operand1,operand2 read_single_result destination ; ; Save the instruction for the next macro invocation ; .set PREVIOUS_INSTRUCTION, CURRENT_INSTRUCTION .else ; ; For 29000 mode, simply produce equivalent trap-inducing instruction ; fsub destination,operand1,operand2 .endif .endm ; end of mfsub macro definition;; SMART MACRO : mfmul;; FUNCTION : single-precision floating point multiplication;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mfmul,destination,operand1,operand2 .if $narg!=3 .err .print "mfmul: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; For 29027 mode, perform full suite of checking ; initialize_previous_instruction .set CURRENT_INSTRUCTION, CP_S_S | CP_P_TIMES_Q .set OPERATION_TYPE, Q_OPERATION perform_single_operation destination,operand1,operand2 read_single_result destination ; ; Save the instruction for the next macro invocation ; .set PREVIOUS_INSTRUCTION, CURRENT_INSTRUCTION .else ; ; For 29000 mode, simply produce equivalent trap-inducing instruction ; fmul destination,operand1,operand2 .endif .endm ; end of mfmul macro definition;; SMART MACRO : mfdiv;; FUNCTION : single-precision floating point divide;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mfdiv,destination,operand1,operand2 .if $narg!=3 .err .print "mfdiv: missing parameter(s)" .exitm .endif ; ; Generate the trap instruction in all cases ; fdiv destination, operand1, operand2 .endm ; end of mfdiv macro definition;; SMART MACRO : mdadd;; FUNCTION : double-precision floating point addition;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mdadd,destination,operand1,operand2 .if $narg!=3 .err .print "mdadd: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; For 29027 mode, perform full suite of checking ; initialize_previous_instruction .set CURRENT_INSTRUCTION, CP_D_D | CP_P_PLUS_T .set OPERATION_TYPE, T_OPERATION perform_double_operation destination,operand1,operand2 read_double_result destination ; ; Save the instruction for the next macro invocation ; .set PREVIOUS_INSTRUCTION, CURRENT_INSTRUCTION .else ; ; For 29000 mode, simply produce equivalent trap-inducing instruction ; dadd destination,operand1,operand2 .endif .endm ; end of mdadd macro definition;; SMART MACRO : mdsub;; FUNCTION : double-precision floating point subtraction;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mdsub,destination,operand1,operand2 .if $narg!=3 .err .print "mdsub: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; For 29027 mode, perform full suite of checking ; initialize_previous_instruction .set CURRENT_INSTRUCTION, CP_D_D | CP_P_MINUS_T .set OPERATION_TYPE, T_OPERATION perform_double_operation destination,operand1,operand2 read_double_result destination ; ; Save the instruction for the next macro invocation ; .set PREVIOUS_INSTRUCTION, CURRENT_INSTRUCTION .else ; ; For 29000 mode, simply produce equivalent trap-inducing instruction ; dsub destination,operand1,operand2 .endif .endm ; end of mdsub macro definition;; SMART MACRO : mdmul;; FUNCTION : double-precision floating point multiplication;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mdmul,destination,operand1,operand2 .if $narg!=3 .err .print "mdmul: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; For 29027 mode, perform full suite of checking ; initialize_previous_instruction .set CURRENT_INSTRUCTION, CP_D_D | CP_P_TIMES_Q .set OPERATION_TYPE, Q_OPERATION perform_double_operation destination,operand1,operand2 read_double_result destination ; ; Save the instruction for the next macro invocation ; .set PREVIOUS_INSTRUCTION, CURRENT_INSTRUCTION .else ; ; For 29000 mode, simply produce equivalent trap-inducing instruction ; dmul destination,operand1,operand2 .endif .endm ; end of mdmul macro definition;; SMART MACRO : mddiv;; FUNCTION : double-precision floating point divide;; Required arguments : destination - one of possible destinations; operand1 - one of possible sources; operand2 - one of possible sources; .macro mddiv,destination,operand1,operand2 .if $narg!=3 .err .print "mddiv: missing parameter(s)" .exitm .endif ; ; Generate the trap instruction in all cases ; ddiv destination, operand1, operand2 .endm ; end of mfdiv macro definition;; SMART MACRO: mconvert;; FUNCTION: Floating point/integer conversion;; PARAMETERS: destination - one of the possible destinations; source - one of the possible sources; sign_flag - one of SIGNED or UNSIGNED; rounding_mode - one of ROUND_TO_NEAREST, ROUND_TO_PLUS,; ROUND_TO_MINUS, ROUND_TO_ZERO; destination_precision - one of FORMAT_INTEGER, FORMAT_DOUBLE,; or FORMAT_SINGLE; source_precision - one of FORMAT_INTEGER, FORMAT_DOUBLE,; or FORMAT_SINGLE; .macro mconvert, destination, source, sign_flag, rounding_mode, destination_precision, source_precision .if $narg!=6 .err .print "mconvert: missing parameter(s)" .exitm .endif .ifdef _29027_MODE ; ; Generate in line 29027 code ; initialize_previous_instruction .if ( destination_precision == FORMAT_INTEGER ) .set CURRENT_INSTRUCTION, CP_CONVERT_T_TO_INT select_T_operand source .if ( source_precision == FORMAT_DOUBLE ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_S_D .else .if ( source_precision == FORMAT_SINGLE ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_S_S .else .err .print "mconvert: invalid source type" .exitm .endif .endif .else .if ( destination_precision == FORMAT_DOUBLE ) .if ( source_precision == FORMAT_SINGLE ) .set CURRENT_INSTRUCTION, CP_PASS_P | CP_P_EQ_R | CP_D_S select_P_operand source .else .if ( source_precision == FORMAT_INTEGER ) .set CURRENT_INSTRUCTION, CP_I_CONVERT_T_TO_FLOAT | CP_D_S select_T_operand source .else .err .print "mconvert: invalid source type" .exitm .endif .endif .else .if ( destination_precision == FORMAT_SINGLE ) .if ( source_precision == FORMAT_DOUBLE ) .set CURRENT_INSTRUCTION, CP_PASS_P | CP_P_EQ_R | CP_S_D select_P_operand source .else .if ( source_precision == FORMAT_INTEGER ) .set CURRENT_INSTRUCTION, CP_I_CONVERT_T_TO_FLOAT | CP_S_S select_T_operand source .else .err .print "mconvert: invalid source type" .exitm .endif .endif .else .err .print "mconvert: invalid destination type " .exitm .endif .endif .endif ; ; Perform the operation, using a 29027 dummy register as the second ; source operand, to avoid writing any data inappropriately to the ; 29027 ; select_destination destination .set S_SOURCE, S_SOURCE_29027 .if ( source_precision == FORMAT_DOUBLE ) write_and_execute_double_operation source, FP0 .else write_and_execute_single_operation source, FP0 .endif .if ( destination_precision == FORMAT_DOUBLE )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -