@@ -961,3 +961,51 @@ static_assert(fmaDouble1[3] == 26.0);
961
961
constexpr float fmaArray[] = {2 .0f , 2 .0f , 2 .0f , 2 .0f };
962
962
constexpr float fmaResult = __builtin_elementwise_fma(fmaArray[1 ], fmaArray[2 ], fmaArray[3 ]);
963
963
static_assert (fmaResult == 6 .0f , " " );
964
+
965
+ static_assert (__builtin_elementwise_fshl((unsigned char )255 , (unsigned char )0 , (unsigned char )8 ) == (unsigned char )255 );
966
+ static_assert (__builtin_elementwise_fshl((char )127 , (char )0 , (char )8 ) == (char )127 );
967
+ static_assert (__builtin_elementwise_fshl((unsigned char )0 , (unsigned char )255 , (unsigned char )8 ) == (unsigned char )0 );
968
+ static_assert (__builtin_elementwise_fshl((char )0 , (char )127 , (char )8 ) == (char )0 );
969
+ static_assert (__builtin_elementwise_fshr((unsigned char )255 , (unsigned char )0 , (unsigned char )8 ) == (unsigned char )0 );
970
+ static_assert (__builtin_elementwise_fshr((char )127 , (char )0 , (char )8 ) == (char )0 );
971
+ static_assert (__builtin_elementwise_fshr((unsigned char )0 , (unsigned char )255 , (unsigned char )8 ) == (unsigned char )255 );
972
+ static_assert (__builtin_elementwise_fshr((char )0 , (char )127 , (char )8 ) == (char )127 );
973
+ static_assert (__builtin_elementwise_fshl((unsigned int )4294967295 , (unsigned int )0 , (unsigned int )32 ) == (unsigned int )4294967295 );
974
+ static_assert (__builtin_elementwise_fshl((int )2147483647 , (int )0 , (int )32 ) == (int )2147483647 );
975
+ static_assert (__builtin_elementwise_fshl((unsigned int )0 , (unsigned int )4294967295 , (unsigned int )32 ) == (unsigned int )0 );
976
+ static_assert (__builtin_elementwise_fshl((int )0 , (int )2147483647 , (int )32 ) == (int )0 );
977
+ static_assert (__builtin_elementwise_fshr((unsigned int )4294967295 , (unsigned int )0 , (unsigned int )32 ) == (unsigned int )0 );
978
+ static_assert (__builtin_elementwise_fshr((int )2147483647 , (int )0 , (int )32 ) == (int )0 );
979
+ static_assert (__builtin_elementwise_fshr((unsigned int )0 , (unsigned int )4294967295 , (unsigned int )32 ) == (unsigned int )4294967295 );
980
+ static_assert (__builtin_elementwise_fshr((int )0 , (int )2147483647 , (int )32 ) == (int )2147483647 );
981
+ static_assert (__builtin_elementwise_fshl((unsigned long long )18446744073709551615ULL , (unsigned long long )0 , (unsigned long long )64 ) == (unsigned long long )18446744073709551615ULL );
982
+ static_assert (__builtin_elementwise_fshl((long long )9223372036854775807 , (long long )0 , (long long )64 ) == (long long )9223372036854775807 );
983
+ static_assert (__builtin_elementwise_fshl((unsigned long long )0 , (unsigned long long )18446744073709551615ULL , (unsigned long long )64 ) == (unsigned long long )0 );
984
+ static_assert (__builtin_elementwise_fshl((long long )0 , (long long )9223372036854775807 , (long long )64 ) == (long long )0 );
985
+ static_assert (__builtin_elementwise_fshr((unsigned long long )18446744073709551615ULL , (unsigned long long )0 , (unsigned long long )64 ) == (unsigned long long )0 );
986
+ static_assert (__builtin_elementwise_fshr((long long )9223372036854775807 , (long long )0 , (long long )64 ) == (long long )0 );
987
+ static_assert (__builtin_elementwise_fshr((unsigned long long )0 , (unsigned long long )18446744073709551615ULL , (unsigned long long )64 ) == (unsigned long long )18446744073709551615ULL );
988
+ static_assert (__builtin_elementwise_fshr((long long )0 , (long long )9223372036854775807 , (long long )64 ) == (long long )9223372036854775807 );
989
+ static_assert (__builtin_elementwise_fshl((short ) 1 , (short ) 2 , (short ) 3 ) == (short )8 );
990
+ static_assert (__builtin_elementwise_fshl((short ) 2 , (short ) 1 , (short ) 3 ) == (short )16 );
991
+ static_assert (__builtin_elementwise_fshl(1 , 2 , 2 ) == 4 );
992
+ static_assert (__builtin_elementwise_fshl(2L , 1L , 2L ) == 8L );
993
+ static_assert (__builtin_elementwise_fshr((unsigned char )1 , (unsigned char )2 , (unsigned char )3 ) == (unsigned char )32 );
994
+ constexpr vector4uchar v4s_fshl_var =
995
+ __builtin_elementwise_fshl ((vector4uchar){255 , 15 , 0 , 2 },
996
+ (vector4uchar){0 , 15 , 255 , 1 },
997
+ (vector4uchar){15 , 11 , 8 , 3 });
998
+ static_assert (v4s_fshl_var[0 ] == 128 );
999
+ static_assert (v4s_fshl_var[1 ] == 120 );
1000
+ static_assert (v4s_fshl_var[2 ] == 0 );
1001
+ static_assert (v4s_fshl_var[3 ] == 16 );
1002
+ constexpr vector4uchar v4s_fshr_var =
1003
+ __builtin_elementwise_fshr ((vector4uchar){255 , 15 , 0 , 1 },
1004
+ (vector4uchar){0 , 15 , 255 , 2 },
1005
+ (vector4uchar){15 , 11 , 8 , 3 });
1006
+ static_assert (v4s_fshr_var[0 ] == 254 );
1007
+ static_assert (v4s_fshr_var[1 ] == 225 );
1008
+ static_assert (v4s_fshr_var[2 ] == 255 );
1009
+ static_assert (v4s_fshr_var[3 ] == 32 );
1010
+ static_assert (__builtin_elementwise_fshl(v4s_fshl_var[0 ], v4s_fshl_var[1 ], v4s_fshl_var[2 ]) == 128 );
1011
+ static_assert (__builtin_elementwise_fshr(v4s_fshr_var[0 ], v4s_fshr_var[1 ], v4s_fshr_var[2 ]) == 253 );
0 commit comments