Rafael Espindola | f4d4005 | 2006-08-22 12:22:46 +0000 | [diff] [blame] | 1 | //===---------------------------------------------------------------------===// |
| 2 | // Random ideas for the ARM backend. |
| 3 | //===---------------------------------------------------------------------===// |
| 4 | |
| 5 | Consider implementing a select with two conditional moves: |
| 6 | |
| 7 | cmp x, y |
| 8 | moveq dst, a |
| 9 | movne dst, b |
Rafael Espindola | 7564549 | 2006-09-22 11:36:17 +0000 | [diff] [blame] | 10 | |
| 11 | ---------------------------------------------------------- |
| 12 | |
| 13 | |
| 14 | %tmp1 = shl int %b, ubyte %c |
| 15 | %tmp4 = add int %a, %tmp1 |
| 16 | |
| 17 | compiles to |
| 18 | |
| 19 | add r0, r0, r1, lsl r2 |
| 20 | |
| 21 | but |
| 22 | |
| 23 | %tmp1 = shl int %b, ubyte %c |
| 24 | %tmp4 = add int %tmp1, %a |
| 25 | |
| 26 | compiles to |
| 27 | mov r1, r1, lsl r2 |
| 28 | add r0, r1, r0 |
| 29 | |
| 30 | ---------------------------------------------------------- |
Rafael Espindola | cd71da5 | 2006-10-03 17:27:58 +0000 | [diff] [blame] | 31 | |
Rafael Espindola | 5aca927 | 2006-10-07 14:03:39 +0000 | [diff] [blame] | 32 | add an offset to FLDS/FLDD addressing mode |
Rafael Espindola | cd71da5 | 2006-10-03 17:27:58 +0000 | [diff] [blame] | 33 | |
| 34 | ---------------------------------------------------------- |
Rafael Espindola | 5af3a68 | 2006-10-09 14:18:33 +0000 | [diff] [blame] | 35 | |
| 36 | the function |
| 37 | |
| 38 | void %f() { |
| 39 | entry: |
| 40 | call void %g( int 1, int 2, int 3, int 4, int 5 ) |
| 41 | ret void |
| 42 | } |
| 43 | |
| 44 | declare void %g(int, int, int, int, int) |
| 45 | |
| 46 | Only needs 8 bytes of stack space. We currently allocate 16. |
| 47 | |
| 48 | ---------------------------------------------------------- |
Rafael Espindola | bec2e38 | 2006-10-16 16:33:29 +0000 | [diff] [blame^] | 49 | |
| 50 | 32 x 32 -> 64 multiplications currently uses two instructions. We |
| 51 | should try to declare smull and umull as returning two values. |
| 52 | |
| 53 | ---------------------------------------------------------- |