aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/asm-hard-reg-error-3.c
blob: 17b2317db9b0b4e46f6f1c17053f2ad7f0705f32 (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
/* { dg-do compile { target arm-*-* s390-*-* } } */
/* { dg-options "-std=c99" } we need long long */
/* { dg-additional-options "-march=armv7-a" { target arm-*-* } } */

/* Test register pairs.  */

#if defined (__arm__)
# define GPR1 "{r4}"
# define GPR2_RAW "r5"
#elif defined (__s390__)
# define GPR1 "{r4}"
# define GPR2_RAW "r5"
#endif

#define GPR2 "{"GPR2_RAW"}"

void
test (void)
{
  __asm__ ("" :: GPR1 (42ll));
  __asm__ ("" :: GPR2 (42ll)); /* { dg-error "register .* for operand 0 isn't suitable for data type" } */
  __asm__ ("" :: GPR1 (42ll), GPR2 (42)); /* { dg-error "multiple inputs to hard register" } */

  long long x;
  __asm__ ("" : "="GPR1 (x) :: GPR2_RAW); /* { dg-error "hard register constraint for output 0 conflicts with 'asm' clobber list" } */
  __asm__ ("" : "=r" (x) : GPR1 (x) : GPR2_RAW); /* { dg-error "hard register constraint for input 0 conflicts with 'asm' clobber list" } */
}