Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This builtin will be converted to llvm.set.rounding intrinsic in IR level and should be work with "#pragma STDC FENV_ACCESS ON" since it changes default FP environment. Users can change rounding mode via this builtin without introducing libc dependency. Reviewed by: andrew.w.kaylor, rjmccall, sepavloff, aaron.ballman Differential Revision: https://reviews.llvm.org/D145765 Signed-off-by: jinge90 <ge.jin@intel.com>
- Loading branch information
Showing
6 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// RUN: %clang_cc1 -triple x86_64-gnu-linux %s -emit-llvm -o - | FileCheck %s | ||
// RUN: %clang_cc1 -triple x86_64-windows-msvc %s -emit-llvm -o - | FileCheck %s | ||
// RUN: %clang_cc1 -triple aarch64-gnu-linux %s -emit-llvm -o - | FileCheck %s | ||
// RUN: %clang_cc1 -triple aarch64-windows-msvc %s -emit-llvm -o - | FileCheck %s | ||
void test_builtin_set_flt_rounds() { | ||
__builtin_set_flt_rounds(1); | ||
// CHECK: call void @llvm.set.rounding(i32 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// RUN: %clang_cc1 -triple mipsel-unknown-linux -fsyntax-only %s -verify=expected,unsupported | ||
// RUN: %clang_cc1 -triple x86_64-gnu-linux -fsyntax-only %s -verify | ||
struct S {int a;}; | ||
void test_builtin_set_flt_rounds() { | ||
__builtin_set_flt_rounds(1); // unsupported-error {{builtin is not supported on this target}} | ||
struct S s; | ||
__builtin_set_flt_rounds(s); // expected-error {{passing 'struct S' to parameter of incompatible type}} | ||
} |