diff mbox series

[v2,5/6] rs6000: Add support for SSE4.1 "floor" intrinsics

Message ID 20210716135022.489455-6-pc@us.ibm.com
State New
Headers show
Series rs6000: Add SSE4.1 "blend", "ceil", "floor" | expand

Commit Message

Paul A. Clarke July 16, 2021, 1:50 p.m. UTC
2021-07-16  Paul A. Clarke  <pc@us.ibm.com>

gcc
	* config/rs6000/smmintrin.h (_mm_floor_pd, _mm_floor_ps,
	_mm_floor_sd, _mm_floor_ss): New.
---
v2: Improve formatting per review from Bill.

 gcc/config/rs6000/smmintrin.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Li, Pan2 via Gcc-patches July 16, 2021, 6:30 p.m. UTC | #1
Hi Paul,

LGTM!  Recommend maintainers approve.

Bill

On 7/16/21 8:50 AM, Paul A. Clarke wrote:
> 2021-07-16  Paul A. Clarke  <pc@us.ibm.com>
>
> gcc
> 	* config/rs6000/smmintrin.h (_mm_floor_pd, _mm_floor_ps,
> 	_mm_floor_sd, _mm_floor_ss): New.
> ---
> v2: Improve formatting per review from Bill.
>
>   gcc/config/rs6000/smmintrin.h | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
>
> diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h
> index cad770a67631..5960991e0af7 100644
> --- a/gcc/config/rs6000/smmintrin.h
> +++ b/gcc/config/rs6000/smmintrin.h
> @@ -264,6 +264,38 @@ _mm_ceil_ss (__m128 __A, __m128 __B)
>     return r;
>   }
>   
> +__inline __m128d
> +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> +_mm_floor_pd (__m128d __A)
> +{
> +  return (__m128d) vec_floor ((__v2df) __A);
> +}
> +
> +__inline __m128
> +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> +_mm_floor_ps (__m128 __A)
> +{
> +  return (__m128) vec_floor ((__v4sf) __A);
> +}
> +
> +__inline __m128d
> +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> +_mm_floor_sd (__m128d __A, __m128d __B)
> +{
> +  __v2df r = vec_floor ((__v2df) __B);
> +  r[1] = ((__v2df) __A)[1];
> +  return (__m128d) r;
> +}
> +
> +__inline __m128
> +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> +_mm_floor_ss (__m128 __A, __m128 __B)
> +{
> +  __v4sf r = (__v4sf) __A;
> +  r[0] = __builtin_floor (((__v4sf) __B)[0]);
> +  return r;
> +}
> +
>   /* Return horizontal packed word minimum and its index in bits [15:0]
>      and bits [18:16] respectively.  */
>   __inline __m128i
Segher Boessenkool July 28, 2021, 10:25 p.m. UTC | #2
On Fri, Jul 16, 2021 at 08:50:21AM -0500, Paul A. Clarke wrote:
> 	* config/rs6000/smmintrin.h (_mm_floor_pd, _mm_floor_ps,
> 	_mm_floor_sd, _mm_floor_ss): New.

Okay for trunk.  Thanks!


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h
index cad770a67631..5960991e0af7 100644
--- a/gcc/config/rs6000/smmintrin.h
+++ b/gcc/config/rs6000/smmintrin.h
@@ -264,6 +264,38 @@  _mm_ceil_ss (__m128 __A, __m128 __B)
   return r;
 }
 
+__inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_floor_pd (__m128d __A)
+{
+  return (__m128d) vec_floor ((__v2df) __A);
+}
+
+__inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_floor_ps (__m128 __A)
+{
+  return (__m128) vec_floor ((__v4sf) __A);
+}
+
+__inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_floor_sd (__m128d __A, __m128d __B)
+{
+  __v2df r = vec_floor ((__v2df) __B);
+  r[1] = ((__v2df) __A)[1];
+  return (__m128d) r;
+}
+
+__inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_floor_ss (__m128 __A, __m128 __B)
+{
+  __v4sf r = (__v4sf) __A;
+  r[0] = __builtin_floor (((__v4sf) __B)[0]);
+  return r;
+}
+
 /* Return horizontal packed word minimum and its index in bits [15:0]
    and bits [18:16] respectively.  */
 __inline __m128i