[PATCH] D72841: Add support for pragma float_control, to control precision and exception behavior at the source level

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 03:11:49 PDT 2020


uabelho added a comment.

Hi @mibintc ,

I think I'm seeing some oddities with this patch (current trunk, 0054c46095 <https://reviews.llvm.org/rG0054c46095eea7a10b9af8f5006160023b95046d>).
With

  clang -S -Xclang -emit-llvm bbi-42553.c -o -

on the input

  float rintf(float x);
  #pragma STDC FENV_ACCESS ON
  
  void t()
  {
      (void)rintf(0.0f);
  }

I get

  bbi-42553.c:2:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas]
  #pragma STDC FENV_ACCESS ON
               ^
  ; ModuleID = 'bbi-42553.c'
  source_filename = "bbi-42553.c"
  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  ; Function Attrs: noinline nounwind optnone strictfp uwtable
  define dso_local void @t() #0 {
  entry:
    %0 = call float @llvm.experimental.constrained.rint.f32(float 0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.ignore") #2
    ret void
  }

and if I remove the pragma I instead get

  define dso_local void @t() #0 {
  entry:
    %0 = call float @llvm.rint.f32(float 0.000000e+00)
    ret void
  }

Before this patch I got the call to llvm.rint.f32 in both cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72841/new/

https://reviews.llvm.org/D72841





More information about the llvm-commits mailing list