1 ; RUN: opt -instcombine %s -S | FileCheck %s
3 ; Check that code corresponding to the following C function is
4 ; simplified into a single ASR operation:
6 ; int test_asr(int a, int b) {
7 ; return a < 0 ? -(-a - 1 >> b) - 1 : a >> b;
10 define i32 @test_asr(i32 %a, i32 %b) {
12 %c = icmp slt i32 %a, 0
13 br i1 %c, label %bb2, label %bb3
18 %d = ashr i32 %not, %b
20 %not2 = sub i32 %t2, 1
26 %f = phi i32 [ %not2, %bb2 ], [ %e, %bb3 ]
30 ; CHECK: %f = ashr i32 %a, %b