2019-06-03 08:44:50 +03:00
/* SPDX-License-Identifier: GPL-2.0-only */
2012-03-05 15:49:32 +04: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 17:24:27 +04:00
# include < a s m / f p s i m d m a c r o s . h >
2012-03-05 15:49:32 +04: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 14:54:29 +03: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 17:24:27 +04:00
fpsimd_ s a v e x0 , 8
2012-03-05 15:49:32 +04:00
ret
2020-05-01 14:54:29 +03: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 15:49:32 +04: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 14:54:29 +03: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 17:24:27 +04:00
fpsimd_ r e s t o r e x0 , 8
2012-03-05 15:49:32 +04:00
ret
2020-05-01 14:54:29 +03: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 18:51:01 +03:00
# ifdef C O N F I G _ A R M 6 4 _ S V E
2020-08-28 21:11:52 +03:00
2021-08-12 23:11:43 +03: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
2021-10-19 20:22:09 +03:00
* x2 - S a v e F F R i f n o n - z e r o
2021-08-12 23:11:43 +03:00
* /
2020-05-01 14:54:29 +03:00
SYM_ F U N C _ S T A R T ( s v e _ s a v e _ s t a t e )
2021-10-19 20:22:09 +03:00
sve_ s a v e 0 , x1 , x2 , 3
2017-10-31 18:51:01 +03:00
ret
2020-05-01 14:54:29 +03:00
SYM_ F U N C _ E N D ( s v e _ s a v e _ s t a t e )
2017-10-31 18:51:01 +03:00
2021-08-12 23:11:43 +03: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
2021-10-19 20:22:09 +03:00
* x2 - R e s t o r e F F R i f n o n - z e r o
2021-08-12 23:11:43 +03:00
* /
2020-05-01 14:54:29 +03:00
SYM_ F U N C _ S T A R T ( s v e _ l o a d _ s t a t e )
2021-10-19 20:22:13 +03:00
sve_ l o a d 0 , x1 , x2 , 4
2017-10-31 18:51:01 +03:00
ret
2020-05-01 14:54:29 +03:00
SYM_ F U N C _ E N D ( s v e _ l o a d _ s t a t e )
2017-10-31 18:51:01 +03:00
2020-05-01 14:54:29 +03:00
SYM_ F U N C _ S T A R T ( s v e _ g e t _ v l )
2017-10-31 18:51:01 +03:00
_ sve_ r d v l 0 , 1
ret
2020-05-01 14:54:29 +03:00
SYM_ F U N C _ E N D ( s v e _ g e t _ v l )
2020-08-28 21:11:52 +03:00
2021-03-12 22:03:13 +03: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 )
2021-05-12 18:11:31 +03: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 .
*
2021-10-19 20:22:09 +03:00
* x0 = i n c l u d e F F R ?
* x1 = V Q - 1
2021-05-12 18:11:31 +03:00
* /
2020-08-28 21:11:52 +03:00
SYM_ F U N C _ S T A R T ( s v e _ f l u s h _ l i v e )
2021-10-19 20:22:09 +03:00
cbz x1 , 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 18:11:29 +03:00
sve_ f l u s h _ z
2021-10-19 20:22:09 +03:00
1 : sve_ f l u s h _ p
tbz x0 , #0 , 2 f
sve_ f l u s h _ f f r
2 : ret
2020-08-28 21:11:52 +03:00
SYM_ F U N C _ E N D ( s v e _ f l u s h _ l i v e )
2017-10-31 18:51:01 +03:00
# endif / * C O N F I G _ A R M 6 4 _ S V E * /
2022-04-19 14:22:17 +03:00
# ifdef C O N F I G _ A R M 6 4 _ S M E
SYM_ F U N C _ S T A R T ( s m e _ g e t _ v l )
_ sme_ r d s v l 0 , 1
ret
SYM_ F U N C _ E N D ( s m e _ g e t _ v l )
2022-04-19 14:22:22 +03:00
SYM_ F U N C _ S T A R T ( s m e _ s e t _ v q )
sme_ l o a d _ v q x0 , x1 , x2
ret
SYM_ F U N C _ E N D ( s m e _ s e t _ v q )
2022-04-19 14:22:23 +03:00
/ *
* Save t h e S M 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
* /
SYM_ F U N C _ S T A R T ( z a _ s a v e _ s t a t e )
_ sme_ r d s v l 1 , 1 / / x1 = V L / 8
sme_ s a v e _ z a 0 , x1 , 1 2
ret
SYM_ F U N C _ E N D ( z a _ s a v e _ s t a t e )
/ *
* Load t h e S M 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
* /
SYM_ F U N C _ S T A R T ( z a _ l o a d _ s t a t e )
_ sme_ r d s v l 1 , 1 / / x1 = V L / 8
sme_ l o a d _ z a 0 , x1 , 1 2
ret
SYM_ F U N C _ E N D ( z a _ l o a d _ s t a t e )
2022-04-19 14:22:17 +03:00
# endif / * C O N F I G _ A R M 6 4 _ S M E * /