1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-- -mattr=+avx2 | FileCheck %s 3; RUN: llc < %s -mtriple=i686-- -mattr=+avx2,fast-hops | FileCheck %s 4; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s 5; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2,fast-hops | FileCheck %s 6 7define <16 x i16> @phaddw1(<16 x i16> %x, <16 x i16> %y) { 8; CHECK-LABEL: phaddw1: 9; CHECK: # %bb.0: 10; CHECK-NEXT: vphaddw %ymm1, %ymm0, %ymm0 11; CHECK-NEXT: ret{{[l|q]}} 12 %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> 13 %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> 14 %r = add <16 x i16> %a, %b 15 ret <16 x i16> %r 16} 17 18define <16 x i16> @phaddw2(<16 x i16> %x, <16 x i16> %y) { 19; CHECK-LABEL: phaddw2: 20; CHECK: # %bb.0: 21; CHECK-NEXT: vphaddw %ymm1, %ymm0, %ymm0 22; CHECK-NEXT: ret{{[l|q]}} 23 %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> 24 %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> 25 %r = add <16 x i16> %a, %b 26 ret <16 x i16> %r 27} 28 29define <8 x i32> @phaddd1(<8 x i32> %x, <8 x i32> %y) { 30; CHECK-LABEL: phaddd1: 31; CHECK: # %bb.0: 32; CHECK-NEXT: vphaddd %ymm1, %ymm0, %ymm0 33; CHECK-NEXT: ret{{[l|q]}} 34 %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> 35 %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> 36 %r = add <8 x i32> %a, %b 37 ret <8 x i32> %r 38} 39 40define <8 x i32> @phaddd2(<8 x i32> %x, <8 x i32> %y) { 41; CHECK-LABEL: phaddd2: 42; CHECK: # %bb.0: 43; CHECK-NEXT: vphaddd %ymm1, %ymm0, %ymm0 44; CHECK-NEXT: ret{{[l|q]}} 45 %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> 46 %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> 47 %r = add <8 x i32> %a, %b 48 ret <8 x i32> %r 49} 50 51define <8 x i32> @phaddd3(<8 x i32> %x) { 52; CHECK-LABEL: phaddd3: 53; CHECK: # %bb.0: 54; CHECK-NEXT: vphaddd %ymm0, %ymm0, %ymm0 55; CHECK-NEXT: ret{{[l|q]}} 56 %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> 57 %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> 58 %r = add <8 x i32> %a, %b 59 ret <8 x i32> %r 60} 61 62define <16 x i16> @phsubw1(<16 x i16> %x, <16 x i16> %y) { 63; CHECK-LABEL: phsubw1: 64; CHECK: # %bb.0: 65; CHECK-NEXT: vphsubw %ymm1, %ymm0, %ymm0 66; CHECK-NEXT: ret{{[l|q]}} 67 %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> 68 %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> 69 %r = sub <16 x i16> %a, %b 70 ret <16 x i16> %r 71} 72 73define <8 x i32> @phsubd1(<8 x i32> %x, <8 x i32> %y) { 74; CHECK-LABEL: phsubd1: 75; CHECK: # %bb.0: 76; CHECK-NEXT: vphsubd %ymm1, %ymm0, %ymm0 77; CHECK-NEXT: ret{{[l|q]}} 78 %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> 79 %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> 80 %r = sub <8 x i32> %a, %b 81 ret <8 x i32> %r 82} 83 84define <8 x i32> @phsubd2(<8 x i32> %x, <8 x i32> %y) { 85; CHECK-LABEL: phsubd2: 86; CHECK: # %bb.0: 87; CHECK-NEXT: vphsubd %ymm1, %ymm0, %ymm0 88; CHECK-NEXT: ret{{[l|q]}} 89 %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> 90 %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> 91 %r = sub <8 x i32> %a, %b 92 ret <8 x i32> %r 93} 94