xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/X86/sitofp-minbitwidth-node.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1f135d224SAlexey Bataev; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2f135d224SAlexey Bataev; RUN: opt -passes=slp-vectorizer -mtriple=x86_64 -mcpu=k8 -mattr=+sse4.1 -S < %s | FileCheck %s
3f135d224SAlexey Bataev
4f135d224SAlexey Bataevdefine void @foo(ptr %ptr) {
5f135d224SAlexey Bataev; CHECK-LABEL: define void @foo(
6f135d224SAlexey Bataev; CHECK-SAME: ptr [[PTR:%.*]]) #[[ATTR0:[0-9]+]] {
7f135d224SAlexey Bataev; CHECK-NEXT:    [[GEP0:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i64 328
8f135d224SAlexey Bataev; CHECK-NEXT:    [[GEP3:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i64 334
9f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x i16>, ptr [[GEP0]], align 8
10*38fffa63SPaul Walker; CHECK-NEXT:    [[TMP3:%.*]] = xor <2 x i16> [[TMP1]], splat (i16 -1)
11f6749d8dSAlexey Bataev; CHECK-NEXT:    [[TMP4:%.*]] = uitofp <2 x i16> [[TMP3]] to <2 x double>
12f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP5:%.*]] = load <2 x i16>, ptr [[GEP3]], align 2
13f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP6:%.*]] = zext <2 x i16> [[TMP5]] to <2 x i32>
14f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP2:%.*]] = zext <2 x i16> [[TMP1]] to <2 x i32>
15f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP7:%.*]] = sub nsw <2 x i32> [[TMP6]], [[TMP2]]
16f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP8:%.*]] = sitofp <2 x i32> [[TMP7]] to <2 x double>
17f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP9:%.*]] = fdiv <2 x double> [[TMP4]], [[TMP8]]
18f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP10:%.*]] = extractelement <2 x double> [[TMP9]], i32 0
19f135d224SAlexey Bataev; CHECK-NEXT:    [[TMP11:%.*]] = extractelement <2 x double> [[TMP9]], i32 1
20f135d224SAlexey Bataev; CHECK-NEXT:    [[FCMP:%.*]] = fcmp olt double [[TMP11]], [[TMP10]]
21f135d224SAlexey Bataev; CHECK-NEXT:    ret void
22f135d224SAlexey Bataev;
23f135d224SAlexey Bataev  %gep0 = getelementptr inbounds i8, ptr %ptr, i64 328
24f135d224SAlexey Bataev  %gep1 = getelementptr inbounds i8, ptr %ptr, i64 330
25f135d224SAlexey Bataev
26f135d224SAlexey Bataev  %gep3 = getelementptr inbounds i8, ptr %ptr, i64 334
27f135d224SAlexey Bataev  %gep4 = getelementptr inbounds i8, ptr %ptr, i64 336
28f135d224SAlexey Bataev
29f135d224SAlexey Bataev  %ld0 = load i16, ptr %gep0, align 8
30f135d224SAlexey Bataev  %ld1 = load i16, ptr %gep1, align 2
31f135d224SAlexey Bataev
32f135d224SAlexey Bataev  %zext0 = zext i16 %ld0 to i32
33f135d224SAlexey Bataev  %zext1 = zext i16 %ld1 to i32
34f135d224SAlexey Bataev
35f135d224SAlexey Bataev  %xor0 = xor i32 %zext0, 65535
36f135d224SAlexey Bataev  %xor1 = xor i32 %zext1, 65535
37f135d224SAlexey Bataev
38f135d224SAlexey Bataev  %sitofp0 = sitofp i32 %xor0 to double
39f135d224SAlexey Bataev  %sitofp1 = sitofp i32 %xor1 to double
40f135d224SAlexey Bataev
41f135d224SAlexey Bataev  %ld3 = load i16, ptr %gep3, align 2
42f135d224SAlexey Bataev  %ld4 = load i16, ptr %gep4, align 8
43f135d224SAlexey Bataev
44f135d224SAlexey Bataev  %zext3 = zext i16 %ld3 to i32
45f135d224SAlexey Bataev  %zext4 = zext i16 %ld4 to i32
46f135d224SAlexey Bataev
47f135d224SAlexey Bataev  %sub30 = sub nsw i32 %zext3, %zext0
48f135d224SAlexey Bataev  %sub41 = sub nsw i32 %zext4, %zext1
49f135d224SAlexey Bataev
50f135d224SAlexey Bataev  %sitofp30 = sitofp i32 %sub30 to double
51f135d224SAlexey Bataev  %sitofp41 = sitofp i32 %sub41 to double
52f135d224SAlexey Bataev
53f135d224SAlexey Bataev  %fdiv030 = fdiv double %sitofp0, %sitofp30
54f135d224SAlexey Bataev  %fdiv141 = fdiv double %sitofp1, %sitofp41
55f135d224SAlexey Bataev  %fcmp = fcmp olt double %fdiv141, %fdiv030
56f135d224SAlexey Bataev  ret void
57f135d224SAlexey Bataev}
58