Jakob Stoklund Olesen | 9efc6d3 | 2012-06-19 21:46:25 +0000 | [diff] [blame^] | 1 | ; RUN: llc -march=ppc64 -mtriple=powerpc64-apple-darwin < %s | FileCheck %s |
Jakob Stoklund Olesen | 7164288 | 2012-06-19 21:14:34 +0000 | [diff] [blame] | 2 | ; Check that the peephole optimizer knows about sext and zext instructions. |
| 3 | ; CHECK: test1sext |
| 4 | define i32 @test1sext(i64 %A, i64 %B, i32* %P, i64 *%P2) nounwind { |
| 5 | %C = add i64 %A, %B |
| 6 | ; CHECK: add [[SUM:r[0-9]+]], r3, r4 |
| 7 | %D = trunc i64 %C to i32 |
| 8 | %E = shl i64 %C, 32 |
| 9 | %F = ashr i64 %E, 32 |
| 10 | ; CHECK: extsw [[EXT:r[0-9]+]], [[SUM]] |
| 11 | store volatile i64 %F, i64 *%P2 |
| 12 | ; CHECK: std [[EXT]] |
| 13 | store volatile i32 %D, i32* %P |
| 14 | ; Reuse low bits of extended register, don't extend live range of SUM. |
| 15 | ; CHECK: stw [[EXT]] |
| 16 | ret i32 %D |
| 17 | } |