1 ; Test LOCHI and LOCGHI.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -verify-machineinstrs | FileCheck %s
5 ; Run the test again to make sure it still works the same even
6 ; in the presence of the select instructions.
7 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 -verify-machineinstrs | FileCheck %s
10 define i32 @f1(i32 %x) {
14 ; CHECK: lochilh %r2, 42
16 %cond = icmp ne i32 %x, 0
17 %res = select i1 %cond, i32 42, i32 0
21 define i32 @f2(i32 %x, i32 %y) {
24 ; CHECK: lochilh %r3, 42
26 %cond = icmp ne i32 %x, 0
27 %res = select i1 %cond, i32 42, i32 %y
31 define i32 @f3(i32 %x, i32 %y) {
34 ; CHECK: lochie %r3, 42
36 %cond = icmp ne i32 %x, 0
37 %res = select i1 %cond, i32 %y, i32 42
41 define i64 @f4(i64 %x) {
45 ; CHECK: locghilh %r2, 42
47 %cond = icmp ne i64 %x, 0
48 %res = select i1 %cond, i64 42, i64 0
52 define i64 @f5(i64 %x, i64 %y) {
55 ; CHECK: locghilh %r3, 42
57 %cond = icmp ne i64 %x, 0
58 %res = select i1 %cond, i64 42, i64 %y
62 define i64 @f6(i64 %x, i64 %y) {
65 ; CHECK: locghie %r3, 42
67 %cond = icmp ne i64 %x, 0
68 %res = select i1 %cond, i64 %y, i64 42
72 ; Check that we also get LOCHI as a result of early if-conversion.
73 define i32 @f7(i32 %x, i32 %y) {
76 ; CHECK: lochie %r3, 42
79 %cond = icmp ne i32 %x, 0
80 br i1 %cond, label %if.then, label %return
86 %res = phi i32 [ %y, %if.then ], [ 42, %entry ]
90 ; ... and the same for LOCGHI.
91 define i64 @f8(i64 %x, i64 %y) {
94 ; CHECK: locghie %r3, 42
97 %cond = icmp ne i64 %x, 0
98 br i1 %cond, label %if.then, label %return
104 %res = phi i64 [ %y, %if.then ], [ 42, %entry ]
108 ; Check that inverting the condition works as well.
109 define i32 @f9(i32 %x, i32 %y) {
112 ; CHECK: lochilh %r3, 42
115 %cond = icmp ne i32 %x, 0
116 br i1 %cond, label %if.then, label %return
122 %res = phi i32 [ 42, %if.then ], [ %y, %entry ]
126 ; ... and the same for LOCGHI.
127 define i64 @f10(i64 %x, i64 %y) {
130 ; CHECK: locghilh %r3, 42
133 %cond = icmp ne i64 %x, 0
134 br i1 %cond, label %if.then, label %return
140 %res = phi i64 [ 42, %if.then ], [ %y, %entry ]