After some investigations, I conclude the TI mode support using our current gcc patches is broken, when it comes to casting, in both optimized and non optimized mode. Here is the basic example:
Original C code:
Code: Select all
#include <tamtypes.h>
u32 foo();
u128 bar() {
    return foo();
}
u128 foobar() {
    return 5;
}Code: Select all
00000000 <bar>:
   0:   27bdfff0        addiu   sp,sp,-16
   4:   ffbf0000        sd      ra,0(sp)
   8:   0c000000        jal     0 <bar>
                        8: R_MIPS_26    foo
   c:   00000000        nop
  10:   dfbf0000        ld      ra,0(sp)
  14:   0000102d        move    v0,zero
  18:   03e00008        jr      ra
  1c:   27bd0010        addiu   sp,sp,16
00000020 <foobar>:
  20:   700014a9        por     v0,zero,zero
  24:   03e00008        jr      ra
  28:   24020005        li      v0,5
  2c:   00000000        nopCode: Select all
00000000 <bar>:
   0:   27bdffe0        addiu   sp,sp,-32
   4:   ffbf0010        sd      ra,16(sp)
   8:   ffbe0000        sd      s8,0(sp)
   c:   0c000000        jal     0 <bar>
                        c: R_MIPS_26    foo
  10:   03a0f02d        move    s8,sp
  14:   0002103c        dsll32  v0,v0,0x0
  18:   0002183e        dsrl32  v1,v0,0x0
  1c:   0060102d        move    v0,v1
  20:   0000102d        move    v0,zero
  24:   03c0e82d        move    sp,s8
  28:   dfbf0010        ld      ra,16(sp)
  2c:   dfbe0000        ld      s8,0(sp)
  30:   03e00008        jr      ra
  34:   27bd0020        addiu   sp,sp,32
00000038 <foobar>:
  38:   27bdfff0        addiu   sp,sp,-16
  3c:   ffbe0000        sd      s8,0(sp)
  40:   03a0f02d        move    s8,sp
  44:   700014a9        por     v0,zero,zero
  48:   24020005        li      v0,5
  4c:   03c0e82d        move    sp,s8
  50:   dfbe0000        ld      s8,0(sp)
  54:   03e00008        jr      ra
  58:   27bd0010        addiu   sp,sp,16Did anyone experienced such things in the past ? Can anyone of you check this with the previous toolchain ? I can't do such test atm.