1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; Test 32-bit addition in which the second operand is constant.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
9 define zeroext i1 @f1(i32 %dummy, i32 %a, ptr %res) {
12 ; CHECK-NEXT: alfi %r3, 1
14 ; CHECK-NEXT: risbg %r2, %r0, 63, 191, 35
15 ; CHECK-NEXT: st %r3, 0(%r4)
17 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 1)
18 %val = extractvalue {i32, i1} %t, 0
19 %obit = extractvalue {i32, i1} %t, 1
20 store i32 %val, ptr %res
24 ; Check the high end of the ALFI range.
25 define zeroext i1 @f2(i32 %dummy, i32 %a, ptr %res) {
28 ; CHECK-NEXT: alfi %r3, 4294967295
30 ; CHECK-NEXT: risbg %r2, %r0, 63, 191, 35
31 ; CHECK-NEXT: st %r3, 0(%r4)
33 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 4294967295)
34 %val = extractvalue {i32, i1} %t, 0
35 %obit = extractvalue {i32, i1} %t, 1
36 store i32 %val, ptr %res
40 ; Check that negative values are treated as unsigned
41 define zeroext i1 @f3(i32 %dummy, i32 %a, ptr %res) {
44 ; CHECK-NEXT: alfi %r3, 4294967295
46 ; CHECK-NEXT: risbg %r2, %r0, 63, 191, 35
47 ; CHECK-NEXT: st %r3, 0(%r4)
49 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 -1)
50 %val = extractvalue {i32, i1} %t, 0
51 %obit = extractvalue {i32, i1} %t, 1
52 store i32 %val, ptr %res
56 ; Check using the overflow result for a branch.
57 define void @f4(i32 %dummy, i32 %a, ptr %res) {
60 ; CHECK-NEXT: alfi %r3, 1
61 ; CHECK-NEXT: st %r3, 0(%r4)
62 ; CHECK-NEXT: jgnle foo@PLT
63 ; CHECK-NEXT: .LBB3_1: # %exit
65 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 1)
66 %val = extractvalue {i32, i1} %t, 0
67 %obit = extractvalue {i32, i1} %t, 1
68 store i32 %val, ptr %res
69 br i1 %obit, label %call, label %exit
79 ; ... and the same with the inverted direction.
80 define void @f5(i32 %dummy, i32 %a, ptr %res) {
83 ; CHECK-NEXT: alfi %r3, 1
84 ; CHECK-NEXT: st %r3, 0(%r4)
85 ; CHECK-NEXT: jgle foo@PLT
86 ; CHECK-NEXT: .LBB4_1: # %exit
88 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 1)
89 %val = extractvalue {i32, i1} %t, 0
90 %obit = extractvalue {i32, i1} %t, 1
91 store i32 %val, ptr %res
92 br i1 %obit, label %exit, label %call
102 declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone