xref: /llvm-project/llvm/test/Analysis/CostModel/X86/scalarize.ll (revision cd12922235f14a78eeed25fabf364950d02cb786)
1; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=i386 -mcpu=corei7-avx | FileCheck %s -check-prefix=CHECK32
2; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s -check-prefix=CHECK64
3
4%i4 = type <4 x i32>
5%i8 = type <2 x i64>
6
7;;; TEST HANDLING OF VARIOUS VECTOR SIZES
8
9declare %i4 @llvm.bswap.v4i32(%i4)
10declare %i8 @llvm.bswap.v2i64(%i8)
11
12declare %i4 @llvm.cttz.v4i32(%i4)
13declare %i8 @llvm.cttz.v2i64(%i8)
14
15; CHECK32-LABEL: test_scalarized_intrinsics
16; CHECK64-LABEL: test_scalarized_intrinsics
17define void @test_scalarized_intrinsics() {
18        %r1 = add %i8 undef, undef
19
20; CHECK32: cost of 2 {{.*}}bswap.v4i32
21; CHECK64: cost of 2 {{.*}}bswap.v4i32
22        %r2 = call %i4 @llvm.bswap.v4i32(%i4 undef)
23; CHECK32: cost of 2 {{.*}}bswap.v2i64
24; CHECK64: cost of 2 {{.*}}bswap.v2i64
25        %r3 = call %i8 @llvm.bswap.v2i64(%i8 undef)
26
27; CHECK32: cost of 11 {{.*}}cttz.v4i32
28; CHECK64: cost of 11 {{.*}}cttz.v4i32
29        %r4 = call %i4 @llvm.cttz.v4i32(%i4 undef)
30; CHECK32: cost of 9 {{.*}}cttz.v2i64
31; CHECK64: cost of 9 {{.*}}cttz.v2i64
32        %r5 = call %i8 @llvm.cttz.v2i64(%i8 undef)
33
34; CHECK32: ret
35; CHECK64: ret
36        ret void
37}
38