1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=aarch64 -aarch64-neon-syntax=generic < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdefine i8 @add_B(<16 x i8>* %arr) { 4*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: add_B 5*9880d681SAndroid Build Coastguard Worker; CHECK: addv {{b[0-9]+}}, {{v[0-9]+}}.16b 6*9880d681SAndroid Build Coastguard Worker %bin.rdx = load <16 x i8>, <16 x i8>* %arr 7*9880d681SAndroid Build Coastguard Worker %rdx.shuf0 = shufflevector <16 x i8> %bin.rdx, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 8*9880d681SAndroid Build Coastguard Worker %bin.rdx0 = add <16 x i8> %bin.rdx, %rdx.shuf0 9*9880d681SAndroid Build Coastguard Worker %rdx.shuf = shufflevector <16 x i8> %bin.rdx0, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef > 10*9880d681SAndroid Build Coastguard Worker %bin.rdx11 = add <16 x i8> %bin.rdx0, %rdx.shuf 11*9880d681SAndroid Build Coastguard Worker %rdx.shuf12 = shufflevector <16 x i8> %bin.rdx11, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef> 12*9880d681SAndroid Build Coastguard Worker %bin.rdx13 = add <16 x i8> %bin.rdx11, %rdx.shuf12 13*9880d681SAndroid Build Coastguard Worker %rdx.shuf13 = shufflevector <16 x i8> %bin.rdx13, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef> 14*9880d681SAndroid Build Coastguard Worker %bin.rdx14 = add <16 x i8> %bin.rdx13, %rdx.shuf13 15*9880d681SAndroid Build Coastguard Worker %r = extractelement <16 x i8> %bin.rdx14, i32 0 16*9880d681SAndroid Build Coastguard Worker ret i8 %r 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Workerdefine i16 @add_H(<8 x i16>* %arr) { 20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: add_H 21*9880d681SAndroid Build Coastguard Worker; CHECK: addv {{h[0-9]+}}, {{v[0-9]+}}.8h 22*9880d681SAndroid Build Coastguard Worker %bin.rdx = load <8 x i16>, <8 x i16>* %arr 23*9880d681SAndroid Build Coastguard Worker %rdx.shuf = shufflevector <8 x i16> %bin.rdx, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef,i32 undef, i32 undef> 24*9880d681SAndroid Build Coastguard Worker %bin.rdx11 = add <8 x i16> %bin.rdx, %rdx.shuf 25*9880d681SAndroid Build Coastguard Worker %rdx.shuf12 = shufflevector <8 x i16> %bin.rdx11, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 26*9880d681SAndroid Build Coastguard Worker %bin.rdx13 = add <8 x i16> %bin.rdx11, %rdx.shuf12 27*9880d681SAndroid Build Coastguard Worker %rdx.shuf13 = shufflevector <8 x i16> %bin.rdx13, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 28*9880d681SAndroid Build Coastguard Worker %bin.rdx14 = add <8 x i16> %bin.rdx13, %rdx.shuf13 29*9880d681SAndroid Build Coastguard Worker %r = extractelement <8 x i16> %bin.rdx14, i32 0 30*9880d681SAndroid Build Coastguard Worker ret i16 %r 31*9880d681SAndroid Build Coastguard Worker} 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard Workerdefine i32 @add_S( <4 x i32>* %arr) { 34*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: add_S 35*9880d681SAndroid Build Coastguard Worker; CHECK: addv {{s[0-9]+}}, {{v[0-9]+}}.4s 36*9880d681SAndroid Build Coastguard Worker %bin.rdx = load <4 x i32>, <4 x i32>* %arr 37*9880d681SAndroid Build Coastguard Worker %rdx.shuf = shufflevector <4 x i32> %bin.rdx, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef> 38*9880d681SAndroid Build Coastguard Worker %bin.rdx11 = add <4 x i32> %bin.rdx, %rdx.shuf 39*9880d681SAndroid Build Coastguard Worker %rdx.shuf12 = shufflevector <4 x i32> %bin.rdx11, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> 40*9880d681SAndroid Build Coastguard Worker %bin.rdx13 = add <4 x i32> %bin.rdx11, %rdx.shuf12 41*9880d681SAndroid Build Coastguard Worker %r = extractelement <4 x i32> %bin.rdx13, i32 0 42*9880d681SAndroid Build Coastguard Worker ret i32 %r 43*9880d681SAndroid Build Coastguard Worker} 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Workerdefine i64 @add_D(<2 x i64>* %arr) { 46*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: add_D 47*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: addv 48*9880d681SAndroid Build Coastguard Worker %bin.rdx = load <2 x i64>, <2 x i64>* %arr 49*9880d681SAndroid Build Coastguard Worker %rdx.shuf0 = shufflevector <2 x i64> %bin.rdx, <2 x i64> undef, <2 x i32> <i32 1, i32 undef> 50*9880d681SAndroid Build Coastguard Worker %bin.rdx0 = add <2 x i64> %bin.rdx, %rdx.shuf0 51*9880d681SAndroid Build Coastguard Worker %r = extractelement <2 x i64> %bin.rdx0, i32 0 52*9880d681SAndroid Build Coastguard Worker ret i64 %r 53*9880d681SAndroid Build Coastguard Worker} 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Workerdefine i32 @oversized_ADDV_256(i8* noalias nocapture readonly %arg1, i8* noalias nocapture readonly %arg2) { 56*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: oversized_ADDV_256 57*9880d681SAndroid Build Coastguard Worker; CHECK: addv {{s[0-9]+}}, {{v[0-9]+}}.4s 58*9880d681SAndroid Build Coastguard Workerentry: 59*9880d681SAndroid Build Coastguard Worker %0 = bitcast i8* %arg1 to <8 x i8>* 60*9880d681SAndroid Build Coastguard Worker %1 = load <8 x i8>, <8 x i8>* %0, align 1 61*9880d681SAndroid Build Coastguard Worker %2 = zext <8 x i8> %1 to <8 x i32> 62*9880d681SAndroid Build Coastguard Worker %3 = bitcast i8* %arg2 to <8 x i8>* 63*9880d681SAndroid Build Coastguard Worker %4 = load <8 x i8>, <8 x i8>* %3, align 1 64*9880d681SAndroid Build Coastguard Worker %5 = zext <8 x i8> %4 to <8 x i32> 65*9880d681SAndroid Build Coastguard Worker %6 = sub nsw <8 x i32> %2, %5 66*9880d681SAndroid Build Coastguard Worker %7 = icmp slt <8 x i32> %6, zeroinitializer 67*9880d681SAndroid Build Coastguard Worker %8 = sub nsw <8 x i32> zeroinitializer, %6 68*9880d681SAndroid Build Coastguard Worker %9 = select <8 x i1> %7, <8 x i32> %8, <8 x i32> %6 69*9880d681SAndroid Build Coastguard Worker %rdx.shuf = shufflevector <8 x i32> %9, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef> 70*9880d681SAndroid Build Coastguard Worker %bin.rdx = add <8 x i32> %9, %rdx.shuf 71*9880d681SAndroid Build Coastguard Worker %rdx.shuf1 = shufflevector <8 x i32> %bin.rdx, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 72*9880d681SAndroid Build Coastguard Worker %bin.rdx2 = add <8 x i32> %bin.rdx, %rdx.shuf1 73*9880d681SAndroid Build Coastguard Worker %rdx.shuf3 = shufflevector <8 x i32> %bin.rdx2, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 74*9880d681SAndroid Build Coastguard Worker %bin.rdx4 = add <8 x i32> %bin.rdx2, %rdx.shuf3 75*9880d681SAndroid Build Coastguard Worker %10 = extractelement <8 x i32> %bin.rdx4, i32 0 76*9880d681SAndroid Build Coastguard Worker ret i32 %10 77*9880d681SAndroid Build Coastguard Worker} 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Workerdefine i32 @oversized_ADDV_512(<16 x i32>* %arr) { 80*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: oversized_ADDV_512 81*9880d681SAndroid Build Coastguard Worker; CHECK: addv {{s[0-9]+}}, {{v[0-9]+}}.4s 82*9880d681SAndroid Build Coastguard Worker %bin.rdx = load <16 x i32>, <16 x i32>* %arr 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker %rdx.shuf0 = shufflevector <16 x i32> %bin.rdx, <16 x i32> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> 85*9880d681SAndroid Build Coastguard Worker %bin.rdx0 = add <16 x i32> %bin.rdx, %rdx.shuf0 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Worker %rdx.shuf = shufflevector <16 x i32> %bin.rdx0, <16 x i32> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef > 88*9880d681SAndroid Build Coastguard Worker %bin.rdx11 = add <16 x i32> %bin.rdx0, %rdx.shuf 89*9880d681SAndroid Build Coastguard Worker 90*9880d681SAndroid Build Coastguard Worker %rdx.shuf12 = shufflevector <16 x i32> %bin.rdx11, <16 x i32> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef> 91*9880d681SAndroid Build Coastguard Worker %bin.rdx13 = add <16 x i32> %bin.rdx11, %rdx.shuf12 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Worker %rdx.shuf13 = shufflevector <16 x i32> %bin.rdx13, <16 x i32> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef, i32 undef, i32 undef,i32 undef, i32 undef> 94*9880d681SAndroid Build Coastguard Worker %bin.rdx14 = add <16 x i32> %bin.rdx13, %rdx.shuf13 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker %r = extractelement <16 x i32> %bin.rdx14, i32 0 97*9880d681SAndroid Build Coastguard Worker ret i32 %r 98*9880d681SAndroid Build Coastguard Worker} 99