@@ -153,8 +153,8 @@ define <2 x i64> @shl_constant_op0_not_undef_lane(i64 %x) {
153153define <2 x i64 > @shl_constant_op0_load (ptr %p ) {
154154; CHECK-LABEL: @shl_constant_op0_load(
155155; CHECK-NEXT: [[LD:%.*]] = load i64, ptr [[P:%.*]], align 8
156- ; CHECK-NEXT: [[INS :%.*]] = insertelement <2 x i64> undef, i64 [[LD]], i32 1
157- ; CHECK-NEXT: [[BO:%.*]] = shl <2 x i64> <i64 undef , i64 2>, [[INS]]
156+ ; CHECK-NEXT: [[BO_SCALAR :%.*]] = shl i64 2, [[LD]]
157+ ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x i64> poison , i64 [[BO_SCALAR]], i64 1
158158; CHECK-NEXT: ret <2 x i64> [[BO]]
159159;
160160 %ld = load i64 , ptr %p
@@ -204,8 +204,8 @@ define <2 x i64> @shl_constant_op1_not_undef_lane(i64 %x) {
204204define <2 x i64 > @shl_constant_op1_load (ptr %p ) {
205205; CHECK-LABEL: @shl_constant_op1_load(
206206; CHECK-NEXT: [[LD:%.*]] = load i64, ptr [[P:%.*]], align 8
207- ; CHECK-NEXT: [[INS :%.*]] = insertelement <2 x i64> undef, i64 [[LD]], i32 0
208- ; CHECK-NEXT: [[BO:%.*]] = shl nuw <2 x i64> [[INS ]], < i64 5, i64 2>
207+ ; CHECK-NEXT: [[BO_SCALAR :%.*]] = shl nuw i64 [[LD]], 5
208+ ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x i64> zeroinitializer, i64 [[BO_SCALAR ]], i64 0
209209; CHECK-NEXT: ret <2 x i64> [[BO]]
210210;
211211 %ld = load i64 , ptr %p
@@ -479,21 +479,31 @@ define <2 x i64> @sdiv_constant_op1_not_undef_lane(i64 %x) {
479479}
480480
481481define <2 x i64 > @and_constant (i64 %x ) {
482- ; CHECK-LABEL: @and_constant(
483- ; CHECK-NEXT: [[BO_SCALAR:%.*]] = and i64 [[X:%.*]], 42
484- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x i64> <i64 0, i64 undef>, i64 [[BO_SCALAR]], i64 0
485- ; CHECK-NEXT: ret <2 x i64> [[BO]]
482+ ; SSE-LABEL: @and_constant(
483+ ; SSE-NEXT: [[INS:%.*]] = insertelement <2 x i64> undef, i64 [[X:%.*]], i32 0
484+ ; SSE-NEXT: [[BO:%.*]] = and <2 x i64> [[INS]], <i64 42, i64 undef>
485+ ; SSE-NEXT: ret <2 x i64> [[BO]]
486+ ;
487+ ; AVX-LABEL: @and_constant(
488+ ; AVX-NEXT: [[BO_SCALAR:%.*]] = and i64 [[X:%.*]], 42
489+ ; AVX-NEXT: [[BO:%.*]] = insertelement <2 x i64> <i64 0, i64 undef>, i64 [[BO_SCALAR]], i64 0
490+ ; AVX-NEXT: ret <2 x i64> [[BO]]
486491;
487492 %ins = insertelement <2 x i64 > undef , i64 %x , i32 0
488493 %bo = and <2 x i64 > %ins , <i64 42 , i64 undef >
489494 ret <2 x i64 > %bo
490495}
491496
492497define <2 x i64 > @and_constant_not_undef_lane (i64 %x ) {
493- ; CHECK-LABEL: @and_constant_not_undef_lane(
494- ; CHECK-NEXT: [[BO_SCALAR:%.*]] = and i64 [[X:%.*]], 42
495- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x i64> zeroinitializer, i64 [[BO_SCALAR]], i64 0
496- ; CHECK-NEXT: ret <2 x i64> [[BO]]
498+ ; SSE-LABEL: @and_constant_not_undef_lane(
499+ ; SSE-NEXT: [[INS:%.*]] = insertelement <2 x i64> undef, i64 [[X:%.*]], i32 0
500+ ; SSE-NEXT: [[BO:%.*]] = and <2 x i64> [[INS]], <i64 42, i64 -42>
501+ ; SSE-NEXT: ret <2 x i64> [[BO]]
502+ ;
503+ ; AVX-LABEL: @and_constant_not_undef_lane(
504+ ; AVX-NEXT: [[BO_SCALAR:%.*]] = and i64 [[X:%.*]], 42
505+ ; AVX-NEXT: [[BO:%.*]] = insertelement <2 x i64> zeroinitializer, i64 [[BO_SCALAR]], i64 0
506+ ; AVX-NEXT: ret <2 x i64> [[BO]]
497507;
498508 %ins = insertelement <2 x i64 > undef , i64 %x , i32 0
499509 %bo = and <2 x i64 > %ins , <i64 42 , i64 -42 >
@@ -523,10 +533,15 @@ define <2 x i64> @or_constant_not_undef_lane(i64 %x) {
523533}
524534
525535define <2 x i64 > @xor_constant (i64 %x ) {
526- ; CHECK-LABEL: @xor_constant(
527- ; CHECK-NEXT: [[BO_SCALAR:%.*]] = xor i64 [[X:%.*]], 42
528- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x i64> <i64 undef, i64 0>, i64 [[BO_SCALAR]], i64 0
529- ; CHECK-NEXT: ret <2 x i64> [[BO]]
536+ ; SSE-LABEL: @xor_constant(
537+ ; SSE-NEXT: [[INS:%.*]] = insertelement <2 x i64> undef, i64 [[X:%.*]], i32 0
538+ ; SSE-NEXT: [[BO:%.*]] = xor <2 x i64> [[INS]], <i64 42, i64 undef>
539+ ; SSE-NEXT: ret <2 x i64> [[BO]]
540+ ;
541+ ; AVX-LABEL: @xor_constant(
542+ ; AVX-NEXT: [[BO_SCALAR:%.*]] = xor i64 [[X:%.*]], 42
543+ ; AVX-NEXT: [[BO:%.*]] = insertelement <2 x i64> <i64 undef, i64 0>, i64 [[BO_SCALAR]], i64 0
544+ ; AVX-NEXT: ret <2 x i64> [[BO]]
530545;
531546 %ins = insertelement <2 x i64 > undef , i64 %x , i32 0
532547 %bo = xor <2 x i64 > %ins , <i64 42 , i64 undef >
@@ -546,8 +561,8 @@ define <2 x i64> @xor_constant_not_undef_lane(i64 %x) {
546561
547562define <2 x double > @fadd_constant (double %x ) {
548563; CHECK-LABEL: @fadd_constant(
549- ; CHECK-NEXT: [[BO_SCALAR :%.*]] = fadd double [[X:%.*]], 4.200000e+01
550- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000 , double undef>, double [[BO_SCALAR]], i64 0
564+ ; CHECK-NEXT: [[INS :%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
565+ ; CHECK-NEXT: [[BO:%.*]] = fadd <2 x double> [[INS]], <double 4.200000e+01 , double undef>
551566; CHECK-NEXT: ret <2 x double> [[BO]]
552567;
553568 %ins = insertelement <2 x double > undef , double %x , i32 0
@@ -568,8 +583,8 @@ define <2 x double> @fadd_constant_not_undef_lane(double %x) {
568583
569584define <2 x double > @fsub_constant_op0 (double %x ) {
570585; CHECK-LABEL: @fsub_constant_op0(
571- ; CHECK-NEXT: [[BO_SCALAR :%.*]] = fsub fast double 4.200000e+01, [[X:%.*]]
572- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000 , double undef>, double [[BO_SCALAR]], i64 0
586+ ; CHECK-NEXT: [[INS :%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
587+ ; CHECK-NEXT: [[BO:%.*]] = fsub fast <2 x double> <double 4.200000e+01 , double undef>, [[INS]]
573588; CHECK-NEXT: ret <2 x double> [[BO]]
574589;
575590 %ins = insertelement <2 x double > undef , double %x , i32 0
@@ -601,8 +616,8 @@ define <2 x double> @fsub_constant_op1(double %x) {
601616
602617define <2 x double > @fsub_constant_op1_not_undef_lane (double %x ) {
603618; CHECK-LABEL: @fsub_constant_op1_not_undef_lane(
604- ; CHECK-NEXT: [[BO_SCALAR :%.*]] = fsub double [[X:%.*]], 4.200000e+01
605- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> splat (double 0x7FF8000000000000), double [[BO_SCALAR ]], i64 0
619+ ; CHECK-NEXT: [[INS :%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
620+ ; CHECK-NEXT: [[BO:%.*]] = fsub <2 x double> [[INS ]], <double 4.200000e+01, double -4.200000e+01>
606621; CHECK-NEXT: ret <2 x double> [[BO]]
607622;
608623 %ins = insertelement <2 x double > undef , double %x , i32 0
@@ -612,8 +627,8 @@ define <2 x double> @fsub_constant_op1_not_undef_lane(double %x) {
612627
613628define <2 x double > @fmul_constant (double %x ) {
614629; CHECK-LABEL: @fmul_constant(
615- ; CHECK-NEXT: [[BO_SCALAR :%.*]] = fmul reassoc double [[X:%.*]], 4.200000e+01
616- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000 , double undef>, double [[BO_SCALAR]], i64 0
630+ ; CHECK-NEXT: [[INS :%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
631+ ; CHECK-NEXT: [[BO:%.*]] = fmul reassoc <2 x double> [[INS]], <double 4.200000e+01 , double undef>
617632; CHECK-NEXT: ret <2 x double> [[BO]]
618633;
619634 %ins = insertelement <2 x double > undef , double %x , i32 0
@@ -644,32 +659,47 @@ define <2 x double> @fdiv_constant_op0(double %x) {
644659}
645660
646661define <2 x double > @fdiv_constant_op0_not_undef_lane (double %x ) {
647- ; CHECK-LABEL: @fdiv_constant_op0_not_undef_lane(
648- ; CHECK-NEXT: [[BO_SCALAR:%.*]] = fdiv ninf double 4.200000e+01, [[X:%.*]]
649- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> splat (double 0x7FF8000000000000), double [[BO_SCALAR]], i64 0
650- ; CHECK-NEXT: ret <2 x double> [[BO]]
662+ ; SSE-LABEL: @fdiv_constant_op0_not_undef_lane(
663+ ; SSE-NEXT: [[BO_SCALAR:%.*]] = fdiv ninf double 4.200000e+01, [[X:%.*]]
664+ ; SSE-NEXT: [[BO:%.*]] = insertelement <2 x double> splat (double 0x7FF8000000000000), double [[BO_SCALAR]], i64 0
665+ ; SSE-NEXT: ret <2 x double> [[BO]]
666+ ;
667+ ; AVX-LABEL: @fdiv_constant_op0_not_undef_lane(
668+ ; AVX-NEXT: [[INS:%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
669+ ; AVX-NEXT: [[BO:%.*]] = fdiv ninf <2 x double> <double 4.200000e+01, double -4.200000e+01>, [[INS]]
670+ ; AVX-NEXT: ret <2 x double> [[BO]]
651671;
652672 %ins = insertelement <2 x double > undef , double %x , i32 0
653673 %bo = fdiv ninf <2 x double > <double 42 .0 , double -42 .0 >, %ins
654674 ret <2 x double > %bo
655675}
656676
657677define <2 x double > @fdiv_constant_op1 (double %x ) {
658- ; CHECK-LABEL: @fdiv_constant_op1(
659- ; CHECK-NEXT: [[BO_SCALAR:%.*]] = fdiv double [[X:%.*]], 4.200000e+01
660- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
661- ; CHECK-NEXT: ret <2 x double> [[BO]]
678+ ; SSE-LABEL: @fdiv_constant_op1(
679+ ; SSE-NEXT: [[BO_SCALAR:%.*]] = fdiv double [[X:%.*]], 4.200000e+01
680+ ; SSE-NEXT: [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
681+ ; SSE-NEXT: ret <2 x double> [[BO]]
682+ ;
683+ ; AVX-LABEL: @fdiv_constant_op1(
684+ ; AVX-NEXT: [[INS:%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
685+ ; AVX-NEXT: [[BO:%.*]] = fdiv <2 x double> [[INS]], <double 4.200000e+01, double undef>
686+ ; AVX-NEXT: ret <2 x double> [[BO]]
662687;
663688 %ins = insertelement <2 x double > undef , double %x , i32 0
664689 %bo = fdiv <2 x double > %ins , <double 42 .0 , double undef >
665690 ret <2 x double > %bo
666691}
667692
668693define <2 x double > @fdiv_constant_op1_not_undef_lane (double %x ) {
669- ; CHECK-LABEL: @fdiv_constant_op1_not_undef_lane(
670- ; CHECK-NEXT: [[BO_SCALAR:%.*]] = fdiv double [[X:%.*]], 4.200000e+01
671- ; CHECK-NEXT: [[BO:%.*]] = insertelement <2 x double> splat (double 0x7FF8000000000000), double [[BO_SCALAR]], i64 0
672- ; CHECK-NEXT: ret <2 x double> [[BO]]
694+ ; SSE-LABEL: @fdiv_constant_op1_not_undef_lane(
695+ ; SSE-NEXT: [[BO_SCALAR:%.*]] = fdiv double [[X:%.*]], 4.200000e+01
696+ ; SSE-NEXT: [[BO:%.*]] = insertelement <2 x double> splat (double 0x7FF8000000000000), double [[BO_SCALAR]], i64 0
697+ ; SSE-NEXT: ret <2 x double> [[BO]]
698+ ;
699+ ; AVX-LABEL: @fdiv_constant_op1_not_undef_lane(
700+ ; AVX-NEXT: [[INS:%.*]] = insertelement <2 x double> undef, double [[X:%.*]], i32 0
701+ ; AVX-NEXT: [[BO:%.*]] = fdiv <2 x double> [[INS]], <double 4.200000e+01, double -4.200000e+01>
702+ ; AVX-NEXT: ret <2 x double> [[BO]]
673703;
674704 %ins = insertelement <2 x double > undef , double %x , i32 0
675705 %bo = fdiv <2 x double > %ins , <double 42 .0 , double -42 .0 >
0 commit comments