llvm.org GIT mirror llvm / 130149e
[X86] Add test cases for 32 and 64 bit versions of PR42118. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362457 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 3 months ago
1 changed file(s) with 81 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11481148 }
11491149
11501150 declare void @bar()
1151
1152 define void @pr42118_i32(i32 %x) {
1153 ; X86-LABEL: pr42118_i32:
1154 ; X86: # %bb.0:
1155 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1156 ; X86-NEXT: movl %eax, %ecx
1157 ; X86-NEXT: negl %ecx
1158 ; X86-NEXT: andnl %eax, %ecx, %eax
1159 ; X86-NEXT: jne .LBB48_1
1160 ; X86-NEXT: # %bb.2:
1161 ; X86-NEXT: jmp bar # TAILCALL
1162 ; X86-NEXT: .LBB48_1:
1163 ; X86-NEXT: retl
1164 ;
1165 ; X64-LABEL: pr42118_i32:
1166 ; X64: # %bb.0:
1167 ; X64-NEXT: movl %edi, %eax
1168 ; X64-NEXT: negl %eax
1169 ; X64-NEXT: andnl %edi, %eax, %eax
1170 ; X64-NEXT: jne .LBB48_1
1171 ; X64-NEXT: # %bb.2:
1172 ; X64-NEXT: jmp bar # TAILCALL
1173 ; X64-NEXT: .LBB48_1:
1174 ; X64-NEXT: retq
1175 %tmp = sub i32 0, %x
1176 %tmp1 = and i32 %tmp, %x
1177 %cmp = icmp eq i32 %tmp1, %x
1178 br i1 %cmp, label %1, label %2
1179
1180 tail call void @bar()
1181 br label %2
1182
1183 ret void
1184 }
1185
1186 define void @pr42118_i64(i64 %x) {
1187 ; X86-LABEL: pr42118_i64:
1188 ; X86: # %bb.0:
1189 ; X86-NEXT: pushl %esi
1190 ; X86-NEXT: .cfi_def_cfa_offset 8
1191 ; X86-NEXT: .cfi_offset %esi, -8
1192 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1193 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1194 ; X86-NEXT: xorl %edx, %edx
1195 ; X86-NEXT: movl %eax, %esi
1196 ; X86-NEXT: negl %esi
1197 ; X86-NEXT: sbbl %ecx, %edx
1198 ; X86-NEXT: andnl %ecx, %edx, %ecx
1199 ; X86-NEXT: andnl %eax, %esi, %eax
1200 ; X86-NEXT: orl %ecx, %eax
1201 ; X86-NEXT: jne .LBB49_1
1202 ; X86-NEXT: # %bb.2:
1203 ; X86-NEXT: popl %esi
1204 ; X86-NEXT: .cfi_def_cfa_offset 4
1205 ; X86-NEXT: jmp bar # TAILCALL
1206 ; X86-NEXT: .LBB49_1:
1207 ; X86-NEXT: .cfi_def_cfa_offset 8
1208 ; X86-NEXT: popl %esi
1209 ; X86-NEXT: .cfi_def_cfa_offset 4
1210 ; X86-NEXT: retl
1211 ;
1212 ; X64-LABEL: pr42118_i64:
1213 ; X64: # %bb.0:
1214 ; X64-NEXT: movq %rdi, %rax
1215 ; X64-NEXT: negq %rax
1216 ; X64-NEXT: andnq %rdi, %rax, %rax
1217 ; X64-NEXT: jne .LBB49_1
1218 ; X64-NEXT: # %bb.2:
1219 ; X64-NEXT: jmp bar # TAILCALL
1220 ; X64-NEXT: .LBB49_1:
1221 ; X64-NEXT: retq
1222 %tmp = sub i64 0, %x
1223 %tmp1 = and i64 %tmp, %x
1224 %cmp = icmp eq i64 %tmp1, %x
1225 br i1 %cmp, label %1, label %2
1226
1227 tail call void @bar()
1228 br label %2
1229
1230 ret void
1231 }