]> www.ginac.de Git - cln.git/blobdiff - src/base/digitseq/cl_asm_mips_.cc
Avoid g++-3.1 offsetof warnings.
[cln.git] / src / base / digitseq / cl_asm_mips_.cc
index a057c2277b94c730b7d285ebf76ccf17077dc4d9..0f23dab1e0eb3985b8fdf29253c6d8b3875ebecb 100644 (file)
@@ -2,12 +2,23 @@
 // Prozessor: MIPS
 // Endianness: irrelevant
 // Compiler: GNU-C oder ...
-// Parameter-Übergabe: in Registern $4,$5,$6,$7, und auf dem Stack 16($sp),...
+// Parameter-Übergabe:
+//   o32: in Registern $4,$5,$6,$7, und auf dem Stack 16($sp),...
+//   n32: in Registern $4,$5,$6,$7,$8,$9,$10,$11, und auf dem Stack 4($sp),...
 // Rückgabewert: in Register $2
 // Einstellungen: intCsize=32, intDsize=32.
 // Besonderheiten: Nach jedem Ladebefehl ein Wartetakt nötig, bevor der
 //   geholte Wert benutzt werden darf.
 
+// Strictly speaking, the MIPS ABI (-32 or -n32) is independent from the CPU
+// identification (-mips[12] or -mips[34]). But -n32 is commonly used together
+// with -mips3, and it's easier to test the CPU identification.
+#if __mips >= 3
+  #define ABI_N32 1
+#else
+  #define ABI_O32 1
+#endif
+
 // When this file is compiled into a shared library, ELF linkers need to
 // know which symbols are functions.
 #if defined(__GNU__) || defined(__NetBSD__)
@@ -531,9 +542,13 @@ sld4:     subu $12,$13          // dest = source1 - source2
 // extern uintD subx_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry);
         .align 2
         DECLARE_FUNCTION(subx_loop_down)
-        .ent subx_loop_down // Input in $4,$5,$6,$7, Output in $2
+        .ent subx_loop_down // Input in $4,$5,$6,$7,$8 Output in $2
 subx_loop_down:
+#if ABI_N32
+        move $12,$8             // carry
+#else
         lw $12,16($sp)          // carry
+#endif
         bnez $12,sxld5          // !(carry==0) ?
         b sxld2
 sxld1:    // kein Carry
@@ -995,9 +1010,13 @@ slu4:     subu $12,$13          // dest = source1 - source2
 // extern uintD subx_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry);
         .align 2
         DECLARE_FUNCTION(subx_loop_up)
-        .ent subx_loop_up // Input in $4,$5,$6,$7, Output in $2
+        .ent subx_loop_up // Input in $4,$5,$6,$7,$8, Output in $2
 subx_loop_up:
+#if ABI_N32
+        move $12,$8             // carry
+#else
         lw $12,16($sp)          // carry
+#endif
         bnez $12,sxlu5          // !(carry==0) ?
         b sxlu2
 sxlu1:    // kein Carry