[444] | 1 | /* convert psi to si inplace |
---|
| 2 | |
---|
| 3 | Note that `fp' below isn't a segment register. |
---|
| 4 | It's r6, the frame pointer. */ |
---|
| 5 | |
---|
| 6 | #if __CODE__==32 |
---|
| 7 | #define RET prts |
---|
| 8 | #else |
---|
| 9 | #define RET rts |
---|
| 10 | #endif |
---|
| 11 | |
---|
| 12 | #define EXTPSISI_SN(r_msw,r_lsw,sp) ; \ |
---|
| 13 | .global __extpsisi##r_msw ; \ |
---|
| 14 | __extpsisi##r_msw: ; \ |
---|
| 15 | mov r_msw,r_lsw ; \ |
---|
| 16 | stc sp,r_msw ; \ |
---|
| 17 | RET |
---|
| 18 | |
---|
| 19 | EXTPSISI_SN(r2,r3,dp) |
---|
| 20 | EXTPSISI_SN(r4,r5,ep) |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #define ADDPSI_AR_RN(sr,an,r_msw,r_lsw) \ |
---|
| 24 | .global __addpsi##an##r_msw ; \ |
---|
| 25 | __addpsi##an##r_msw: ; \ |
---|
| 26 | stc sr,@-sp ; \ |
---|
| 27 | add an,r_lsw ; \ |
---|
| 28 | addx @sp+,r_msw ; \ |
---|
| 29 | RET |
---|
| 30 | |
---|
| 31 | ADDPSI_AR_RN(dp,r2,r0,r1) |
---|
| 32 | ADDPSI_AR_RN(dp,r2,r3,r4) |
---|
| 33 | ADDPSI_AR_RN(ep,r4,r0,r1) |
---|
| 34 | ADDPSI_AR_RN(ep,r4,r1,r2) |
---|
| 35 | ADDPSI_AR_RN(ep,r4,r3,r4) |
---|
| 36 | ADDPSI_AR_RN(ep,r4,r5,fp) |
---|
| 37 | |
---|
| 38 | ADDPSI_AR_RN(tp,fp,r0,r1) |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | #define ADDPSI_RN_AR(r_msw,r_lsw,sr,an,t_msw,t_lsw) \ |
---|
| 42 | .global __addpsi##r_msw##an ; \ |
---|
| 43 | __addpsi##r_msw##an: ; \ |
---|
| 44 | mov.w t_msw,@-sp ; \ |
---|
| 45 | mov.w t_lsw,@-sp ; \ |
---|
| 46 | stc sr,t_msw ; \ |
---|
| 47 | mov an,t_lsw ; \ |
---|
| 48 | add r_lsw,t_lsw ; \ |
---|
| 49 | addx r_msw,t_msw ; \ |
---|
| 50 | ldc t_msw,sr ; \ |
---|
| 51 | mov.w t_lsw,an ; \ |
---|
| 52 | mov.w @sp+,t_lsw ; \ |
---|
| 53 | mov.w @sp+,t_msw ; \ |
---|
| 54 | RET |
---|
| 55 | |
---|
| 56 | ADDPSI_RN_AR(r0,r1,dp,r2,r4,r5) |
---|
| 57 | ADDPSI_RN_AR(r0,r1,ep,r4,r2,r3) |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | #define EXTPSIHI_RN_RN(rm,r_msw,r_lsw) ; \ |
---|
| 62 | .global __extpsihi##rm##r_msw ; \ |
---|
| 63 | __extpsihi##rm##r_msw: ; \ |
---|
| 64 | mov rm,r_lsw ; \ |
---|
| 65 | clr.w r_msw ; \ |
---|
| 66 | RET |
---|
| 67 | |
---|
| 68 | EXTPSIHI_RN_RN(r3,r0,r1) |
---|
| 69 | EXTPSIHI_RN_RN(r4,r0,r1) |
---|
| 70 | EXTPSIHI_RN_RN(r5,r0,r1) |
---|
| 71 | EXTPSIHI_RN_RN(r2,r0,r1) |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | /* ifdefed out, because gcc doesn't like the # character in the above |
---|
| 76 | macro. The macro expands into an assembly languange comment anyways, |
---|
| 77 | so it serves no useful purpose. */ |
---|
| 78 | #if 0 |
---|
| 79 | #define EXTPSIHI_RN_SN(rm,r_msw,r_lsw) ; \ |
---|
| 80 | .global __extpsihi##rm##r_lsw ; \ |
---|
| 81 | __extpsihi##rm##r_lsw: ; \ |
---|
| 82 | mov rm,r_lsw ; \ |
---|
| 83 | ldc \#0,r_msw ; \ |
---|
| 84 | RET |
---|
| 85 | |
---|
| 86 | EXTPSIHI_RN_SN(r0,dp,r2) |
---|
| 87 | EXTPSIHI_RN_SN(r0,ep,r4) |
---|
| 88 | EXTPSIHI_RN_SN(r1,dp,r2) |
---|
| 89 | EXTPSIHI_RN_SN(r1,ep,r4) |
---|
| 90 | EXTPSIHI_RN_SN(r3,dp,r2) |
---|
| 91 | EXTPSIHI_RN_SN(r3,ep,r4) |
---|
| 92 | EXTPSIHI_RN_SN(r5,dp,r2) |
---|
| 93 | EXTPSIHI_RN_SN(r5,ep,r4) |
---|
| 94 | EXTPSIHI_RN_SN(r2,ep,r4) |
---|
| 95 | #endif |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | #define EXTPSISI_RN(r_msw,r_lsw) ; \ |
---|
| 99 | .global __extpsisi##r_msw ; \ |
---|
| 100 | __extpsisi##r_msw: ; \ |
---|
| 101 | RET |
---|
| 102 | |
---|
| 103 | EXTPSISI_RN(r0,r1) |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | #define ADDPSI_SA_SB(sa,ra,sb,rb) ; \ |
---|
| 108 | .global __addpsi##ra##rb ; \ |
---|
| 109 | __addpsi##ra##rb: ; \ |
---|
| 110 | mov.w r0,@-sp ; \ |
---|
| 111 | mov.w r1,@-sp ; \ |
---|
| 112 | stc sa,r0 ; \ |
---|
| 113 | stc sb,r1 ; \ |
---|
| 114 | add.w ra,rb ; \ |
---|
| 115 | addx r0,r1 ; \ |
---|
| 116 | ldc r1,sb ; \ |
---|
| 117 | mov.w @sp+,r1 ; \ |
---|
| 118 | mov.w @sp+,r0 ; \ |
---|
| 119 | RET |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | ADDPSI_SA_SB(dp,r2,ep,r4) |
---|
| 123 | ADDPSI_SA_SB(ep,r4,dp,r2) |
---|
| 124 | ADDPSI_SA_SB(tp,fp,dp,r2) |
---|
| 125 | ADDPSI_SA_SB(tp,fp,ep,r4) |
---|
| 126 | |
---|
| 127 | ADDPSI_SA_SB(dp,r2,dp,r2) |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | .global __addpsir0r0 |
---|
| 132 | __addpsir0r0: |
---|
| 133 | add.w r1,r1 |
---|
| 134 | addx r0,r0 |
---|
| 135 | RET |
---|
| 136 | |
---|