[AArch64] Fix bug in prolog clobbering live reg when shrink wrapping.
[oota-llvm.git] / test / CodeGen / SPARC / multiple-div.ll
1 ; RUN: llc < %s -march=sparc | FileCheck %s
2 ; RUN: llc -O0 < %s -march=sparc | FileCheck %s
3
4 ;; llc -O0 used to try to spill Y to the stack, which isn't possible,
5 ;; and then crashed. Additionally, in -O1, it would omit the second
6 ;; apparently-redundant wr to %y, which is not actually redundant
7 ;; because the spec says to treat %y as potentially-written by udiv.
8
9 ; CHECK-LABEL: two_divides:
10 ; CHECK: wr %g0, %g0, %y
11 ; CHECK: udiv
12 ; CHECK: wr %g0, %g0, %y
13 ; CHECK: udiv
14 ; CHECK: add
15
16 define i32 @two_divides(i32 %a, i32 %b) {
17   %r = udiv i32 %a, %b
18   %r2 = udiv i32 %b, %a
19   %r3 = add i32 %r, %r2
20   ret i32 %r3
21 }