2 ; See comments in asm-18.ll about testing high-word operations.
4 ; RUN: llc < %s -verify-machineinstrs -mtriple=s390x-linux-gnu -mcpu=z15 \
5 ; RUN: -no-integrated-as | FileCheck %s
7 define void @f1(i32 %limit) {
9 ; CHECK-DAG: stepa [[REG1:%r[0-5]]]
10 ; CHECK-DAG: stepb [[REG2:%r[0-5]]]
11 ; CHECK-DAG: clfi %r2, 42
12 ; CHECK: selfhrl [[REG3:%r[0-5]]], [[REG1]], [[REG2]]
13 ; CHECK: stepc [[REG3]]
15 %a = call i32 asm sideeffect "stepa $0", "=h"()
16 %b = call i32 asm sideeffect "stepb $0", "=h"()
17 %cond = icmp ult i32 %limit, 42
18 %res = select i1 %cond, i32 %a, i32 %b
19 call void asm sideeffect "stepc $0", "h"(i32 %res)
20 call void asm sideeffect "use $0", "h"(i32 %a)
21 call void asm sideeffect "use $0", "h"(i32 %b)
25 ; Check that we also get SELFHR as a result of early if-conversion.
26 define void @f2(i32 %limit) {
28 ; CHECK-DAG: stepa [[REG1:%r[0-5]]]
29 ; CHECK-DAG: stepb [[REG2:%r[0-5]]]
30 ; CHECK-DAG: clfi %r2, 41
31 ; CHECK: selfhrh [[REG3:%r[0-5]]], [[REG2]], [[REG1]]
32 ; CHECK: stepc [[REG3]]
35 %a = call i32 asm sideeffect "stepa $0", "=h"()
36 %b = call i32 asm sideeffect "stepb $0", "=h"()
37 %cond = icmp ult i32 %limit, 42
38 br i1 %cond, label %if.then, label %return
44 %res = phi i32 [ %a, %if.then ], [ %b, %entry ]
45 call void asm sideeffect "stepc $0", "h"(i32 %res)
46 call void asm sideeffect "use $0", "h"(i32 %a)
47 call void asm sideeffect "use $0", "h"(i32 %b)
51 ; Check that inverting the condition works as well.
52 define void @f3(i32 %limit) {
54 ; CHECK-DAG: stepa [[REG1:%r[0-5]]]
55 ; CHECK-DAG: stepb [[REG2:%r[0-5]]]
56 ; CHECK-DAG: clfi %r2, 41
57 ; CHECK: selfhrh [[REG3:%r[0-5]]], [[REG1]], [[REG2]]
58 ; CHECK: stepc [[REG3]]
61 %a = call i32 asm sideeffect "stepa $0", "=h"()
62 %b = call i32 asm sideeffect "stepb $0", "=h"()
63 %cond = icmp ult i32 %limit, 42
64 br i1 %cond, label %if.then, label %return
70 %res = phi i32 [ %b, %if.then ], [ %a, %entry ]
71 call void asm sideeffect "stepc $0", "h"(i32 %res)
72 call void asm sideeffect "use $0", "h"(i32 %a)
73 call void asm sideeffect "use $0", "h"(i32 %b)