1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+cmov | FileCheck %s --check-prefix=X64
;
; PR48768 - 'and' clears the overflow flag, so we don't need a separate 'test'.
;
define i8 @and_i8_ri(i8 zeroext %0, i8 zeroext %1) {
; X86-LABEL: and_i8_ri:
; X86: # %bb.0:
; X86-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-NEXT: movl %eax, %ecx
; X86-NEXT: andb $-17, %cl
; X86-NEXT: je .LBB0_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB0_2:
; X86-NEXT: retl
;
; X64-LABEL: and_i8_ri:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andb $-17, %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: cmovel %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%3 = and i8 %0, -17
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i8 %0, i8 %3
ret i8 %5
}
define i8 @and_i8_rr(i8 zeroext %0, i8 zeroext %1) {
; X86-LABEL: and_i8_rr:
; X86: # %bb.0:
; X86-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
; X86-NEXT: andb %al, %cl
; X86-NEXT: je .LBB1_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB1_2:
; X86-NEXT: retl
;
; X64-LABEL: and_i8_rr:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: andl %edi, %eax
; X64-NEXT: cmovel %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%3 = and i8 %1, %0
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i8 %0, i8 %3
ret i8 %5
}
define i16 @and_i16_ri(i16 zeroext %0, i16 zeroext %1) {
; X86-LABEL: and_i16_ri:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl %eax, %ecx
; X86-NEXT: andl $-17, %ecx
; X86-NEXT: testw %cx, %cx
; X86-NEXT: je .LBB2_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB2_2:
; X86-NEXT: # kill: def $ax killed $ax killed $eax
; X86-NEXT: retl
;
; X64-LABEL: and_i16_ri:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andl $-17, %eax
; X64-NEXT: cmovel %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
%3 = and i16 %0, -17
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i16 %0, i16 %3
ret i16 %5
}
define i16 @and_i16_rr(i16 zeroext %0, i16 zeroext %1) {
; X86-LABEL: and_i16_rr:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: andw %ax, %cx
; X86-NEXT: je .LBB3_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB3_2:
; X86-NEXT: # kill: def $ax killed $ax killed $eax
; X86-NEXT: retl
;
; X64-LABEL: and_i16_rr:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: andl %edi, %eax
; X64-NEXT: cmovel %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
%3 = and i16 %1, %0
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i16 %0, i16 %3
ret i16 %5
}
define i32 @and_i32_ri(i32 %0, i32 %1) {
; X86-LABEL: and_i32_ri:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl %eax, %ecx
; X86-NEXT: andl $-17, %ecx
; X86-NEXT: jle .LBB4_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB4_2:
; X86-NEXT: retl
;
; X64-LABEL: and_i32_ri:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: andl $-17, %eax
; X64-NEXT: cmovlel %edi, %eax
; X64-NEXT: retq
%3 = and i32 %0, -17
%4 = icmp slt i32 %3, 1
%5 = select i1 %4, i32 %0, i32 %3
ret i32 %5
}
define i32 @and_i32_rr(i32 %0, i32 %1) {
; X86-LABEL: and_i32_rr:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: andl %eax, %ecx
; X86-NEXT: jle .LBB5_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB5_2:
; X86-NEXT: retl
;
; X64-LABEL: and_i32_rr:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: andl %edi, %eax
; X64-NEXT: cmovlel %edi, %eax
; X64-NEXT: retq
%3 = and i32 %1, %0
%4 = icmp slt i32 %3, 1
%5 = select i1 %4, i32 %0, i32 %3
ret i32 %5
}
define i64 @and_i64_ri(i64 %0, i64 %1) nounwind {
; X86-LABEL: and_i64_ri:
; X86: # %bb.0:
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: movl %eax, %ecx
; X86-NEXT: andl $-17, %ecx
; X86-NEXT: cmpl $1, %ecx
; X86-NEXT: movl %edx, %esi
; X86-NEXT: sbbl $0, %esi
; X86-NEXT: jl .LBB6_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB6_2:
; X86-NEXT: popl %esi
; X86-NEXT: retl
;
; X64-LABEL: and_i64_ri:
; X64: # %bb.0:
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: andq $-17, %rax
; X64-NEXT: cmovleq %rdi, %rax
; X64-NEXT: retq
%3 = and i64 %0, -17
%4 = icmp slt i64 %3, 1
%5 = select i1 %4, i64 %0, i64 %3
ret i64 %5
}
define i64 @and_i64_rr(i64 %0, i64 %1) nounwind {
; X86-LABEL: and_i64_rr:
; X86: # %bb.0:
; X86-NEXT: pushl %edi
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: andl %edx, %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NEXT: andl %eax, %esi
; X86-NEXT: cmpl $1, %esi
; X86-NEXT: movl %ecx, %edi
; X86-NEXT: sbbl $0, %edi
; X86-NEXT: jl .LBB7_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %esi, %eax
; X86-NEXT: movl %ecx, %edx
; X86-NEXT: .LBB7_2:
; X86-NEXT: popl %esi
; X86-NEXT: popl %edi
; X86-NEXT: retl
;
; X64-LABEL: and_i64_rr:
; X64: # %bb.0:
; X64-NEXT: movq %rsi, %rax
; X64-NEXT: andq %rdi, %rax
; X64-NEXT: cmovleq %rdi, %rax
; X64-NEXT: retq
%3 = and i64 %1, %0
%4 = icmp slt i64 %3, 1
%5 = select i1 %4, i64 %0, i64 %3
ret i64 %5
}
|