@@ -939,3 +939,47 @@ define <2 x double> @copysign_same_operand_vec(<2 x double> %x) {
939
939
%r = call <2 x double > @llvm.copysign.v2f64 (<2 x double > %x , <2 x double > %x )
940
940
ret <2 x double > %r
941
941
}
942
+
943
+ define float @negated_sign_arg (float %x ) {
944
+ ; CHECK-LABEL: @negated_sign_arg(
945
+ ; CHECK-NEXT: [[NEGX:%.*]] = fsub ninf float -0.000000e+00, [[X:%.*]]
946
+ ; CHECK-NEXT: [[R:%.*]] = call arcp float @llvm.copysign.f32(float [[X]], float [[NEGX]])
947
+ ; CHECK-NEXT: ret float [[R]]
948
+ ;
949
+ %negx = fsub ninf float -0 .0 , %x
950
+ %r = call arcp float @llvm.copysign.f32 (float %x , float %negx )
951
+ ret float %r
952
+ }
953
+
954
+ define <2 x double > @negated_sign_arg_vec (<2 x double > %x ) {
955
+ ; CHECK-LABEL: @negated_sign_arg_vec(
956
+ ; CHECK-NEXT: [[NEGX:%.*]] = fneg afn <2 x double> [[X:%.*]]
957
+ ; CHECK-NEXT: [[R:%.*]] = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> [[X]], <2 x double> [[NEGX]])
958
+ ; CHECK-NEXT: ret <2 x double> [[R]]
959
+ ;
960
+ %negx = fneg afn <2 x double > %x
961
+ %r = call arcp <2 x double > @llvm.copysign.v2f64 (<2 x double > %x , <2 x double > %negx )
962
+ ret <2 x double > %r
963
+ }
964
+
965
+ define float @negated_mag_arg (float %x ) {
966
+ ; CHECK-LABEL: @negated_mag_arg(
967
+ ; CHECK-NEXT: [[NEGX:%.*]] = fneg nnan float [[X:%.*]]
968
+ ; CHECK-NEXT: [[R:%.*]] = call ninf float @llvm.copysign.f32(float [[NEGX]], float [[X]])
969
+ ; CHECK-NEXT: ret float [[R]]
970
+ ;
971
+ %negx = fneg nnan float %x
972
+ %r = call ninf float @llvm.copysign.f32 (float %negx , float %x )
973
+ ret float %r
974
+ }
975
+
976
+ define <2 x double > @negated_mag_arg_vec (<2 x double > %x ) {
977
+ ; CHECK-LABEL: @negated_mag_arg_vec(
978
+ ; CHECK-NEXT: [[NEGX:%.*]] = fneg afn <2 x double> [[X:%.*]]
979
+ ; CHECK-NEXT: [[R:%.*]] = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> [[NEGX]], <2 x double> [[X]])
980
+ ; CHECK-NEXT: ret <2 x double> [[R]]
981
+ ;
982
+ %negx = fneg afn <2 x double > %x
983
+ %r = call arcp <2 x double > @llvm.copysign.v2f64 (<2 x double > %negx , <2 x double > %x )
984
+ ret <2 x double > %r
985
+ }
0 commit comments