Debian Codegraph @

gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c

raw
1 /* Machine description pattern tests. */
2
3 /* { dg-do compile { target { lp64 } } } */
4 /* Starting with arch13 the and with complement instruction is
5 available and the splitter is disabled. */
6 /* { dg-options "-march=z14 -mzarch -save-temps -dP" } */
7 /* { dg-do run { target { lp64 && s390_useable_hw } } } */
8 /* Skip test if -O0 is present on the command line:
9
10 { dg-skip-if "" { *-*-* } { "-O0" } { "" } }
11
12 Skip test if the -O option is missing from the command line
13 { dg-skip-if "" { *-*-* } { "*" } { "-O*" } }
14 */
15
16 __attribute__ ((noinline))
17 unsigned long andc_vv(unsigned long a, unsigned long b)
18 { return ~b & a; }
19 /* { dg-final { scan-assembler ":18:.\* \{\\*anddi3\}" } } */
20 /* { dg-final { scan-assembler ":18:.\* \{\\*xordi3\}" } } */
21
22 __attribute__ ((noinline))
23 unsigned long andc_pv(unsigned long *a, unsigned long b)
24 { return ~b & *a; }
25 /* { dg-final { scan-assembler ":24:.\* \{\\*anddi3\}" } } */
26 /* { dg-final { scan-assembler ":24:.\* \{\\*xordi3\}" } } */
27
28 __attribute__ ((noinline))
29 unsigned long andc_vp(unsigned long a, unsigned long *b)
30 { return ~*b & a; }
31 /* { dg-final { scan-assembler ":30:.\* \{\\*anddi3\}" } } */
32 /* { dg-final { scan-assembler ":30:.\* \{\\*xordi3\}" } } */
33
34 __attribute__ ((noinline))
35 unsigned long andc_pp(unsigned long *a, unsigned long *b)
36 { return ~*b & *a; }
37 /* { dg-final { scan-assembler ":36:.\* \{\\*anddi3\}" } } */
38 /* { dg-final { scan-assembler ":36:.\* \{\\*xordi3\}" } } */
39
40 /* { dg-final { scan-assembler-times "\tngr\?k\?\t" 4 } } */
41 /* { dg-final { scan-assembler-times "\txgr\?\t" 4 } } */
42
43 int
44 main (void)
45 {
46 unsigned long a = 0xc00000000000000cllu;
47 unsigned long b = 0x500000000000000allu;
48 unsigned long e = 0x8000000000000004llu;
49 unsigned long c;
50
51 c = andc_vv (a, b);
52 if (c != e)
53 __builtin_abort ();
54 c = andc_pv (&a, b);
55 if (c != e)
56 __builtin_abort ();
57 c = andc_vp (a, &b);
58 if (c != e)
59 __builtin_abort ();
60 c = andc_pp (&a, &b);
61 if (c != e)
62 __builtin_abort ();
63 return 0;
64 }