diff mbox

Add AVX512 k-mask intrinsics

Message ID CAFULd4YOmYoYV4ChYPPB0d3L5MyJOBUdfQRLb1f2hC973iLz0g@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Dec. 14, 2016, 7:55 p.m. UTC
On Wed, Dec 14, 2016 at 8:04 PM, Andrew Senkevich
<andrew.n.senkevich@gmail.com> wrote:

> here is the second part of k-mask intrinsics, is it Ok?

> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -1309,12 +1309,30 @@
>  ;; Mask variant shift mnemonics
>  (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
>
> +(define_expand "kmovb"
> +  [(set (match_operand:QI 0 "nonimmediate_operand")
> + (match_operand:QI 1 "nonimmediate_operand"))]
> +  "TARGET_AVX512DQ
> +   && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
> +
>  (define_expand "kmovw"
>    [(set (match_operand:HI 0 "nonimmediate_operand")
>   (match_operand:HI 1 "nonimmediate_operand"))]
>    "TARGET_AVX512F
>     && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
>
> +(define_expand "kmovd"
> +  [(set (match_operand:SI 0 "nonimmediate_operand")
> + (match_operand:SI 1 "nonimmediate_operand"))]
> +  "TARGET_AVX512BW
> +   && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
> +
> +(define_expand "kmovq"
> +  [(set (match_operand:DI 0 "nonimmediate_operand")
> + (match_operand:DI 1 "nonimmediate_operand"))]
> +  "TARGET_AVX512BW
> +   && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
> +
>  (define_insn "k<code><mode>"
>    [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
>   (any_logic:SWI1248_AVX512BW

All the above patterns can be macroized with the following patch:

--cut here--
--cut here--

Please also post ChangeLog entry.

Uros.

Comments

Uros Bizjak Dec. 15, 2016, 4:51 p.m. UTC | #1
On Thu, Dec 15, 2016 at 2:31 PM, Andrew Senkevich
<andrew.n.senkevich@gmail.com> wrote:
> 2016-12-14 22:55 GMT+03:00 Uros Bizjak <ubizjak@gmail.com>:
>> On Wed, Dec 14, 2016 at 8:04 PM, Andrew Senkevich
>> <andrew.n.senkevich@gmail.com> wrote:
>>
>>> here is the second part of k-mask intrinsics, is it Ok?
>>
>>> --- a/gcc/config/i386/sse.md
>>> +++ b/gcc/config/i386/sse.md
>>> @@ -1309,12 +1309,30 @@
>>>  ;; Mask variant shift mnemonics
>>>  (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
>>>
>>> +(define_expand "kmovb"
>>> +  [(set (match_operand:QI 0 "nonimmediate_operand")
>>> + (match_operand:QI 1 "nonimmediate_operand"))]
>>> +  "TARGET_AVX512DQ
>>> +   && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
>>> +
>>>  (define_expand "kmovw"
>>>    [(set (match_operand:HI 0 "nonimmediate_operand")
>>>   (match_operand:HI 1 "nonimmediate_operand"))]
>>>    "TARGET_AVX512F
>>>     && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
>>>
>>> +(define_expand "kmovd"
>>> +  [(set (match_operand:SI 0 "nonimmediate_operand")
>>> + (match_operand:SI 1 "nonimmediate_operand"))]
>>> +  "TARGET_AVX512BW
>>> +   && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
>>> +
>>> +(define_expand "kmovq"
>>> +  [(set (match_operand:DI 0 "nonimmediate_operand")
>>> + (match_operand:DI 1 "nonimmediate_operand"))]
>>> +  "TARGET_AVX512BW
>>> +   && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
>>> +
>>>  (define_insn "k<code><mode>"
>>>    [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
>>>   (any_logic:SWI1248_AVX512BW
>>
>> All the above patterns can be macroized with the following patch:
>>
>> --cut here--
>> Index: sse.md
>> ===================================================================
>> --- sse.md      (revision 243651)
>> +++ sse.md      (working copy)
>> @@ -1309,9 +1309,9 @@
>>  ;; Mask variant shift mnemonics
>>  (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
>>
>> -(define_expand "kmovw"
>> -  [(set (match_operand:HI 0 "nonimmediate_operand")
>> -       (match_operand:HI 1 "nonimmediate_operand"))]
>> +(define_expand "kmov<mskmodesuffix>"
>> +  [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
>> +       (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
>>    "TARGET_AVX512F
>>     && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
>>
>> --cut here--
>>
>> Please also post ChangeLog entry.
>
> Thanks,
>
> here is with ChangeLogs and renamed internal __builtin_ia32_kmov* to
> match instruction names.
> For __builtin_ia32_kmov16 change I will follow up for update in branches.
>
> Regtested on x86_64-linux-gnu, Ok for trunk?

OK.

Thanks,
Uros.
diff mbox

Patch

Index: sse.md
===================================================================
--- sse.md      (revision 243651)
+++ sse.md      (working copy)
@@ -1309,9 +1309,9 @@ 
 ;; Mask variant shift mnemonics
 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])

-(define_expand "kmovw"
-  [(set (match_operand:HI 0 "nonimmediate_operand")
-       (match_operand:HI 1 "nonimmediate_operand"))]
+(define_expand "kmov<mskmodesuffix>"
+  [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
+       (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
   "TARGET_AVX512F
    && !(MEM_P (operands[0]) && MEM_P (operands[1]))")