public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Paul Clarke <pc@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2705] rs6000: Add support for _mm_minpos_epu16 Date: Tue, 3 Aug 2021 18:59:50 +0000 (GMT) [thread overview] Message-ID: <20210803185950.8A18A384601E@sourceware.org> (raw) https://gcc.gnu.org/g:eaa93a0f3d9f67c8cbc1dc849ea6feba432ff412 commit r12-2705-geaa93a0f3d9f67c8cbc1dc849ea6feba432ff412 Author: Paul A. Clarke <pc@us.ibm.com> Date: Mon Feb 22 19:13:28 2021 -0600 rs6000: Add support for _mm_minpos_epu16 Add a naive implementation of the subject x86 intrinsic to ease porting. 2021-08-03 Paul A. Clarke <pc@us.ibm.com> gcc * config/rs6000/smmintrin.h (_mm_minpos_epu16): New. Diff: --- gcc/config/rs6000/smmintrin.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h index 0145b9229a6..3767a67eada 100644 --- a/gcc/config/rs6000/smmintrin.h +++ b/gcc/config/rs6000/smmintrin.h @@ -296,4 +296,31 @@ _mm_floor_ss (__m128 __A, __m128 __B) return __r; } +/* Return horizontal packed word minimum and its index in bits [15:0] + and bits [18:16] respectively. */ +__inline __m128i +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) +_mm_minpos_epu16 (__m128i __A) +{ + union __u + { + __m128i __m; + __v8hu __uh; + }; + union __u __u = { .__m = __A }, __r = { .__m = {0} }; + unsigned short __ridx = 0; + unsigned short __rmin = __u.__uh[__ridx]; + for (unsigned long __i = 1; __i < 8; __i++) + { + if (__u.__uh[__i] < __rmin) + { + __rmin = __u.__uh[__i]; + __ridx = __i; + } + } + __r.__uh[0] = __rmin; + __r.__uh[1] = __ridx; + return __r.__m; +} + #endif
reply other threads:[~2021-08-03 18:59 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210803185950.8A18A384601E@sourceware.org \ --to=pc@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).