I am trying to understand why the TI gcc compiler (version from 9 Feb
2015) is generating some wildly inefficient code.
The line:
v = corrected(results[0]) - p->offsets[0];
Appears to generate this:
2fe0: 1c 42 7e 03 mov &0x037e,r12
2fe4: b0 12 9e 2f call #0x2f9e
00002fe8 <.LVL12>:
2fe8: 3d 40 40 10 mov #4160, r13 ;#0x1040
2fec: 5e 4d 02 00 mov.b 2(r13), r14 ;0x0002(r13)
2ff0: 5d 4d 03 00 mov.b 3(r13), r13 ;0x0003(r13)
2ff4: 0d 5d rla r13
2ff6: 0d 5d rla r13
2ff8: 0d 5d rla r13
2ffa: 0d 5d rla r13
2ffc: 0d 5d rla r13
2ffe: 0d 5d rla r13
3000: 0d 5d rla r13
3002: 0d 5d rla r13
3004: 0d de bis r14, r13
00003006 <.Loc.223.1>:
3006: 0c 8d sub r13, r12
3008: 30 41 ret
In spite of the type for offsets being an int, the compiler generates
code that fetches it a byte at a time and then shifts to combine. This
is with optimization on. (-O2) Looking at some other spots where I read
the information memory, it also reads it a byte at a time.
Why is it being so stupid? Even the shift is stupid since a single swpb
would do the trick.
--
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving
------------------------------------------------------------------------------
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users