2019-06-03 07:44:50 +02:00
/* SPDX-License-Identifier: GPL-2.0-only */
2012-03-05 11:49:32 +00:00
/ *
* FP/ S I M D s t a t e s a v i n g a n d r e s t o r i n g
*
* Copyright ( C ) 2 0 1 2 A R M L t d .
* Author : Catalin M a r i n a s < c a t a l i n . m a r i n a s @arm.com>
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
2012-11-12 13:24:27 +00:00
# include < a s m / f p s i m d m a c r o s . h >
2012-03-05 11:49:32 +00:00
/ *
* Save t h e F P r e g i s t e r s .
*
* x0 - p o i n t e r t o s t r u c t f p s i m d _ s t a t e
* /
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ S T A R T ( f p s i m d _ s a v e _ s t a t e )
2012-11-12 13:24:27 +00:00
fpsimd_ s a v e x0 , 8
2012-03-05 11:49:32 +00:00
ret
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ E N D ( f p s i m d _ s a v e _ s t a t e )
2012-03-05 11:49:32 +00:00
/ *
* Load t h e F P r e g i s t e r s .
*
* x0 - p o i n t e r t o s t r u c t f p s i m d _ s t a t e
* /
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ S T A R T ( f p s i m d _ l o a d _ s t a t e )
2012-11-12 13:24:27 +00:00
fpsimd_ r e s t o r e x0 , 8
2012-03-05 11:49:32 +00:00
ret
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ E N D ( f p s i m d _ l o a d _ s t a t e )
2017-10-31 15:51:01 +00:00
# ifdef C O N F I G _ A R M 6 4 _ S V E
2020-08-28 19:11:52 +01:00
2021-08-12 21:11:43 +01:00
/ *
* Save t h e S V E s t a t e
*
* x0 - p o i n t e r t o b u f f e r f o r s t a t e
* x1 - p o i n t e r t o s t o r a g e f o r F P S R
* /
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ S T A R T ( s v e _ s a v e _ s t a t e )
2017-10-31 15:51:01 +00:00
sve_ s a v e 0 , x1 , 2
ret
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ E N D ( s v e _ s a v e _ s t a t e )
2017-10-31 15:51:01 +00:00
2021-08-12 21:11:43 +01:00
/ *
* Load t h e S V E s t a t e
*
* x0 - p o i n t e r t o b u f f e r f o r s t a t e
* x1 - p o i n t e r t o s t o r a g e f o r F P S R
* x2 - V Q - 1
* /
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ S T A R T ( s v e _ l o a d _ s t a t e )
2018-05-14 18:51:09 +01:00
sve_ l o a d 0 , x1 , x2 , 3 , x4
2017-10-31 15:51:01 +00:00
ret
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ E N D ( s v e _ l o a d _ s t a t e )
2017-10-31 15:51:01 +00:00
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ S T A R T ( s v e _ g e t _ v l )
2017-10-31 15:51:01 +00:00
_ sve_ r d v l 0 , 1
ret
2020-05-01 12:54:29 +01:00
SYM_ F U N C _ E N D ( s v e _ g e t _ v l )
2020-08-28 19:11:52 +01:00
2021-03-12 19:03:13 +00:00
SYM_ F U N C _ S T A R T ( s v e _ s e t _ v q )
sve_ l o a d _ v q x0 , x1 , x2
ret
SYM_ F U N C _ E N D ( s v e _ s e t _ v q )
2020-08-28 19:11:53 +01:00
/ *
* Load S V E s t a t e f r o m F P S I M D s t a t e .
*
* x0 = p o i n t e r t o s t r u c t f p s i m d _ s t a t e
* x1 = V Q - 1
*
* Each S V E v e c t o r w i l l b e l o a d e d w i t h t h e f i r s t 1 2 8 - b i t s t a k e n f r o m F P S I M D
* and t h e r e s t z e r o e d . A l l t h e o t h e r S V E r e g i s t e r s w i l l b e z e r o e d .
* /
SYM_ F U N C _ S T A R T ( s v e _ l o a d _ f r o m _ f p s i m d _ s t a t e )
2021-05-12 16:11:30 +01:00
sve_ l o a d _ v q x1 , x2 , x3
fpsimd_ r e s t o r e x0 , 8
sve_ f l u s h _ p _ f f r
ret
2020-08-28 19:11:53 +01:00
SYM_ F U N C _ E N D ( s v e _ l o a d _ f r o m _ f p s i m d _ s t a t e )
2021-05-12 16:11:31 +01:00
/ *
* Zero a l l S V E r e g i s t e r s b u t t h e f i r s t 1 2 8 - b i t s o f e a c h v e c t o r
*
* VQ m u s t a l r e a d y b e c o n f i g u r e d b y c a l l e r , a n y f u r t h e r u p d a t e s o f V Q
* will n e e d t o e n s u r e t h a t t h e r e g i s t e r s t a t e r e m a i n s v a l i d .
*
* x0 = V Q - 1
* /
2020-08-28 19:11:52 +01:00
SYM_ F U N C _ S T A R T ( s v e _ f l u s h _ l i v e )
2021-05-12 16:11:31 +01:00
cbz x0 , 1 f / / A V Q - 1 o f 0 i s 1 2 8 b i t s s o n o e x t r a Z s t a t e
2021-05-12 16:11:29 +01:00
sve_ f l u s h _ z
2021-05-12 16:11:31 +01:00
1 : sve_ f l u s h _ p _ f f r
2020-08-28 19:11:52 +01:00
ret
SYM_ F U N C _ E N D ( s v e _ f l u s h _ l i v e )
2017-10-31 15:51:01 +00:00
# endif / * C O N F I G _ A R M 6 4 _ S V E * /