1 ; Test that this transform works: 2 ; udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) 3 ; 4 ; RUN: opt < %s -instcombine -S -o %t 5 ; RUN: not grep select %t 6 ; RUN: grep lshr %t | count 2 7 ; RUN: not grep udiv %t 8 9 define i64 @test(i64 %X, i1 %Cond ) { 10 entry: 11 %divisor1 = select i1 %Cond, i64 16, i64 8 12 %quotient1 = udiv i64 %X, %divisor1 13 %divisor2 = select i1 %Cond, i64 8, i64 0 14 %quotient2 = udiv i64 %X, %divisor2 15 %sum = add i64 %quotient1, %quotient2 16 ret i64 %sum 17 } 18