llvm.org GIT mirror llvm / 9930182
[X86] Add combineBT test failure because bits have multiple uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309124 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Pilgrim 2 years ago
1 changed file(s) with 64 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
10831083 %tobool = icmp ne i64 %and1, 0
10841084 ret i1 %tobool
10851085 }
1086
1087 ; TODO: BT fails to look through to demanded bits as c%32 has more than one use.
1088 ; void demanded_i32(int *a, int *b, unsigned c) {
1089 ; if ((a[c/32] >> (c % 32)) & 1)
1090 ; b[c/32] |= 1 << (c % 32);
1091 ; }
1092 define void @demanded_i32(i32* nocapture readonly, i32* nocapture, i32) nounwind {
1093 ; X86-LABEL: demanded_i32:
1094 ; X86: # BB#0:
1095 ; X86-NEXT: pushl %esi
1096 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1097 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1098 ; X86-NEXT: movl %ecx, %eax
1099 ; X86-NEXT: shrl $5, %eax
1100 ; X86-NEXT: movl (%edx,%eax,4), %esi
1101 ; X86-NEXT: movl $1, %edx
1102 ; X86-NEXT: shll %cl, %edx
1103 ; X86-NEXT: andb $31, %cl
1104 ; X86-NEXT: movzbl %cl, %ecx
1105 ; X86-NEXT: btl %ecx, %esi
1106 ; X86-NEXT: jae .LBB30_2
1107 ; X86-NEXT: # BB#1:
1108 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1109 ; X86-NEXT: orl %edx, (%ecx,%eax,4)
1110 ; X86-NEXT: .LBB30_2:
1111 ; X86-NEXT: popl %esi
1112 ; X86-NEXT: retl
1113 ;
1114 ; X64-LABEL: demanded_i32:
1115 ; X64: # BB#0:
1116 ; X64-NEXT: movl %edx, %eax
1117 ; X64-NEXT: shrl $5, %eax
1118 ; X64-NEXT: movl (%rdi,%rax,4), %r8d
1119 ; X64-NEXT: movl $1, %edi
1120 ; X64-NEXT: movl %edx, %ecx
1121 ; X64-NEXT: shll %cl, %edi
1122 ; X64-NEXT: andb $31, %dl
1123 ; X64-NEXT: movzbl %dl, %ecx
1124 ; X64-NEXT: btl %ecx, %r8d
1125 ; X64-NEXT: jae .LBB30_2
1126 ; X64-NEXT: # BB#1:
1127 ; X64-NEXT: orl %edi, (%rsi,%rax,4)
1128 ; X64-NEXT: .LBB30_2:
1129 ; X64-NEXT: retq
1130 %4 = lshr i32 %2, 5
1131 %5 = zext i32 %4 to i64
1132 %6 = getelementptr inbounds i32, i32* %0, i64 %5
1133 %7 = load i32, i32* %6, align 4
1134 %8 = and i32 %2, 31
1135 %9 = shl i32 1, %8
1136 %10 = and i32 %7, %9
1137 %11 = icmp eq i32 %10, 0
1138 br i1 %11, label %16, label %12
1139
1140 ;
1141 %13 = getelementptr inbounds i32, i32* %1, i64 %5
1142 %14 = load i32, i32* %13, align 4
1143 %15 = or i32 %14, %9
1144 store i32 %15, i32* %13, align 4
1145 br label %16
1146
1147 ;
1148 ret void
1149 }