1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK
4 ; In the following patterns, lhs and rhs of the or instruction have no common bits.
5 ; Therefore, "add" and "or" instructions are equal.
7 define <2 x i32> @or_and_and_rhs_neg_vec_i32(<2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {
8 ; CHECK-LABEL: or_and_and_rhs_neg_vec_i32:
10 ; CHECK-NEXT: xorps %xmm0, %xmm0
12 %and1 = and <2 x i32> %z, %y
13 %xor = xor <2 x i32> %y, <i32 -1, i32 -1>
14 %and2 = and <2 x i32> %x, %xor
15 %or = or <2 x i32> %and1, %and2
16 %add = add <2 x i32> %and1, %and2
17 %sub = sub <2 x i32> %or, %add
21 define <2 x i32> @or_and_and_lhs_neg_vec_i32(<2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {
22 ; CHECK-LABEL: or_and_and_lhs_neg_vec_i32:
24 ; CHECK-NEXT: xorps %xmm0, %xmm0
26 %and1 = and <2 x i32> %z, %y
27 %xor = xor <2 x i32> %y, <i32 -1, i32 -1>
28 %and2 = and <2 x i32> %xor, %x
29 %or = or <2 x i32> %and1, %and2
30 %add = add <2 x i32> %and1, %and2
31 %sub = sub <2 x i32> %or, %add
35 define <2 x i32> @or_and_rhs_neg_and_vec_i32(<2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {
36 ; CHECK-LABEL: or_and_rhs_neg_and_vec_i32:
38 ; CHECK-NEXT: xorps %xmm0, %xmm0
40 %xor = xor <2 x i32> %y, <i32 -1, i32 -1>
41 %and1 = and <2 x i32> %z, %xor
42 %and2 = and <2 x i32> %x, %y
43 %or = or <2 x i32> %and1, %and2
44 %add = add <2 x i32> %and1, %and2
45 %sub = sub <2 x i32> %or, %add
49 define <2 x i32> @or_and_lhs_neg_and_vec_i32(<2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {
50 ; CHECK-LABEL: or_and_lhs_neg_and_vec_i32:
52 ; CHECK-NEXT: xorps %xmm0, %xmm0
54 %xor = xor <2 x i32> %y, <i32 -1, i32 -1>
55 %and1 = and <2 x i32> %xor, %z
56 %and2 = and <2 x i32> %x, %y
57 %or = or <2 x i32> %and1, %and2
58 %add = add <2 x i32> %and1, %and2
59 %sub = sub <2 x i32> %or, %add
63 define <2 x i64> @or_and_and_rhs_neg_vec_i64(<2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
64 ; CHECK-LABEL: or_and_and_rhs_neg_vec_i64:
66 ; CHECK-NEXT: xorps %xmm0, %xmm0
68 %and1 = and <2 x i64> %z, %y
69 %xor = xor <2 x i64> %y, <i64 -1, i64 -1>
70 %and2 = and <2 x i64> %x, %xor
71 %or = or <2 x i64> %and1, %and2
72 %add = add <2 x i64> %and1, %and2
73 %sub = sub <2 x i64> %or, %add
77 define <2 x i64> @or_and_and_lhs_neg_vec_i64(<2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
78 ; CHECK-LABEL: or_and_and_lhs_neg_vec_i64:
80 ; CHECK-NEXT: xorps %xmm0, %xmm0
82 %and1 = and <2 x i64> %z, %y
83 %xor = xor <2 x i64> %y, <i64 -1, i64 -1>
84 %and2 = and <2 x i64> %xor, %x
85 %or = or <2 x i64> %and1, %and2
86 %add = add <2 x i64> %and1, %and2
87 %sub = sub <2 x i64> %or, %add
91 define <2 x i64> @or_and_rhs_neg_and_vec_i64(<2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
92 ; CHECK-LABEL: or_and_rhs_neg_and_vec_i64:
94 ; CHECK-NEXT: xorps %xmm0, %xmm0
96 %xor = xor <2 x i64> %y, <i64 -1, i64 -1>
97 %and1 = and <2 x i64> %z, %xor
98 %and2 = and <2 x i64> %x, %y
99 %or = or <2 x i64> %and1, %and2
100 %add = add <2 x i64> %and1, %and2
101 %sub = sub <2 x i64> %or, %add
105 define <2 x i64> @or_and_lhs_neg_and_vec_i64(<2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {
106 ; CHECK-LABEL: or_and_lhs_neg_and_vec_i64:
108 ; CHECK-NEXT: xorps %xmm0, %xmm0
110 %xor = xor <2 x i64> %y, <i64 -1, i64 -1>
111 %and1 = and <2 x i64> %xor, %z
112 %and2 = and <2 x i64> %x, %y
113 %or = or <2 x i64> %and1, %and2
114 %add = add <2 x i64> %and1, %and2
115 %sub = sub <2 x i64> %or, %add