public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
@ 2004-01-01  8:04 ` pinskia at gcc dot gnu dot org
  2004-01-01 19:21 ` pgonzalez at bluel dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-01  8:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-01 08:04 -------
Can you attach one of those complex situtations?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
 GCC target triplet|                            |arm-elf
           Keywords|                            |ice-on-valid-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
  2004-01-01  8:04 ` [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload" pinskia at gcc dot gnu dot org
@ 2004-01-01 19:21 ` pgonzalez at bluel dot com
  2004-01-01 19:57 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pgonzalez at bluel dot com @ 2004-01-01 19:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pgonzalez at bluel dot com  2004-01-01 19:21 -------
(In reply to comment #6)
> Can you attach one of those complex situtations?

I'll see what I can do.  The source code that was repeatably 
exposing the bug is proprietary, and my attempts to isolate
the problem were causing the error to go away.  If you know
of a utility that can obfuscate C++ identifiers, I could just
attach a big preprocessed file.  Or, if a specific person 
is debugging this, a simple NDA would be sufficient.

Thanks!

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
  2004-01-01  8:04 ` [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload" pinskia at gcc dot gnu dot org
  2004-01-01 19:21 ` pgonzalez at bluel dot com
@ 2004-01-01 19:57 ` pinskia at gcc dot gnu dot org
  2004-01-07 19:28 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-01 19:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-01 19:57 -------
Yes I am person who is trying to debug this but I think there is no reason why I should sign a NDA 
as this is opensourced software and I do not get paid doing this.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (2 preceding siblings ...)
  2004-01-01 19:57 ` pinskia at gcc dot gnu dot org
@ 2004-01-07 19:28 ` pinskia at gcc dot gnu dot org
  2004-01-08  3:47 ` pgonzalez at bluel dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-07 19:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-07 19:28 -------
It is okay to supply a testcase which does no one needs a NDA, note if I was a little too 
harsh last time, I am sorry.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (3 preceding siblings ...)
  2004-01-07 19:28 ` pinskia at gcc dot gnu dot org
@ 2004-01-08  3:47 ` pgonzalez at bluel dot com
  2004-01-14 18:32 ` rearnsha at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pgonzalez at bluel dot com @ 2004-01-08  3:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pgonzalez at bluel dot com  2004-01-08 03:47 -------
(In reply to comment #9)
> It is okay to supply a testcase which does no one needs a NDA, note if I was 
a little too 
> harsh last time, I am sorry.

No problem.  However, since the NDA is not an option, I will need to modify the 
error-reproducing-testcase to satisfy the commercial licensing.  As mentioned, 
I did not have much success isolating the bug, so instead I'll try to obfuscate 
the identifiers somehow.  Based on my current schedule, it will take me about 2 
months to complete this.

Thanks again for your help.  We will solve this!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (4 preceding siblings ...)
  2004-01-08  3:47 ` pgonzalez at bluel dot com
@ 2004-01-14 18:32 ` rearnsha at gcc dot gnu dot org
  2004-01-14 23:44 ` pgonzalez at bluel dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2004-01-14 18:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2004-01-14 18:32 -------
Note that the compiler gets nearly optimal code if you simply write:

inline int mfp(int a, int b)
{
  return (((long long) a) * b) >> 16;
}

Which is only out by a couple of cycles (A couple of redundant mov insns). 
However, by not using an ASM you allow the compiler to schedule the instructions
independently, and may also expose additional optimization opportunities. 

None of the above fixes the bug, but may be sufficient to solve your immediate
problems.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (5 preceding siblings ...)
  2004-01-14 18:32 ` rearnsha at gcc dot gnu dot org
@ 2004-01-14 23:44 ` pgonzalez at bluel dot com
  2004-04-12 13:00 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pgonzalez at bluel dot com @ 2004-01-14 23:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pgonzalez at bluel dot com  2004-01-14 23:44 -------
(In reply to comment #11)
> Which is only out by a couple of cycles (A couple of redundant mov insns). 
> However, by not using an ASM you allow the compiler to schedule the 
instructions
> independently, and may also expose additional optimization opportunities. 

True, although the purpose of the inline assembly is to recover exactly those 
missing cycles.  :-)  I should note also that the simple example above is 
representative of similar problems with more complex cases (e.g. fixed-point 
vector multiplication).  The workaround we're using right now is a manually-
enabled preprocessor flag that reduces the constraint count in files that 
failed to compile without it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (6 preceding siblings ...)
  2004-01-14 23:44 ` pgonzalez at bluel dot com
@ 2004-04-12 13:00 ` pinskia at gcc dot gnu dot org
  2004-05-22  0:51 ` pgonzalez at bluel dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-12 13:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-12 12:50 -------
No feedback in 3 months.  If we recieve a test case we will reopen this bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (7 preceding siblings ...)
  2004-04-12 13:00 ` pinskia at gcc dot gnu dot org
@ 2004-05-22  0:51 ` pgonzalez at bluel dot com
  2004-05-22  2:26 ` [Bug rtl-optimization/10396] " pinskia at gcc dot gnu dot org
  2004-08-25 17:02 ` [Bug middle-end/10396] " rearnsha at gcc dot gnu dot org
  10 siblings, 0 replies; 16+ messages in thread
From: pgonzalez at bluel dot com @ 2004-05-22  0:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pgonzalez at bluel dot com  2004-05-20 23:47 -------
(In reply to comment #13)

I have attached a preprocessed test case for this bug.  If you run 
"arm-arm-gcc -c -O2 ConstraintBug.cpp" you will see the following errors:

ConstraintBug.cpp: In function `void ratloop::computeNormal(const 
ratloop::TVector&, const ratloop::TVector&, const ratloop::TVector&, 
ratloop::TVector&)':
ConstraintBug.cpp:303: error: `asm' operand requires impossible reload
ConstraintBug.cpp:303: error: `asm' operand requires impossible reload
ConstraintBug.cpp:303: error: `asm' operand requires impossible reload
ConstraintBug.cpp:303: error: `asm' operand requires impossible reload
ConstraintBug.cpp:303: error: `asm' operand requires impossible reload
ConstraintBug.cpp:303: error: `asm' operand requires impossible reload

My "gcc -v" shows:

Configured with: ../gcc-3.4.0/configure --prefix=/devkitadv --target=arm-agb-elf
 --with-cpu=arm7tdmi --without-local-prefix --disable-shared --with-newlib --wit
h-headers=../newlib-1.12.0/newlib/libc/include/ --enable-multilib --enable-inter
work --enable-languages=c++ --enable-targets=arm-elf,arm-coff,arm-aout --disable
-threads --disable-win32-registry -v
Thread model: single
gcc version 3.4.0



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug rtl-optimization/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (8 preceding siblings ...)
  2004-05-22  0:51 ` pgonzalez at bluel dot com
@ 2004-05-22  2:26 ` pinskia at gcc dot gnu dot org
  2004-08-25 17:02 ` [Bug middle-end/10396] " rearnsha at gcc dot gnu dot org
  10 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-22  2:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-21 00:23 -------
Confirmed, here is a shorter example:
int multiplyFixedPoint(int *mantissaA,int *mantissaB) {
  int result;
  int temp;

  asm("# %0 %1 %2 %3"
  : "=&r"(result), "=&r"(temp) // outputs
    : "%r"(*mantissaA), "01r"(*mantissaB - *mantissaA)  // inputs
  );
  *mantissaB = result;
  asm("# %0 %1 %2 %3"
   : "=&r"(result), "=&r"(temp) // outputs
    : "%r"(*mantissaA - *mantissaB), "01r"(*mantissaB)  // inputs
  );
  return result;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW
          Component|inline-asm                  |rtl-optimization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.pgonzalez@bluel.com>
                   ` (9 preceding siblings ...)
  2004-05-22  2:26 ` [Bug rtl-optimization/10396] " pinskia at gcc dot gnu dot org
@ 2004-08-25 17:02 ` rearnsha at gcc dot gnu dot org
  10 siblings, 0 replies; 16+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2004-08-25 17:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2004-08-25 17:02 -------
>  asm("# %0 %1 %2 %3"
>  : "=&r"(result), "=&r"(temp) // outputs
>    : "%r"(*mantissaA), "01r"(*mantissaB - *mantissaA)  // inputs
>  );

This shorter example is bogus.  You can't tie a single output operand to
multiple input operands.

I think the underlying problem here is that we don't really support alternatives
in asm constraints (see, for example asm_operand_ok, which basically ignores ','
-- hence the reason the bogus example produces the same behaviour).

Maybe we should just document this as a limitation of inline assembly and change
the compiler to reject asm patterns that have multiple alternatives.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |middle-end
 GCC target triplet|arm-arm-elf                 |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <bug-10396-1583@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-12-31 16:30 ` someone42 at gmail dot com
@ 2008-12-31 16:37 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-31 16:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from pinskia at gcc dot gnu dot org  2008-12-31 16:36 -------
(In reply to comment #20) 
> Perhaps this bug could then be "fixed" by simply removing or appropriately
> modifying section 5.38.2 ("Multiple Alternative Constraints") of the GCC
> manual.

Part of the problem is that section is part of the internals manual also and
alternative constraints works correctly for RTL, just not inline-asm.  For some
reason I thought it was already patched to say the correct thing. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <bug-10396-1583@http.gcc.gnu.org/bugzilla/>
  2008-12-31 16:07 ` [Bug inline-asm/10396] " someone42 at gmail dot com
  2008-12-31 16:11 ` pinskia at gcc dot gnu dot org
@ 2008-12-31 16:30 ` someone42 at gmail dot com
  2008-12-31 16:37 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 16+ messages in thread
From: someone42 at gmail dot com @ 2008-12-31 16:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from someone42 at gmail dot com  2008-12-31 16:29 -------
(In reply to comment #19)
> Note commas in inline-asm are ignored.
> 

Perhaps this bug could then be "fixed" by simply removing or appropriately
modifying section 5.38.2 ("Multiple Alternative Constraints") of the GCC
manual.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <bug-10396-1583@http.gcc.gnu.org/bugzilla/>
  2008-12-31 16:07 ` [Bug inline-asm/10396] " someone42 at gmail dot com
@ 2008-12-31 16:11 ` pinskia at gcc dot gnu dot org
  2008-12-31 16:30 ` someone42 at gmail dot com
  2008-12-31 16:37 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-31 16:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from pinskia at gcc dot gnu dot org  2008-12-31 16:09 -------
Note commas in inline-asm are ignored.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <bug-10396-1583@http.gcc.gnu.org/bugzilla/>
@ 2008-12-31 16:07 ` someone42 at gmail dot com
  2008-12-31 16:11 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: someone42 at gmail dot com @ 2008-12-31 16:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from someone42 at gmail dot com  2008-12-31 16:05 -------
I was going to submit a new bug report but this bug sounds very similar. Here
is my test case:

Code (actual assembly code removed for brevity):
int thing(unsigned int a,unsigned int b)
{
  asm("":"=mr,r"(b):"%0,0"(a / 3),"ri,g"(b));
  return b;
}

Result:
$ gcc aorir.c -S -O1
aorir.c: In function 'thing':
aorir.c:3: error: 'asm' operand requires impossible reload

This was tested with GCC 4.3.2 and only occurs if -O, -O1, -O2, -O3 or -Os is
used. Like the opening poster, this only occurs if multiple alternatives are
specified. Removing one of the alternatives makes the issue disappear (it does
not matter which one is removed). Replacing "a / 3" with "a + 3" also makes the
issue disappear, regardless of the number of alternatives specified. Removing
"%" from the first input constraint results in:

$ gcc aorir.c -S -O1
aorir.c: In function 'thing':
aorir.c:5: internal compiler error: in reg_overlap_mentioned_p, at
rtlanal.c:1398
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Changing "%0,0" to "%r,r" also makes the issue go away, however that is not an
option for the assembly code I'm using.


-- 

someone42 at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |someone42 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload"
       [not found] <20030414040601.10396.gonz@ratloop.com>
@ 2003-07-31 22:00 ` gonz at ratloop dot com
  0 siblings, 0 replies; 16+ messages in thread
From: gonz at ratloop dot com @ 2003-07-31 22:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396



------- Additional Comments From gonz at ratloop dot com  2003-07-31 22:00 -------
Today I rebuilt using the "gcc-3.4-20030730" snapshot and confirmed that this 
bug is still present.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-12-31 16:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20030414040601.10396.pgonzalez@bluel.com>
2004-01-01  8:04 ` [Bug inline-asm/10396] Constraint alternatives cause error " `asm' operand requires impossible reload" pinskia at gcc dot gnu dot org
2004-01-01 19:21 ` pgonzalez at bluel dot com
2004-01-01 19:57 ` pinskia at gcc dot gnu dot org
2004-01-07 19:28 ` pinskia at gcc dot gnu dot org
2004-01-08  3:47 ` pgonzalez at bluel dot com
2004-01-14 18:32 ` rearnsha at gcc dot gnu dot org
2004-01-14 23:44 ` pgonzalez at bluel dot com
2004-04-12 13:00 ` pinskia at gcc dot gnu dot org
2004-05-22  0:51 ` pgonzalez at bluel dot com
2004-05-22  2:26 ` [Bug rtl-optimization/10396] " pinskia at gcc dot gnu dot org
2004-08-25 17:02 ` [Bug middle-end/10396] " rearnsha at gcc dot gnu dot org
     [not found] <bug-10396-1583@http.gcc.gnu.org/bugzilla/>
2008-12-31 16:07 ` [Bug inline-asm/10396] " someone42 at gmail dot com
2008-12-31 16:11 ` pinskia at gcc dot gnu dot org
2008-12-31 16:30 ` someone42 at gmail dot com
2008-12-31 16:37 ` pinskia at gcc dot gnu dot org
     [not found] <20030414040601.10396.gonz@ratloop.com>
2003-07-31 22:00 ` gonz at ratloop dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).