[27/41] i386: Make _mm_empty () as NOP for TARGET_MMX_WITH_SSE

Message ID 20190216224032.4889-28-hjl.tools@gmail.com
State Superseded
Headers show
Series
  • V8: Emulate MMX intrinsics with SSE
Related show

Commit Message

H.J. Lu Feb. 16, 2019, 10:40 p.m.
With SSE emulation of MMX intrinsics, we should make _mm_empty () as NOP
for TARGET_MMX_WITH_SSE.

	PR target/89021
	* config/i386/mmx.md (mmx_<emms>): Renamed to ...
	(*mmx_<emms>): This.
	(mmx_<emms>): New expander.
---
 gcc/config/i386/mmx.md | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

-- 
2.20.1

Comments

Uros Bizjak Feb. 17, 2019, 9:45 a.m. | #1
On 2/16/19, H.J. Lu <hjl.tools@gmail.com> wrote:
> With SSE emulation of MMX intrinsics, we should make _mm_empty () as NOP

> for TARGET_MMX_WITH_SSE.


NAK. NOP can be emitter only for !TARGET_MMX.

Uros.

>

> 	PR target/89021

> 	* config/i386/mmx.md (mmx_<emms>): Renamed to ...

> 	(*mmx_<emms>): This.

> 	(mmx_<emms>): New expander.

> ---

>  gcc/config/i386/mmx.md | 30 +++++++++++++++++++++++++++++-

>  1 file changed, 29 insertions(+), 1 deletion(-)

>

> diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md

> index f27513f7f2c..8b5fe3948e2 100644

> --- a/gcc/config/i386/mmx.md

> +++ b/gcc/config/i386/mmx.md

> @@ -1849,7 +1849,35 @@

>    [(UNSPECV_EMMS "emms")

>     (UNSPECV_FEMMS "femms")])

>

> -(define_insn "mmx_<emms>"

> +(define_expand "mmx_<emms>"

> +  [(parallel

> +    [(unspec_volatile [(const_int 0)] EMMS)

> +      (clobber (reg:XF ST0_REG))

> +      (clobber (reg:XF ST1_REG))

> +      (clobber (reg:XF ST2_REG))

> +      (clobber (reg:XF ST3_REG))

> +      (clobber (reg:XF ST4_REG))

> +      (clobber (reg:XF ST5_REG))

> +      (clobber (reg:XF ST6_REG))

> +      (clobber (reg:XF ST7_REG))

> +      (clobber (reg:DI MM0_REG))

> +      (clobber (reg:DI MM1_REG))

> +      (clobber (reg:DI MM2_REG))

> +      (clobber (reg:DI MM3_REG))

> +      (clobber (reg:DI MM4_REG))

> +      (clobber (reg:DI MM5_REG))

> +      (clobber (reg:DI MM6_REG))

> +      (clobber (reg:DI MM7_REG))])]

> +  "TARGET_MMX || TARGET_MMX_WITH_SSE"

> +{

> +   if (TARGET_MMX_WITH_SSE)

> +     {

> +       emit_insn (gen_nop ());

> +       DONE;

> +     }

> +})

> +

> +(define_insn "*mmx_<emms>"

>    [(unspec_volatile [(const_int 0)] EMMS)

>     (clobber (reg:XF ST0_REG))

>     (clobber (reg:XF ST1_REG))

> --

> 2.20.1

>

>
H.J. Lu Feb. 17, 2019, 1:37 p.m. | #2
On Sun, Feb 17, 2019 at 1:45 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>

> On 2/16/19, H.J. Lu <hjl.tools@gmail.com> wrote:

> > With SSE emulation of MMX intrinsics, we should make _mm_empty () as NOP

> > for TARGET_MMX_WITH_SSE.

>

> NAK. NOP can be emitter only for !TARGET_MMX.

>


I changed it to

  "TARGET_MMX || TARGET_MMX_WITH_SSE"
{
   if (!TARGET_MMX)
     {
       emit_insn (gen_nop ());
       DONE;
     }
})


-- 
H.J.

Patch

diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index f27513f7f2c..8b5fe3948e2 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -1849,7 +1849,35 @@ 
   [(UNSPECV_EMMS "emms")
    (UNSPECV_FEMMS "femms")])
 
-(define_insn "mmx_<emms>"
+(define_expand "mmx_<emms>"
+  [(parallel
+    [(unspec_volatile [(const_int 0)] EMMS)
+      (clobber (reg:XF ST0_REG))
+      (clobber (reg:XF ST1_REG))
+      (clobber (reg:XF ST2_REG))
+      (clobber (reg:XF ST3_REG))
+      (clobber (reg:XF ST4_REG))
+      (clobber (reg:XF ST5_REG))
+      (clobber (reg:XF ST6_REG))
+      (clobber (reg:XF ST7_REG))
+      (clobber (reg:DI MM0_REG))
+      (clobber (reg:DI MM1_REG))
+      (clobber (reg:DI MM2_REG))
+      (clobber (reg:DI MM3_REG))
+      (clobber (reg:DI MM4_REG))
+      (clobber (reg:DI MM5_REG))
+      (clobber (reg:DI MM6_REG))
+      (clobber (reg:DI MM7_REG))])]
+  "TARGET_MMX || TARGET_MMX_WITH_SSE"
+{
+   if (TARGET_MMX_WITH_SSE)
+     {
+       emit_insn (gen_nop ());
+       DONE;
+     }
+})
+
+(define_insn "*mmx_<emms>"
   [(unspec_volatile [(const_int 0)] EMMS)
    (clobber (reg:XF ST0_REG))
    (clobber (reg:XF ST1_REG))