1 /* Verify that the SH2A clips and clipu instructions are generated as
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
6 /* { dg-final { scan-assembler-times "clips.b" 2 } } */
7 /* { dg-final { scan-assembler-times "clips.w" 2 } } */
8 /* { dg-final { scan-assembler-times "clipu.b" 2 } } */
9 /* { dg-final { scan-assembler-times "clipu.w" 2 } } */
27 return max (-128, min (127, a
));
34 return min (127, max (-128, a
));
41 return max (-32768, min (32767, a
));
48 return min (32767, max (-32768, a
));
52 test_04 (unsigned int a
)
55 return a
> 255 ? 255 : a
;
59 test_05 (unsigned int a
)
62 return a
>= 255 ? 255 : a
;
66 test_06 (unsigned int a
)
69 return a
> 65535 ? 65535 : a
;
73 test_07 (unsigned int a
)
76 return a
>= 65535 ? 65535 : a
;
80 test_08 (unsigned short a
, unsigned short b
, unsigned int* r
)
82 /* Must not see a clip insn here -- it is not needed. */
83 unsigned short x
= a
+ b
;