[SelectionDAGBuilder] Make sure DemoteReg ends up in right reg-class.
[oota-llvm.git] / test / CodeGen / SystemZ / risbg-03.ll
1 ; Test use of RISBG vs RISBGN on zEC12.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=zEC12 | FileCheck %s
4
5 ; On zEC12, we generally prefer RISBGN.
6 define i64 @f1(i64 %a, i64 %b) {
7 ; CHECK-LABEL: f1:
8 ; CHECK: risbgn %r2, %r3, 60, 62, 0
9 ; CHECK: br %r14
10   %anda = and i64 %a, -15
11   %andb = and i64 %b, 14
12   %or = or i64 %anda, %andb
13   ret i64 %or
14 }
15
16 ; But we may fall back to RISBG if we can use the condition code.
17 define i64 @f2(i64 %a, i64 %b, i32* %c) {
18 ; CHECK-LABEL: f2:
19 ; CHECK: risbg %r2, %r3, 60, 62, 0
20 ; CHECK-NEXT: ipm
21 ; CHECK: br %r14
22   %anda = and i64 %a, -15
23   %andb = and i64 %b, 14
24   %or = or i64 %anda, %andb
25   %cmp = icmp sgt i64 %or, 0
26   %conv = zext i1 %cmp to i32
27   store i32 %conv, i32* %c, align 4
28   ret i64 %or
29 }
30