1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3
4; rdar://12081007
5
6define i32 @and_1(i8 zeroext %a, i8 zeroext %b, i32 %x) {
7; CHECK-LABEL: and_1:
8; CHECK:       # %bb.0:
9; CHECK-NEXT:    movl %edi, %eax
10; CHECK-NEXT:    andl %esi, %eax
11; CHECK-NEXT:    cmovnel %edx, %eax
12; CHECK-NEXT:    retq
13  %1 = and i8 %b, %a
14  %2 = icmp ne i8 %1, 0
15  %3 = select i1 %2, i32 %x, i32 0
16  ret i32 %3
17}
18
19define zeroext i1 @and_2(i8 zeroext %a, i8 zeroext %b) {
20; CHECK-LABEL: and_2:
21; CHECK:       # %bb.0:
22; CHECK-NEXT:    testl %edi, %esi
23; CHECK-NEXT:    setne %al
24; CHECK-NEXT:    retq
25  %1 = and i8 %b, %a
26  %2 = icmp ne i8 %1, 0
27  ret i1 %2
28}
29
30define i32 @xor_1(i8 zeroext %a, i8 zeroext %b, i32 %x) {
31; CHECK-LABEL: xor_1:
32; CHECK:       # %bb.0:
33; CHECK-NEXT:    xorl %eax, %eax
34; CHECK-NEXT:    xorl %esi, %edi
35; CHECK-NEXT:    cmovnel %edx, %eax
36; CHECK-NEXT:    retq
37  %1 = xor i8 %b, %a
38  %2 = icmp ne i8 %1, 0
39  %3 = select i1 %2, i32 %x, i32 0
40  ret i32 %3
41}
42
43define zeroext i1 @xor_2(i8 zeroext %a, i8 zeroext %b) {
44; CHECK-LABEL: xor_2:
45; CHECK:       # %bb.0:
46; CHECK-NEXT:    xorl %esi, %edi
47; CHECK-NEXT:    setne %al
48; CHECK-NEXT:    retq
49  %1 = xor i8 %b, %a
50  %2 = icmp ne i8 %1, 0
51  ret i1 %2
52}
53
54