1 ; Test LOCHI and LOCGHI.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -verify-machineinstrs | FileCheck %s
5 define i32 @f1(i32 %x) {
9 ; CHECK: lochilh %r2, 42
11 %cond = icmp ne i32 %x, 0
12 %res = select i1 %cond, i32 42, i32 0
16 define i32 @f2(i32 %x, i32 %y) {
19 ; CHECK: lochilh %r3, 42
21 %cond = icmp ne i32 %x, 0
22 %res = select i1 %cond, i32 42, i32 %y
26 define i32 @f3(i32 %x, i32 %y) {
29 ; CHECK: lochie %r3, 42
31 %cond = icmp ne i32 %x, 0
32 %res = select i1 %cond, i32 %y, i32 42
36 define i64 @f4(i64 %x) {
40 ; CHECK: locghilh %r2, 42
42 %cond = icmp ne i64 %x, 0
43 %res = select i1 %cond, i64 42, i64 0
47 define i64 @f5(i64 %x, i64 %y) {
50 ; CHECK: locghilh %r3, 42
52 %cond = icmp ne i64 %x, 0
53 %res = select i1 %cond, i64 42, i64 %y
57 define i64 @f6(i64 %x, i64 %y) {
60 ; CHECK: locghie %r3, 42
62 %cond = icmp ne i64 %x, 0
63 %res = select i1 %cond, i64 %y, i64 42
67 ; Check that we also get LOCHI as a result of early if-conversion.
68 define i32 @f7(i32 %x, i32 %y) {
71 ; CHECK: lochie %r3, 42
74 %cond = icmp ne i32 %x, 0
75 br i1 %cond, label %if.then, label %return
81 %res = phi i32 [ %y, %if.then ], [ 42, %entry ]
85 ; ... and the same for LOCGHI.
86 define i64 @f8(i64 %x, i64 %y) {
89 ; CHECK: locghie %r3, 42
92 %cond = icmp ne i64 %x, 0
93 br i1 %cond, label %if.then, label %return
99 %res = phi i64 [ %y, %if.then ], [ 42, %entry ]
103 ; Check that inverting the condition works as well.
104 define i32 @f9(i32 %x, i32 %y) {
107 ; CHECK: lochilh %r3, 42
110 %cond = icmp ne i32 %x, 0
111 br i1 %cond, label %if.then, label %return
117 %res = phi i32 [ 42, %if.then ], [ %y, %entry ]
121 ; ... and the same for LOCGHI.
122 define i64 @f10(i64 %x, i64 %y) {
125 ; CHECK: locghilh %r3, 42
128 %cond = icmp ne i64 %x, 0
129 br i1 %cond, label %if.then, label %return
135 %res = phi i64 [ 42, %if.then ], [ %y, %entry ]