1; RUN: opt < %s  -cost-model -analyze -mtriple=i386 -mcpu=corei7-avx | FileCheck %s -check-prefix=CHECK32
2; RUN: opt < %s  -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s -check-prefix=CHECK64
3
4; Test vector scalarization costs.
5; RUN: llc < %s -march=x86 -mcpu=i386
6; RUN: llc < %s -march=x86 -mcpu=yonah
7
8%i4 = type <4 x i32>
9%i8 = type <2 x i64>
10
11;;; TEST HANDLING OF VARIOUS VECTOR SIZES
12
13declare %i4 @llvm.bswap.v4i32(%i4)
14declare %i8 @llvm.bswap.v2i64(%i8)
15
16declare %i4 @llvm.ctpop.v4i32(%i4)
17declare %i8 @llvm.ctpop.v2i64(%i8)
18
19; CHECK32-LABEL: test_scalarized_intrinsics
20; CHECK64-LABEL: test_scalarized_intrinsics
21define void @test_scalarized_intrinsics() {
22        %r1 = add %i8 undef, undef
23
24; CHECK32: cost of 12 {{.*}}bswap.v4i32
25; CHECK64: cost of 12 {{.*}}bswap.v4i32
26        %r2 = call %i4 @llvm.bswap.v4i32(%i4 undef)
27; CHECK32: cost of 10 {{.*}}bswap.v2i64
28; CHECK64: cost of 6 {{.*}}bswap.v2i64
29        %r3 = call %i8 @llvm.bswap.v2i64(%i8 undef)
30
31; CHECK32: cost of 12 {{.*}}ctpop.v4i32
32; CHECK64: cost of 12 {{.*}}ctpop.v4i32
33        %r4 = call %i4 @llvm.ctpop.v4i32(%i4 undef)
34; CHECK32: cost of 10 {{.*}}ctpop.v2i64
35; CHECK64: cost of 6 {{.*}}ctpop.v2i64
36        %r5 = call %i8 @llvm.ctpop.v2i64(%i8 undef)
37
38; CHECK32: ret
39; CHECK64: ret
40        ret void
41}
42