This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/66393] New: register asm input for inline asm not respected when using a template
- From: "krebbel at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Jun 2015 09:09:56 +0000
- Subject: [Bug rtl-optimization/66393] New: register asm input for inline asm not respected when using a template
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66393
Bug ID: 66393
Summary: register asm input for inline asm not respected when
using a template
Product: gcc
Version: 4.8.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: krebbel at gcc dot gnu.org
Target Milestone: ---
In the following example r1 is being used as input to the inline asm although
the register asm definition forces it into r2:
typedef unsigned long long int uint64_t;
template < typename T > static inline void
bar (T c)
{
int a;
register uint64_t b __asm__ ("r2") = (uint64_t)&a;
__asm__ volatile (".long 0"::"d" (b):);
}
void
foo (uint64_t c)
{
bar (c);
}
cc1plus -O1
_Z3fooy:
.LFB1:
stg %r15,120(%r15)
.LCFI0:
aghi %r15,-168
.LCFI1:
lgr %r1,%r15
aghi %r1,164 <------
#APP
# 8 "t.cc" 1
.long 0
# 0 "" 2
#NO_APP
lg %r15,288(%r15)
.LCFI2:
br %r14
234r.ira:
Loop 0 (parent -1, header bb2, depth 0)
bbs: 2
all: 0r62
modified regnos: 62
border:
Pressure: GENERAL_REGS=2 <------
Hard reg set forest:
0:( 0-14 16-31)@0
1:( 0-13)@8000
Allocno a0r62 of GENERAL_REGS(15) has 14 avail. regs 0-13, node: 0-13
(confl regs = 14-52)
Pushing a0(r62,l0)(cost 0)
Popping a0(r62,l0) -- assign reg 1 <-------
The example can be made working just by removing the type template:
typedef unsigned long long int uint64_t;
static inline void
bar (uint64_t c)
{
int a;
register uint64_t b __asm__ ("r2") = (uint64_t)&a;
__asm__ volatile (".long 0"::"d" (b):);
}
void
foo (uint64_t c)
{
bar (c);
}
_Z3fooy:
.LFB1:
stg %r15,120(%r15)
.LCFI0:
aghi %r15,-168
.LCFI1:
lgr %r2,%r15
aghi %r2,164
#APP
# 8 "t.cc" 1
.long 0
# 0 "" 2
#NO_APP
lg %r15,288(%r15)
.LCFI2:
br %r14