diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2017-11-20 20:52:14 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2017-11-20 20:52:14 +0100 |
commit | 121075d7601b521973522cce134567beb0c913bb (patch) | |
tree | 13999dbb8d9dde6155bbfa0707f25258a840b4cd /gcc | |
parent | 6017b8f0cfadaad21ceaf8c58f940cbc118f1a17 (diff) | |
download | gcc-121075d7601b521973522cce134567beb0c913bb.zip gcc-121075d7601b521973522cce134567beb0c913bb.tar.gz gcc-121075d7601b521973522cce134567beb0c913bb.tar.bz2 |
i386.md (bswaphi2): New expander.
* config/i386/i386.md (bswaphi2): New expander.
(*bswaphi2_movbe): New insn pattern.
(bswaphi -> rorhi pepehole2): New peephole pattern.
testsuite/ChangeLog:
* gcc.target/i386/movbe-5.c: New test.
From-SVN: r254967
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 28 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 33 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/movbe-5.c | 18 |
4 files changed, 71 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05b3e65..1499934 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-11-20 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (bswaphi2): New expander. + (*bswaphi2_movbe): New insn pattern. + (bswaphi -> rorhi pepehole2): New peephole pattern. + 2017-11-20 Jeff Law <law@redhat.com> * Makefile.in (OBJS): Add gimple-ssa-evrp-analyze.o. @@ -161,8 +167,7 @@ 2017-11-19 Jan Hubicka <hubicka@ucw.cz> PR target/82713 - * i386.c (ix86_builtin_vectorization_cost): Be ready for insane - types. + * i386.c (ix86_builtin_vectorization_cost): Be ready for insane types. 2017-11-19 Tom de Vries <tom@codesourcery.com> @@ -301,8 +306,7 @@ 2017-11-17 Jan Hubicka <hubicka@ucw.cz> - * ipa-cp.c (update_profiling_info): Handle conversion to local - profile. + * ipa-cp.c (update_profiling_info): Handle conversion to local profile. * tree-cfg.c (execute_fixup_cfg): Do fixup same way as inliner does. 2017-11-17 Jeff Law <law@redhat.com> @@ -466,8 +470,7 @@ * doc/invoke.texi (-std=c17): Refer to 2018 expected publication date of C17. - (-std=c18, -std=iso9899:2018, -std=gnu18): Document option - aliases. + (-std=c18, -std=iso9899:2018, -std=gnu18): Document option aliases. 2017-11-16 Thomas Koenig <tkoenig@gcc.gnu.org> @@ -519,8 +522,8 @@ 2017-11-16 Jan Hubicka <hubicka@ucw.cz> - * predict.c (combine_predictions_for_bb): Preserve zero predicted - eges. + * predict.c (combine_predictions_for_bb): Preserve zero predicted + edges. (expensive_function_p): Remove useless assert. (determine_unlikely_bbs): Propagate also forward; determine cold blocks @@ -2206,9 +2209,8 @@ 2017-11-06 James Bowman <james.bowman@ftdichip.com> - * gcc/dwarf2out.c (modified_type_die): Retain ADDR_SPACE - qualifiers. - (add_type_attribute) likewise. + * gcc/dwarf2out.c (modified_type_die): Retain ADDR_SPACE qualifiers. + (add_type_attribute) likewise. 2017-11-06 H.J. Lu <hongjiu.lu@intel.com> @@ -3448,7 +3450,7 @@ * doc/tm.texi (TARGET_FLOATN_BUILTIN_P): Likewise. 2017-10-31 Matthew Fortune <matthew.fortune@imgtec.com> - Eric Botcazou <ebotcazou@adacore.com> + Eric Botcazou <ebotcazou@adacore.com> PR rtl-optimization/81803 * lra-constraints.c (curr_insn_transform): Also reload the whole @@ -3553,7 +3555,7 @@ 2017-10-31 Olivier Hainque <hainque@adacore.com> - * gcc/Makefile.in (FLAGS_TO_PASS): Pass libsubdir as well. + * gcc/Makefile.in (FLAGS_TO_PASS): Pass libsubdir as well. 2017-10-31 Julia Koval <julia.koval@intel.com> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 1e91823..0eaa1f2 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -14091,6 +14091,39 @@ (set_attr "modrm" "0") (set_attr "mode" "<MODE>")]) +(define_expand "bswaphi2" + [(set (match_operand:HI 0 "register_operand") + (bswap:HI (match_operand:HI 1 "nonimmediate_operand")))] + "TARGET_MOVBE") + +(define_insn "*bswaphi2_movbe" + [(set (match_operand:HI 0 "nonimmediate_operand" "=Q,r,m") + (bswap:HI (match_operand:HI 1 "nonimmediate_operand" "0,m,r")))] + "TARGET_MOVBE + && !(MEM_P (operands[0]) && MEM_P (operands[1]))" + "@ + xchg{b}\t{%h0, %b0|%b0, %h0} + movbe\t{%1, %0|%0, %1} + movbe\t{%1, %0|%0, %1}" + [(set_attr "type" "imov") + (set_attr "modrm" "*,1,1") + (set_attr "prefix_0f" "*,1,1") + (set_attr "prefix_extra" "*,1,1") + (set_attr "pent_pair" "np,*,*") + (set_attr "athlon_decode" "vector,*,*") + (set_attr "amdfam10_decode" "double,*,*") + (set_attr "bdver1_decode" "double,*,*") + (set_attr "mode" "QI,HI,HI")]) + +(define_peephole2 + [(set (match_operand:HI 0 "general_reg_operand") + (bswap:HI (match_dup 0)))] + "TARGET_MOVBE + && !(TARGET_USE_XCHGB || optimize_function_for_size_p (cfun)) + && peep2_regno_dead_p (0, FLAGS_REG)" + [(parallel [(set (match_dup 0) (rotate:HI (match_dup 0) (const_int 8))) + (clobber (reg:CC FLAGS_REG))])]) + (define_insn "*bswaphi_lowpart_1" [(set (strict_low_part (match_operand:HI 0 "register_operand" "+Q,r")) (bswap:HI (match_dup 0))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 949eb19..ee6a910 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-20 Uros Bizjak <ubizjak@gmail.com> + Jakub Jelinek <jakub@redhat.com> + + * gcc.target/i386/movbe-5.c: New test. + 2017-11-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/79072 diff --git a/gcc/testsuite/gcc.target/i386/movbe-5.c b/gcc/testsuite/gcc.target/i386/movbe-5.c new file mode 100644 index 0000000..72e4165 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movbe-5.c @@ -0,0 +1,18 @@ +/* PR tree-optimization/78821 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmovbe" } */ +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 2 } } */ + +unsigned short +foo (unsigned short *buf) +{ + unsigned short a = buf[0]; + return ((unsigned short) (a >> 8)) | (unsigned short) (a << 8); +} + +void +bar (char *buf, unsigned int data) +{ + buf[0] = data >> 8; + buf[1] = data; +} |