-; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse < %s | FileCheck %s --check-prefix=SSE
-; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx < %s | FileCheck %s --check-prefix=AVX
+; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse2 < %s | FileCheck %s --check-prefix=SSE
+; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx2 < %s | FileCheck %s --check-prefix=AVX
; Verify that 128-bit vector logical ops are reassociated.
ret <4 x i32> %t2
}
+; Verify that 256-bit vector logical ops are reassociated.
+
+define <8 x i32> @reassociate_and_v8i32(<8 x i32> %x0, <8 x i32> %x1, <8 x i32> %x2, <8 x i32> %x3) {
+; AVX-LABEL: reassociate_and_v8i32:
+; AVX: # BB#0:
+; AVX-NEXT: vpaddd %ymm1, %ymm0, %ymm0
+; AVX-NEXT: vpand %ymm3, %ymm2, %ymm1
+; AVX-NEXT: vpand %ymm1, %ymm0, %ymm0
+; AVX-NEXT: retq
+
+ %t0 = add <8 x i32> %x0, %x1
+ %t1 = and <8 x i32> %x2, %t0
+ %t2 = and <8 x i32> %x3, %t1
+ ret <8 x i32> %t2
+}
+
+define <8 x i32> @reassociate_or_v8i32(<8 x i32> %x0, <8 x i32> %x1, <8 x i32> %x2, <8 x i32> %x3) {
+; AVX-LABEL: reassociate_or_v8i32:
+; AVX: # BB#0:
+; AVX-NEXT: vpaddd %ymm1, %ymm0, %ymm0
+; AVX-NEXT: vpor %ymm3, %ymm2, %ymm1
+; AVX-NEXT: vpor %ymm1, %ymm0, %ymm0
+; AVX-NEXT: retq
+
+ %t0 = add <8 x i32> %x0, %x1
+ %t1 = or <8 x i32> %x2, %t0
+ %t2 = or <8 x i32> %x3, %t1
+ ret <8 x i32> %t2
+}
+
+define <8 x i32> @reassociate_xor_v8i32(<8 x i32> %x0, <8 x i32> %x1, <8 x i32> %x2, <8 x i32> %x3) {
+; AVX-LABEL: reassociate_xor_v8i32:
+; AVX: # BB#0:
+; AVX-NEXT: vpaddd %ymm1, %ymm0, %ymm0
+; AVX-NEXT: vpxor %ymm3, %ymm2, %ymm1
+; AVX-NEXT: vpxor %ymm1, %ymm0, %ymm0
+; AVX-NEXT: retq
+
+ %t0 = add <8 x i32> %x0, %x1
+ %t1 = xor <8 x i32> %x2, %t0
+ %t2 = xor <8 x i32> %x3, %t1
+ ret <8 x i32> %t2
+}
+