1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; Test 128-bit subtraction on z13 and higher
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
6 define zeroext i1 @f1(i128 %a, i128 %b, ptr %res) {
9 ; CHECK-NEXT: vl %v0, 0(%r3), 3
10 ; CHECK-NEXT: vl %v1, 0(%r2), 3
11 ; CHECK-NEXT: vscbiq %v2, %v1, %v0
12 ; CHECK-NEXT: vlgvg %r2, %v2, 1
13 ; CHECK-NEXT: vsq %v0, %v1, %v0
14 ; CHECK-NEXT: xilf %r2, 1
15 ; CHECK-NEXT: vst %v0, 0(%r4), 3
17 %t = call {i128, i1} @llvm.usub.with.overflow.i128(i128 %a, i128 %b)
18 %val = extractvalue {i128, i1} %t, 0
19 %obit = extractvalue {i128, i1} %t, 1
20 store i128 %val, ptr %res
24 define zeroext i1 @f2(i128 %a, i128 %b) {
27 ; CHECK-NEXT: vl %v0, 0(%r3), 3
28 ; CHECK-NEXT: vl %v1, 0(%r2), 3
29 ; CHECK-NEXT: vscbiq %v0, %v1, %v0
30 ; CHECK-NEXT: vlgvg %r2, %v0, 1
31 ; CHECK-NEXT: xilf %r2, 1
33 %t = call {i128, i1} @llvm.usub.with.overflow.i128(i128 %a, i128 %b)
34 %obit = extractvalue {i128, i1} %t, 1
38 define i128 @f3(i128 %a, i128 %b) {
41 ; CHECK-NEXT: vl %v0, 0(%r4), 3
42 ; CHECK-NEXT: vl %v1, 0(%r3), 3
43 ; CHECK-NEXT: vsq %v0, %v1, %v0
44 ; CHECK-NEXT: vst %v0, 0(%r2), 3
46 %t = call {i128, i1} @llvm.usub.with.overflow.i128(i128 %a, i128 %b)
47 %val = extractvalue {i128, i1} %t, 0
51 define i128 @f4(i128 %a, i128 %b) {
54 ; CHECK-NEXT: vl %v0, 0(%r4), 3
55 ; CHECK-NEXT: vl %v1, 0(%r3), 3
56 ; CHECK-NEXT: vscbiq %v2, %v1, %v0
57 ; CHECK-NEXT: vlgvf %r0, %v2, 3
58 ; CHECK-NEXT: vgbm %v2, 0
59 ; CHECK-NEXT: xilf %r0, 1
60 ; CHECK-NEXT: jl .LBB3_2
61 ; CHECK-NEXT: # %bb.1:
62 ; CHECK-NEXT: vsq %v2, %v1, %v0
63 ; CHECK-NEXT: .LBB3_2:
64 ; CHECK-NEXT: vst %v2, 0(%r2), 3
66 %val = call i128 @llvm.usub.sat.i128(i128 %a, i128 %b)
70 declare {i128, i1} @llvm.usub.with.overflow.i128(i128, i128) nounwind readnone
71 declare i128 @llvm.usub.sat.i128(i128, i128) nounwind readnone