1 /* { dg-do compile } */
2 /* { dg-options "-fdump-rtl-cmpelim -dp" } */
3 /* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
4
5 typedef int __attribute__ ((mode (SI))) int_t;
6 typedef int __attribute__ ((mode (QI))) short_t;
7
8 int_t
9 le_ashrsi (int_t x, short_t y)
10 {
11 x >>= y;
12 if (x <= 0)
13 return x;
14 else
15 return x + 2;
16 }
17
18 /* Expect assembly like:
19
20 mnegb 8(%ap),%r0 # 32 [c=16] *negqi2
21 ashl %r0,4(%ap),%r0 # 33 [c=52] *ashlnegsi3_2_ccnz
22 jleq .L1 # 35 [c=26] *branch_ccnz
23 addl2 $2,%r0 # 31 [c=32] *addsi3
24 .L1:
25
26 */
27
28 /* { dg-final { scan-rtl-dump-times "deleting insn with uid" 1 "cmpelim" } } */
29 /* { dg-final { scan-assembler-not "\t(bit|cmpz?|tst). " } } */
30 /* { dg-final { scan-assembler "ashlnegsi\[^ \]*_ccnz(/\[0-9\]+)?\n" } } */
31 /* { dg-final { scan-assembler "branch_ccnz\n" } } */