[PATCH] Fix ICE with x87 asm operands (PR inline-asm/68843)
Uros Bizjak
ubizjak@gmail.com
Sun May 22 20:02:00 GMT 2016
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.
More information about the Gcc-patches
mailing list