aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/asm-hard-reg-5.c
blob: ea7907ae2a0e5057f7dfd859084e0fb1dd6b6890 (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
32
33
34
35
36
/* { dg-do compile { target { { aarch64*-*-* powerpc64*-*-* riscv64-*-* s390*-*-* } || { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } } */

typedef int V __attribute__ ((vector_size (4 * sizeof (int))));

#if defined (__aarch64__)
# define VR "{v20}"
/* { dg-final { scan-assembler-times "foo\tv20" 2 { target { aarch64*-*-* } } } } */
#elif defined (__powerpc__) || defined (__POWERPC__)
# define VR "{v5}"
/* { dg-final { scan-assembler-times "foo\t5" 2 { target { powerpc64*-*-* } } } } */
#elif defined (__riscv)
# define VR "{v5}"
/* { dg-additional-options "-march=rv64imv" { target riscv64-*-* } } */
/* { dg-final { scan-assembler-times "foo\tv5" 2 { target { riscv*-*-* } } } } */
#elif defined (__s390__)
# define VR "{v5}"
/* { dg-require-effective-target s390_mvx { target s390*-*-* } } */
/* { dg-final { scan-assembler-times "foo\t%v5" 2 { target s390*-*-* } } } */
#elif defined (__x86_64__)
# define VR "{xmm9}"
/* { dg-final { scan-assembler-times "foo\t%xmm9" 2 { target { x86_64-*-* } } } } */
#endif

V
test (V x)
{
  __asm__ ("foo\t%0" : "+"VR (x));
  return x;
}

V
test_from_mem (V *x)
{
  __asm__ ("foo\t%0" : "+"VR (*x));
  return *x;
}