File: timode-1.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (106 lines) | stat: -rw-r--r-- 2,064 bytes parent folder | download | duplicates (10)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* { dg-options "isa_rev<=5 -mgp64" } */
/* { dg-skip-if "we deliberately use calls when optimizing for size" { *-*-* } { "-Os" } { "" } } */
typedef int int128_t __attribute__((mode(TI)));
typedef unsigned int uint128_t __attribute__((mode(TI)));

#define UINT128_CONST(A, B) \
  (((uint128_t) (0x ## A ## ULL) << 64) | (0x ## B ## ULL))

volatile uint128_t a = UINT128_CONST (1111111111111111, a222222222222222);
volatile uint128_t b = UINT128_CONST (0000000000000005, 0000000000000003);
volatile uint128_t c = UINT128_CONST (5dddddddddddddde, e666666666666666);
volatile uint128_t d = UINT128_CONST (e612340000000000, 5000000000234500);
volatile uint128_t e = UINT128_CONST (43f011dddddddddf, 366666666689ab66);
volatile uint128_t f = UINT128_CONST (4210100000000000, 1000000000010100);
volatile uint128_t g = UINT128_CONST (a5e225dddddddddf, 6666666666aaee66);
volatile uint128_t h = UINT128_CONST (e7f235dddddddddf, 7666666666abef66);
volatile uint128_t i = UINT128_CONST (5e225dddddddddf6, 666666666aaee660);
volatile uint128_t j = UINT128_CONST (0a5e225ddddddddd, f6666666666aaee6);
volatile uint128_t k = UINT128_CONST (fa5e225ddddddddd, f6666666666aaee6);

volatile int amount = 4;

volatile uint128_t result;

int
test1 (void)
{
  result = a * b;
  if (result != c)
    return 1;
  return 0;
}

int
test2 (void)
{
  result = c + d;
  if (result != e)
    return 1;
  return 0;
}

int
test3 (void)
{
  result = e - d;
  if (result != c)
    return 1;
  return 0;
}

int
test4 (void)
{
  result = d & e;
  if (result != f)
    return 1;
  return 0;
}

int
test5 (void)
{
  result = d ^ e;
  if (result != g)
    return 1;
  return 0;
}

int
test6 (void)
{
  result = d | e;
  if (result != h)
    return 1;
  return 0;
}

int
test7 (void)
{
  result = g << amount;
  if (result != i)
    return 1;
  return 0;
}

int
test8 (void)
{
  result = g >> amount;
  if (result != j)
    return 1;
  return 0;
}

int
test9 (void)
{
  result = (int128_t) g >> amount;
  if (result != k)
    return 1;
  return 0;
}

/* { dg-final { scan-assembler-not "\tjal" } } */