Skip to content

Commit 7ceb19e

Browse files
authored
[PowerPC] Support set_flt_rounds builtin (llvm#73750)
1 parent cec147a commit 7ceb19e

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3979,9 +3979,9 @@ standard:
39793979
- ``4`` - to nearest, ties away from zero
39803980
The effect of passing some other value to ``__builtin_flt_rounds`` is
39813981
implementation-defined. ``__builtin_set_flt_rounds`` is currently only supported
3982-
to work on x86, x86_64, Arm and AArch64 targets. These builtins read and modify
3983-
the floating-point environment, which is not always allowed and may have unexpected
3984-
behavior. Please see the section on `Accessing the floating point environment <https://clang.llvm.org/docs/UsersManual.html#accessing-the-floating-point-environment>`_ for more information.
3982+
to work on x86, x86_64, powerpc, powerpc64, Arm and AArch64 targets. These builtins
3983+
read and modify the floating-point environment, which is not always allowed and may
3984+
have unexpected behavior. Please see the section on `Accessing the floating point environment <https://clang.llvm.org/docs/UsersManual.html#accessing-the-floating-point-environment>`_ for more information.
39853985
39863986
String builtins
39873987
---------------

clang/lib/Sema/SemaChecking.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,9 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
22122212
if (CheckBuiltinTargetInSupported(
22132213
*this, TheCall,
22142214
{llvm::Triple::x86, llvm::Triple::x86_64, llvm::Triple::arm,
2215-
llvm::Triple::thumb, llvm::Triple::aarch64, llvm::Triple::amdgcn}))
2215+
llvm::Triple::thumb, llvm::Triple::aarch64, llvm::Triple::amdgcn,
2216+
llvm::Triple::ppc, llvm::Triple::ppc64, llvm::Triple::ppcle,
2217+
llvm::Triple::ppc64le}))
22162218
return ExprError();
22172219
break;
22182220

clang/test/CodeGen/builtin_set_flt_rounds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clang_cc1 -triple x86_64-windows-msvc %s -emit-llvm -o - | FileCheck %s
33
// RUN: %clang_cc1 -triple aarch64-gnu-linux %s -emit-llvm -o - | FileCheck %s
44
// RUN: %clang_cc1 -triple aarch64-windows-msvc %s -emit-llvm -o - | FileCheck %s
5+
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s
6+
// RUN: %clang_cc1 -triple powerpc64-ibm-aix %s -emit-llvm -o - | FileCheck %s
7+
// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -emit-llvm -o - | FileCheck %s
58
void test_builtin_set_flt_rounds() {
69
__builtin_set_flt_rounds(1);
710
// CHECK: call void @llvm.set.rounding(i32 1)

0 commit comments

Comments
 (0)