ARM64: initial backend import
[oota-llvm.git] / test / CodeGen / ARM64 / coalesce-ext.ll
1 ; RUN: llc -march=arm64 -mtriple=arm64-apple-darwin < %s | FileCheck %s
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 x[[SUM:[0-9]+]], x0, x1
7   %D = trunc i64 %C to i32
8   %E = shl i64 %C, 32
9   %F = ashr i64 %E, 32
10   ; CHECK: sxtw x[[EXT:[0-9]+]], x[[SUM]]
11   store volatile i64 %F, i64 *%P2
12   ; CHECK: str x[[EXT]]
13   store volatile i32 %D, i32* %P
14   ; Reuse low bits of extended register, don't extend live range of SUM.
15   ; CHECK: str w[[SUM]]
16   ret i32 %D
17 }