blob: c5c121c52966c772c436ef7e000ba1eac1994ee7 [file] [log] [blame]
Sanjay Patel9b3c8a72016-10-11 16:04:37 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3
Sanjay Patel58b49872016-10-11 16:49:52 +00004define i32 @mask_negated_zext_bool1(i1 %x) {
5; CHECK-LABEL: mask_negated_zext_bool1:
Sanjay Patel9b3c8a72016-10-11 16:04:37 +00006; CHECK: # BB#0:
Sanjay Patel9b3c8a72016-10-11 16:04:37 +00007; CHECK-NEXT: andl $1, %edi
8; CHECK-NEXT: movl %edi, %eax
9; CHECK-NEXT: retq
10;
11 %ext = zext i1 %x to i32
12 %neg = sub i32 0, %ext
13 %and = and i32 %neg, 1
14 ret i32 %and
15}
16
Sanjay Patel58b49872016-10-11 16:49:52 +000017define i32 @mask_negated_zext_bool2(i1 zeroext %x) {
18; CHECK-LABEL: mask_negated_zext_bool2:
Sanjay Patel9b3c8a72016-10-11 16:04:37 +000019; CHECK: # BB#0:
20; CHECK-NEXT: movzbl %dil, %eax
Sanjay Patel9b3c8a72016-10-11 16:04:37 +000021; CHECK-NEXT: retq
22;
23 %ext = zext i1 %x to i32
24 %neg = sub i32 0, %ext
25 %and = and i32 %neg, 1
26 ret i32 %and
27}
28
Sanjay Patel58b49872016-10-11 16:49:52 +000029define <4 x i32> @mask_negated_zext_bool_vec(<4 x i1> %x) {
30; CHECK-LABEL: mask_negated_zext_bool_vec:
Sanjay Patel9b3c8a72016-10-11 16:04:37 +000031; CHECK: # BB#0:
Sanjay Patel83847032016-10-11 16:26:36 +000032; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
Sanjay Patel9b3c8a72016-10-11 16:04:37 +000033; CHECK-NEXT: retq
34;
35 %ext = zext <4 x i1> %x to <4 x i32>
36 %neg = sub <4 x i32> zeroinitializer, %ext
37 %and = and <4 x i32> %neg, <i32 1, i32 1, i32 1, i32 1>
38 ret <4 x i32> %and
39}
40
Sanjay Patel58b49872016-10-11 16:49:52 +000041define i32 @mask_negated_sext_bool1(i1 %x) {
42; CHECK-LABEL: mask_negated_sext_bool1:
43; CHECK: # BB#0:
Sanjay Patel58b49872016-10-11 16:49:52 +000044; CHECK-NEXT: andl $1, %edi
45; CHECK-NEXT: movl %edi, %eax
46; CHECK-NEXT: retq
47;
48 %ext = sext i1 %x to i32
49 %neg = sub i32 0, %ext
50 %and = and i32 %neg, 1
51 ret i32 %and
52}
53
54define i32 @mask_negated_sext_bool2(i1 zeroext %x) {
55; CHECK-LABEL: mask_negated_sext_bool2:
56; CHECK: # BB#0:
57; CHECK-NEXT: movzbl %dil, %eax
Sanjay Patel58b49872016-10-11 16:49:52 +000058; CHECK-NEXT: retq
59;
60 %ext = sext i1 %x to i32
61 %neg = sub i32 0, %ext
62 %and = and i32 %neg, 1
63 ret i32 %and
64}
65
66define <4 x i32> @mask_negated_sext_bool_vec(<4 x i1> %x) {
67; CHECK-LABEL: mask_negated_sext_bool_vec:
68; CHECK: # BB#0:
Sanjay Patel8253e152016-10-11 17:05:52 +000069; CHECK-NEXT: andps {{.*}}(%rip), %xmm0
Sanjay Patel58b49872016-10-11 16:49:52 +000070; CHECK-NEXT: retq
71;
72 %ext = sext <4 x i1> %x to <4 x i32>
73 %neg = sub <4 x i32> zeroinitializer, %ext
74 %and = and <4 x i32> %neg, <i32 1, i32 1, i32 1, i32 1>
75 ret <4 x i32> %and
76}
77