[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-17 Thread Joshua Cranmer via cfe-commits
@@ -5980,6 +5987,64 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, return Ret; } +static bool endsWithRoundingModeSuffix(StringRef FuncName) { + size_t Underscore = FuncName.find_last_of("_"); + if (Underscore == StringRef::npos || Underscore < 2) +

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-17 Thread Joshua Cranmer via cfe-commits
@@ -5980,6 +5987,64 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, return Ret; } +static bool endsWithRoundingModeSuffix(StringRef FuncName) { + size_t Underscore = FuncName.find_last_of("_"); + if (Underscore == StringRef::npos || Underscore < 2) +

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-17 Thread Joshua Cranmer via cfe-commits
@@ -1232,6 +1232,14 @@ class TargetInfo : public TransferrableTargetInfo, return true; } + /// Returns true, if an operations that depends on rounding mode can be + /// implemented without changing FP environment. In this case the rounding + /// mode is encoded in the

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-17 Thread Joshua Cranmer via cfe-commits
https://github.com/jcranmer-intel commented: Sorry for just thinking of this now, but we should also have tests for some of the builtins like `__builtin_fma` or `__builtin_sqrt`. https://github.com/llvm/llvm-project/pull/89617 ___ cfe-commits mailing

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-17 Thread Joshua Cranmer via cfe-commits
https://github.com/jcranmer-intel edited https://github.com/llvm/llvm-project/pull/89617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-13 Thread Serge Pavlov via cfe-commits
spavloff wrote: > 7.6.2p4 does clearly state that floating constants need to be evaluated > according to the standard rounding mode, so that the constant 0.1 evaluates > to a different value in FE_DOWNWARD versus FE_UPWARD. Treatment of floating-point constants is fixed in https://github.com/

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-13 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff edited https://github.com/llvm/llvm-project/pull/89617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-13 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From ec8838685fb7af618445c3ff1bae953778996c37 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH 1/3] Implementation of '#pragma STDC FENV_ROUND' This pragma is i

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-26 Thread Joshua Cranmer via cfe-commits
https://github.com/jcranmer-intel requested changes to this pull request. I haven't fully tested the changes yet, so right now I'm looking at the test to figure out how much is supported. Nevertheless, I can already tell that this is not complete support. 7.6.2p4 does clearly state that floati

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-25 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From 0fc5c57264ecf51f8b9fe8303520a51cb1fee40e Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH 1/2] Implementation of '#pragma STDC FENV_ROUND' This pragma is i

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-24 Thread Joshua Cranmer via cfe-commits
@@ -0,0 +1,160 @@ +// RUN: %clang_cc1 -S -triple x86_64-linux-gnu -emit-llvm %s -o - | \ +// RUN: FileCheck %s --implicit-check-not "call void @llvm.set.rounding" --implicit-check-not "call i32 @llvm.get.rounding" + +float func_rz_ru(float w, float x, float y, float z) { + #pr

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-24 Thread Zahira Ammarguellat via cfe-commits
@@ -1257,9 +1257,6 @@ def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, // The C standard 7.6.1p2 says "The [FENV_ACCESS] pragma shall occur either zahiraam wrote: This comment can be removed I think. https://github.com/llvm/llvm-proje

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-24 Thread Zahira Ammarguellat via cfe-commits
@@ -0,0 +1,160 @@ +// RUN: %clang_cc1 -S -triple x86_64-linux-gnu -emit-llvm %s -o - | \ +// RUN: FileCheck %s --implicit-check-not "call void @llvm.set.rounding" --implicit-check-not "call i32 @llvm.get.rounding" + +float func_rz_ru(float w, float x, float y, float z) { + #pr

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-24 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: How about adding `pragma STDC FENV_ROUND` at file scope and some C++ tests (with default argument in functions). https://github.com/llvm/llvm-project/pull/89617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-23 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From 0fc5c57264ecf51f8b9fe8303520a51cb1fee40e Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH] Implementation of '#pragma STDC FENV_ROUND' This pragma is intro

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-22 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From fc7aab600c25b39b2df039c0cbcf517719736311 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH] Implementation of '#pragma STDC FENV_ROUND' This pragma is intro

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-22 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 37b7207651b44743909a427b5509bed5e6c21b59 58adf3643828272d071fd49195cfcf0b2164eb70 --

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Serge Pavlov (spavloff) Changes This pragma is introduced by forthcoming C2x standard and can be used to set particular rounding mode without need to call 'fesetmode' or accessing control mode registers directly. Previously this p

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-22 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/89617 This pragma is introduced by forthcoming C2x standard and can be used to set particular rounding mode without need to call 'fesetmode' or accessing control mode registers directly. Previously this pragma was im