1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
4 define i128 @sub128(i128 %a, i128 %b) nounwind {
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: movq %rdi, %rax
8 ; CHECK-NEXT: subq %rdx, %rax
9 ; CHECK-NEXT: sbbq %rcx, %rsi
10 ; CHECK-NEXT: movq %rsi, %rdx
17 define i256 @sub256(i256 %a, i256 %b) nounwind {
18 ; CHECK-LABEL: sub256:
19 ; CHECK: # %bb.0: # %entry
20 ; CHECK-NEXT: movq %rdi, %rax
21 ; CHECK-NEXT: subq %r9, %rsi
22 ; CHECK-NEXT: sbbq {{[0-9]+}}(%rsp), %rdx
23 ; CHECK-NEXT: sbbq {{[0-9]+}}(%rsp), %rcx
24 ; CHECK-NEXT: sbbq {{[0-9]+}}(%rsp), %r8
25 ; CHECK-NEXT: movq %rdx, 8(%rdi)
26 ; CHECK-NEXT: movq %rsi, (%rdi)
27 ; CHECK-NEXT: movq %rcx, 16(%rdi)
28 ; CHECK-NEXT: movq %r8, 24(%rdi)
35 %S = type { [4 x i64] }
37 define %S @negate(%S* nocapture readonly %this) {
38 ; CHECK-LABEL: negate:
39 ; CHECK: # %bb.0: # %entry
40 ; CHECK-NEXT: movq %rdi, %rax
41 ; CHECK-NEXT: xorl %r8d, %r8d
42 ; CHECK-NEXT: xorl %edx, %edx
43 ; CHECK-NEXT: subq (%rsi), %rdx
44 ; CHECK-NEXT: movl $0, %edi
45 ; CHECK-NEXT: sbbq 8(%rsi), %rdi
46 ; CHECK-NEXT: movl $0, %ecx
47 ; CHECK-NEXT: sbbq 16(%rsi), %rcx
48 ; CHECK-NEXT: sbbq 24(%rsi), %r8
49 ; CHECK-NEXT: movq %rdx, (%rax)
50 ; CHECK-NEXT: movq %rdi, 8(%rax)
51 ; CHECK-NEXT: movq %rcx, 16(%rax)
52 ; CHECK-NEXT: movq %r8, 24(%rax)
55 %0 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 0
56 %1 = load i64, i64* %0, align 8
58 %3 = zext i64 %2 to i128
59 %4 = add nuw nsw i128 %3, 1
60 %5 = trunc i128 %4 to i64
62 %7 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 1
63 %8 = load i64, i64* %7, align 8
65 %10 = zext i64 %9 to i128
66 %11 = add nuw nsw i128 %6, %10
67 %12 = trunc i128 %11 to i64
68 %13 = lshr i128 %11, 64
69 %14 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 2
70 %15 = load i64, i64* %14, align 8
72 %17 = zext i64 %16 to i128
73 %18 = add nuw nsw i128 %13, %17
74 %19 = lshr i128 %18, 64
75 %20 = trunc i128 %18 to i64
76 %21 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 3
77 %22 = load i64, i64* %21, align 8
79 %24 = zext i64 %23 to i128
80 %25 = add nuw nsw i128 %19, %24
81 %26 = trunc i128 %25 to i64
82 %27 = insertvalue [4 x i64] undef, i64 %5, 0
83 %28 = insertvalue [4 x i64] %27, i64 %12, 1
84 %29 = insertvalue [4 x i64] %28, i64 %20, 2
85 %30 = insertvalue [4 x i64] %29, i64 %26, 3
86 %31 = insertvalue %S undef, [4 x i64] %30, 0
90 define %S @sub(%S* nocapture readonly %this, %S %arg.b) local_unnamed_addr {
92 ; CHECK: # %bb.0: # %entry
93 ; CHECK-NEXT: pushq %rbx
94 ; CHECK-NEXT: .cfi_def_cfa_offset 16
95 ; CHECK-NEXT: .cfi_offset %rbx, -16
96 ; CHECK-NEXT: movq %rdi, %rax
97 ; CHECK-NEXT: movq (%rsi), %r10
98 ; CHECK-NEXT: movq 8(%rsi), %rdi
99 ; CHECK-NEXT: movq %r10, %r11
100 ; CHECK-NEXT: subq %rdx, %r11
101 ; CHECK-NEXT: notq %rdx
102 ; CHECK-NEXT: movb $1, %bl
103 ; CHECK-NEXT: addb $-1, %bl
104 ; CHECK-NEXT: adcq %r10, %rdx
105 ; CHECK-NEXT: adcq $0, %rdi
106 ; CHECK-NEXT: setb %dl
107 ; CHECK-NEXT: movzbl %dl, %edx
108 ; CHECK-NEXT: notq %rcx
109 ; CHECK-NEXT: addq %rdi, %rcx
110 ; CHECK-NEXT: adcq 16(%rsi), %rdx
111 ; CHECK-NEXT: setb %bl
112 ; CHECK-NEXT: movzbl %bl, %edi
113 ; CHECK-NEXT: notq %r8
114 ; CHECK-NEXT: addq %rdx, %r8
115 ; CHECK-NEXT: adcq 24(%rsi), %rdi
116 ; CHECK-NEXT: notq %r9
117 ; CHECK-NEXT: addq %rdi, %r9
118 ; CHECK-NEXT: movq %r11, (%rax)
119 ; CHECK-NEXT: movq %rcx, 8(%rax)
120 ; CHECK-NEXT: movq %r8, 16(%rax)
121 ; CHECK-NEXT: movq %r9, 24(%rax)
122 ; CHECK-NEXT: popq %rbx
123 ; CHECK-NEXT: .cfi_def_cfa_offset 8
126 %0 = extractvalue %S %arg.b, 0
127 %.elt6 = extractvalue [4 x i64] %0, 1
128 %.elt8 = extractvalue [4 x i64] %0, 2
129 %.elt10 = extractvalue [4 x i64] %0, 3
130 %.elt = extractvalue [4 x i64] %0, 0
131 %1 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 0
132 %2 = load i64, i64* %1, align 8
133 %3 = zext i64 %2 to i128
134 %4 = add nuw nsw i128 %3, 1
135 %5 = xor i64 %.elt, -1
136 %6 = zext i64 %5 to i128
137 %7 = add nuw nsw i128 %4, %6
138 %8 = trunc i128 %7 to i64
139 %9 = lshr i128 %7, 64
140 %10 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 1
141 %11 = load i64, i64* %10, align 8
142 %12 = zext i64 %11 to i128
143 %13 = add nuw nsw i128 %9, %12
144 %14 = xor i64 %.elt6, -1
145 %15 = zext i64 %14 to i128
146 %16 = add nuw nsw i128 %13, %15
147 %17 = trunc i128 %16 to i64
148 %18 = lshr i128 %16, 64
149 %19 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 2
150 %20 = load i64, i64* %19, align 8
151 %21 = zext i64 %20 to i128
152 %22 = add nuw nsw i128 %18, %21
153 %23 = xor i64 %.elt8, -1
154 %24 = zext i64 %23 to i128
155 %25 = add nuw nsw i128 %22, %24
156 %26 = lshr i128 %25, 64
157 %27 = trunc i128 %25 to i64
158 %28 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 3
159 %29 = load i64, i64* %28, align 8
160 %30 = zext i64 %29 to i128
161 %31 = add nuw nsw i128 %26, %30
162 %32 = xor i64 %.elt10, -1
163 %33 = zext i64 %32 to i128
164 %34 = add nuw nsw i128 %31, %33
165 %35 = trunc i128 %34 to i64
166 %36 = insertvalue [4 x i64] undef, i64 %8, 0
167 %37 = insertvalue [4 x i64] %36, i64 %17, 1
168 %38 = insertvalue [4 x i64] %37, i64 %27, 2
169 %39 = insertvalue [4 x i64] %38, i64 %35, 3
170 %40 = insertvalue %S undef, [4 x i64] %39, 0