@@ -1675,6 +1675,7 @@ static unsigned SelectOpcodeFromVT(EVT VT, ArrayRef<unsigned> Opcodes) {
1675
1675
return 0 ;
1676
1676
1677
1677
EVT EltVT = VT.getVectorElementType ();
1678
+ unsigned Key = VT.getVectorMinNumElements ();
1678
1679
switch (Kind) {
1679
1680
case SelectTypeKind::AnyType:
1680
1681
break ;
@@ -1688,14 +1689,17 @@ static unsigned SelectOpcodeFromVT(EVT VT, ArrayRef<unsigned> Opcodes) {
1688
1689
return 0 ;
1689
1690
break ;
1690
1691
case SelectTypeKind::FP:
1691
- if (EltVT != MVT::f16 && EltVT != MVT::f32 && EltVT != MVT::f64 )
1692
+ if (EltVT == MVT::bf16 )
1693
+ Key = 16 ;
1694
+ else if (EltVT != MVT::bf16 && EltVT != MVT::f16 && EltVT != MVT::f32 &&
1695
+ EltVT != MVT::f64 )
1692
1696
return 0 ;
1693
1697
break ;
1694
1698
}
1695
1699
1696
1700
unsigned Offset;
1697
- switch (VT. getVectorMinNumElements () ) {
1698
- case 16 : // 8-bit
1701
+ switch (Key ) {
1702
+ case 16 : // 8-bit or bf16
1699
1703
Offset = 0 ;
1700
1704
break ;
1701
1705
case 8 : // 16-bit
@@ -5482,8 +5486,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5482
5486
case Intrinsic::aarch64_sve_fmax_single_x2:
5483
5487
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5484
5488
Node->getValueType (0 ),
5485
- {0 , AArch64::FMAX_VG2_2ZZ_H , AArch64::FMAX_VG2_2ZZ_S ,
5486
- AArch64::FMAX_VG2_2ZZ_D}))
5489
+ {AArch64::BFMAX_VG2_2ZZ_H , AArch64::FMAX_VG2_2ZZ_H ,
5490
+ AArch64::FMAX_VG2_2ZZ_S, AArch64:: FMAX_VG2_2ZZ_D}))
5487
5491
SelectDestructiveMultiIntrinsic (Node, 2 , false , Op);
5488
5492
return ;
5489
5493
case Intrinsic::aarch64_sve_smax_single_x4:
@@ -5503,8 +5507,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5503
5507
case Intrinsic::aarch64_sve_fmax_single_x4:
5504
5508
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5505
5509
Node->getValueType (0 ),
5506
- {0 , AArch64::FMAX_VG4_4ZZ_H , AArch64::FMAX_VG4_4ZZ_S ,
5507
- AArch64::FMAX_VG4_4ZZ_D}))
5510
+ {AArch64::BFMAX_VG4_4ZZ_H , AArch64::FMAX_VG4_4ZZ_H ,
5511
+ AArch64::FMAX_VG4_4ZZ_S, AArch64:: FMAX_VG4_4ZZ_D}))
5508
5512
SelectDestructiveMultiIntrinsic (Node, 4 , false , Op);
5509
5513
return ;
5510
5514
case Intrinsic::aarch64_sve_smin_single_x2:
@@ -5524,8 +5528,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5524
5528
case Intrinsic::aarch64_sve_fmin_single_x2:
5525
5529
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5526
5530
Node->getValueType (0 ),
5527
- {0 , AArch64::FMIN_VG2_2ZZ_H , AArch64::FMIN_VG2_2ZZ_S ,
5528
- AArch64::FMIN_VG2_2ZZ_D}))
5531
+ {AArch64::BFMIN_VG2_2ZZ_H , AArch64::FMIN_VG2_2ZZ_H ,
5532
+ AArch64::FMIN_VG2_2ZZ_S, AArch64:: FMIN_VG2_2ZZ_D}))
5529
5533
SelectDestructiveMultiIntrinsic (Node, 2 , false , Op);
5530
5534
return ;
5531
5535
case Intrinsic::aarch64_sve_smin_single_x4:
@@ -5545,8 +5549,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5545
5549
case Intrinsic::aarch64_sve_fmin_single_x4:
5546
5550
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5547
5551
Node->getValueType (0 ),
5548
- {0 , AArch64::FMIN_VG4_4ZZ_H , AArch64::FMIN_VG4_4ZZ_S ,
5549
- AArch64::FMIN_VG4_4ZZ_D}))
5552
+ {AArch64::BFMIN_VG4_4ZZ_H , AArch64::FMIN_VG4_4ZZ_H ,
5553
+ AArch64::FMIN_VG4_4ZZ_S, AArch64:: FMIN_VG4_4ZZ_D}))
5550
5554
SelectDestructiveMultiIntrinsic (Node, 4 , false , Op);
5551
5555
return ;
5552
5556
case Intrinsic::aarch64_sve_smax_x2:
@@ -5566,8 +5570,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5566
5570
case Intrinsic::aarch64_sve_fmax_x2:
5567
5571
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5568
5572
Node->getValueType (0 ),
5569
- {0 , AArch64::FMAX_VG2_2Z2Z_H , AArch64::FMAX_VG2_2Z2Z_S ,
5570
- AArch64::FMAX_VG2_2Z2Z_D}))
5573
+ {AArch64::BFMAX_VG2_2Z2Z_H , AArch64::FMAX_VG2_2Z2Z_H ,
5574
+ AArch64::FMAX_VG2_2Z2Z_S, AArch64:: FMAX_VG2_2Z2Z_D}))
5571
5575
SelectDestructiveMultiIntrinsic (Node, 2 , true , Op);
5572
5576
return ;
5573
5577
case Intrinsic::aarch64_sve_smax_x4:
@@ -5587,8 +5591,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5587
5591
case Intrinsic::aarch64_sve_fmax_x4:
5588
5592
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5589
5593
Node->getValueType (0 ),
5590
- {0 , AArch64::FMAX_VG4_4Z4Z_H , AArch64::FMAX_VG4_4Z4Z_S ,
5591
- AArch64::FMAX_VG4_4Z4Z_D}))
5594
+ {AArch64::BFMAX_VG4_4Z2Z_H , AArch64::FMAX_VG4_4Z4Z_H ,
5595
+ AArch64::FMAX_VG4_4Z4Z_S, AArch64:: FMAX_VG4_4Z4Z_D}))
5592
5596
SelectDestructiveMultiIntrinsic (Node, 4 , true , Op);
5593
5597
return ;
5594
5598
case Intrinsic::aarch64_sve_smin_x2:
@@ -5608,8 +5612,8 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5608
5612
case Intrinsic::aarch64_sve_fmin_x2:
5609
5613
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5610
5614
Node->getValueType (0 ),
5611
- {0 , AArch64::FMIN_VG2_2Z2Z_H , AArch64::FMIN_VG2_2Z2Z_S ,
5612
- AArch64::FMIN_VG2_2Z2Z_D}))
5615
+ {AArch64::BFMIN_VG2_2Z2Z_H , AArch64::FMIN_VG2_2Z2Z_H ,
5616
+ AArch64::FMIN_VG2_2Z2Z_S, AArch64:: FMIN_VG2_2Z2Z_D}))
5613
5617
SelectDestructiveMultiIntrinsic (Node, 2 , true , Op);
5614
5618
return ;
5615
5619
case Intrinsic::aarch64_sve_smin_x4:
@@ -5629,64 +5633,64 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5629
5633
case Intrinsic::aarch64_sve_fmin_x4:
5630
5634
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5631
5635
Node->getValueType (0 ),
5632
- {0 , AArch64::FMIN_VG4_4Z4Z_H , AArch64::FMIN_VG4_4Z4Z_S ,
5633
- AArch64::FMIN_VG4_4Z4Z_D}))
5636
+ {AArch64::BFMIN_VG4_4Z2Z_H , AArch64::FMIN_VG4_4Z4Z_H ,
5637
+ AArch64::FMIN_VG4_4Z4Z_S, AArch64:: FMIN_VG4_4Z4Z_D}))
5634
5638
SelectDestructiveMultiIntrinsic (Node, 4 , true , Op);
5635
5639
return ;
5636
5640
case Intrinsic::aarch64_sve_fmaxnm_single_x2 :
5637
5641
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5638
5642
Node->getValueType (0 ),
5639
- {0 , AArch64::FMAXNM_VG2_2ZZ_H , AArch64::FMAXNM_VG2_2ZZ_S ,
5640
- AArch64::FMAXNM_VG2_2ZZ_D}))
5643
+ {AArch64::BFMAXNM_VG2_2ZZ_H , AArch64::FMAXNM_VG2_2ZZ_H ,
5644
+ AArch64::FMAXNM_VG2_2ZZ_S, AArch64:: FMAXNM_VG2_2ZZ_D}))
5641
5645
SelectDestructiveMultiIntrinsic (Node, 2 , false , Op);
5642
5646
return ;
5643
5647
case Intrinsic::aarch64_sve_fmaxnm_single_x4 :
5644
5648
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5645
5649
Node->getValueType (0 ),
5646
- {0 , AArch64::FMAXNM_VG4_4ZZ_H , AArch64::FMAXNM_VG4_4ZZ_S ,
5647
- AArch64::FMAXNM_VG4_4ZZ_D}))
5650
+ {AArch64::BFMAXNM_VG4_4ZZ_H , AArch64::FMAXNM_VG4_4ZZ_H ,
5651
+ AArch64::FMAXNM_VG4_4ZZ_S, AArch64:: FMAXNM_VG4_4ZZ_D}))
5648
5652
SelectDestructiveMultiIntrinsic (Node, 4 , false , Op);
5649
5653
return ;
5650
5654
case Intrinsic::aarch64_sve_fminnm_single_x2:
5651
5655
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5652
5656
Node->getValueType (0 ),
5653
- {0 , AArch64::FMINNM_VG2_2ZZ_H , AArch64::FMINNM_VG2_2ZZ_S ,
5654
- AArch64::FMINNM_VG2_2ZZ_D}))
5657
+ {AArch64::BFMINNM_VG2_2ZZ_H , AArch64::FMINNM_VG2_2ZZ_H ,
5658
+ AArch64::FMINNM_VG2_2ZZ_S, AArch64:: FMINNM_VG2_2ZZ_D}))
5655
5659
SelectDestructiveMultiIntrinsic (Node, 2 , false , Op);
5656
5660
return ;
5657
5661
case Intrinsic::aarch64_sve_fminnm_single_x4:
5658
5662
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5659
5663
Node->getValueType (0 ),
5660
- {0 , AArch64::FMINNM_VG4_4ZZ_H , AArch64::FMINNM_VG4_4ZZ_S ,
5661
- AArch64::FMINNM_VG4_4ZZ_D}))
5664
+ {AArch64::BFMINNM_VG4_4ZZ_H , AArch64::FMINNM_VG4_4ZZ_H ,
5665
+ AArch64::FMINNM_VG4_4ZZ_S, AArch64:: FMINNM_VG4_4ZZ_D}))
5662
5666
SelectDestructiveMultiIntrinsic (Node, 4 , false , Op);
5663
5667
return ;
5664
5668
case Intrinsic::aarch64_sve_fmaxnm_x2:
5665
5669
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5666
5670
Node->getValueType (0 ),
5667
- {0 , AArch64::FMAXNM_VG2_2Z2Z_H , AArch64::FMAXNM_VG2_2Z2Z_S ,
5668
- AArch64::FMAXNM_VG2_2Z2Z_D}))
5671
+ {AArch64::BFMAXNM_VG2_2Z2Z_H , AArch64::FMAXNM_VG2_2Z2Z_H ,
5672
+ AArch64::FMAXNM_VG2_2Z2Z_S, AArch64:: FMAXNM_VG2_2Z2Z_D}))
5669
5673
SelectDestructiveMultiIntrinsic (Node, 2 , true , Op);
5670
5674
return ;
5671
5675
case Intrinsic::aarch64_sve_fmaxnm_x4:
5672
5676
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5673
5677
Node->getValueType (0 ),
5674
- {0 , AArch64::FMAXNM_VG4_4Z4Z_H , AArch64::FMAXNM_VG4_4Z4Z_S ,
5675
- AArch64::FMAXNM_VG4_4Z4Z_D}))
5678
+ {AArch64::BFMAXNM_VG4_4Z2Z_H , AArch64::FMAXNM_VG4_4Z4Z_H ,
5679
+ AArch64::FMAXNM_VG4_4Z4Z_S, AArch64:: FMAXNM_VG4_4Z4Z_D}))
5676
5680
SelectDestructiveMultiIntrinsic (Node, 4 , true , Op);
5677
5681
return ;
5678
5682
case Intrinsic::aarch64_sve_fminnm_x2:
5679
5683
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5680
5684
Node->getValueType (0 ),
5681
- {0 , AArch64::FMINNM_VG2_2Z2Z_H , AArch64::FMINNM_VG2_2Z2Z_S ,
5682
- AArch64::FMINNM_VG2_2Z2Z_D}))
5685
+ {AArch64::BFMINNM_VG2_2Z2Z_H , AArch64::FMINNM_VG2_2Z2Z_H ,
5686
+ AArch64::FMINNM_VG2_2Z2Z_S, AArch64:: FMINNM_VG2_2Z2Z_D}))
5683
5687
SelectDestructiveMultiIntrinsic (Node, 2 , true , Op);
5684
5688
return ;
5685
5689
case Intrinsic::aarch64_sve_fminnm_x4:
5686
5690
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::FP>(
5687
5691
Node->getValueType (0 ),
5688
- {0 , AArch64::FMINNM_VG4_4Z4Z_H , AArch64::FMINNM_VG4_4Z4Z_S ,
5689
- AArch64::FMINNM_VG4_4Z4Z_D}))
5692
+ {AArch64::BFMINNM_VG4_4Z2Z_H , AArch64::FMINNM_VG4_4Z4Z_H ,
5693
+ AArch64::FMINNM_VG4_4Z4Z_S, AArch64:: FMINNM_VG4_4Z4Z_D}))
5690
5694
SelectDestructiveMultiIntrinsic (Node, 4 , true , Op);
5691
5695
return ;
5692
5696
case Intrinsic::aarch64_sve_fcvtzs_x2:
0 commit comments