@@ -111,7 +111,23 @@ Macro definitions
111
111
#elif defined(__GNUC__ )
112
112
113
113
/* void __builtin_rx_xchg (int *, int *) */
114
+ #if __has_builtin (__builtin_rx_xchg )
114
115
#define R_BSP_EXCHANGE (x , y ) __builtin_rx_xchg((int *)(x), (int *)(y))
116
+ #else
117
+ static inline void rx_xchg (int * a , int * b )
118
+ {
119
+ int temp ;
120
+ __asm__ __volatile__ (
121
+ "mov %2, %0\n\t" // temp = *b
122
+ "xchg [%1], %0\n\t" // *a <-> temp
123
+ "mov %0, %2\n\t" // *b = temp
124
+ : "=&r" (temp ) // temp is output only
125
+ : "r" (a ), "m" (* b )
126
+ : "memory"
127
+ );
128
+ }
129
+ #define R_BSP_EXCHANGE (x , y ) rx_xchg((int *)(x), (int *)(y))
130
+ #endif /* __builtin_rx_xchg */
115
131
116
132
#elif defined(__ICCRX__ )
117
133
@@ -713,7 +729,7 @@ Macro definitions
713
729
714
730
/* Invalid for ICCRX.
715
731
Because the initilaze function of TFU is called automatically when the TFU function is called. */
716
- #define R_BSP_INIT_TFU ()
732
+ #define R_BSP_INIT_TFU ()
717
733
#endif /* BSP_MCU_TFU_VERSION == 1 */
718
734
#endif
719
735
@@ -736,7 +752,7 @@ Macro definitions
736
752
737
753
#endif
738
754
739
- /* ---------- Uses the trigonometric function unit to calculate the arc tangent of x and y and the square root of the
755
+ /* ---------- Uses the trigonometric function unit to calculate the arc tangent of x and y and the square root of the
740
756
sum of squares of these values at the same time. (single precision) ---------- */
741
757
#if defined(__CCRX__ )
742
758
@@ -765,7 +781,7 @@ Macro definitions
765
781
/* void __sincosfx(signed long fx, signed long *sin, signed long *cos) */
766
782
#define R_BSP_SINCOSFX (x , y , z ) __sincosfx((int32_t)(x), (int32_t *)(y), (int32_t *)(z))
767
783
#else
768
- #define R_BSP_SINCOSFX (x , y , z )
784
+ #define R_BSP_SINCOSFX (x , y , z )
769
785
#endif
770
786
771
787
#elif defined(__GNUC__ )
@@ -788,7 +804,7 @@ Macro definitions
788
804
/* signed long __sinfx(signed long fx) */
789
805
#define R_BSP_SINFX (x ) __sinfx((int32_t)(x))
790
806
#else
791
- #define R_BSP_SINFX (x )
807
+ #define R_BSP_SINFX (x )
792
808
#endif
793
809
794
810
#elif defined(__GNUC__ )
@@ -811,7 +827,7 @@ Macro definitions
811
827
/* signed long __cosfx(signed long fx) */
812
828
#define R_BSP_COSFX (x ) __cosfx((int32_t)(x))
813
829
#else
814
- #define R_BSP_COSFX (x )
830
+ #define R_BSP_COSFX (x )
815
831
#endif
816
832
817
833
#elif defined(__GNUC__ )
@@ -826,15 +842,15 @@ Macro definitions
826
842
827
843
#endif
828
844
829
- /* ---------- Uses the trigonometric function unit to calculate the arc tangent of x and y and the square root of the
845
+ /* ---------- Uses the trigonometric function unit to calculate the arc tangent of x and y and the square root of the
830
846
sum of squares of these values. (fixed-point numbers) ---------- */
831
847
#if defined(__CCRX__ )
832
848
833
849
#if __RENESAS_VERSION__ >= 0x03050000
834
850
/* __atan2hypotfx(signed long y, signed long x, signed long *atan2, signed long *hypot) */
835
851
#define R_BSP_ATAN2HYPOTFX (w , x , y , z ) __atan2hypotfx((int32_t)(w), (int32_t)(x), (int32_t *)(y), (int32_t *)(z))
836
852
#else
837
- #define R_BSP_ATAN2HYPOTFX (w , x , y , z )
853
+ #define R_BSP_ATAN2HYPOTFX (w , x , y , z )
838
854
#endif
839
855
840
856
#elif defined(__GNUC__ )
@@ -859,7 +875,7 @@ Macro definitions
859
875
/* signed long __atan2fx(signed long y, signed long x) */
860
876
#define R_BSP_ATAN2FX (x , y ) __atan2fx((int32_t)(x), (int32_t)(y))
861
877
#else
862
- #define R_BSP_ATAN2FX (x , y )
878
+ #define R_BSP_ATAN2FX (x , y )
863
879
#endif
864
880
865
881
#elif defined(__GNUC__ )
@@ -874,15 +890,15 @@ Macro definitions
874
890
875
891
#endif
876
892
877
- /* ---------- Uses the trigonometric function unit to calculate the square root of the
893
+ /* ---------- Uses the trigonometric function unit to calculate the square root of the
878
894
sum of squares of x and y. (fixed-point numbers) ---------- */
879
895
#if defined(__CCRX__ )
880
896
881
897
#if __RENESAS_VERSION__ >= 0x03050000
882
898
/* signed long __hypotfx(signed long x, signed long y) */
883
899
#define R_BSP_HYPOTFX (x , y ) __hypotfx((int32_t)(x), (int32_t)(y))
884
900
#else
885
- #define R_BSP_HYPOTFX (x , y )
901
+ #define R_BSP_HYPOTFX (x , y )
886
902
#endif
887
903
888
904
#elif defined(__GNUC__ )
0 commit comments