kpn updated this revision to Diff 235880. kpn added a comment. Update now-failing tests.
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71854/new/ https://reviews.llvm.org/D71854 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/builtins-systemz-vector.c clang/test/CodeGen/builtins-systemz-vector2.c clang/test/CodeGen/builtins-systemz-zvector.c clang/test/CodeGen/builtins-systemz-zvector2.c
Index: clang/test/CodeGen/builtins-systemz-zvector2.c =================================================================== --- clang/test/CodeGen/builtins-systemz-zvector2.c +++ clang/test/CodeGen/builtins-systemz-zvector2.c @@ -686,11 +686,11 @@ vf = vec_nabs(vf); // CHECK: [[ABS:%[^ ]+]] = tail call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) - // CHECK-NEXT: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[ABS]] + // CHECK-NEXT: fneg <4 x float> [[ABS]] // CHECK-ASM: vflnsb vd = vec_nabs(vd); // CHECK: [[ABS:%[^ ]+]] = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{.*}}) - // CHECK-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[ABS]] + // CHECK-NEXT: fneg <2 x double> [[ABS]] // CHECK-ASM: vflndb vf = vec_max(vf, vf); @@ -715,32 +715,32 @@ // CHECK-ASM: vfmadb vf = vec_msub(vf, vf, vf); - // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <4 x float> %{{.*}} // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) // CHECK-ASM: vfmssb vd = vec_msub(vd, vd, vd); - // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <2 x double> %{{.*}} // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) // CHECK-ASM: vfmsdb vf = vec_nmadd(vf, vf, vf); // CHECK: [[RES:%[^ ]+]] = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) - // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + // CHECK: fneg <4 x float> [[RES]] // CHECK-ASM: vfnmasb vd = vec_nmadd(vd, vd, vd); // CHECK: [[RES:%[^ ]+]] = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) - // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + // CHECK: fneg <2 x double> [[RES]] // CHECK-ASM: vfnmadb vf = vec_nmsub(vf, vf, vf); - // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <4 x float> %{{.*}} // CHECK: [[RES:%[^ ]+]] = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) - // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + // CHECK: fneg <4 x float> [[RES]] // CHECK-ASM: vfnmssb vd = vec_nmsub(vd, vd, vd); - // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <2 x double> %{{.*}} // CHECK: [[RES:%[^ ]+]] = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) - // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + // CHECK: fneg <2 x double> [[RES]] // CHECK-ASM: vfnmsdb vf = vec_sqrt(vf); Index: clang/test/CodeGen/builtins-systemz-zvector.c =================================================================== --- clang/test/CodeGen/builtins-systemz-zvector.c +++ clang/test/CodeGen/builtins-systemz-zvector.c @@ -4442,14 +4442,14 @@ vd = vec_nabs(vd); // CHECK: [[ABS:%[^ ]+]] = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{.*}}) - // CHECK-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[ABS]] + // CHECK-NEXT: fneg <2 x double> [[ABS]] // CHECK-ASM: vflndb vd = vec_madd(vd, vd, vd); // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) // CHECK-ASM: vfmadb vd = vec_msub(vd, vd, vd); - // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <2 x double> %{{.*}} // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) // CHECK-ASM: vfmsdb vd = vec_sqrt(vd); Index: clang/test/CodeGen/builtins-systemz-vector2.c =================================================================== --- clang/test/CodeGen/builtins-systemz-vector2.c +++ clang/test/CodeGen/builtins-systemz-vector2.c @@ -64,11 +64,11 @@ vd = __builtin_s390_vfnmadb(vd, vd, vd); // CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) - // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + // CHECK: fneg <2 x double> [[RES]] vd = __builtin_s390_vfnmsdb(vd, vd, vd); - // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <2 x double> %{{.*}} // CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) - // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + // CHECK: fneg <2 x double> [[RES]] vsi = __builtin_s390_vfcesbs(vf, vf, &cc); // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) @@ -102,21 +102,21 @@ vf = __builtin_s390_vfmasb(vf, vf, vf); // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) vf = __builtin_s390_vfmssb(vf, vf, vf); - // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <4 x float> %{{.*}} // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) vf = __builtin_s390_vfnmasb(vf, vf, vf); // CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) - // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + // CHECK: fneg <4 x float> [[RES]] vf = __builtin_s390_vfnmssb(vf, vf, vf); - // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <4 x float> %{{.*}} // CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) - // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + // CHECK: fneg <4 x float> [[RES]] vf = __builtin_s390_vflpsb(vf); // CHECK: call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) vf = __builtin_s390_vflnsb(vf); // CHECK: [[ABS:%[^ ]+]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) - // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[ABS]] + // CHECK: fneg <4 x float> [[ABS]] vf = __builtin_s390_vfisb(vf, 0, 0); // CHECK: call <4 x float> @llvm.rint.v4f32(<4 x float> %{{.*}}) Index: clang/test/CodeGen/builtins-systemz-vector.c =================================================================== --- clang/test/CodeGen/builtins-systemz-vector.c +++ clang/test/CodeGen/builtins-systemz-vector.c @@ -584,14 +584,14 @@ vd = __builtin_s390_vfmadb(vd, vd, vd); // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) vd = __builtin_s390_vfmsdb(vd, vd, vd); - // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[NEG:%[^ ]+]] = fneg <2 x double> %{{.*}} // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) vd = __builtin_s390_vflpdb(vd); // CHECK: call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{.*}}) vd = __builtin_s390_vflndb(vd); // CHECK: [[ABS:%[^ ]+]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{.*}}) - // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[ABS]] + // CHECK: fneg <2 x double> [[ABS]] vd = __builtin_s390_vfidb(vd, 0, 0); // CHECK: call <2 x double> @llvm.rint.v2f64(<2 x double> %{{.*}}) Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -13292,9 +13292,8 @@ Value *X = EmitScalarExpr(E->getArg(0)); Value *Y = EmitScalarExpr(E->getArg(1)); Value *Z = EmitScalarExpr(E->getArg(2)); - Value *Zero = llvm::ConstantFP::getZeroValueForNegation(ResultType); Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType); - return Builder.CreateCall(F, {X, Y, Builder.CreateFSub(Zero, Z, "sub")}); + return Builder.CreateCall(F, {X, Y, Builder.CreateFNeg(Z, "neg")}); } case SystemZ::BI__builtin_s390_vfnmasb: case SystemZ::BI__builtin_s390_vfnmadb: { @@ -13302,9 +13301,8 @@ Value *X = EmitScalarExpr(E->getArg(0)); Value *Y = EmitScalarExpr(E->getArg(1)); Value *Z = EmitScalarExpr(E->getArg(2)); - Value *Zero = llvm::ConstantFP::getZeroValueForNegation(ResultType); Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType); - return Builder.CreateFSub(Zero, Builder.CreateCall(F, {X, Y, Z}), "sub"); + return Builder.CreateFNeg(Builder.CreateCall(F, {X, Y, Z}), "neg"); } case SystemZ::BI__builtin_s390_vfnmssb: case SystemZ::BI__builtin_s390_vfnmsdb: { @@ -13312,10 +13310,9 @@ Value *X = EmitScalarExpr(E->getArg(0)); Value *Y = EmitScalarExpr(E->getArg(1)); Value *Z = EmitScalarExpr(E->getArg(2)); - Value *Zero = llvm::ConstantFP::getZeroValueForNegation(ResultType); Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType); - Value *NegZ = Builder.CreateFSub(Zero, Z, "sub"); - return Builder.CreateFSub(Zero, Builder.CreateCall(F, {X, Y, NegZ})); + Value *NegZ = Builder.CreateFNeg(Z, "neg"); + return Builder.CreateFNeg(Builder.CreateCall(F, {X, Y, NegZ})); } case SystemZ::BI__builtin_s390_vflpsb: case SystemZ::BI__builtin_s390_vflpdb: { @@ -13328,9 +13325,8 @@ case SystemZ::BI__builtin_s390_vflndb: { llvm::Type *ResultType = ConvertType(E->getType()); Value *X = EmitScalarExpr(E->getArg(0)); - Value *Zero = llvm::ConstantFP::getZeroValueForNegation(ResultType); Function *F = CGM.getIntrinsic(Intrinsic::fabs, ResultType); - return Builder.CreateFSub(Zero, Builder.CreateCall(F, X), "sub"); + return Builder.CreateFNeg(Builder.CreateCall(F, X), "neg"); } case SystemZ::BI__builtin_s390_vfisb: case SystemZ::BI__builtin_s390_vfidb: {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits