summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/cmov1.c
blob: edbbda5848225b2796a758c9000ca71aaa9d9790 (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
30
31
/* { dg-do compile } */
/* This test checks for absolute memory operands.  */
/* { dg-require-effective-target nonpic } */
/* { dg-options "-O2 -march=k8" } */
/* { dg-final { scan-assembler "sar\[^\\n\]*magic_namea" } } */
/* { dg-final { scan-assembler "sar\[^\\n\]*magic_nameb" } } */
/* { dg-final { scan-assembler "sar\[^\\n\]*magic_namec" } } */
/* { dg-final { scan-assembler "shr\[^\\n\]*magic_named" } } */
/* { dg-final { scan-assembler "shr\[^\\n\]*magic_namee" } } */
/* { dg-final { scan-assembler "shr\[^\\n\]*magic_namef" } } */

/* Check code generation for several conditional moves doable by single arithmetics.  */

static int magic_namea;
static char magic_nameb;
static short magic_namec;
static int magic_named;
static char magic_namee;
static short magic_namef;

unsigned int gen;
void m(void)
{
  magic_namec=magic_namec>=0?0:-1;
  magic_namea=magic_namea>=0?0:-1;
  magic_nameb=magic_nameb>=0?0:-1;
  magic_named=magic_named>=0?0:1;
  magic_namee=magic_namee>=0?0:1;
  magic_namef=magic_namef>=0?0:1;
}