xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/insert-element-build-vector-const.ll (revision ebfdd38228d4e21597642301fb75f5b02ff3ee06)
1*ebfdd382SAlexey Bataev; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*ebfdd382SAlexey Bataev; RUN: %if x86-registered-target %{ opt -S -passes=slp-vectorizer -slp-threshold=0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s %}
3*ebfdd382SAlexey Bataev; RUN: %if aarch64-registered-target %{ opt -S -passes=slp-vectorizer -slp-threshold=0 -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s %}
4*ebfdd382SAlexey Bataev
5*ebfdd382SAlexey Bataevdefine <4 x float> @simple_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) {
6*ebfdd382SAlexey Bataev; CHECK-LABEL: @simple_select(
7*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <4 x i32> [[C:%.*]], <4 x i32> poison, <2 x i32> <i32 0, i32 1>
8*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne <2 x i32> [[TMP1]], zeroinitializer
9*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP3:%.*]] = shufflevector <4 x float> [[A:%.*]], <4 x float> poison, <2 x i32> <i32 0, i32 1>
10*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <4 x float> [[B:%.*]], <4 x float> poison, <2 x i32> <i32 0, i32 1>
11*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP5:%.*]] = select <2 x i1> [[TMP2]], <2 x float> [[TMP3]], <2 x float> [[TMP4]]
12*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP7:%.*]] = shufflevector <2 x float> [[TMP5]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
13*ebfdd382SAlexey Bataev; CHECK-NEXT:    [[TMP6:%.*]] = shufflevector <4 x float> <float poison, float poison, float 0.000000e+00, float 0.000000e+00>, <4 x float> [[TMP7]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
14*ebfdd382SAlexey Bataev; CHECK-NEXT:    ret <4 x float> [[TMP6]]
15*ebfdd382SAlexey Bataev;
16*ebfdd382SAlexey Bataev  %c0 = extractelement <4 x i32> %c, i32 0
17*ebfdd382SAlexey Bataev  %c1 = extractelement <4 x i32> %c, i32 1
18*ebfdd382SAlexey Bataev  %a0 = extractelement <4 x float> %a, i32 0
19*ebfdd382SAlexey Bataev  %a1 = extractelement <4 x float> %a, i32 1
20*ebfdd382SAlexey Bataev  %b0 = extractelement <4 x float> %b, i32 0
21*ebfdd382SAlexey Bataev  %b1 = extractelement <4 x float> %b, i32 1
22*ebfdd382SAlexey Bataev  %cmp0 = icmp ne i32 %c0, 0
23*ebfdd382SAlexey Bataev  %cmp1 = icmp ne i32 %c1, 0
24*ebfdd382SAlexey Bataev  %s0 = select i1 %cmp0, float %a0, float %b0
25*ebfdd382SAlexey Bataev  %s1 = select i1 %cmp1, float %a1, float %b1
26*ebfdd382SAlexey Bataev  %ra = insertelement <4 x float> <float poison, float poison, float 0.0, float 0.0>, float %s0, i32 0
27*ebfdd382SAlexey Bataev  %rb = insertelement <4 x float> %ra, float %s1, i32 1
28*ebfdd382SAlexey Bataev  ret <4 x float> %rb
29*ebfdd382SAlexey Bataev}
30