1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-- -mattr=+avx2 | FileCheck %s --check-prefixes=X32,X32-SLOW
3 ; RUN: llc < %s -mtriple=i686-- -mattr=+avx2,fast-hops | FileCheck %s --check-prefixes=X32,X32-FAST
4 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s --check-prefixes=X64,X64-SLOW
5 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2,fast-hops | FileCheck %s --check-prefixes=X64,X64-FAST
7 define <16 x i16> @phaddw1(<16 x i16> %x, <16 x i16> %y) {
10 ; X32-NEXT: vphaddw %ymm1, %ymm0, %ymm0
15 ; X64-NEXT: vphaddw %ymm1, %ymm0, %ymm0
17 %a = shufflevector <16 x i16> %x, <16 x i16> %y, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 16, i32 18, i32 20, i32 22, i32 8, i32 10, i32 12, i32 14, i32 24, i32 26, i32 28, i32 30>
18 %b = shufflevector <16 x i16> %x, <16 x i16> %y, <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 17, i32 19, i32 21, i32 23, i32 9, i32 11, i32 13, i32 15, i32 25, i32 27, i32 29, i32 31>
19 %r = add <16 x i16> %a, %b
23 define <16 x i16> @phaddw2(<16 x i16> %x, <16 x i16> %y) {
26 ; X32-NEXT: vphaddw %ymm1, %ymm0, %ymm0
31 ; X64-NEXT: vphaddw %ymm1, %ymm0, %ymm0
33 %a = shufflevector <16 x i16> %x, <16 x i16> %y, <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 17, i32 19, i32 21, i32 23, i32 9, i32 11, i32 13, i32 15, i32 25, i32 27, i32 29, i32 31>
34 %b = shufflevector <16 x i16> %y, <16 x i16> %x, <16 x i32> <i32 16, i32 18, i32 20, i32 22, i32 0, i32 2, i32 4, i32 6, i32 24, i32 26, i32 28, i32 30, i32 8, i32 10, i32 12, i32 14>
35 %r = add <16 x i16> %a, %b
39 define <8 x i32> @phaddd1(<8 x i32> %x, <8 x i32> %y) {
42 ; X32-NEXT: vphaddd %ymm1, %ymm0, %ymm0
47 ; X64-NEXT: vphaddd %ymm1, %ymm0, %ymm0
49 %a = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 0, i32 2, i32 8, i32 10, i32 4, i32 6, i32 12, i32 14>
50 %b = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 1, i32 3, i32 9, i32 11, i32 5, i32 7, i32 13, i32 15>
51 %r = add <8 x i32> %a, %b
55 define <8 x i32> @phaddd2(<8 x i32> %x, <8 x i32> %y) {
58 ; X32-NEXT: vphaddd %ymm1, %ymm0, %ymm0
63 ; X64-NEXT: vphaddd %ymm1, %ymm0, %ymm0
65 %a = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 1, i32 2, i32 9, i32 10, i32 5, i32 6, i32 13, i32 14>
66 %b = shufflevector <8 x i32> %y, <8 x i32> %x, <8 x i32> <i32 8, i32 11, i32 0, i32 3, i32 12, i32 15, i32 4, i32 7>
67 %r = add <8 x i32> %a, %b
71 define <8 x i32> @phaddd3(<8 x i32> %x) {
74 ; X32-NEXT: vphaddd %ymm0, %ymm0, %ymm0
79 ; X64-NEXT: vphaddd %ymm0, %ymm0, %ymm0
81 %a = shufflevector <8 x i32> %x, <8 x i32> undef, <8 x i32> <i32 undef, i32 2, i32 8, i32 10, i32 4, i32 6, i32 undef, i32 14>
82 %b = shufflevector <8 x i32> %x, <8 x i32> undef, <8 x i32> <i32 1, i32 3, i32 9, i32 undef, i32 5, i32 7, i32 13, i32 15>
83 %r = add <8 x i32> %a, %b
87 define <16 x i16> @phsubw1(<16 x i16> %x, <16 x i16> %y) {
90 ; X32-NEXT: vphsubw %ymm1, %ymm0, %ymm0
95 ; X64-NEXT: vphsubw %ymm1, %ymm0, %ymm0
97 %a = shufflevector <16 x i16> %x, <16 x i16> %y, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 16, i32 18, i32 20, i32 22, i32 8, i32 10, i32 12, i32 14, i32 24, i32 26, i32 28, i32 30>
98 %b = shufflevector <16 x i16> %x, <16 x i16> %y, <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 17, i32 19, i32 21, i32 23, i32 9, i32 11, i32 13, i32 15, i32 25, i32 27, i32 29, i32 31>
99 %r = sub <16 x i16> %a, %b
103 define <8 x i32> @phsubd1(<8 x i32> %x, <8 x i32> %y) {
104 ; X32-LABEL: phsubd1:
106 ; X32-NEXT: vphsubd %ymm1, %ymm0, %ymm0
109 ; X64-LABEL: phsubd1:
111 ; X64-NEXT: vphsubd %ymm1, %ymm0, %ymm0
113 %a = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 0, i32 2, i32 8, i32 10, i32 4, i32 6, i32 12, i32 14>
114 %b = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 1, i32 3, i32 9, i32 11, i32 5, i32 7, i32 13, i32 15>
115 %r = sub <8 x i32> %a, %b
119 define <8 x i32> @phsubd2(<8 x i32> %x, <8 x i32> %y) {
120 ; X32-LABEL: phsubd2:
122 ; X32-NEXT: vphsubd %ymm1, %ymm0, %ymm0
125 ; X64-LABEL: phsubd2:
127 ; X64-NEXT: vphsubd %ymm1, %ymm0, %ymm0
129 %a = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 0, i32 undef, i32 8, i32 undef, i32 4, i32 6, i32 12, i32 14>
130 %b = shufflevector <8 x i32> %x, <8 x i32> %y, <8 x i32> <i32 1, i32 undef, i32 9, i32 11, i32 5, i32 7, i32 undef, i32 15>
131 %r = sub <8 x i32> %a, %b