75ab75b5273d2587ff37baa30751523bba42d68a
[gcc.git] / gcc / testsuite / gcc.target / s390 / md / andc-splitter-2.c
1 /* Machine description pattern tests. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-save-temps -dP" } */
5 /* { dg-do run { target { s390_useable_hw } } } */
6 /* Skip test if -O0 is present on the command line:
7
8 { dg-skip-if "" { *-*-* } { "-O0" } { "" } }
9
10 Skip test if the -O option is missing from the command line
11 { dg-skip-if "" { *-*-* } { "*" } { "-O*" } }
12 */
13
14 __attribute__ ((noinline))
15 unsigned int andc_vv(unsigned int a, unsigned int b)
16 { return ~b & a; }
17 /* { dg-final { scan-assembler ":16:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */
18 /* { dg-final { scan-assembler ":16:.\* \{\\*xorsi3\}" } } */
19
20 __attribute__ ((noinline))
21 unsigned int andc_pv(unsigned int *a, unsigned int b)
22 { return ~b & *a; }
23 /* { dg-final { scan-assembler ":22:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */
24 /* { dg-final { scan-assembler ":22:.\* \{\\*xorsi3\}" } } */
25
26 __attribute__ ((noinline))
27 unsigned int andc_vp(unsigned int a, unsigned int *b)
28 { return ~*b & a; }
29 /* { dg-final { scan-assembler ":28:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */
30 /* { dg-final { scan-assembler ":28:.\* \{\\*xorsi3\}" } } */
31
32 __attribute__ ((noinline))
33 unsigned int andc_pp(unsigned int *a, unsigned int *b)
34 { return ~*b & *a; }
35 /* { dg-final { scan-assembler ":34:.\* \{\\*andsi3_\(esa\|zarch\)\}" } } */
36 /* { dg-final { scan-assembler ":34:.\* \{\\*xorsi3\}" } } */
37
38 /* { dg-final { scan-assembler-times "\tnr\?k\?\t" 4 } } */
39 /* { dg-final { scan-assembler-times "\txr\?k\?\t" 4 } } */
40
41 int
42 main (void)
43 {
44 unsigned int a = 0xc000000cu;
45 unsigned int b = 0x5000000au;
46 unsigned int e = 0x80000004u;
47 unsigned int c;
48
49 c = andc_vv (a, b);
50 if (c != e)
51 __builtin_abort ();
52 c = andc_pv (&a, b);
53 if (c != e)
54 __builtin_abort ();
55 c = andc_vp (a, &b);
56 if (c != e)
57 __builtin_abort ();
58 c = andc_pp (&a, &b);
59 if (c != e)
60 __builtin_abort ();
61 return 0;
62 }