blob: c6bd7626f822c2b3507a836eb72808084466d644 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* { dg-do compile } */
/* { dg-options "-O3" } */
#include <stdint.h>
uint32_t
truncate_int (const unsigned long long value)
{
if ( value < 0 )
{
return 0;
}
else if ( value > UINT32_MAX )
{
return UINT32_MAX;
}
else
return (uint32_t)value;
}
uint32_t
mul (const unsigned long long x, const unsigned long long y)
{
uint32_t value = truncate_int (x * y);
return value;
}
uint32_t *
test(unsigned size, uint32_t *a, uint32_t s)
{
unsigned i;
for (i = 0; i < size; i++)
{
a[i] = mul (a[i], s);
}
return a;
}
|