1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64-unknown -basicaa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=SSE
3 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=slm -basicaa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=SLM
4 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -basicaa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX1
5 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -basicaa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2
6 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=knl -basicaa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512F
7 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skx -basicaa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=AVX512BW
9 define <8 x float> @ceil_floor(<8 x float> %a) {
10 ; CHECK-LABEL: @ceil_floor(
11 ; CHECK-NEXT: [[A0:%.*]] = extractelement <8 x float> [[A:%.*]], i32 0
12 ; CHECK-NEXT: [[A1:%.*]] = extractelement <8 x float> [[A]], i32 1
13 ; CHECK-NEXT: [[A2:%.*]] = extractelement <8 x float> [[A]], i32 2
14 ; CHECK-NEXT: [[A3:%.*]] = extractelement <8 x float> [[A]], i32 3
15 ; CHECK-NEXT: [[A4:%.*]] = extractelement <8 x float> [[A]], i32 4
16 ; CHECK-NEXT: [[A5:%.*]] = extractelement <8 x float> [[A]], i32 5
17 ; CHECK-NEXT: [[A6:%.*]] = extractelement <8 x float> [[A]], i32 6
18 ; CHECK-NEXT: [[A7:%.*]] = extractelement <8 x float> [[A]], i32 7
19 ; CHECK-NEXT: [[AB0:%.*]] = call float @llvm.ceil.f32(float [[A0]])
20 ; CHECK-NEXT: [[AB1:%.*]] = call float @llvm.floor.f32(float [[A1]])
21 ; CHECK-NEXT: [[AB2:%.*]] = call float @llvm.floor.f32(float [[A2]])
22 ; CHECK-NEXT: [[AB3:%.*]] = call float @llvm.ceil.f32(float [[A3]])
23 ; CHECK-NEXT: [[AB4:%.*]] = call float @llvm.ceil.f32(float [[A4]])
24 ; CHECK-NEXT: [[AB5:%.*]] = call float @llvm.ceil.f32(float [[A5]])
25 ; CHECK-NEXT: [[AB6:%.*]] = call float @llvm.floor.f32(float [[A6]])
26 ; CHECK-NEXT: [[AB7:%.*]] = call float @llvm.floor.f32(float [[A7]])
27 ; CHECK-NEXT: [[R0:%.*]] = insertelement <8 x float> undef, float [[AB0]], i32 0
28 ; CHECK-NEXT: [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[AB1]], i32 1
29 ; CHECK-NEXT: [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[AB2]], i32 2
30 ; CHECK-NEXT: [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[AB3]], i32 3
31 ; CHECK-NEXT: [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
32 ; CHECK-NEXT: [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
33 ; CHECK-NEXT: [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
34 ; CHECK-NEXT: [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
35 ; CHECK-NEXT: ret <8 x float> [[R7]]
37 %a0 = extractelement <8 x float> %a, i32 0
38 %a1 = extractelement <8 x float> %a, i32 1
39 %a2 = extractelement <8 x float> %a, i32 2
40 %a3 = extractelement <8 x float> %a, i32 3
41 %a4 = extractelement <8 x float> %a, i32 4
42 %a5 = extractelement <8 x float> %a, i32 5
43 %a6 = extractelement <8 x float> %a, i32 6
44 %a7 = extractelement <8 x float> %a, i32 7
45 %ab0 = call float @llvm.ceil.f32(float %a0)
46 %ab1 = call float @llvm.floor.f32(float %a1)
47 %ab2 = call float @llvm.floor.f32(float %a2)
48 %ab3 = call float @llvm.ceil.f32(float %a3)
49 %ab4 = call float @llvm.ceil.f32(float %a4)
50 %ab5 = call float @llvm.ceil.f32(float %a5)
51 %ab6 = call float @llvm.floor.f32(float %a6)
52 %ab7 = call float @llvm.floor.f32(float %a7)
53 %r0 = insertelement <8 x float> undef, float %ab0, i32 0
54 %r1 = insertelement <8 x float> %r0, float %ab1, i32 1
55 %r2 = insertelement <8 x float> %r1, float %ab2, i32 2
56 %r3 = insertelement <8 x float> %r2, float %ab3, i32 3
57 %r4 = insertelement <8 x float> %r3, float %ab4, i32 4
58 %r5 = insertelement <8 x float> %r4, float %ab5, i32 5
59 %r6 = insertelement <8 x float> %r5, float %ab6, i32 6
60 %r7 = insertelement <8 x float> %r6, float %ab7, i32 7
64 declare float @llvm.ceil.f32(float)
65 declare float @llvm.floor.f32(float)