Skip to content

Commit 5dbf80c

Browse files
committed
[clang][codegen] Annotate correctly-rounded-divide-sqrt-fp-math fn-attr for OpenCL only.
- `-cl-fp32-correctly-rounded-divide-sqrt` is an OpenCL-specific option and `correctly-rounded-divide-sqrt-fp-math` should be added for OpenCL at most. Differential revision: https://reviews.llvm.org/D88303
1 parent 0e0a0c8 commit 5dbf80c

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,9 +1794,11 @@ void CodeGenModule::getDefaultFunctionAttributes(StringRef Name,
17941794
llvm::utostr(CodeGenOpts.SSPBufferSize));
17951795
FuncAttrs.addAttribute("no-signed-zeros-fp-math",
17961796
llvm::toStringRef(LangOpts.NoSignedZero));
1797-
FuncAttrs.addAttribute(
1798-
"correctly-rounded-divide-sqrt-fp-math",
1799-
llvm::toStringRef(CodeGenOpts.CorrectlyRoundedDivSqrt));
1797+
if (getLangOpts().OpenCL) {
1798+
FuncAttrs.addAttribute(
1799+
"correctly-rounded-divide-sqrt-fp-math",
1800+
llvm::toStringRef(CodeGenOpts.CorrectlyRoundedDivSqrt));
1801+
}
18001802

18011803
// TODO: Reciprocal estimate codegen options should apply to instructions?
18021804
const std::vector<std::string> &Recips = CodeGenOpts.Reciprocals;

clang/test/CodeGen/complex-builtins.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,8 @@ void foo(float f) {
197197
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]
198198
};
199199

200-
201200
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
202-
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
201+
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
203202

204-
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
203+
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
205204
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
206-

clang/test/CodeGen/complex-libcalls.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,8 @@ void foo(float f) {
197197
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]
198198
};
199199

200-
201200
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
202-
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
201+
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
203202

204-
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
203+
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
205204
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
206-

clang/test/CodeGen/math-builtins.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,12 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
577577
// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
578578
};
579579

580-
581580
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
582581
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
583-
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
582+
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
584583
// NO__ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} }
585584

586-
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
585+
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
587586
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
588587
// HAS_ERRNO: attributes [[PURE]] = { {{.*}}readonly{{.*}} }
589588
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }

clang/test/CodeGen/math-libcalls.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,12 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
532532
// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
533533
};
534534

535-
536535
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
537536
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
538-
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
537+
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
539538
// NO__ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
540539

541-
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
540+
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
542541
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
543542
// HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
544543
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }

0 commit comments

Comments
 (0)