Commit ff8f129b by Jan Beulich Committed by Jan Beulich

x86/AVX512: improve generated code for bit-wise negation of vectors of integers

NOT on vectors of integers does not require loading a constant vector of
all ones into a register - VPTERNLOG can be used here (and could/should
be further used to carry out other binary and ternary logical operations
which don't have a special purpose instruction).

gcc/
2019-07-22  Jan Beulich  <jbeulich@suse.com>

	* config/i386/sse.md (ternlogsuffix): New.
	(one_cmpl<mode>2): Don't force CONSTM1_RTX into a register when
	AVX512F is in use.
	(<mask_codefor>one_cmpl<mode>2<mask_name>): New.

From-SVN: r273663
parent a861990d
2019-07-22 Jan Beulich <jbeulich@suse.com>
* config/i386/sse.md (ternlogsuffix): New.
(one_cmpl<mode>2): Don't force CONSTM1_RTX into a register when
AVX512F is in use.
(<mask_codefor>one_cmpl<mode>2<mask_name>): New.
2019-07-22 Martin Liska <mliska@suse.cz> 2019-07-22 Martin Liska <mliska@suse.cz>
* config/avr/avr.c (avr_asm_output_aligned_decl_common): Update * config/avr/avr.c (avr_asm_output_aligned_decl_common): Update
......
...@@ -853,6 +853,13 @@ ...@@ -853,6 +853,13 @@
(V4SF "k") (V2DF "q") (V4SF "k") (V2DF "q")
(SF "k") (DF "q")]) (SF "k") (DF "q")])
;; Mapping of vector modes to VPTERNLOG suffix
(define_mode_attr ternlogsuffix
[(V8DI "q") (V4DI "q") (V2DI "q")
(V16SI "d") (V8SI "d") (V4SI "d")
(V32HI "d") (V16HI "d") (V8HI "d")
(V64QI "d") (V32QI "d") (V16QI "d")])
;; Number of scalar elements in each vector type ;; Number of scalar elements in each vector type
(define_mode_attr ssescalarnum (define_mode_attr ssescalarnum
[(V64QI "64") (V16SI "16") (V8DI "8") [(V64QI "64") (V16SI "16") (V8DI "8")
...@@ -12723,9 +12730,22 @@ ...@@ -12723,9 +12730,22 @@
(match_dup 2)))] (match_dup 2)))]
"TARGET_SSE" "TARGET_SSE"
{ {
operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode)); if (!TARGET_AVX512F)
operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
else
operands[2] = CONSTM1_RTX (<MODE>mode);
}) })
(define_insn "<mask_codefor>one_cmpl<mode>2<mask_name>"
[(set (match_operand:VI 0 "register_operand" "=v")
(xor:VI (match_operand:VI 1 "nonimmediate_operand" "vm")
(match_operand:VI 2 "vector_all_ones_operand" "BC")))]
"TARGET_AVX512F"
"vpternlog<ternlogsuffix>\t{$0x55, %1, %0, %0<mask_operand3>|%0<mask_operand3>, %0, %1, 0x55}"
[(set_attr "type" "sselog")
(set_attr "prefix" "evex")
(set_attr "mode" "<sseinsnmode>")])
(define_expand "<sse2_avx2>_andnot<mode>3" (define_expand "<sse2_avx2>_andnot<mode>3"
[(set (match_operand:VI_AVX2 0 "register_operand") [(set (match_operand:VI_AVX2 0 "register_operand")
(and:VI_AVX2 (and:VI_AVX2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment