xref: /llvm-project/llvm/test/CodeGen/DirectX/min_vec_size.ll (revision 89e02c7aea339a0120f5e0c0c3f6608fb88912aa)
1; RUN: opt -S -passes=vector-combine < %s | FileCheck %s
2
3target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
4target triple = "dxil-unknown-shadermodel6.7-library"
5
6; Make sure vec combine min vec size is 1 instead of 4 for float.
7; CHECK:@foo()
8; CHECK-NEXT:%[[LD:[0-9]+]] = load <1 x float>, ptr @a, align 8
9; CHECK-NEXT:%insert = shufflevector <1 x float> %[[LD]], <1 x float> poison, <2 x i32> <i32 0, i32 poison>
10; CHECK-NEXT:%shuffle = shufflevector <2 x float> %insert, <2 x float> poison, <2 x i32> zeroinitializer
11; CHECK-NEXT:ret <2 x float> %shuffle
12
13@a = external local_unnamed_addr constant float
14
15; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
16define noundef <2 x float> @foo() local_unnamed_addr {
17  %1 = load float, ptr @a, align 8
18  %insert = insertelement <2 x float> poison, float %1, i64 0
19  %shuffle = shufflevector <2 x float> %insert, <2 x float> poison, <2 x i32> zeroinitializer
20  ret <2 x float> %shuffle
21}
22