2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / adx-addcarryx32-2.c
blobb1da555bc310331fb7a663027e8fa59c28eb3adb
1 /* { dg-do run } */
2 /* { dg-options "-madx -O2" } */
3 /* { dg-require-effective-target adx } */
5 #include <x86intrin.h>
6 #include "adx-check.h"
8 static void
9 adx_test (void)
11 volatile unsigned char c;
12 unsigned int x;
13 volatile unsigned int y, sum_ref;
15 c = 0;
16 x = y = 0xFFFFFFFF;
17 sum_ref = 0xFFFFFFFE;
19 /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 0. */
20 c = _addcarryx_u32 (c, x, y, &x);
21 /* X = 0xFFFFFFFE, Y = 0xFFFFFFFF, C = 1. */
22 c = _addcarryx_u32 (c, x, y, &x);
23 /* X = 0xFFFFFFFE, Y = 0xFFFFFFFF, C = 1. */
25 if (x != sum_ref)
26 abort ();
28 c = 0;
29 x = y = 0xFFFFFFFF;
30 sum_ref = 0xFFFFFFFE;
32 /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 0. */
33 c = _addcarry_u32 (c, x, y, &x);
34 /* X = 0xFFFFFFFE, Y = 0xFFFFFFFF, C = 1. */
35 c = _addcarry_u32 (c, x, y, &x);
36 /* X = 0xFFFFFFFE, Y = 0xFFFFFFFF, C = 1. */
38 if (x != sum_ref)
39 abort ();
41 c = 0;
42 x = 1;
43 y = 0;
44 sum_ref = 0x0;
46 /* X = 0x00000001, Y = 0x00000000, C = 0. */
47 c = _subborrow_u32 (c, x, y, &x);
48 /* X = 0xFFFFFFFF, Y = 0x00000000, C = 1. */
49 c = _subborrow_u32 (c, x, y, &x);
50 /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 1. */
52 if (x != sum_ref)
53 abort ();