1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
4 %S = type { [4 x i64] }
6 define %S @negate(%S* nocapture readonly %this) {
8 ; CHECK: # BB#0: # %entry
9 ; CHECK-NEXT: movq (%rsi), %rax
10 ; CHECK-NEXT: movq 8(%rsi), %rcx
11 ; CHECK-NEXT: notq %rax
12 ; CHECK-NEXT: addq $1, %rax
13 ; CHECK-NEXT: notq %rcx
14 ; CHECK-NEXT: adcq $0, %rcx
15 ; CHECK-NEXT: movq 16(%rsi), %rdx
16 ; CHECK-NEXT: notq %rdx
17 ; CHECK-NEXT: adcq $0, %rdx
18 ; CHECK-NEXT: movq 24(%rsi), %rsi
19 ; CHECK-NEXT: notq %rsi
20 ; CHECK-NEXT: adcq $0, %rsi
21 ; CHECK-NEXT: movq %rax, (%rdi)
22 ; CHECK-NEXT: movq %rcx, 8(%rdi)
23 ; CHECK-NEXT: movq %rdx, 16(%rdi)
24 ; CHECK-NEXT: movq %rsi, 24(%rdi)
25 ; CHECK-NEXT: movq %rdi, %rax
28 %0 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 0
29 %1 = load i64, i64* %0, align 8
31 %3 = zext i64 %2 to i128
32 %4 = add nuw nsw i128 %3, 1
33 %5 = trunc i128 %4 to i64
35 %7 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 1
36 %8 = load i64, i64* %7, align 8
38 %10 = zext i64 %9 to i128
39 %11 = add nuw nsw i128 %6, %10
40 %12 = trunc i128 %11 to i64
41 %13 = lshr i128 %11, 64
42 %14 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 2
43 %15 = load i64, i64* %14, align 8
45 %17 = zext i64 %16 to i128
46 %18 = add nuw nsw i128 %13, %17
47 %19 = lshr i128 %18, 64
48 %20 = trunc i128 %18 to i64
49 %21 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 3
50 %22 = load i64, i64* %21, align 8
52 %24 = zext i64 %23 to i128
53 %25 = add nuw nsw i128 %19, %24
54 %26 = trunc i128 %25 to i64
55 %27 = insertvalue [4 x i64] undef, i64 %5, 0
56 %28 = insertvalue [4 x i64] %27, i64 %12, 1
57 %29 = insertvalue [4 x i64] %28, i64 %20, 2
58 %30 = insertvalue [4 x i64] %29, i64 %26, 3
59 %31 = insertvalue %S undef, [4 x i64] %30, 0
63 define %S @sub(%S* nocapture readonly %this, %S %arg.b) local_unnamed_addr {
65 ; CHECK: # BB#0: # %entry
66 ; CHECK-NEXT: notq %rdx
67 ; CHECK-NEXT: xorl %r10d, %r10d
68 ; CHECK-NEXT: addq (%rsi), %rdx
69 ; CHECK-NEXT: setb %r10b
70 ; CHECK-NEXT: addq $1, %rdx
71 ; CHECK-NEXT: adcq 8(%rsi), %r10
72 ; CHECK-NEXT: setb %al
73 ; CHECK-NEXT: movzbl %al, %r11d
74 ; CHECK-NEXT: notq %rcx
75 ; CHECK-NEXT: addq %r10, %rcx
76 ; CHECK-NEXT: adcq 16(%rsi), %r11
77 ; CHECK-NEXT: setb %al
78 ; CHECK-NEXT: movzbl %al, %eax
79 ; CHECK-NEXT: notq %r8
80 ; CHECK-NEXT: addq %r11, %r8
81 ; CHECK-NEXT: adcq 24(%rsi), %rax
82 ; CHECK-NEXT: notq %r9
83 ; CHECK-NEXT: addq %rax, %r9
84 ; CHECK-NEXT: movq %rdx, (%rdi)
85 ; CHECK-NEXT: movq %rcx, 8(%rdi)
86 ; CHECK-NEXT: movq %r8, 16(%rdi)
87 ; CHECK-NEXT: movq %r9, 24(%rdi)
88 ; CHECK-NEXT: movq %rdi, %rax
91 %0 = extractvalue %S %arg.b, 0
92 %.elt6 = extractvalue [4 x i64] %0, 1
93 %.elt8 = extractvalue [4 x i64] %0, 2
94 %.elt10 = extractvalue [4 x i64] %0, 3
95 %.elt = extractvalue [4 x i64] %0, 0
96 %1 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 0
97 %2 = load i64, i64* %1, align 8
98 %3 = zext i64 %2 to i128
99 %4 = add nuw nsw i128 %3, 1
100 %5 = xor i64 %.elt, -1
101 %6 = zext i64 %5 to i128
102 %7 = add nuw nsw i128 %4, %6
103 %8 = trunc i128 %7 to i64
104 %9 = lshr i128 %7, 64
105 %10 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 1
106 %11 = load i64, i64* %10, align 8
107 %12 = zext i64 %11 to i128
108 %13 = add nuw nsw i128 %9, %12
109 %14 = xor i64 %.elt6, -1
110 %15 = zext i64 %14 to i128
111 %16 = add nuw nsw i128 %13, %15
112 %17 = trunc i128 %16 to i64
113 %18 = lshr i128 %16, 64
114 %19 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 2
115 %20 = load i64, i64* %19, align 8
116 %21 = zext i64 %20 to i128
117 %22 = add nuw nsw i128 %18, %21
118 %23 = xor i64 %.elt8, -1
119 %24 = zext i64 %23 to i128
120 %25 = add nuw nsw i128 %22, %24
121 %26 = lshr i128 %25, 64
122 %27 = trunc i128 %25 to i64
123 %28 = getelementptr inbounds %S, %S* %this, i64 0, i32 0, i64 3
124 %29 = load i64, i64* %28, align 8
125 %30 = zext i64 %29 to i128
126 %31 = add nuw nsw i128 %26, %30
127 %32 = xor i64 %.elt10, -1
128 %33 = zext i64 %32 to i128
129 %34 = add nuw nsw i128 %31, %33
130 %35 = trunc i128 %34 to i64
131 %36 = insertvalue [4 x i64] undef, i64 %8, 0
132 %37 = insertvalue [4 x i64] %36, i64 %17, 1
133 %38 = insertvalue [4 x i64] %37, i64 %27, 2
134 %39 = insertvalue [4 x i64] %38, i64 %35, 3
135 %40 = insertvalue %S undef, [4 x i64] %39, 0