This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ICE with x87 asm operands (PR inline-asm/68843)
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Vladimir Makarov <vmakarov at redhat dot com>, Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>
- Date: Sun, 22 May 2016 22:02:45 +0200
- Subject: Re: [PATCH] Fix ICE with x87 asm operands (PR inline-asm/68843)
- Authentication-results: sourceware.org; auth=none
- References: <HE1PR07MB1580427A1FF65815CB85A023E44D0 at HE1PR07MB1580 dot eurprd07 dot prod dot outlook dot com>
On Sun, May 22, 2016 at 9:00 AM, Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
> Hi!
>
> as described in the PR there are several non-intuitive rules that
> one has to follow to avoid ICEs with x87 asm operands.
>
> This patch adds an explicit rule, that avoids ICE in the first test case and
> removes an unnecessary error message in the second test case.
>
>
> Boot-strapped and regression-tested on x86_64-pc-linux-gnu.
> OK for trunk?
This patch is actually dealing with two separate problems
This part:
@@ -607,7 +631,7 @@ check_asm_stack_operands (rtx_insn *insn)
record any earlyclobber. */
for (i = n_outputs; i < n_outputs + n_inputs; i++)
- if (op_alt[i].matches == -1)
+ if (op_alt[i].matches == -1 && STACK_REG_P (recog_data.operand[i]))
{
int j;
is OK, although, I'd written it as:
+ if (STACK_REG_P (recog_data.operand[i]) && op_alt[i].matches == -1)
with slightly simplified testcase:
--cut here--
int
__attribute__((noinline, noclone))
test (double y)
{
int a, b;
asm ("fistpl (%1)\n\t"
"movl (%1), %0"
: "=r" (a)
: "r" (&b), "t" (y)
: "st");
return a;
}
int
main ()
{
int t = -10;
if (test (t) != t)
__builtin_abort ();
return 0;
}
--cut here--
BTW: It looks to me you also don't need all-memory clobber here.
This part is OK, with a testcase you provided it borders on obvious.
However, you will need rtl-optimization approval for the other
problem.
Uros.