re PR target/79733 (ICE in int_mode_for_mode, at stor-layout.c:406)

PR target/79733
	* config/i386/i386.c (ix86_expand_builtin)
	<case IX86_BUILTIN_K{,OR}TEST{C,Z}{8,16,32,64}>: Determine insn operand
	mode from insn data. Convert operands to insn operand mode.
	Copy operands that don't satisfy insn predicate to a register.

testsuite/ChangeLog:

	PR target/79733
	* gcc.target/i386/pr79733.c: New test.

From-SVN: r246739
This commit is contained in:
Uros Bizjak 2017-04-06 20:49:43 +02:00 committed by Uros Bizjak
parent a5211c800e
commit e5f5658166
4 changed files with 71 additions and 38 deletions

View File

@ -1,3 +1,11 @@
2017-04-06 Uros Bizjak <ubizjak@gmail.com>
PR target/79733
* config/i386/i386.c (ix86_expand_builtin)
<case IX86_BUILTIN_K{,OR}TEST{C,Z}{8,16,32,64}>: Determine insn operand
mode from insn data. Convert operands to insn operand mode.
Copy operands that don't satisfy insn predicate to a register.
2017-04-06 Sam Thursfield <sam.thursfield@codethink.co.uk> 2017-04-06 Sam Thursfield <sam.thursfield@codethink.co.uk>
* config/rs6000/x-aix: Increase memory limit for genautomata on AIX. * config/rs6000/x-aix: Increase memory limit for genautomata on AIX.

View File

@ -37752,98 +37752,82 @@ rdseed_step:
case IX86_BUILTIN_KTESTC8: case IX86_BUILTIN_KTESTC8:
icode = CODE_FOR_ktestqi; icode = CODE_FOR_ktestqi;
mode0 = QImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTZ8: case IX86_BUILTIN_KTESTZ8:
icode = CODE_FOR_ktestqi; icode = CODE_FOR_ktestqi;
mode0 = QImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTC16: case IX86_BUILTIN_KTESTC16:
icode = CODE_FOR_ktesthi; icode = CODE_FOR_ktesthi;
mode0 = HImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTZ16: case IX86_BUILTIN_KTESTZ16:
icode = CODE_FOR_ktesthi; icode = CODE_FOR_ktesthi;
mode0 = HImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTC32: case IX86_BUILTIN_KTESTC32:
icode = CODE_FOR_ktestsi; icode = CODE_FOR_ktestsi;
mode0 = SImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTZ32: case IX86_BUILTIN_KTESTZ32:
icode = CODE_FOR_ktestsi; icode = CODE_FOR_ktestsi;
mode0 = SImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTC64: case IX86_BUILTIN_KTESTC64:
icode = CODE_FOR_ktestdi; icode = CODE_FOR_ktestdi;
mode0 = DImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KTESTZ64: case IX86_BUILTIN_KTESTZ64:
icode = CODE_FOR_ktestdi; icode = CODE_FOR_ktestdi;
mode0 = DImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTC8: case IX86_BUILTIN_KORTESTC8:
icode = CODE_FOR_kortestqi; icode = CODE_FOR_kortestqi;
mode0 = QImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTZ8: case IX86_BUILTIN_KORTESTZ8:
icode = CODE_FOR_kortestqi; icode = CODE_FOR_kortestqi;
mode0 = QImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTC16: case IX86_BUILTIN_KORTESTC16:
icode = CODE_FOR_kortesthi; icode = CODE_FOR_kortesthi;
mode0 = HImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTZ16: case IX86_BUILTIN_KORTESTZ16:
icode = CODE_FOR_kortesthi; icode = CODE_FOR_kortesthi;
mode0 = HImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTC32: case IX86_BUILTIN_KORTESTC32:
icode = CODE_FOR_kortestsi; icode = CODE_FOR_kortestsi;
mode0 = SImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTZ32: case IX86_BUILTIN_KORTESTZ32:
icode = CODE_FOR_kortestsi; icode = CODE_FOR_kortestsi;
mode0 = SImode; mode3 = CCZmode;
mode1 = CCZmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTC64: case IX86_BUILTIN_KORTESTC64:
icode = CODE_FOR_kortestdi; icode = CODE_FOR_kortestdi;
mode0 = DImode; mode3 = CCCmode;
mode1 = CCCmode;
goto kortest; goto kortest;
case IX86_BUILTIN_KORTESTZ64: case IX86_BUILTIN_KORTESTZ64:
icode = CODE_FOR_kortestdi; icode = CODE_FOR_kortestdi;
mode0 = DImode; mode3 = CCZmode;
mode1 = CCZmode;
kortest: kortest:
arg0 = CALL_EXPR_ARG (exp, 0); /* Mask reg src1. */ arg0 = CALL_EXPR_ARG (exp, 0); /* Mask reg src1. */
@ -37851,19 +37835,32 @@ rdseed_step:
op0 = expand_normal (arg0); op0 = expand_normal (arg0);
op1 = expand_normal (arg1); op1 = expand_normal (arg1);
op0 = copy_to_reg (op0); mode0 = insn_data[icode].operand[0].mode;
op0 = lowpart_subreg (mode0, op0, GET_MODE (op0)); mode1 = insn_data[icode].operand[1].mode;
op1 = copy_to_reg (op1);
op1 = lowpart_subreg (mode0, op1, GET_MODE (op1)); if (GET_MODE (op0) != VOIDmode)
op0 = force_reg (GET_MODE (op0), op0);
op0 = gen_lowpart (mode0, op0);
if (!insn_data[icode].operand[0].predicate (op0, mode0))
op0 = copy_to_mode_reg (mode0, op0);
if (GET_MODE (op1) != VOIDmode)
op1 = force_reg (GET_MODE (op1), op1);
op1 = gen_lowpart (mode1, op1);
if (!insn_data[icode].operand[1].predicate (op1, mode1))
op1 = copy_to_mode_reg (mode1, op1);
target = gen_reg_rtx (QImode); target = gen_reg_rtx (QImode);
emit_insn (gen_rtx_SET (target, const0_rtx));
/* Emit kortest. */ /* Emit kortest. */
emit_insn (GEN_FCN (icode) (op0, op1)); emit_insn (GEN_FCN (icode) (op0, op1));
/* And use setcc to return result from flags. */ /* And use setcc to return result from flags. */
ix86_expand_setcc (target, EQ, ix86_expand_setcc (target, EQ,
gen_rtx_REG (mode1, FLAGS_REG), const0_rtx); gen_rtx_REG (mode3, FLAGS_REG), const0_rtx);
return target; return target;
case IX86_BUILTIN_GATHERSIV2DF: case IX86_BUILTIN_GATHERSIV2DF:

View File

@ -1,3 +1,8 @@
2017-04-06 Uros Bizjak <ubizjak@gmail.com>
PR target/79733
* gcc.target/i386/pr79733.c: New test.
2017-04-06 Uros Bizjak <ubizjak@gmail.com> 2017-04-06 Uros Bizjak <ubizjak@gmail.com>
PR target/80298 PR target/80298

View File

@ -0,0 +1,23 @@
/* PR target/79733 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f" } */
typedef unsigned short __mmask16;
extern __inline int
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_kortestc (__mmask16 __A, __mmask16 __B)
{
return (__mmask16) __builtin_ia32_kortestchi ((__mmask16) __A,
(__mmask16) __B);
}
void
avx512f_test ()
{
volatile __mmask16 k1 = 0;
__mmask16 k2 = 0;
volatile short r;
r = _mm512_kortestc (k1, k2);
}