aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-1.C
blob: 204836019b5cfb67aa374ba2918b9de74b0416cd (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
/* { dg-do compile } */
/* { dg-options "-std=gnu++17" } */
/* { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } } */

#include <string>

constexpr std::string_view genfoo ()
{
  return "foo %1,%0";
}

constexpr std::string_view genoutput ()
{
  return "=r";
}

constexpr std::string_view geninput ()
{
  return "r";
}

constexpr std::string_view genclobber ()
{
  return "memory";
}

void f()
{
  int a;
  asm((genfoo ()) : (genoutput ()) (a) : (geninput ()) (1) : (genclobber ()));
}

/* { dg-final { scan-assembler "foo" } } */