Home | History | Annotate | Download | only in SystemZ
      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: locrhe %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: locgrhe %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 }
     26 
     27 ; Test LOCR in a case that could use COMPARE AND BRANCH.  We prefer using
     28 ; LOCR if possible.
     29 define i32 @f3(i32 %a, i32 %b, i32 %limit) {
     30 ; CHECK-LABEL: f3:
     31 ; CHECK: chi %r4, 42
     32 ; CHECK: locrlh %r2, %r3
     33 ; CHECK: br %r14
     34   %cond = icmp eq i32 %limit, 42
     35   %res = select i1 %cond, i32 %a, i32 %b
     36   ret i32 %res
     37 }
     38 
     39 ; ...and again for LOCGR.
     40 define i64 @f4(i64 %a, i64 %b, i64 %limit) {
     41 ; CHECK-LABEL: f4:
     42 ; CHECK: cghi %r4, 42
     43 ; CHECK: locgrlh %r2, %r3
     44 ; CHECK: br %r14
     45   %cond = icmp eq i64 %limit, 42
     46   %res = select i1 %cond, i64 %a, i64 %b
     47   ret i64 %res
     48 }
     49