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