1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+ssse3 | FileCheck %s --check-prefix=CHECK --check-prefix=SSSE3 2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+sse4.2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE42 3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx | FileCheck %s --check-prefix=CHECK --check-prefix=AVX 4*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 7*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-macosx10.8.0" 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: 'add' 10*9880d681SAndroid Build Coastguard Workerdefine i32 @add(i32 %arg) { 11*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 1 {{.*}} %A = add 12*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 1 {{.*}} %A = add 13*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %A = add 14*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A = add 15*9880d681SAndroid Build Coastguard Worker %A = add <4 x i32> undef, undef 16*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 2 {{.*}} %B = add 17*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 2 {{.*}} %B = add 18*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 4 {{.*}} %B = add 19*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %B = add 20*9880d681SAndroid Build Coastguard Worker %B = add <8 x i32> undef, undef 21*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 1 {{.*}} %C = add 22*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 1 {{.*}} %C = add 23*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %C = add 24*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %C = add 25*9880d681SAndroid Build Coastguard Worker %C = add <2 x i64> undef, undef 26*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 2 {{.*}} %D = add 27*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 2 {{.*}} %D = add 28*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 4 {{.*}} %D = add 29*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %D = add 30*9880d681SAndroid Build Coastguard Worker %D = add <4 x i64> undef, undef 31*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 4 {{.*}} %E = add 32*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 4 {{.*}} %E = add 33*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 8 {{.*}} %E = add 34*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 2 {{.*}} %E = add 35*9880d681SAndroid Build Coastguard Worker %E = add <8 x i64> undef, undef 36*9880d681SAndroid Build Coastguard Worker ret i32 undef 37*9880d681SAndroid Build Coastguard Worker} 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: 'xor' 40*9880d681SAndroid Build Coastguard Workerdefine i32 @xor(i32 %arg) { 41*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 1 {{.*}} %A = xor 42*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 1 {{.*}} %A = xor 43*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %A = xor 44*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A = xor 45*9880d681SAndroid Build Coastguard Worker %A = xor <4 x i32> undef, undef 46*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 2 {{.*}} %B = xor 47*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 2 {{.*}} %B = xor 48*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %B = xor 49*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %B = xor 50*9880d681SAndroid Build Coastguard Worker %B = xor <8 x i32> undef, undef 51*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 1 {{.*}} %C = xor 52*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 1 {{.*}} %C = xor 53*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %C = xor 54*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %C = xor 55*9880d681SAndroid Build Coastguard Worker %C = xor <2 x i64> undef, undef 56*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 2 {{.*}} %D = xor 57*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 2 {{.*}} %D = xor 58*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %D = xor 59*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %D = xor 60*9880d681SAndroid Build Coastguard Worker %D = xor <4 x i64> undef, undef 61*9880d681SAndroid Build Coastguard Worker ret i32 undef 62*9880d681SAndroid Build Coastguard Worker} 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: 'mul' 65*9880d681SAndroid Build Coastguard Workerdefine void @mul() { 66*9880d681SAndroid Build Coastguard Worker ; A <2 x i32> gets expanded to a <2 x i64> vector. 67*9880d681SAndroid Build Coastguard Worker ; A <2 x i64> vector multiply is implemented using 68*9880d681SAndroid Build Coastguard Worker ; 3 PMULUDQ and 2 PADDS and 4 shifts. 69*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 9 {{.*}} %A0 = mul 70*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 9 {{.*}} %A0 = mul 71*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 9 {{.*}} %A0 = mul 72*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 9 {{.*}} %A0 = mul 73*9880d681SAndroid Build Coastguard Worker %A0 = mul <2 x i32> undef, undef 74*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 6 {{.*}} %A1 = mul 75*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 1 {{.*}} %A1 = mul 76*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 1 {{.*}} %A1 = mul 77*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A1 = mul 78*9880d681SAndroid Build Coastguard Worker %A1 = mul <4 x i32> undef, undef 79*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 9 {{.*}} %A2 = mul 80*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 9 {{.*}} %A2 = mul 81*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 9 {{.*}} %A2 = mul 82*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 9 {{.*}} %A2 = mul 83*9880d681SAndroid Build Coastguard Worker %A2 = mul <2 x i64> undef, undef 84*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 18 {{.*}} %A3 = mul 85*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 18 {{.*}} %A3 = mul 86*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 18 {{.*}} %A3 = mul 87*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 9 {{.*}} %A3 = mul 88*9880d681SAndroid Build Coastguard Worker %A3 = mul <4 x i64> undef, undef 89*9880d681SAndroid Build Coastguard Worker ret void 90*9880d681SAndroid Build Coastguard Worker} 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: 'fmul' 93*9880d681SAndroid Build Coastguard Workerdefine i32 @fmul(i32 %arg) { 94*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 2 {{.*}} %A = fmul 95*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 2 {{.*}} %A = fmul 96*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 2 {{.*}} %A = fmul 97*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 2 {{.*}} %A = fmul 98*9880d681SAndroid Build Coastguard Worker %A = fmul <4 x float> undef, undef 99*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 4 {{.*}} %B = fmul 100*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 4 {{.*}} %B = fmul 101*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 2 {{.*}} %B = fmul 102*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 2 {{.*}} %B = fmul 103*9880d681SAndroid Build Coastguard Worker %B = fmul <8 x float> undef, undef 104*9880d681SAndroid Build Coastguard Worker ret i32 undef 105*9880d681SAndroid Build Coastguard Worker} 106*9880d681SAndroid Build Coastguard Worker 107*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: 'shift' 108*9880d681SAndroid Build Coastguard Workerdefine void @shift() { 109*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 10 {{.*}} %A0 = shl 110*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 10 {{.*}} %A0 = shl 111*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 10 {{.*}} %A0 = shl 112*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A0 = shl 113*9880d681SAndroid Build Coastguard Worker %A0 = shl <4 x i32> undef, undef 114*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 4 {{.*}} %A1 = shl 115*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 4 {{.*}} %A1 = shl 116*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 4 {{.*}} %A1 = shl 117*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A1 = shl 118*9880d681SAndroid Build Coastguard Worker %A1 = shl <2 x i64> undef, undef 119*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 20 {{.*}} %A2 = shl 120*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 20 {{.*}} %A2 = shl 121*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 20 {{.*}} %A2 = shl 122*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A2 = shl 123*9880d681SAndroid Build Coastguard Worker %A2 = shl <8 x i32> undef, undef 124*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 8 {{.*}} %A3 = shl 125*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 8 {{.*}} %A3 = shl 126*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 8 {{.*}} %A3 = shl 127*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %A3 = shl 128*9880d681SAndroid Build Coastguard Worker %A3 = shl <4 x i64> undef, undef 129*9880d681SAndroid Build Coastguard Worker 130*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 16 {{.*}} %B0 = lshr 131*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 16 {{.*}} %B0 = lshr 132*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 16 {{.*}} %B0 = lshr 133*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %B0 = lshr 134*9880d681SAndroid Build Coastguard Worker %B0 = lshr <4 x i32> undef, undef 135*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 4 {{.*}} %B1 = lshr 136*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 4 {{.*}} %B1 = lshr 137*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 4 {{.*}} %B1 = lshr 138*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %B1 = lshr 139*9880d681SAndroid Build Coastguard Worker %B1 = lshr <2 x i64> undef, undef 140*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 32 {{.*}} %B2 = lshr 141*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 32 {{.*}} %B2 = lshr 142*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 32 {{.*}} %B2 = lshr 143*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %B2 = lshr 144*9880d681SAndroid Build Coastguard Worker %B2 = lshr <8 x i32> undef, undef 145*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 8 {{.*}} %B3 = lshr 146*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 8 {{.*}} %B3 = lshr 147*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 8 {{.*}} %B3 = lshr 148*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %B3 = lshr 149*9880d681SAndroid Build Coastguard Worker %B3 = lshr <4 x i64> undef, undef 150*9880d681SAndroid Build Coastguard Worker 151*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 16 {{.*}} %C0 = ashr 152*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 16 {{.*}} %C0 = ashr 153*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 16 {{.*}} %C0 = ashr 154*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %C0 = ashr 155*9880d681SAndroid Build Coastguard Worker %C0 = ashr <4 x i32> undef, undef 156*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 12 {{.*}} %C1 = ashr 157*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 12 {{.*}} %C1 = ashr 158*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 12 {{.*}} %C1 = ashr 159*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 4 {{.*}} %C1 = ashr 160*9880d681SAndroid Build Coastguard Worker %C1 = ashr <2 x i64> undef, undef 161*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 32 {{.*}} %C2 = ashr 162*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 32 {{.*}} %C2 = ashr 163*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 32 {{.*}} %C2 = ashr 164*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 1 {{.*}} %C2 = ashr 165*9880d681SAndroid Build Coastguard Worker %C2 = ashr <8 x i32> undef, undef 166*9880d681SAndroid Build Coastguard Worker ; SSSE3: cost of 24 {{.*}} %C3 = ashr 167*9880d681SAndroid Build Coastguard Worker ; SSE42: cost of 24 {{.*}} %C3 = ashr 168*9880d681SAndroid Build Coastguard Worker ; AVX: cost of 24 {{.*}} %C3 = ashr 169*9880d681SAndroid Build Coastguard Worker ; AVX2: cost of 4 {{.*}} %C3 = ashr 170*9880d681SAndroid Build Coastguard Worker %C3 = ashr <4 x i64> undef, undef 171*9880d681SAndroid Build Coastguard Worker 172*9880d681SAndroid Build Coastguard Worker ret void 173*9880d681SAndroid Build Coastguard Worker} 174