Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 8c88727

Browse files
committed
[SLPVectorizer][X86] Tests to show missed buildvector sitofp/fptosi vectorizations
e.g. buildvector(sitofp(i32), sitofp(i32), sitofp(i32), sitofp(i32)) --> sitofp(buildvector(i32, i32, i32, i32)) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288807 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 91bc1bb commit 8c88727

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

test/Transforms/SLPVectorizer/X86/fptosi.ll

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,4 +489,54 @@ define void @fptosi_8f32_8i8() #0 {
489489
ret void
490490
}
491491

492+
;
493+
; FPTOSI BUILDVECTOR
494+
;
495+
496+
define <4 x i32> @fptosi_4xf64_4i32(double %a0, double %a1, double %a2, double %a3) #0 {
497+
; CHECK-LABEL: @fptosi_4xf64_4i32(
498+
; CHECK-NEXT: [[CVT0:%.*]] = fptosi double %a0 to i32
499+
; CHECK-NEXT: [[CVT1:%.*]] = fptosi double %a1 to i32
500+
; CHECK-NEXT: [[CVT2:%.*]] = fptosi double %a2 to i32
501+
; CHECK-NEXT: [[CVT3:%.*]] = fptosi double %a3 to i32
502+
; CHECK-NEXT: [[RES0:%.*]] = insertelement <4 x i32> undef, i32 [[CVT0]], i32 0
503+
; CHECK-NEXT: [[RES1:%.*]] = insertelement <4 x i32> [[RES0]], i32 [[CVT1]], i32 1
504+
; CHECK-NEXT: [[RES2:%.*]] = insertelement <4 x i32> [[RES1]], i32 [[CVT2]], i32 2
505+
; CHECK-NEXT: [[RES3:%.*]] = insertelement <4 x i32> [[RES2]], i32 [[CVT3]], i32 3
506+
; CHECK-NEXT: ret <4 x i32> [[RES3]]
507+
;
508+
%cvt0 = fptosi double %a0 to i32
509+
%cvt1 = fptosi double %a1 to i32
510+
%cvt2 = fptosi double %a2 to i32
511+
%cvt3 = fptosi double %a3 to i32
512+
%res0 = insertelement <4 x i32> undef, i32 %cvt0, i32 0
513+
%res1 = insertelement <4 x i32> %res0, i32 %cvt1, i32 1
514+
%res2 = insertelement <4 x i32> %res1, i32 %cvt2, i32 2
515+
%res3 = insertelement <4 x i32> %res2, i32 %cvt3, i32 3
516+
ret <4 x i32> %res3
517+
}
518+
519+
define <4 x i32> @fptosi_4xf32_4i32(float %a0, float %a1, float %a2, float %a3) #0 {
520+
; CHECK-LABEL: @fptosi_4xf32_4i32(
521+
; CHECK-NEXT: [[CVT0:%.*]] = fptosi float %a0 to i32
522+
; CHECK-NEXT: [[CVT1:%.*]] = fptosi float %a1 to i32
523+
; CHECK-NEXT: [[CVT2:%.*]] = fptosi float %a2 to i32
524+
; CHECK-NEXT: [[CVT3:%.*]] = fptosi float %a3 to i32
525+
; CHECK-NEXT: [[RES0:%.*]] = insertelement <4 x i32> undef, i32 [[CVT0]], i32 0
526+
; CHECK-NEXT: [[RES1:%.*]] = insertelement <4 x i32> [[RES0]], i32 [[CVT1]], i32 1
527+
; CHECK-NEXT: [[RES2:%.*]] = insertelement <4 x i32> [[RES1]], i32 [[CVT2]], i32 2
528+
; CHECK-NEXT: [[RES3:%.*]] = insertelement <4 x i32> [[RES2]], i32 [[CVT3]], i32 3
529+
; CHECK-NEXT: ret <4 x i32> [[RES3]]
530+
;
531+
%cvt0 = fptosi float %a0 to i32
532+
%cvt1 = fptosi float %a1 to i32
533+
%cvt2 = fptosi float %a2 to i32
534+
%cvt3 = fptosi float %a3 to i32
535+
%res0 = insertelement <4 x i32> undef, i32 %cvt0, i32 0
536+
%res1 = insertelement <4 x i32> %res0, i32 %cvt1, i32 1
537+
%res2 = insertelement <4 x i32> %res1, i32 %cvt2, i32 2
538+
%res3 = insertelement <4 x i32> %res2, i32 %cvt3, i32 3
539+
ret <4 x i32> %res3
540+
}
541+
492542
attributes #0 = { nounwind }

test/Transforms/SLPVectorizer/X86/sitofp.ll

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,4 +1175,54 @@ define void @sitofp_16i8_16f32() #0 {
11751175
ret void
11761176
}
11771177

1178+
;
1179+
; SITOFP BUILDVECTOR
1180+
;
1181+
1182+
define <4 x double> @sitofp_4xi32_4f64(i32 %a0, i32 %a1, i32 %a2, i32 %a3) #0 {
1183+
; CHECK-LABEL: @sitofp_4xi32_4f64(
1184+
; CHECK-NEXT: [[CVT0:%.*]] = sitofp i32 %a0 to double
1185+
; CHECK-NEXT: [[CVT1:%.*]] = sitofp i32 %a1 to double
1186+
; CHECK-NEXT: [[CVT2:%.*]] = sitofp i32 %a2 to double
1187+
; CHECK-NEXT: [[CVT3:%.*]] = sitofp i32 %a3 to double
1188+
; CHECK-NEXT: [[RES0:%.*]] = insertelement <4 x double> undef, double [[CVT0]], i32 0
1189+
; CHECK-NEXT: [[RES1:%.*]] = insertelement <4 x double> [[RES0]], double [[CVT1]], i32 1
1190+
; CHECK-NEXT: [[RES2:%.*]] = insertelement <4 x double> [[RES1]], double [[CVT2]], i32 2
1191+
; CHECK-NEXT: [[RES3:%.*]] = insertelement <4 x double> [[RES2]], double [[CVT3]], i32 3
1192+
; CHECK-NEXT: ret <4 x double> [[RES3]]
1193+
;
1194+
%cvt0 = sitofp i32 %a0 to double
1195+
%cvt1 = sitofp i32 %a1 to double
1196+
%cvt2 = sitofp i32 %a2 to double
1197+
%cvt3 = sitofp i32 %a3 to double
1198+
%res0 = insertelement <4 x double> undef, double %cvt0, i32 0
1199+
%res1 = insertelement <4 x double> %res0, double %cvt1, i32 1
1200+
%res2 = insertelement <4 x double> %res1, double %cvt2, i32 2
1201+
%res3 = insertelement <4 x double> %res2, double %cvt3, i32 3
1202+
ret <4 x double> %res3
1203+
}
1204+
1205+
define <4 x float> @sitofp_4xi32_4f32(i32 %a0, i32 %a1, i32 %a2, i32 %a3) #0 {
1206+
; CHECK-LABEL: @sitofp_4xi32_4f32(
1207+
; CHECK-NEXT: [[CVT0:%.*]] = sitofp i32 %a0 to float
1208+
; CHECK-NEXT: [[CVT1:%.*]] = sitofp i32 %a1 to float
1209+
; CHECK-NEXT: [[CVT2:%.*]] = sitofp i32 %a2 to float
1210+
; CHECK-NEXT: [[CVT3:%.*]] = sitofp i32 %a3 to float
1211+
; CHECK-NEXT: [[RES0:%.*]] = insertelement <4 x float> undef, float [[CVT0]], i32 0
1212+
; CHECK-NEXT: [[RES1:%.*]] = insertelement <4 x float> [[RES0]], float [[CVT1]], i32 1
1213+
; CHECK-NEXT: [[RES2:%.*]] = insertelement <4 x float> [[RES1]], float [[CVT2]], i32 2
1214+
; CHECK-NEXT: [[RES3:%.*]] = insertelement <4 x float> [[RES2]], float [[CVT3]], i32 3
1215+
; CHECK-NEXT: ret <4 x float> [[RES3]]
1216+
;
1217+
%cvt0 = sitofp i32 %a0 to float
1218+
%cvt1 = sitofp i32 %a1 to float
1219+
%cvt2 = sitofp i32 %a2 to float
1220+
%cvt3 = sitofp i32 %a3 to float
1221+
%res0 = insertelement <4 x float> undef, float %cvt0, i32 0
1222+
%res1 = insertelement <4 x float> %res0, float %cvt1, i32 1
1223+
%res2 = insertelement <4 x float> %res1, float %cvt2, i32 2
1224+
%res3 = insertelement <4 x float> %res2, float %cvt3, i32 3
1225+
ret <4 x float> %res3
1226+
}
1227+
11781228
attributes #0 = { nounwind }

0 commit comments

Comments
 (0)