llvm.org GIT mirror llvm / fbe3eeb
DAG combiner: fold (select, C, X, undef) -> X Differential Revision: https://reviews.llvm.org/D54646 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347110 91177308-0d34-0410-b5e6-96231b3b80d8 Stanislav Mekhanoshin 2 years ago
13 changed file(s) with 256 addition(s) and 417 deletion(s). Raw diff Collapse all Expand all
72397239 if (N1 == N2)
72407240 return N1;
72417241
7242 // fold (select, C, X, undef) -> X
7243 if (N2.isUndef())
7244 return N1;
7245 if (N1.isUndef())
7246 return N2;
7247
72427248 if (const ConstantSDNode *N0C = dyn_cast(N0)) {
72437249 // fold (select true, X, Y) -> X
72447250 // fold (select false, X, Y) -> Y
8686 ;CHECK: fcmp
8787 %cmp0 = fcmp ogt half 0xH3333, undef
8888 %cmp1 = fcmp ogt half 0xH2222, undef
89 %x = select i1 %cmp0, i16 0, i16 undef
89 %x = select i1 %cmp0, i16 0, i16 1
9090 %or = or i1 %cmp1, %cmp0
91 %y = select i1 %or, i16 4, i16 undef
91 %y = select i1 %or, i16 4, i16 1
9292 %r = add i16 %x, %y
9393 ret i16 %r
9494 }
0 ; RUN: llc -mtriple=amdgcn-amd-amdhsa < %s | FileCheck -check-prefix=GCN %s
1
2 ; GCN-LABEL: {{^}}select_undef_lhs:
3 ; GCN: s_waitcnt
4 ; GCN-NOT: v_cmp
5 ; GCN-NOT: v_cndmask
6 ; GCN-NEXT: s_setpc_b64
7 define float @select_undef_lhs(float %val, i1 %cond) {
8 %undef = call float @llvm.amdgcn.rcp.f32(float undef)
9 %sel = select i1 %cond, float %undef, float %val
10 ret float %sel
11 }
12
13 ; GCN-LABEL: {{^}}select_undef_rhs:
14 ; GCN: s_waitcnt
15 ; GCN-NOT: v_cmp
16 ; GCN-NOT: v_cndmask
17 ; GCN-NEXT: s_setpc_b64
18 define float @select_undef_rhs(float %val, i1 %cond) {
19 %undef = call float @llvm.amdgcn.rcp.f32(float undef)
20 %sel = select i1 %cond, float %val, float %undef
21 ret float %sel
22 }
23
24 declare float @llvm.amdgcn.rcp.f32(float)
7474 ; CHECK: cmp
7575 define i32 @bc_raise(i1 %cond) nounwind ssp {
7676 entry:
77 %val.2.i = select i1 %cond, i32 0, i32 undef
77 %val.2.i = select i1 %cond, i32 0, i32 1
7878 %sub.i = sub nsw i32 0, %val.2.i
7979 %retval.0.i = select i1 %cond, i32 %val.2.i, i32 %sub.i
8080 %cmp1 = icmp eq i32 %retval.0.i, 0
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s | FileCheck %s
2
3 define void @select_undef_n1(float addrspace(1)* %a, i32 %c) {
4 ; CHECK-LABEL: select_undef_n1:
5 ; CHECK: # %bb.0:
6 ; CHECK-NEXT: movl $1065353216, (%rdi) # imm = 0x3F800000
7 ; CHECK-NEXT: retq
8 %cc = icmp eq i32 %c, 0
9 %sel = select i1 %cc, float 1.000000e+00, float undef
10 store float %sel, float addrspace(1)* %a
11 ret void
12 }
13
14 define void @select_undef_n2(float addrspace(1)* %a, i32 %c) {
15 ; CHECK-LABEL: select_undef_n2:
16 ; CHECK: # %bb.0:
17 ; CHECK-NEXT: movl $1065353216, (%rdi) # imm = 0x3F800000
18 ; CHECK-NEXT: retq
19 %cc = icmp eq i32 %c, 0
20 %sel = select i1 %cc, float undef, float 1.000000e+00
21 store float %sel, float addrspace(1)* %a
22 ret void
23 }
2020 %v7 = tail call i32 @llvm.hexagon.A2.subh.l16.sat.ll(i32 %v6, i32 16)
2121 %v8 = trunc i32 %v7 to i16
2222 %v9 = icmp sgt i16 %v8, -1
23 %v10 = select i1 %v9, i16 0, i16 undef
23 %v10 = select i1 %v9, i16 0, i16 1
2424 ret i16 %v10
2525 }
2626
3333 %v7 = add i32 %v6, undef
3434 %v8 = icmp slt i32 undef, %v7
3535 %v9 = add nsw i32 %v7, 1
36 %v10 = select i1 undef, i32 undef, i32 %v9
36 %v10 = select i1 undef, i32 1, i32 %v9
3737 %v11 = add i32 %v10, 0
3838 %v12 = getelementptr inbounds i8, i8* null, i32 %v11
3939 %v13 = load i8, i8* %v12, align 1, !tbaa !4
1919
2020 bb5: ; preds = %bb3
2121 %tmp6 = or i1 %tmp2, false
22 %tmp7 = select i1 %tmp6, i32 0, i32 undef
22 %tmp7 = select i1 %tmp6, i32 0, i32 100
2323 %tmp8 = ashr i32 %tmp1, %tmp7
2424 %tmp9 = zext i32 %tmp8 to i64
2525 %tmp10 = shl i64 %tmp9, 48
2525 %tmp113 = sub i8 %tmp106, 0
2626 %tmp114 = add i8 %tmp113, -72
2727 %tmp141 = icmp ne i32 %tmp67, -1263900958
28 %tmp142 = select i1 %tmp141, i8 %tmp114, i8 undef
28 %tmp142 = select i1 %tmp141, i8 %tmp114, i8 1
2929 %tmp143 = xor i8 %tmp142, 81
3030 %tmp144 = zext i8 %tmp143 to i32
3131 %tmp145 = add i32 %tmp144, 2062143348
2626 %c.0 = phi i32 [ %inc15, %for.inc14 ], [ 1, %entry ]
2727 %k.0 = phi i32 [ %k.1.lcssa, %for.inc14 ], [ undef, %entry ]
2828 %tmp3 = icmp sgt i32 undef, 0
29 %smax52 = select i1 %tmp3, i32 undef, i32 0
29 %smax52 = select i1 %tmp3, i32 %c.0, i32 0
3030 %tmp4 = zext i32 %smax52 to i64
3131 %tmp5 = icmp sgt i64 undef, %tmp4
32 %smax53 = select i1 %tmp5, i64 undef, i64 %tmp4
32 %smax53 = select i1 %tmp5, i64 %tmp2, i64 %tmp4
3333 %tmp6 = add nsw i64 %smax53, 1
3434 %tmp7 = sub nsw i64 %tmp6, %tmp4
3535 %tmp8 = add nsw i64 %tmp7, -8
1818 ; CHECK-LABEL: _Z1av:
1919 ; CHECK: # %bb.0: # %entry
2020 ; CHECK-NEXT: movl struct_obj_3+{{.*}}(%rip), %eax
21 ; CHECK-NEXT: movsbl {{.*}}(%rip), %ecx
21 ; CHECK-NEXT: movzbl {{.*}}(%rip), %ecx
2222 ; CHECK-NEXT: movzbl {{.*}}(%rip), %edx
2323 ; CHECK-NEXT: andl $1, %eax
24 ; CHECK-NEXT: leal (%rax,%rax), %esi
25 ; CHECK-NEXT: subl %ecx, %esi
26 ; CHECK-NEXT: subl %edx, %esi
27 ; CHECK-NEXT: xorl %ecx, %ecx
28 ; CHECK-NEXT: testb %al, %al
29 ; CHECK-NEXT: cmovel %eax, %ecx
30 ; CHECK-NEXT: movzbl {{.*}}(%rip), %edx
31 ; CHECK-NEXT: andl struct_obj_8+{{.*}}(%rip), %ecx
32 ; CHECK-NEXT: andl $1, %ecx
33 ; CHECK-NEXT: negl %ecx
34 ; CHECK-NEXT: andl %edx, %ecx
35 ; CHECK-NEXT: negl %ecx
36 ; CHECK-NEXT: andl %eax, %ecx
37 ; CHECK-NEXT: negl %ecx
38 ; CHECK-NEXT: testl %ecx, %esi
39 ; CHECK-NEXT: notl %esi
40 ; CHECK-NEXT: movzbl %sil, %eax
24 ; CHECK-NEXT: addl %eax, %eax
25 ; CHECK-NEXT: subl %ecx, %eax
26 ; CHECK-NEXT: subl %edx, %eax
27 ; CHECK-NEXT: notl %eax
28 ; CHECK-NEXT: movzbl %al, %eax
4129 ; CHECK-NEXT: movw %ax, struct_obj_12+{{.*}}(%rip)
42 ; CHECK-NEXT: setne {{.*}}(%rip)
30 ; CHECK-NEXT: movb $0, {{.*}}(%rip)
4331 ; CHECK-NEXT: retq
4432 entry:
4533 %bf.load = load i32, i32* bitcast (i24* getelementptr inbounds (%struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363, %struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363* @struct_obj_3, i64 0, i32 0, i32 2) to i32*), align 2
1919 %conv = zext i1 %cmp to i32
2020 %tobool1.i = icmp ne i32 undef, 0
2121 %or.cond.i = and i1 %cmp, %tobool1.i
22 %cond.i = select i1 %or.cond.i, i32 %conv, i32 undef
22 %cond.i = select i1 %or.cond.i, i32 %conv, i32 1
2323 store i32 %cond.i, i32* @c, align 4, !tbaa !1
2424 %1 = load i32, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @b, i32 0, i32 0), align 4
2525 %tobool = icmp ne i32 %1, 0
26 %2 = select i1 %tobool, i32 %1, i32 undef
26 %2 = select i1 %tobool, i32 %1, i32 2
2727 store i32 %2, i32* @d, align 4, !tbaa !1
2828 ret void
2929 }
1212 ; ILP-LABEL: test1:
1313 ; ILP: # %bb.0:
1414 ; ILP-NEXT: pushq %rbp
15 ; ILP-NEXT: pushq %r15
16 ; ILP-NEXT: pushq %r14
17 ; ILP-NEXT: pushq %r13
18 ; ILP-NEXT: pushq %r12
1915 ; ILP-NEXT: pushq %rbx
20 ; ILP-NEXT: movq %rcx, %r9
21 ; ILP-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
22 ; ILP-NEXT: xorl %eax, %eax
23 ; ILP-NEXT: addq $1, %rsi
24 ; ILP-NEXT: adcq $0, %rdx
25 ; ILP-NEXT: adcq $0, %r9
26 ; ILP-NEXT: adcq $0, %r8
27 ; ILP-NEXT: leal 1(%rsi,%rsi), %edi
28 ; ILP-NEXT: movl $1, %ebp
29 ; ILP-NEXT: xorl %r14d, %r14d
30 ; ILP-NEXT: movl %edi, %ecx
31 ; ILP-NEXT: shldq %cl, %rbp, %r14
32 ; ILP-NEXT: movl $1, %r11d
33 ; ILP-NEXT: shlq %cl, %r11
34 ; ILP-NEXT: movb $-128, %r10b
35 ; ILP-NEXT: subb %dil, %r10b
36 ; ILP-NEXT: movq %r9, %r13
37 ; ILP-NEXT: movl %r10d, %ecx
38 ; ILP-NEXT: shlq %cl, %r13
39 ; ILP-NEXT: movl $1, %r12d
40 ; ILP-NEXT: shrdq %cl, %rax, %r12
41 ; ILP-NEXT: xorl %r15d, %r15d
42 ; ILP-NEXT: movl %edi, %ecx
43 ; ILP-NEXT: shldq %cl, %r15, %r15
44 ; ILP-NEXT: movq %rsi, %rbx
45 ; ILP-NEXT: shrdq %cl, %rdx, %rbx
46 ; ILP-NEXT: shrq %cl, %rdx
47 ; ILP-NEXT: addb $-128, %cl
48 ; ILP-NEXT: shrdq %cl, %r8, %r9
49 ; ILP-NEXT: testb $64, %dil
50 ; ILP-NEXT: cmovneq %r11, %r14
51 ; ILP-NEXT: cmoveq %rbx, %rdx
52 ; ILP-NEXT: cmovneq %rax, %r15
53 ; ILP-NEXT: cmovneq %rax, %r11
54 ; ILP-NEXT: testb $64, %r10b
55 ; ILP-NEXT: cmovneq %rax, %r12
56 ; ILP-NEXT: cmovneq %rax, %r13
16 ; ILP-NEXT: movq %rdi, %rax
17 ; ILP-NEXT: leal 3(%rsi,%rsi), %ebp
18 ; ILP-NEXT: movl %ebp, %r11d
19 ; ILP-NEXT: addb $-128, %r11b
20 ; ILP-NEXT: xorl %r8d, %r8d
21 ; ILP-NEXT: movl $1, %r10d
22 ; ILP-NEXT: xorl %edi, %edi
23 ; ILP-NEXT: movl %ebp, %ecx
24 ; ILP-NEXT: shldq %cl, %r10, %rdi
25 ; ILP-NEXT: xorl %r9d, %r9d
26 ; ILP-NEXT: movl %r11d, %ecx
27 ; ILP-NEXT: shldq %cl, %r10, %r9
28 ; ILP-NEXT: xorl %esi, %esi
29 ; ILP-NEXT: movl %ebp, %ecx
30 ; ILP-NEXT: shldq %cl, %rsi, %rsi
31 ; ILP-NEXT: movl $1, %edx
32 ; ILP-NEXT: shlq %cl, %rdx
5733 ; ILP-NEXT: movl $1, %ebx
34 ; ILP-NEXT: movl %r11d, %ecx
5835 ; ILP-NEXT: shlq %cl, %rbx
59 ; ILP-NEXT: orl %edx, %r13d
60 ; ILP-NEXT: xorl %edx, %edx
61 ; ILP-NEXT: movl $1, %ebp
62 ; ILP-NEXT: shldq %cl, %rbp, %rdx
63 ; ILP-NEXT: shrq %cl, %r8
36 ; ILP-NEXT: movb $-128, %cl
37 ; ILP-NEXT: subb %bpl, %cl
38 ; ILP-NEXT: shrdq %cl, %r8, %r10
6439 ; ILP-NEXT: testb $64, %cl
65 ; ILP-NEXT: cmoveq %r9, %r8
66 ; ILP-NEXT: cmovneq %rbx, %rdx
67 ; ILP-NEXT: cmovneq %rax, %rbx
68 ; ILP-NEXT: testb %dil, %dil
69 ; ILP-NEXT: cmovsq %rax, %r14
70 ; ILP-NEXT: cmovsq %rax, %r11
71 ; ILP-NEXT: jns .LBB0_2
72 ; ILP-NEXT: # %bb.1:
73 ; ILP-NEXT: movl %r8d, %r13d
74 ; ILP-NEXT: .LBB0_2:
75 ; ILP-NEXT: je .LBB0_4
76 ; ILP-NEXT: # %bb.3:
77 ; ILP-NEXT: movl %r13d, %esi
78 ; ILP-NEXT: .LBB0_4:
79 ; ILP-NEXT: cmovnsq %r12, %rbx
80 ; ILP-NEXT: cmoveq %rax, %rbx
81 ; ILP-NEXT: cmovnsq %r15, %rdx
82 ; ILP-NEXT: cmoveq %rax, %rdx
83 ; ILP-NEXT: testb $1, %sil
84 ; ILP-NEXT: cmovneq %rax, %rdx
85 ; ILP-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
86 ; ILP-NEXT: movq %rdx, 24(%rax)
87 ; ILP-NEXT: cmovneq %rax, %rbx
40 ; ILP-NEXT: cmovneq %r8, %r10
41 ; ILP-NEXT: testb $64, %r11b
42 ; ILP-NEXT: cmovneq %rbx, %r9
43 ; ILP-NEXT: cmovneq %r8, %rbx
44 ; ILP-NEXT: testb $64, %bpl
45 ; ILP-NEXT: cmovneq %rdx, %rdi
46 ; ILP-NEXT: cmovneq %r8, %rdx
47 ; ILP-NEXT: cmovneq %r8, %rsi
48 ; ILP-NEXT: testb %bpl, %bpl
49 ; ILP-NEXT: cmovsq %r8, %rdi
50 ; ILP-NEXT: cmovsq %r8, %rdx
51 ; ILP-NEXT: movq %rdi, 8(%rax)
52 ; ILP-NEXT: movq %rdx, (%rax)
53 ; ILP-NEXT: cmovsq %r9, %rsi
54 ; ILP-NEXT: cmoveq %r8, %rsi
55 ; ILP-NEXT: movq %rsi, 24(%rax)
56 ; ILP-NEXT: cmovnsq %r10, %rbx
57 ; ILP-NEXT: cmoveq %r8, %rbx
8858 ; ILP-NEXT: movq %rbx, 16(%rax)
89 ; ILP-NEXT: cmovneq %rax, %r14
90 ; ILP-NEXT: movq %r14, 8(%rax)
91 ; ILP-NEXT: cmovneq %rax, %r11
92 ; ILP-NEXT: movq %r11, (%rax)
9359 ; ILP-NEXT: popq %rbx
94 ; ILP-NEXT: popq %r12
95 ; ILP-NEXT: popq %r13
96 ; ILP-NEXT: popq %r14
97 ; ILP-NEXT: popq %r15
9860 ; ILP-NEXT: popq %rbp
9961 ; ILP-NEXT: retq
10062 ;
10163 ; HYBRID-LABEL: test1:
10264 ; HYBRID: # %bb.0:
103 ; HYBRID-NEXT: pushq %rbp
104 ; HYBRID-NEXT: pushq %r15
105 ; HYBRID-NEXT: pushq %r14
106 ; HYBRID-NEXT: pushq %r13
107 ; HYBRID-NEXT: pushq %r12
10865 ; HYBRID-NEXT: pushq %rbx
109 ; HYBRID-NEXT: movq %rcx, %r9
11066 ; HYBRID-NEXT: movq %rdi, %rax
111 ; HYBRID-NEXT: addq $1, %rsi
112 ; HYBRID-NEXT: adcq $0, %rdx
113 ; HYBRID-NEXT: adcq $0, %r9
114 ; HYBRID-NEXT: adcq $0, %r8
115 ; HYBRID-NEXT: xorl %r10d, %r10d
116 ; HYBRID-NEXT: leal 1(%rsi,%rsi), %edi
117 ; HYBRID-NEXT: xorl %r14d, %r14d
118 ; HYBRID-NEXT: movl %edi, %ecx
119 ; HYBRID-NEXT: shldq %cl, %r14, %r14
120 ; HYBRID-NEXT: testb $64, %dil
121 ; HYBRID-NEXT: cmovneq %r10, %r14
122 ; HYBRID-NEXT: movl $1, %ebp
123 ; HYBRID-NEXT: movl $1, %r12d
124 ; HYBRID-NEXT: shlq %cl, %r12
125 ; HYBRID-NEXT: testb $64, %dil
126 ; HYBRID-NEXT: movq %r12, %r11
127 ; HYBRID-NEXT: cmovneq %r10, %r11
128 ; HYBRID-NEXT: movq %rsi, %rbx
129 ; HYBRID-NEXT: shrdq %cl, %rdx, %rbx
130 ; HYBRID-NEXT: shrq %cl, %rdx
131 ; HYBRID-NEXT: testb $64, %dil
132 ; HYBRID-NEXT: cmoveq %rbx, %rdx
133 ; HYBRID-NEXT: xorl %r15d, %r15d
134 ; HYBRID-NEXT: shldq %cl, %rbp, %r15
135 ; HYBRID-NEXT: testb $64, %dil
136 ; HYBRID-NEXT: cmovneq %r12, %r15
67 ; HYBRID-NEXT: leal 3(%rsi,%rsi), %r10d
13768 ; HYBRID-NEXT: movb $-128, %cl
138 ; HYBRID-NEXT: subb %dil, %cl
139 ; HYBRID-NEXT: movq %r9, %r13
140 ; HYBRID-NEXT: shlq %cl, %r13
141 ; HYBRID-NEXT: movl $1, %r12d
142 ; HYBRID-NEXT: shrdq %cl, %r10, %r12
69 ; HYBRID-NEXT: subb %r10b, %cl
70 ; HYBRID-NEXT: xorl %r8d, %r8d
71 ; HYBRID-NEXT: movl $1, %esi
72 ; HYBRID-NEXT: movl $1, %r9d
73 ; HYBRID-NEXT: shrdq %cl, %r8, %r9
14374 ; HYBRID-NEXT: testb $64, %cl
144 ; HYBRID-NEXT: cmovneq %r10, %r12
145 ; HYBRID-NEXT: cmovneq %r10, %r13
146 ; HYBRID-NEXT: orl %edx, %r13d
147 ; HYBRID-NEXT: movl %edi, %ecx
75 ; HYBRID-NEXT: cmovneq %r8, %r9
76 ; HYBRID-NEXT: xorl %edx, %edx
77 ; HYBRID-NEXT: movl %r10d, %ecx
78 ; HYBRID-NEXT: shldq %cl, %rsi, %rdx
14879 ; HYBRID-NEXT: addb $-128, %cl
149 ; HYBRID-NEXT: shrdq %cl, %r8, %r9
150 ; HYBRID-NEXT: shrq %cl, %r8
151 ; HYBRID-NEXT: xorl %edx, %edx
152 ; HYBRID-NEXT: shldq %cl, %rbp, %rdx
153 ; HYBRID-NEXT: shlq %cl, %rbp
80 ; HYBRID-NEXT: xorl %r11d, %r11d
81 ; HYBRID-NEXT: shldq %cl, %rsi, %r11
82 ; HYBRID-NEXT: movl $1, %edi
83 ; HYBRID-NEXT: shlq %cl, %rdi
15484 ; HYBRID-NEXT: testb $64, %cl
155 ; HYBRID-NEXT: cmovneq %rbp, %rdx
156 ; HYBRID-NEXT: cmoveq %r9, %r8
157 ; HYBRID-NEXT: cmovneq %r10, %rbp
158 ; HYBRID-NEXT: testb %dil, %dil
159 ; HYBRID-NEXT: jns .LBB0_2
160 ; HYBRID-NEXT: # %bb.1:
161 ; HYBRID-NEXT: movl %r8d, %r13d
162 ; HYBRID-NEXT: .LBB0_2:
163 ; HYBRID-NEXT: je .LBB0_4
164 ; HYBRID-NEXT: # %bb.3:
165 ; HYBRID-NEXT: movl %r13d, %esi
166 ; HYBRID-NEXT: .LBB0_4:
167 ; HYBRID-NEXT: cmovsq %r10, %r15
168 ; HYBRID-NEXT: cmovnsq %r12, %rbp
169 ; HYBRID-NEXT: cmoveq %r10, %rbp
170 ; HYBRID-NEXT: cmovnsq %r14, %rdx
171 ; HYBRID-NEXT: cmoveq %r10, %rdx
172 ; HYBRID-NEXT: cmovsq %r10, %r11
173 ; HYBRID-NEXT: testb $1, %sil
174 ; HYBRID-NEXT: cmovneq %rax, %rdx
175 ; HYBRID-NEXT: movq %rdx, 24(%rax)
176 ; HYBRID-NEXT: cmovneq %rax, %rbp
177 ; HYBRID-NEXT: movq %rbp, 16(%rax)
178 ; HYBRID-NEXT: cmovneq %rax, %r15
179 ; HYBRID-NEXT: movq %r15, 8(%rax)
180 ; HYBRID-NEXT: cmovneq %rax, %r11
181 ; HYBRID-NEXT: movq %r11, (%rax)
85 ; HYBRID-NEXT: cmovneq %rdi, %r11
86 ; HYBRID-NEXT: cmovneq %r8, %rdi
87 ; HYBRID-NEXT: xorl %ebx, %ebx
88 ; HYBRID-NEXT: movl %r10d, %ecx
89 ; HYBRID-NEXT: shldq %cl, %rbx, %rbx
90 ; HYBRID-NEXT: shlq %cl, %rsi
91 ; HYBRID-NEXT: testb $64, %r10b
92 ; HYBRID-NEXT: cmovneq %rsi, %rdx
93 ; HYBRID-NEXT: cmovneq %r8, %rbx
94 ; HYBRID-NEXT: cmovneq %r8, %rsi
95 ; HYBRID-NEXT: testb %r10b, %r10b
96 ; HYBRID-NEXT: cmovsq %r8, %rdx
97 ; HYBRID-NEXT: movq %rdx, 8(%rax)
98 ; HYBRID-NEXT: cmovsq %r8, %rsi
99 ; HYBRID-NEXT: movq %rsi, (%rax)
100 ; HYBRID-NEXT: cmovsq %r11, %rbx
101 ; HYBRID-NEXT: cmoveq %r8, %rbx
102 ; HYBRID-NEXT: movq %rbx, 24(%rax)
103 ; HYBRID-NEXT: cmovnsq %r9, %rdi
104 ; HYBRID-NEXT: cmoveq %r8, %rdi
105 ; HYBRID-NEXT: movq %rdi, 16(%rax)
182106 ; HYBRID-NEXT: popq %rbx
183 ; HYBRID-NEXT: popq %r12
184 ; HYBRID-NEXT: popq %r13
185 ; HYBRID-NEXT: popq %r14
186 ; HYBRID-NEXT: popq %r15
187 ; HYBRID-NEXT: popq %rbp
188107 ; HYBRID-NEXT: retq
189108 ;
190109 ; BURR-LABEL: test1:
191110 ; BURR: # %bb.0:
192 ; BURR-NEXT: pushq %rbp
193 ; BURR-NEXT: pushq %r15
194 ; BURR-NEXT: pushq %r14
195 ; BURR-NEXT: pushq %r13
196 ; BURR-NEXT: pushq %r12
197111 ; BURR-NEXT: pushq %rbx
198 ; BURR-NEXT: movq %rcx, %r9
199112 ; BURR-NEXT: movq %rdi, %rax
200 ; BURR-NEXT: addq $1, %rsi
201 ; BURR-NEXT: adcq $0, %rdx
202 ; BURR-NEXT: adcq $0, %r9
203 ; BURR-NEXT: adcq $0, %r8
204 ; BURR-NEXT: xorl %r10d, %r10d
205 ; BURR-NEXT: leal 1(%rsi,%rsi), %edi
206 ; BURR-NEXT: xorl %r14d, %r14d
207 ; BURR-NEXT: movl %edi, %ecx
208 ; BURR-NEXT: shldq %cl, %r14, %r14
209 ; BURR-NEXT: testb $64, %dil
210 ; BURR-NEXT: cmovneq %r10, %r14
211 ; BURR-NEXT: movl $1, %ebp
212 ; BURR-NEXT: movl $1, %r12d
213 ; BURR-NEXT: shlq %cl, %r12
214 ; BURR-NEXT: testb $64, %dil
215 ; BURR-NEXT: movq %r12, %r11
216 ; BURR-NEXT: cmovneq %r10, %r11
217 ; BURR-NEXT: movq %rsi, %rbx
218 ; BURR-NEXT: shrdq %cl, %rdx, %rbx
219 ; BURR-NEXT: shrq %cl, %rdx
220 ; BURR-NEXT: testb $64, %dil
221 ; BURR-NEXT: cmoveq %rbx, %rdx
222 ; BURR-NEXT: xorl %r15d, %r15d
223 ; BURR-NEXT: shldq %cl, %rbp, %r15
224 ; BURR-NEXT: testb $64, %dil
225 ; BURR-NEXT: cmovneq %r12, %r15
113 ; BURR-NEXT: leal 3(%rsi,%rsi), %r10d
226114 ; BURR-NEXT: movb $-128, %cl
227 ; BURR-NEXT: subb %dil, %cl
228 ; BURR-NEXT: movq %r9, %r13
229 ; BURR-NEXT: shlq %cl, %r13
230 ; BURR-NEXT: movl $1, %r12d
231 ; BURR-NEXT: shrdq %cl, %r10, %r12
115 ; BURR-NEXT: subb %r10b, %cl
116 ; BURR-NEXT: xorl %r8d, %r8d
117 ; BURR-NEXT: movl $1, %esi
118 ; BURR-NEXT: movl $1, %r9d
119 ; BURR-NEXT: shrdq %cl, %r8, %r9
232120 ; BURR-NEXT: testb $64, %cl
233 ; BURR-NEXT: cmovneq %r10, %r12
234 ; BURR-NEXT: cmovneq %r10, %r13
235 ; BURR-NEXT: orl %edx, %r13d
236 ; BURR-NEXT: movl %edi, %ecx
121 ; BURR-NEXT: cmovneq %r8, %r9
122 ; BURR-NEXT: xorl %edx, %edx
123 ; BURR-NEXT: movl %r10d, %ecx
124 ; BURR-NEXT: shldq %cl, %rsi, %rdx
237125 ; BURR-NEXT: addb $-128, %cl
238 ; BURR-NEXT: shrdq %cl, %r8, %r9
239 ; BURR-NEXT: xorl %edx, %edx
240 ; BURR-NEXT: shldq %cl, %rbp, %rdx
241 ; BURR-NEXT: shrq %cl, %r8
242 ; BURR-NEXT: shlq %cl, %rbp
126 ; BURR-NEXT: xorl %r11d, %r11d
127 ; BURR-NEXT: shldq %cl, %rsi, %r11
128 ; BURR-NEXT: movl $1, %edi
129 ; BURR-NEXT: shlq %cl, %rdi
243130 ; BURR-NEXT: testb $64, %cl
244 ; BURR-NEXT: cmovneq %rbp, %rdx
245 ; BURR-NEXT: cmoveq %r9, %r8
246 ; BURR-NEXT: cmovneq %r10, %rbp
247 ; BURR-NEXT: testb %dil, %dil
248 ; BURR-NEXT: jns .LBB0_2
249 ; BURR-NEXT: # %bb.1:
250 ; BURR-NEXT: movl %r8d, %r13d
251 ; BURR-NEXT: .LBB0_2:
252 ; BURR-NEXT: je .LBB0_4
253 ; BURR-NEXT: # %bb.3:
254 ; BURR-NEXT: movl %r13d, %esi
255 ; BURR-NEXT: .LBB0_4:
256 ; BURR-NEXT: cmovsq %r10, %r15
257 ; BURR-NEXT: cmovnsq %r12, %rbp
258 ; BURR-NEXT: cmoveq %r10, %rbp
259 ; BURR-NEXT: cmovnsq %r14, %rdx
260 ; BURR-NEXT: cmoveq %r10, %rdx
261 ; BURR-NEXT: cmovsq %r10, %r11
262 ; BURR-NEXT: testb $1, %sil
263 ; BURR-NEXT: cmovneq %rax, %rdx
264 ; BURR-NEXT: movq %rdx, 24(%rax)
265 ; BURR-NEXT: cmovneq %rax, %rbp
266 ; BURR-NEXT: movq %rbp, 16(%rax)
267 ; BURR-NEXT: cmovneq %rax, %r15
268 ; BURR-NEXT: movq %r15, 8(%rax)
269 ; BURR-NEXT: cmovneq %rax, %r11
270 ; BURR-NEXT: movq %r11, (%rax)
131 ; BURR-NEXT: cmovneq %rdi, %r11
132 ; BURR-NEXT: cmovneq %r8, %rdi
133 ; BURR-NEXT: xorl %ebx, %ebx
134 ; BURR-NEXT: movl %r10d, %ecx
135 ; BURR-NEXT: shldq %cl, %rbx, %rbx
136 ; BURR-NEXT: shlq %cl, %rsi
137 ; BURR-NEXT: testb $64, %r10b
138 ; BURR-NEXT: cmovneq %rsi, %rdx
139 ; BURR-NEXT: cmovneq %r8, %rbx
140 ; BURR-NEXT: cmovneq %r8, %rsi
141 ; BURR-NEXT: testb %r10b, %r10b
142 ; BURR-NEXT: cmovsq %r8, %rdx
143 ; BURR-NEXT: movq %rdx, 8(%rax)
144 ; BURR-NEXT: cmovsq %r8, %rsi
145 ; BURR-NEXT: movq %rsi, (%rax)
146 ; BURR-NEXT: cmovsq %r11, %rbx
147 ; BURR-NEXT: cmoveq %r8, %rbx
148 ; BURR-NEXT: movq %rbx, 24(%rax)
149 ; BURR-NEXT: cmovnsq %r9, %rdi
150 ; BURR-NEXT: cmoveq %r8, %rdi
151 ; BURR-NEXT: movq %rdi, 16(%rax)
271152 ; BURR-NEXT: popq %rbx
272 ; BURR-NEXT: popq %r12
273 ; BURR-NEXT: popq %r13
274 ; BURR-NEXT: popq %r14
275 ; BURR-NEXT: popq %r15
276 ; BURR-NEXT: popq %rbp
277153 ; BURR-NEXT: retq
278154 ;
279155 ; SRC-LABEL: test1:
280156 ; SRC: # %bb.0:
281 ; SRC-NEXT: pushq %rbp
282 ; SRC-NEXT: pushq %r15
283157 ; SRC-NEXT: pushq %r14
284 ; SRC-NEXT: pushq %r13
285 ; SRC-NEXT: pushq %r12
286158 ; SRC-NEXT: pushq %rbx
287 ; SRC-NEXT: movq %rcx, %r9
288159 ; SRC-NEXT: movq %rdi, %rax
289 ; SRC-NEXT: addq $1, %rsi
290 ; SRC-NEXT: adcq $0, %rdx
291 ; SRC-NEXT: adcq $0, %r9
292 ; SRC-NEXT: adcq $0, %r8
293 ; SRC-NEXT: leal 1(%rsi,%rsi), %r11d
294 ; SRC-NEXT: movb $-128, %r10b
295 ; SRC-NEXT: subb %r11b, %r10b
296 ; SRC-NEXT: movq %r9, %r12
297 ; SRC-NEXT: movl %r10d, %ecx
298 ; SRC-NEXT: shlq %cl, %r12
299 ; SRC-NEXT: movq %rsi, %rbp
160 ; SRC-NEXT: leal 3(%rsi,%rsi), %r9d
161 ; SRC-NEXT: movb $-128, %cl
162 ; SRC-NEXT: subb %r9b, %cl
163 ; SRC-NEXT: xorl %r8d, %r8d
164 ; SRC-NEXT: movl $1, %edi
165 ; SRC-NEXT: movl $1, %r10d
166 ; SRC-NEXT: shrdq %cl, %r8, %r10
167 ; SRC-NEXT: testb $64, %cl
168 ; SRC-NEXT: cmovneq %r8, %r10
169 ; SRC-NEXT: movl %r9d, %r11d
170 ; SRC-NEXT: addb $-128, %r11b
171 ; SRC-NEXT: xorl %esi, %esi
300172 ; SRC-NEXT: movl %r11d, %ecx
301 ; SRC-NEXT: shrdq %cl, %rdx, %rbp
302 ; SRC-NEXT: shrq %cl, %rdx
303 ; SRC-NEXT: xorl %r15d, %r15d
304 ; SRC-NEXT: movl $1, %edi
173 ; SRC-NEXT: shldq %cl, %rdi, %rsi
174 ; SRC-NEXT: xorl %edx, %edx
175 ; SRC-NEXT: movl %r9d, %ecx
176 ; SRC-NEXT: shldq %cl, %rdi, %rdx
305177 ; SRC-NEXT: xorl %r14d, %r14d
306 ; SRC-NEXT: shldq %cl, %rdi, %r14
307 ; SRC-NEXT: xorl %r13d, %r13d
308 ; SRC-NEXT: shldq %cl, %r13, %r13
178 ; SRC-NEXT: shldq %cl, %r14, %r14
309179 ; SRC-NEXT: movl $1, %ebx
310180 ; SRC-NEXT: shlq %cl, %rbx
181 ; SRC-NEXT: testb $64, %r9b
182 ; SRC-NEXT: cmovneq %rbx, %rdx
183 ; SRC-NEXT: cmovneq %r8, %rbx
184 ; SRC-NEXT: cmovneq %r8, %r14
185 ; SRC-NEXT: movl %r11d, %ecx
186 ; SRC-NEXT: shlq %cl, %rdi
311187 ; SRC-NEXT: testb $64, %r11b
312 ; SRC-NEXT: cmoveq %rbp, %rdx
313 ; SRC-NEXT: cmovneq %rbx, %r14
314 ; SRC-NEXT: cmovneq %r15, %rbx
315 ; SRC-NEXT: cmovneq %r15, %r13
316 ; SRC-NEXT: movl $1, %ebp
317 ; SRC-NEXT: movl %r10d, %ecx
318 ; SRC-NEXT: shrdq %cl, %r15, %rbp
319 ; SRC-NEXT: testb $64, %r10b
320 ; SRC-NEXT: cmovneq %r15, %r12
321 ; SRC-NEXT: cmovneq %r15, %rbp
322 ; SRC-NEXT: orl %edx, %r12d
323 ; SRC-NEXT: movl %r11d, %ecx
324 ; SRC-NEXT: addb $-128, %cl
325 ; SRC-NEXT: shrdq %cl, %r8, %r9
326 ; SRC-NEXT: shrq %cl, %r8
327 ; SRC-NEXT: xorl %edx, %edx
328 ; SRC-NEXT: shldq %cl, %rdi, %rdx
329 ; SRC-NEXT: shlq %cl, %rdi
330 ; SRC-NEXT: testb $64, %cl
331 ; SRC-NEXT: cmoveq %r9, %r8
332 ; SRC-NEXT: cmovneq %rdi, %rdx
333 ; SRC-NEXT: cmovneq %r15, %rdi
334 ; SRC-NEXT: testb %r11b, %r11b
335 ; SRC-NEXT: jns .LBB0_2
336 ; SRC-NEXT: # %bb.1:
337 ; SRC-NEXT: movl %r8d, %r12d
338 ; SRC-NEXT: .LBB0_2:
339 ; SRC-NEXT: je .LBB0_4
340 ; SRC-NEXT: # %bb.3:
341 ; SRC-NEXT: movl %r12d, %esi
342 ; SRC-NEXT: .LBB0_4:
343 ; SRC-NEXT: cmovnsq %r13, %rdx
344 ; SRC-NEXT: cmoveq %r15, %rdx
345 ; SRC-NEXT: cmovnsq %rbp, %rdi
346 ; SRC-NEXT: cmoveq %r15, %rdi
347 ; SRC-NEXT: cmovsq %r15, %r14
348 ; SRC-NEXT: cmovsq %r15, %rbx
349 ; SRC-NEXT: testb $1, %sil
350 ; SRC-NEXT: cmovneq %rax, %rbx
351 ; SRC-NEXT: cmovneq %rax, %r14
352 ; SRC-NEXT: cmovneq %rax, %rdi
353 ; SRC-NEXT: cmovneq %rax, %rdx
354 ; SRC-NEXT: movq %rdx, 24(%rax)
188 ; SRC-NEXT: cmovneq %rdi, %rsi
189 ; SRC-NEXT: cmovneq %r8, %rdi
190 ; SRC-NEXT: testb %r9b, %r9b
191 ; SRC-NEXT: cmovnsq %r10, %rdi
192 ; SRC-NEXT: cmoveq %r8, %rdi
193 ; SRC-NEXT: cmovnsq %r14, %rsi
194 ; SRC-NEXT: cmoveq %r8, %rsi
195 ; SRC-NEXT: cmovsq %r8, %rdx
196 ; SRC-NEXT: cmovsq %r8, %rbx
197 ; SRC-NEXT: movq %rdx, 8(%rax)
198 ; SRC-NEXT: movq %rbx, (%rax)
199 ; SRC-NEXT: movq %rsi, 24(%rax)
355200 ; SRC-NEXT: movq %rdi, 16(%rax)
356 ; SRC-NEXT: movq %r14, 8(%rax)
357 ; SRC-NEXT: movq %rbx, (%rax)
358201 ; SRC-NEXT: popq %rbx
359 ; SRC-NEXT: popq %r12
360 ; SRC-NEXT: popq %r13
361202 ; SRC-NEXT: popq %r14
362 ; SRC-NEXT: popq %r15
363 ; SRC-NEXT: popq %rbp
364203 ; SRC-NEXT: retq
365204 ;
366205 ; LIN-LABEL: test1:
367206 ; LIN: # %bb.0:
368 ; LIN-NEXT: pushq %rbp
369 ; LIN-NEXT: pushq %r15
370 ; LIN-NEXT: pushq %r14
371 ; LIN-NEXT: pushq %r12
372 ; LIN-NEXT: pushq %rbx
373 ; LIN-NEXT: movq %rcx, %r9
374207 ; LIN-NEXT: movq %rdi, %rax
375 ; LIN-NEXT: xorl %r15d, %r15d
376 ; LIN-NEXT: movl $1, %r14d
377 ; LIN-NEXT: addq $1, %rsi
378 ; LIN-NEXT: leal 1(%rsi,%rsi), %ebp
379 ; LIN-NEXT: movl $1, %r12d
380 ; LIN-NEXT: movl %ebp, %ecx
381 ; LIN-NEXT: shlq %cl, %r12
382 ; LIN-NEXT: testb $64, %bpl
383 ; LIN-NEXT: movq %r12, %rbx
384 ; LIN-NEXT: cmovneq %r15, %rbx
385 ; LIN-NEXT: testb %bpl, %bpl
386 ; LIN-NEXT: cmovsq %r15, %rbx
387 ; LIN-NEXT: adcq $0, %rdx
388 ; LIN-NEXT: adcq $0, %r9
389 ; LIN-NEXT: adcq $0, %r8
390 ; LIN-NEXT: movl %ebp, %r10d
391 ; LIN-NEXT: addb $-128, %r10b
392 ; LIN-NEXT: movq %r9, %rdi
393 ; LIN-NEXT: movl %r10d, %ecx
394 ; LIN-NEXT: shrdq %cl, %r8, %rdi
395 ; LIN-NEXT: shrq %cl, %r8
396 ; LIN-NEXT: testb $64, %r10b
397 ; LIN-NEXT: cmoveq %rdi, %r8
398 ; LIN-NEXT: movq %rsi, %rdi
399 ; LIN-NEXT: movl %ebp, %ecx
400 ; LIN-NEXT: shrdq %cl, %rdx, %rdi
401 ; LIN-NEXT: shrq %cl, %rdx
402 ; LIN-NEXT: cmoveq %rdi, %rdx
403 ; LIN-NEXT: movb $-128, %r11b
404 ; LIN-NEXT: subb %bpl, %r11b
208 ; LIN-NEXT: xorl %r9d, %r9d
209 ; LIN-NEXT: movl $1, %r8d
210 ; LIN-NEXT: leal 3(%rsi,%rsi), %r11d
211 ; LIN-NEXT: movl $1, %edx
405212 ; LIN-NEXT: movl %r11d, %ecx
406 ; LIN-NEXT: shlq %cl, %r9
213 ; LIN-NEXT: shlq %cl, %rdx
407214 ; LIN-NEXT: testb $64, %r11b
408 ; LIN-NEXT: cmovneq %r15, %r9
409 ; LIN-NEXT: orl %edx, %r9d
410 ; LIN-NEXT: jns .LBB0_2
411 ; LIN-NEXT: # %bb.1:
412 ; LIN-NEXT: movl %r8d, %r9d
413 ; LIN-NEXT: .LBB0_2:
414 ; LIN-NEXT: je .LBB0_4
415 ; LIN-NEXT: # %bb.3:
416 ; LIN-NEXT: movl %r9d, %esi
417 ; LIN-NEXT: .LBB0_4:
418 ; LIN-NEXT: testb $1, %sil
419 ; LIN-NEXT: cmovneq %rax, %rbx
420 ; LIN-NEXT: movq %rbx, (%rax)
215 ; LIN-NEXT: movq %rdx, %rcx
216 ; LIN-NEXT: cmovneq %r9, %rcx
217 ; LIN-NEXT: testb %r11b, %r11b
218 ; LIN-NEXT: cmovsq %r9, %rcx
219 ; LIN-NEXT: movq %rcx, (%rdi)
220 ; LIN-NEXT: xorl %edi, %edi
221 ; LIN-NEXT: movl %r11d, %ecx
222 ; LIN-NEXT: shldq %cl, %r8, %rdi
223 ; LIN-NEXT: cmovneq %rdx, %rdi
224 ; LIN-NEXT: cmovsq %r9, %rdi
225 ; LIN-NEXT: movq %rdi, 8(%rax)
226 ; LIN-NEXT: movl %r11d, %edx
227 ; LIN-NEXT: addb $-128, %dl
228 ; LIN-NEXT: movl $1, %r10d
229 ; LIN-NEXT: movl %edx, %ecx
230 ; LIN-NEXT: shlq %cl, %r10
231 ; LIN-NEXT: testb $64, %dl
232 ; LIN-NEXT: movq %r10, %rdi
233 ; LIN-NEXT: cmovneq %r9, %rdi
234 ; LIN-NEXT: movb $-128, %cl
235 ; LIN-NEXT: subb %r11b, %cl
236 ; LIN-NEXT: movl $1, %esi
237 ; LIN-NEXT: shrdq %cl, %r9, %rsi
238 ; LIN-NEXT: testb $64, %cl
239 ; LIN-NEXT: cmovneq %r9, %rsi
240 ; LIN-NEXT: cmovsq %rdi, %rsi
241 ; LIN-NEXT: cmoveq %r9, %rsi
242 ; LIN-NEXT: movq %rsi, 16(%rax)
243 ; LIN-NEXT: xorl %esi, %esi
244 ; LIN-NEXT: movl %edx, %ecx
245 ; LIN-NEXT: shldq %cl, %r8, %rsi
246 ; LIN-NEXT: cmovneq %r10, %rsi
421247 ; LIN-NEXT: xorl %edx, %edx
422 ; LIN-NEXT: movl %ebp, %ecx
423 ; LIN-NEXT: shldq %cl, %r14, %rdx
424 ; LIN-NEXT: cmovneq %r12, %rdx
425 ; LIN-NEXT: cmovsq %r15, %rdx
426 ; LIN-NEXT: cmovneq %rax, %rdx
427 ; LIN-NEXT: movq %rdx, 8(%rax)
428 ; LIN-NEXT: movl $1, %edx
429 ; LIN-NEXT: movl %r10d, %ecx
430 ; LIN-NEXT: shlq %cl, %rdx
431 ; LIN-NEXT: movq %rdx, %rsi
432 ; LIN-NEXT: cmovneq %r15, %rsi
433 ; LIN-NEXT: movl $1, %edi
434248 ; LIN-NEXT: movl %r11d, %ecx
435 ; LIN-NEXT: shrdq %cl, %r15, %rdi
436 ; LIN-NEXT: cmovneq %r15, %rdi
437 ; LIN-NEXT: cmovsq %rsi, %rdi
438 ; LIN-NEXT: cmoveq %r15, %rdi
439 ; LIN-NEXT: cmovneq %rax, %rdi
440 ; LIN-NEXT: movq %rdi, 16(%rax)
441 ; LIN-NEXT: xorl %esi, %esi
442 ; LIN-NEXT: movl %r10d, %ecx
443 ; LIN-NEXT: shldq %cl, %r14, %rsi
444 ; LIN-NEXT: cmovneq %rdx, %rsi
445 ; LIN-NEXT: xorl %edx, %edx
446 ; LIN-NEXT: movl %ebp, %ecx
447249 ; LIN-NEXT: shldq %cl, %rdx, %rdx
448 ; LIN-NEXT: cmovneq %r15, %rdx
250 ; LIN-NEXT: cmovneq %r9, %rdx
449251 ; LIN-NEXT: cmovsq %rsi, %rdx
450 ; LIN-NEXT: cmoveq %r15, %rdx
451 ; LIN-NEXT: cmovneq %rax, %rdx
252 ; LIN-NEXT: cmoveq %r9, %rdx
452253 ; LIN-NEXT: movq %rdx, 24(%rax)
453 ; LIN-NEXT: popq %rbx
454 ; LIN-NEXT: popq %r12
455 ; LIN-NEXT: popq %r14
456 ; LIN-NEXT: popq %r15
457 ; LIN-NEXT: popq %rbp
458254 ; LIN-NEXT: retq
459255 %b = add i256 %a, 1
460256 %m = shl i256 %b, 1