summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr81294-1.c
blob: 6a15ed0a410ef1b26789ce5d59eaa6db0b39770c (plain)
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
/* PR target/81294 */
/* { dg-do run } */
/* { dg-options "-O2" } */

#include <x86intrin.h>

int
main ()
{
  volatile unsigned char c;
  unsigned int x;
  volatile unsigned int y, sum_ref;

  c = 0;
  x = 1;
  y = 0;
  sum_ref = 0x0;

  /* X = 0x00000001, Y = 0x00000000, C = 0.  */
  c = _subborrow_u32 (c, y, x, &x);
  /* X = 0xFFFFFFFF, Y = 0x00000000, C = 1.  */
  c = _subborrow_u32 (c, y, x, &x);
  /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 1.  */

  if (x != sum_ref)
    __builtin_abort ();

  return 0;
}