blob: d5064f6d16e63053c911f1cb2dd8beb0cb0a21b2 [file] [log] [blame]
Simon Pilgrimfc4d4b22016-07-19 13:35:11 +00001; RUN: llc -mtriple=arm64-apple-darwin < %s | FileCheck %s
Tim Northover00ed9962014-03-29 10:18:08 +00002; Check that the peephole optimizer knows about sext and zext instructions.
3; CHECK: test1sext
4define 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
Jim Grosbach0fba6d92014-04-17 20:47:31 +000010 ; CHECK: sxtw x[[EXT:[0-9]+]], w[[SUM]]
Tim Northover00ed9962014-03-29 10:18:08 +000011 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}