[SystemZ] Add LOCR and LOCGR
[oota-llvm.git] / test / CodeGen / SystemZ / cond-move-01.ll
1 ; Test LOCR and LOCGR.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
4
5 ; Test LOCR.
6 define i32 @f1(i32 %a, i32 %b, i32 %limit) {
7 ; CHECK-LABEL: f1:
8 ; CHECK: clfi %r4, 42
9 ; CHECK: locrnl %r2, %r3
10 ; CHECK: br %r14
11   %cond = icmp ult i32 %limit, 42
12   %res = select i1 %cond, i32 %a, i32 %b
13   ret i32 %res
14 }
15
16 ; Test LOCGR.
17 define i64 @f2(i64 %a, i64 %b, i64 %limit) {
18 ; CHECK-LABEL: f2:
19 ; CHECK: clgfi %r4, 42
20 ; CHECK: locgrnl %r2, %r3
21 ; CHECK: br %r14
22   %cond = icmp ult i64 %limit, 42
23   %res = select i1 %cond, i64 %a, i64 %b
24   ret i64 %res
25 }