llvm-project

Форк
0
/
pragma-floatcontrol.c 
68 строк · 3.5 Кб
1
// Test this without pch.
2
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -include %s -verify -fsyntax-only -DSET
3
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -include %s -verify -fsyntax-only -DPUSH
4
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -include %s -verify -fsyntax-only -DPUSH_POP
5

6
// Test with pch.
7
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -emit-pch -o %t
8
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-EBSTRICT %s
9
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -ffp-contract=on -DSET -emit-pch -o %t
10
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-EBSTRICT %s
11
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -menable-no-nans -DSET -emit-pch -o %t
12
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-EBSTRICT %s
13
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -frounding-math -DSET -emit-pch -o %t
14
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-EBSTRICT %s
15
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -ffp-exception-behavior=maytrap -DSET -emit-pch -o %t
16
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-EBSTRICT %s
17
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -ffp-contract=fast -DSET -emit-pch -o %t
18
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-EBSTRICT %s
19
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DSET -emit-pch -o %t
20
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -ffp-contract=on -DSET -include-pch %t -emit-llvm -o - | FileCheck --check-prefix=CHECK-CONTRACT %s
21
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DPUSH -emit-pch -o %t
22
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DPUSH -verify -include-pch %t
23
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DPUSH_POP -emit-pch -o %t
24
// RUN: %clang_cc1 -fexperimental-strict-floating-point  %s -DPUSH_POP -verify -include-pch %t
25

26
#ifndef HEADER
27
#define HEADER
28

29
#ifdef SET
30
#pragma float_control(except, on)
31
#endif
32

33
#ifdef PUSH
34
#pragma float_control(precise, on)
35
#pragma float_control(push)
36
#pragma float_control(precise, off)
37
#endif
38

39
#ifdef PUSH_POP
40
#pragma float_control(precise, on, push)
41
#pragma float_control(push)
42
#pragma float_control(pop)
43
#endif
44
#else
45

46
#ifdef SET
47
float fun(float a, float b) {
48
  // CHECK-LABEL: define float @fun{{.*}}
49
  //CHECK-EBSTRICT: llvm.experimental.constrained.fmul{{.*}}tonearest{{.*}}strict
50
  //CHECK-EBSTRICT: llvm.experimental.constrained.fadd{{.*}}tonearest{{.*}}strict
51
  //CHECK-CONTRACT: llvm.experimental.constrained.fmuladd{{.*}}tonearest{{.*}}strict
52
  return a * b + 2;
53
}
54
#pragma float_control(pop) // expected-warning {{#pragma float_control(pop, ...) failed: stack empty}}
55
#pragma float_control(pop) // expected-warning {{#pragma float_control(pop, ...) failed: stack empty}}
56
#endif
57

58
#ifdef PUSH
59
#pragma float_control(pop)
60
#pragma float_control(pop) // expected-warning {{#pragma float_control(pop, ...) failed: stack empty}}
61
#endif
62

63
#ifdef PUSH_POP
64
#pragma float_control(pop)
65
#pragma float_control(pop) // expected-warning {{#pragma float_control(pop, ...) failed: stack empty}}
66
#endif
67

68
#endif //ifndef HEADER
69

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.