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