typedef __INT8_TYPE__ int8_t;
typedef uint8_t pixel;
+#define MSB (__CHAR_BIT__ * __SIZEOF_INT__ - 1)
+
/* get the sign of input variable (TODO: this is a dup, make common) */
static inline int8_t signOf(int x)
{
- return (x >> 31) | ((int)((((uint32_t)-x)) >> 31));
+ return (x >> MSB) | ((int)((((uint32_t)-x)) >> MSB));
}
__attribute__((noipa))
/* { dg-do run } */
+#if __SIZEOF_INT__ < 4
+#define Xint __INT32_TYPE__
+#else
+#define Xint int
+#endif
+
int printf(const char *, ...);
void abort ();
/* We need an abort that isn't noreturn. */
int a, g, h, i, v, w = 2, x, y, ab, ac, ad, ae, af, ag;
static int f, j, m, n, p, r, u, aa;
struct b {
- int c : 20;
- int d : 20;
+ Xint c : 20;
+ Xint d : 20;
int e : 10;
};
static struct b l, o, q = {3, 3, 5};
of `(a & b) CMP a` and `(a | b) CMP a`
which can be optimized to 1. */
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
/* For `&`, the non-negativeness of b is not taken into account. */
int f_and_le(int len) {
of `(a & b) CMP a` and `(a | b) CMP a`
which can be optimized to 0. */
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
/* For `&`, the non-negativeness of b is not taken into account. */
int f_and_gt(int len) {
len &= 0xfffff;
#define PREC (__CHAR_BIT__)
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
int clz_complement_count1 (unsigned char b) {
int c = 0;
#define PREC (__CHAR_BIT__)
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
int clz_count1 (unsigned char b) {
int c = 0;
else if (a == 10)
global2 = 12345;
else if (a == 1)
- global2 = 123456;
+ global2 = 23456;
}
}
/* PR tree-optimization/88702 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-iftoswitch-optimized" } */
+/* { dg-additional-options "--param=case-values-threshold=3" { target { avr-*-* } } } */
int IsHTMLWhitespace(int aChar) {
return aChar == 0x0009 || aChar == 0x000A ||
DEF(1, unsigned, unsigned long long)
DEF(2, double, float)
-/* { dg-final { scan-tree-dump-times "negate_expr" 6 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "negate_expr" 6 "optimized" { target { large_double } } } } */
+/* { dg-final { scan-tree-dump-times "negate_expr" 4 "optimized" { target { ! large_double } } } } */
/* Test to make sure unrelated arguments and comparisons
don't get optimized incorrectly. */
-unsigned short test_bswap16(unsigned short x, unsigned short y)
+__UINT16_TYPE__ short test_bswap16(__UINT16_TYPE__ x, __UINT16_TYPE__ y)
{
return x ? __builtin_bswap16(y) : 0;
}
-unsigned int test_bswap32(unsigned int x, unsigned int y)
+__UINT32_TYPE__ test_bswap32(__UINT32_TYPE__ x, __UINT32_TYPE__ y)
{
return x ? __builtin_bswap32(y) : 0;
}
-unsigned long long test_bswap64(unsigned long long x, unsigned long long y)
+__UINT64_TYPE__ test_bswap64(__UINT64_TYPE__ x, __UINT64_TYPE__ y)
{
return x ? __builtin_bswap64(y) : 0;
}
#define PREC (__CHAR_BIT__)
-int count1 (unsigned char b) {
+__INT32_TYPE__ count1 (unsigned char b) {
int c = 0;
while (b) {
return 34567;
}
-int count2 (unsigned char b) {
+__INT32_TYPE__ count2 (unsigned char b) {
int c = 0;
while (b) {
a = 1;
for (; a; a++) {
{
- long b = j, d = h;
+ __INTPTR_TYPE__ b = j, d = h;
int c = 0;
while (d--)
*(char *)b++ = c;
const unsigned short *n[65];
g = &n[4];
k || l();
- long a = k;
+ __INTPTR_TYPE__ a = k;
char i = 0;
unsigned long j = k;
while (j--)
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
-extern int x;
+extern __INT32_TYPE__ x;
void foo(void)
{
- int a = __builtin_bswap32(x);
+ __INT32_TYPE__ a = __builtin_bswap32(x);
a &= 0x5a5b5c5d;
x = __builtin_bswap32(a);
}