@@ -2459,52 +2459,12 @@ bool CodeGenPatternMatch::MatchBranch(llvm::BranchInst& I)
2459
2459
if (!I.isUnconditional ())
2460
2460
{
2461
2461
Value* cond = I.getCondition ();
2462
- ICmpInst* icmp = dyn_cast<ICmpInst>(cond);
2463
- bool predMatched = false ;
2464
-
2465
2462
if (GenIntrinsicInst* intrin = dyn_cast<GenIntrinsicInst>(cond,
2466
2463
GenISAIntrinsic::GenISA_UpdateDiscardMask))
2467
2464
{
2468
2465
pattern->isDiscardBranch = true ;
2469
2466
}
2470
- else if (icmp)
2471
- {
2472
- GenIntrinsicInst* intrin = dyn_cast<GenIntrinsicInst>(
2473
- icmp->getOperand (0 ), GenISAIntrinsic::GenISA_WaveBallot);
2474
- ConstantInt* constCmp = dyn_cast<ConstantInt>(icmp->getOperand (1 ));
2475
-
2476
- if (intrin && constCmp)
2477
- {
2478
- if (icmp->getPredicate () == ICmpInst::ICMP_NE || icmp->getPredicate () == ICmpInst::ICMP_EQ)
2479
- {
2480
- if (constCmp->isZero ())
2481
- {
2482
- pattern->predMode = EPRED_ANY;
2483
- pattern->cond = GetSource (intrin->getArgOperand (0 ), false , false );
2484
- if (icmp->getPredicate () == ICmpInst::ICMP_EQ)
2485
- {
2486
- pattern->cond .mod = EMOD_NOT;
2487
- }
2488
- predMatched = true ;
2489
- }
2490
- else if (constCmp->isMinusOne ())
2491
- {
2492
- pattern->predMode = EPRED_ALL;
2493
- pattern->cond = GetSource (intrin->getArgOperand (0 ), false , false );
2494
- if (icmp->getPredicate () == ICmpInst::ICMP_NE)
2495
- {
2496
- pattern->cond .mod = EMOD_NOT;
2497
- }
2498
- predMatched = true ;
2499
- }
2500
- }
2501
- }
2502
- }
2503
-
2504
- if (!predMatched)
2505
- {
2506
- pattern->cond = GetSource (I.getCondition (), false , false );
2507
- }
2467
+ pattern->cond = GetSource (I.getCondition (), false , false );
2508
2468
}
2509
2469
AddPattern (pattern);
2510
2470
return true ;
@@ -2633,37 +2593,7 @@ bool CodeGenPatternMatch::MatchSelectModifier(llvm::SelectInst& I)
2633
2593
SelectPattern *pattern = new (m_allocator) SelectPattern ();
2634
2594
pattern->predMode = EPRED_NORMAL;
2635
2595
2636
- /* *
2637
- * Match the IR for blend to fill
2638
- * %1 = WaveBallot(i1 %cond) ; return uniform i32
2639
- * %2 = icmp ne i31 %1, i32 0
2640
- * %3 = select i1 %2, i32 %x, i32 %y
2641
- * ->
2642
- * cmp f0.0 ...
2643
- * ifany_f0.0 select ...
2644
- */
2645
- Value* cond = I.getCondition ();
2646
- ICmpInst* icmp = dyn_cast<ICmpInst>(cond);
2647
- bool predMatched = false ;
2648
- if (icmp != nullptr && cond->hasOneUse () &&
2649
- m_WI->whichDepend (cond) == WIAnalysis::UNIFORM &&
2650
- icmp->getPredicate () == ICmpInst::ICMP_NE)
2651
- {
2652
- GenIntrinsicInst* intrin = dyn_cast<GenIntrinsicInst>(
2653
- icmp->getOperand (0 ), GenISAIntrinsic::GenISA_WaveBallot);
2654
- ConstantInt* const0 = dyn_cast<ConstantInt>(icmp->getOperand (1 ));
2655
- if (intrin && const0 && const0->getZExtValue () == 0 )
2656
- {
2657
- pattern->sources [0 ] = GetSource (intrin->getArgOperand (0 ), false , false );
2658
- pattern->predMode = EPRED_ANY;
2659
- predMatched = true ;
2660
- }
2661
- }
2662
-
2663
- if (!predMatched)
2664
- {
2665
- pattern->sources [0 ] = GetSource (I.getCondition (), false , false );
2666
- }
2596
+ pattern->sources [0 ] = GetSource (I.getCondition (), false , false );
2667
2597
pattern->sources [1 ] = GetSource (I.getTrueValue (), true , false );
2668
2598
pattern->sources [2 ] = GetSource (I.getFalseValue (), true , false );
2669
2599
AddPattern (pattern);
0 commit comments