1; RUN: opt -instcombine -S < %s | FileCheck %s 2 3; Check that code corresponding to the following C function is 4; simplified into a single ASR operation: 5; 6; int test_asr(int a, int b) { 7; return a < 0 ? -(-a - 1 >> b) - 1 : a >> b; 8; } 9; 10define i32 @test_asr(i32 %a, i32 %b) { 11entry: 12 %c = icmp slt i32 %a, 0 13 br i1 %c, label %bb2, label %bb3 14 15bb2: 16 %t1 = sub i32 0, %a 17 %not = sub i32 %t1, 1 18 %d = ashr i32 %not, %b 19 %t2 = sub i32 0, %d 20 %not2 = sub i32 %t2, 1 21 br label %bb4 22bb3: 23 %e = ashr i32 %a, %b 24 br label %bb4 25bb4: 26 %f = phi i32 [ %not2, %bb2 ], [ %e, %bb3 ] 27 ret i32 %f 28; CHECK-LABEL: @test_asr( 29; CHECK: bb4: 30; CHECK: %f = ashr i32 %a, %b 31; CHECK: ret i32 %f 32} 33