brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · a945b23 Raw
69 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s2// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fdelayed-template-parsing -o - %s | FileCheck %s3 4template <typename T>5T templ_01(T x, T y) {6#pragma STDC FENV_ACCESS ON7  return x + y;8}9 10float func_01(float x, float y) {11  return templ_01(x, y);12}13 14// CHECK-LABEL: define {{.*}} @_Z8templ_01IfET_S0_S0_15// CHECK-SAME:  (float noundef %{{.*}}, float noundef %{{.*}}) #[[ATTR01:[0-9]+]]{{.*}} {16// CHECK:       call float @llvm.experimental.constrained.fadd.f3217 18 19template <typename Ty>20Ty templ_02(Ty x, Ty y) {21  return x + y;22}23 24#pragma STDC FENV_ROUND FE_UPWARD25 26template <typename Ty>27Ty templ_03(Ty x, Ty y) {28  return x - y;29}30 31#pragma STDC FENV_ROUND FE_TONEAREST32 33float func_02(float x, float y) {34  return templ_02(x, y);35}36 37// CHECK-LABEL: define {{.*}} float @_Z8templ_02IfET_S0_S0_38// CHECK:       %add = fadd float %0, %139 40float func_03(float x, float y) {41  return templ_03(x, y);42}43 44// CHECK-LABEL: define {{.*}} float @_Z8templ_03IfET_S0_S0_45// CHECK:       call float @llvm.experimental.constrained.fsub.f32({{.*}}, metadata !"round.upward", metadata !"fpexcept.ignore")46 47 48#pragma STDC FENV_ROUND FE_TONEAREST49 50namespace PR63542 {51  template <class Compare> float stable_sort(float x, Compare) {52    float result = x + x;53    stable_sort(x, int());54    return result;55  }56  float linkage_wrap() { return stable_sort(0.0, 1); }57}58 59// CHECK-LABEL: define {{.*}} float @_ZN7PR6354211stable_sortIiEEffT_(60// CHECK:         fadd float61 62// These pragmas set non-default FP environment before delayed parsing occurs.63// It is used to check that the parsing uses FP options defined by command line64// options or by pragma before the template definition but not by these pragmas.65#pragma STDC FENV_ROUND FE_TOWARDZERO66#pragma STDC FENV_ACCESS ON67 68// CHECK: attributes #[[ATTR01]] = { {{.*}}strictfp69