1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=X32 3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=X64 4 5define <16 x i16> @phaddw1(<16 x i16> %x, <16 x i16> %y) { 6; X32-LABEL: phaddw1: 7; X32: # %bb.0: 8; X32-NEXT: vphaddw %ymm1, %ymm0, %ymm0 9; X32-NEXT: retl 10; 11; X64-LABEL: phaddw1: 12; X64: # %bb.0: 13; X64-NEXT: vphaddw %ymm1, %ymm0, %ymm0 14; X64-NEXT: retq 15 %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> 16 %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> 17 %r = add <16 x i16> %a, %b 18 ret <16 x i16> %r 19} 20 21define <16 x i16> @phaddw2(<16 x i16> %x, <16 x i16> %y) { 22; X32-LABEL: phaddw2: 23; X32: # %bb.0: 24; X32-NEXT: vphaddw %ymm1, %ymm0, %ymm0 25; X32-NEXT: retl 26; 27; X64-LABEL: phaddw2: 28; X64: # %bb.0: 29; X64-NEXT: vphaddw %ymm1, %ymm0, %ymm0 30; X64-NEXT: retq 31 %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> 32 %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> 33 %r = add <16 x i16> %a, %b 34 ret <16 x i16> %r 35} 36 37define <8 x i32> @phaddd1(<8 x i32> %x, <8 x i32> %y) { 38; X32-LABEL: phaddd1: 39; X32: # %bb.0: 40; X32-NEXT: vphaddd %ymm1, %ymm0, %ymm0 41; X32-NEXT: retl 42; 43; X64-LABEL: phaddd1: 44; X64: # %bb.0: 45; X64-NEXT: vphaddd %ymm1, %ymm0, %ymm0 46; X64-NEXT: retq 47 %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> 48 %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> 49 %r = add <8 x i32> %a, %b 50 ret <8 x i32> %r 51} 52 53define <8 x i32> @phaddd2(<8 x i32> %x, <8 x i32> %y) { 54; X32-LABEL: phaddd2: 55; X32: # %bb.0: 56; X32-NEXT: vphaddd %ymm1, %ymm0, %ymm0 57; X32-NEXT: retl 58; 59; X64-LABEL: phaddd2: 60; X64: # %bb.0: 61; X64-NEXT: vphaddd %ymm1, %ymm0, %ymm0 62; X64-NEXT: retq 63 %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> 64 %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> 65 %r = add <8 x i32> %a, %b 66 ret <8 x i32> %r 67} 68 69define <8 x i32> @phaddd3(<8 x i32> %x) { 70; X32-LABEL: phaddd3: 71; X32: # %bb.0: 72; X32-NEXT: vphaddd %ymm0, %ymm0, %ymm0 73; X32-NEXT: retl 74; 75; X64-LABEL: phaddd3: 76; X64: # %bb.0: 77; X64-NEXT: vphaddd %ymm0, %ymm0, %ymm0 78; X64-NEXT: retq 79 %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> 80 %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> 81 %r = add <8 x i32> %a, %b 82 ret <8 x i32> %r 83} 84 85define <16 x i16> @phsubw1(<16 x i16> %x, <16 x i16> %y) { 86; X32-LABEL: phsubw1: 87; X32: # %bb.0: 88; X32-NEXT: vphsubw %ymm1, %ymm0, %ymm0 89; X32-NEXT: retl 90; 91; X64-LABEL: phsubw1: 92; X64: # %bb.0: 93; X64-NEXT: vphsubw %ymm1, %ymm0, %ymm0 94; X64-NEXT: retq 95 %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> 96 %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> 97 %r = sub <16 x i16> %a, %b 98 ret <16 x i16> %r 99} 100 101define <8 x i32> @phsubd1(<8 x i32> %x, <8 x i32> %y) { 102; X32-LABEL: phsubd1: 103; X32: # %bb.0: 104; X32-NEXT: vphsubd %ymm1, %ymm0, %ymm0 105; X32-NEXT: retl 106; 107; X64-LABEL: phsubd1: 108; X64: # %bb.0: 109; X64-NEXT: vphsubd %ymm1, %ymm0, %ymm0 110; X64-NEXT: retq 111 %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> 112 %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> 113 %r = sub <8 x i32> %a, %b 114 ret <8 x i32> %r 115} 116 117define <8 x i32> @phsubd2(<8 x i32> %x, <8 x i32> %y) { 118; X32-LABEL: phsubd2: 119; X32: # %bb.0: 120; X32-NEXT: vphsubd %ymm1, %ymm0, %ymm0 121; X32-NEXT: retl 122; 123; X64-LABEL: phsubd2: 124; X64: # %bb.0: 125; X64-NEXT: vphsubd %ymm1, %ymm0, %ymm0 126; X64-NEXT: retq 127 %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> 128 %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> 129 %r = sub <8 x i32> %a, %b 130 ret <8 x i32> %r 131} 132