This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: all ones m128i constant


Hello!

> Hi, all one m128i constant can be materialized using pcmpeqd
> instruction (compared with a memory load from rodata). This patch
> implements this.
>
> Index: config/i386/i386.c
> ===================================================================
> --- config/i386/i386.c	(revision 145332)
> +++ config/i386/i386.c	(working copy)
> @@ -8951,7 +8951,8 @@ legitimate_constant_p (rtx x)
>        break;
>
>      case CONST_VECTOR:
> -      if (x == CONST0_RTX (GET_MODE (x)))
> +      if (x == CONST0_RTX (GET_MODE (x))
> +          || (vector_all_ones_operand (x, GET_MODE (x)) && TARGET_SSE))
>  	return true;
>        return false;

We can use standard_sse_constant_p function, this function will cover
all supported constants in all supported modes.

> Index: testsuite/gcc.dg/all_one_m128i.c
> ===================================================================
> --- testsuite/gcc.dg/all_one_m128i.c	(revision 0)
> +++ testsuite/gcc.dg/all_one_m128i.c	(revision 0)

Uh, there many problems with this testcase:

- it belongs to gcc.target/i386 directory since it is clearly testing
target-dependent feature.
- it is in fact a compile testcase. Runtime testcases that depend on a
non-default feature are a bit more complicated since they should check
for supported processor features. Please see many examples in
gcc.target/i386 directory.

Attached to this message, please find a patch that implements all
above suggestions. The include testcase checks just for the change
that was added by the patch, so since it is a compile time feature,
the testcase can be pretty short, without any runtime complications.

Thanks,
Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]