1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=pentium4 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=SSE2 2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=SSE42 3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7-avx -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=AVX1 4*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core-avx2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=AVX2 5*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=XOP -check-prefix=XOPAVX1 6*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver4 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=XOP -check-prefix=XOPAVX2 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker; Verify the cost of vector bswap instructions. 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Workerdeclare <2 x i64> @llvm.bswap.v2i64(<2 x i64>) 11*9880d681SAndroid Build Coastguard Workerdeclare <4 x i32> @llvm.bswap.v4i32(<4 x i32>) 12*9880d681SAndroid Build Coastguard Workerdeclare <8 x i16> @llvm.bswap.v8i16(<8 x i16>) 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Workerdeclare <4 x i64> @llvm.bswap.v4i64(<4 x i64>) 15*9880d681SAndroid Build Coastguard Workerdeclare <8 x i32> @llvm.bswap.v8i32(<8 x i32>) 16*9880d681SAndroid Build Coastguard Workerdeclare <16 x i16> @llvm.bswap.v16i16(<16 x i16>) 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @var_bswap_v2i64(<2 x i64> %a) { 19*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_bswap_v2i64': 20*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 7 for instruction: %bswap 21*9880d681SAndroid Build Coastguard Worker; SSE42: Found an estimated cost of 1 for instruction: %bswap 22*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction: %bswap 23*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction: %bswap 24*9880d681SAndroid Build Coastguard Worker %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a) 25*9880d681SAndroid Build Coastguard Worker ret <2 x i64> %bswap 26*9880d681SAndroid Build Coastguard Worker} 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Workerdefine <4 x i64> @var_bswap_v4i64(<4 x i64> %a) { 29*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_bswap_v4i64': 30*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 14 for instruction: %bswap 31*9880d681SAndroid Build Coastguard Worker; SSE42: Found an estimated cost of 2 for instruction: %bswap 32*9880d681SAndroid Build Coastguard Worker; AVX1: Found an estimated cost of 4 for instruction: %bswap 33*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction: %bswap 34*9880d681SAndroid Build Coastguard Worker; XOPAVX1: Found an estimated cost of 4 for instruction: %bswap 35*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction: %bswap 36*9880d681SAndroid Build Coastguard Worker %bswap = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> %a) 37*9880d681SAndroid Build Coastguard Worker ret <4 x i64> %bswap 38*9880d681SAndroid Build Coastguard Worker} 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @var_bswap_v4i32(<4 x i32> %a) { 41*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_bswap_v4i32': 42*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 7 for instruction: %bswap 43*9880d681SAndroid Build Coastguard Worker; SSE42: Found an estimated cost of 1 for instruction: %bswap 44*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction: %bswap 45*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction: %bswap 46*9880d681SAndroid Build Coastguard Worker %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a) 47*9880d681SAndroid Build Coastguard Worker ret <4 x i32> %bswap 48*9880d681SAndroid Build Coastguard Worker} 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Workerdefine <8 x i32> @var_bswap_v8i32(<8 x i32> %a) { 51*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_bswap_v8i32': 52*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 14 for instruction: %bswap 53*9880d681SAndroid Build Coastguard Worker; SSE42: Found an estimated cost of 2 for instruction: %bswap 54*9880d681SAndroid Build Coastguard Worker; AVX1: Found an estimated cost of 4 for instruction: %bswap 55*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction: %bswap 56*9880d681SAndroid Build Coastguard Worker; XOPAVX1: Found an estimated cost of 4 for instruction: %bswap 57*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction: %bswap 58*9880d681SAndroid Build Coastguard Worker %bswap = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> %a) 59*9880d681SAndroid Build Coastguard Worker ret <8 x i32> %bswap 60*9880d681SAndroid Build Coastguard Worker} 61*9880d681SAndroid Build Coastguard Worker 62*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @var_bswap_v8i16(<8 x i16> %a) { 63*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_bswap_v8i16': 64*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 7 for instruction: %bswap 65*9880d681SAndroid Build Coastguard Worker; SSE42: Found an estimated cost of 1 for instruction: %bswap 66*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction: %bswap 67*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction: %bswap 68*9880d681SAndroid Build Coastguard Worker %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a) 69*9880d681SAndroid Build Coastguard Worker ret <8 x i16> %bswap 70*9880d681SAndroid Build Coastguard Worker} 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Workerdefine <16 x i16> @var_bswap_v16i16(<16 x i16> %a) { 73*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_bswap_v16i16': 74*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 14 for instruction: %bswap 75*9880d681SAndroid Build Coastguard Worker; SSE42: Found an estimated cost of 2 for instruction: %bswap 76*9880d681SAndroid Build Coastguard Worker; AVX1: Found an estimated cost of 4 for instruction: %bswap 77*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction: %bswap 78*9880d681SAndroid Build Coastguard Worker; XOPAVX1: Found an estimated cost of 4 for instruction: %bswap 79*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction: %bswap 80*9880d681SAndroid Build Coastguard Worker %bswap = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> %a) 81*9880d681SAndroid Build Coastguard Worker ret <16 x i16> %bswap 82*9880d681SAndroid Build Coastguard Worker} 83