[AArch64/arm] PR testsuite/85326 Avoid C++ tests when C++ compiler not present
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / insv_2.c
blob62728cbc6e3f2e41929ba2ec053425d6475533d2
1 /* { dg-do run { target aarch64*-*-* } } */
2 /* { dg-options "-O2 --save-temps -fno-inline" } */
3 /* { dg-require-effective-target aarch64_big_endian } */
5 extern void abort (void);
7 typedef struct bitfield
9 unsigned short eight: 8;
10 unsigned short four: 4;
11 unsigned short five: 5;
12 unsigned short seven: 7;
13 unsigned int sixteen: 16;
14 } bitfield;
16 bitfield
17 bfi1 (bitfield a)
19 /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 56, 8" } } */
20 a.eight = 3;
21 return a;
24 bitfield
25 bfi2 (bitfield a)
27 /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 43, 5" } } */
28 a.five = 7;
29 return a;
32 bitfield
33 movk (bitfield a)
35 /* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0x1d6b, lsl 16" } } */
36 a.sixteen = 7531;
37 return a;
40 bitfield
41 set1 (bitfield a)
43 /* { dg-final { scan-assembler "orr\tx\[0-9\]+, x\[0-9\]+, 272678883688448" } } */
44 a.five = 0x1f;
45 return a;
48 bitfield
49 set0 (bitfield a)
51 /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, -272678883688449" } } */
52 a.five = 0;
53 return a;
57 int
58 main (int argc, char** argv)
60 static bitfield a;
61 bitfield b = bfi1 (a);
62 bitfield c = bfi2 (b);
63 bitfield d = movk (c);
65 if (d.eight != 3)
66 abort ();
68 if (d.five != 7)
69 abort ();
71 if (d.sixteen != 7531)
72 abort ();
74 d = set1 (d);
75 if (d.five != 0x1f)
76 abort ();
78 d = set0 (d);
79 if (d.five != 0)
80 abort ();
82 return 0;